/* ============================================
   ReviewMe Design System — Mobile First
   Breakpoints: base (< 576px) | sm 576px | md 768px | lg 992px | xl 1200px
   Use CSS variables only; no hardcoded hex in components.
   ============================================ */

:root {
    /* Spacing scale (use for padding/margin/gap) */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.25rem;
    /* Typography — Plus Jakarta Sans */
    --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --leading-tight: 1.25;
    --leading-snug: 1.375;
}

/* ============================================
   CSS Variables for Theme (Light / Dark)
   ============================================ */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f1f5f9;
    --bg-tertiary: #e2e8f0;
    --sidebar-bg: #ffffff;
    --sidebar-hover: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.08), 0 2px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.08), 0 4px 8px -2px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.06);
    --accent-primary: #0d9488;
    --accent-hover: #0f766e;
    --accent-light: rgba(13, 148, 136, 0.08);
    --accent-subtle: rgba(13, 148, 136, 0.12);
    --success: #059669;
    --success-light: rgba(5, 150, 105, 0.1);
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0891b2;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.3);
    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.2);
    --accent-primary: #14b8a6;
    --accent-hover: #2dd4bf;
    --accent-light: rgba(20, 184, 166, 0.15);
    --accent-subtle: rgba(20, 184, 166, 0.2);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
}

/* ============================================
   Reset & Base Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: var(--text-base);
    transition: background-color 0.25s ease, color 0.25s ease;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-body .main-content {
    background-color: var(--bg-secondary);
}

/* ============================================
   Sidebar Styles
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 272px;
    height: 100vh;
    background-color: var(--sidebar-bg);
    color: var(--text-primary);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 24px -4px rgba(0, 0, 0, 0.06);
    border-right: 1px solid var(--border-color);
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar.collapsed .nav-text,
.sidebar.collapsed .logo,
.sidebar.collapsed .user-name,
.sidebar.collapsed .user-role,
.sidebar.collapsed .nav-arrow {
    opacity: 0;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 1.5rem 0.5rem;
    min-height: 72px;
    height: 72px;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.875rem 0.5rem;
    margin: 0 0.5rem;
}

.sidebar.collapsed .nav-icon {
    margin-right: 0;
}

.sidebar.collapsed .nav-item-has-children .nav-link {
    position: relative;
}

.sidebar.collapsed .nav-submenu {
    display: none !important;
}

/* Popover for collapsed sidebar hover */
.nav-item-has-children {
    position: relative;
}

.nav-popover {
    position: fixed;
    left: 80px;
    min-width: 220px;
    max-width: 300px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    padding: 0.5rem 0;
    display: none;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    margin: 0;
}

.nav-popover.show {
    display: block;
    opacity: 1;
    transform: translateX(0);
    pointer-events: all;
}

.nav-popover ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-popover-item {
    margin: 0;
}

.nav-popover-link {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    white-space: nowrap;
    position: relative;
}

.nav-popover-link::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--text-muted);
    transition: background-color 0.2s ease;
}

.nav-popover-link:hover {
    color: var(--accent-primary);
    background-color: var(--bg-tertiary);
}

.nav-popover-link:hover::before {
    background-color: var(--accent-primary);
}

.nav-popover-link.active {
    color: var(--accent-primary);
    font-weight: 600;
    background-color: var(--sidebar-hover);
}

.nav-popover-link.active::before {
    background-color: var(--accent-primary);
}

.sidebar.collapsed .sidebar-footer {
    padding: 1.5rem 0.5rem;
}

.sidebar.collapsed .user-profile {
    justify-content: center;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    min-height: 72px;
    height: 72px;
    box-sizing: border-box;
}

.logo {
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--accent-primary);
    transition: opacity 0.25s ease;
    white-space: nowrap;
}

.sidebar-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: background-color 0.3s ease, transform 0.3s ease;
    width: 32px;
    height: 32px;
}

.sidebar-collapse-btn:hover {
    background-color: var(--bg-tertiary);
}

.sidebar.collapsed .sidebar-collapse-btn {
    transform: rotate(180deg);
}

.collapse-icon {
    width: 18px;
    height: 18px;
    stroke-width: 2;
    transition: transform 0.3s ease;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
}

.sidebar-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--text-primary);
    margin: 4px 0;
    transition: 0.3s;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.nav-menu {
    list-style: none;
    padding: 0;
}

.nav-item {
    margin: 0.25rem 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    margin: 0 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
    border-radius: var(--radius-lg);
    position: relative;
}

.nav-link:hover {
    background-color: var(--sidebar-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background-color: var(--accent-light);
    color: var(--accent-primary);
    font-weight: 600;
}

.nav-link.active:hover {
    background-color: var(--accent-subtle);
    color: var(--accent-hover);
}

.nav-link:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.nav-text {
    flex: 1;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}

.nav-icon {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
    stroke-width: 2;
    flex-shrink: 0;
    transition: margin 0.3s ease;
}

.nav-arrow {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    transition: transform 0.3s ease, opacity 0.3s ease;
    flex-shrink: 0;
    margin-left: auto;
}

.nav-item-has-children .nav-link-parent.active + .nav-submenu,
.nav-item-has-children.active .nav-submenu {
    display: block;
}

.nav-item-has-children .nav-link-parent.active .nav-arrow {
    transform: rotate(90deg);
}

.nav-submenu {
    display: none;
    list-style: none;
    padding: 0;
    background-color: var(--bg-tertiary);
    border-left: 3px solid var(--accent-primary);
    margin-left: 1.5rem;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

.nav-subitem {
    margin: 0;
}

.nav-sublink {
    display: block;
    padding: 0.75rem 1.5rem 0.75rem 2.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    position: relative;
}

.nav-sublink::before {
    content: '';
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--text-muted);
    transition: background-color 0.3s ease;
}

.nav-sublink:hover {
    color: var(--accent-primary);
    background-color: var(--sidebar-hover);
}

.nav-sublink:hover::before {
    background-color: var(--accent-primary);
}

.nav-sublink.active {
    color: var(--accent-primary);
    font-weight: 600;
}

.nav-sublink.active::before {
    background-color: var(--accent-primary);
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    border: 2px solid var(--accent-primary);
}

.user-avatar svg {
    width: 24px;
    height: 24px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ============================================
   Main Content Area
   ============================================ */
.main-content {
    margin-left: 272px;
    min-height: 100vh;
    transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed ~ .main-content {
    margin-left: 80px;
}

.header {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 0 0 var(--border-color);
    min-height: 64px;
    height: 64px;
    box-sizing: border-box;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-primary);
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--text-primary);
    margin: 4px 0;
    transition: 0.3s;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: var(--leading-tight);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-store-name {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-weight: var(--font-medium);
    margin-right: var(--space-2);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-avatar-dropdown {
    position: relative;
}

.header-avatar-trigger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-primary);
}

.header-avatar-trigger:hover {
    opacity: 0.9;
}

.header-right .header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
}

.header-right .header-avatar svg {
    width: 22px;
    height: 22px;
}

.header-avatar-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-2);
    min-width: 200px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-2);
    z-index: 200;
    display: none;
}

.header-avatar-menu.show {
    display: block;
}

.header-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: none;
    background: none;
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    border-radius: var(--radius-sm);
    text-align: left;
    transition: background-color 0.2s ease;
}

.header-dropdown-item:hover {
    background: var(--bg-tertiary);
}

.header-dropdown-item .theme-icon {
    width: 18px;
    height: 18px;
    position: relative;
    flex-shrink: 0;
}

.header-dropdown-item .sun-icon {
    opacity: 1;
}

.header-dropdown-item .moon-icon {
    opacity: 0;
    position: absolute;
    left: 0;
    top: 0;
}

[data-theme="dark"] .header-dropdown-item .sun-icon {
    opacity: 0;
}

[data-theme="dark"] .header-dropdown-item .moon-icon {
    opacity: 1;
}

.header-dropdown-form {
    margin: 0;
    padding: 0;
}

.header-dropdown-item-logout {
    color: var(--danger);
}

.header-dropdown-item-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.theme-toggle,
#themeToggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-primary);
    border-radius: 0.5rem;
    transition: background-color 0.3s ease;
}

.theme-toggle:hover,
#themeToggle:hover {
    background-color: var(--bg-tertiary);
}

.theme-icon {
    width: 20px;
    height: 20px;
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#themeToggle .theme-icon {
    position: relative;
}

.sun-icon {
    opacity: 1;
    transform: rotate(0deg);
}

.moon-icon {
    opacity: 0;
    transform: rotate(90deg);
}

[data-theme="dark"] .moon-icon {
    opacity: 0;
    transform: rotate(90deg);
}

[data-theme="dark"] .sun-icon {
    opacity: 1;
    transform: rotate(0deg);
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.header-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-primary);
    border-radius: 0.5rem;
    transition: background-color 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-btn:hover {
    background-color: var(--bg-tertiary);
}

.header-btn svg {
    width: 20px;
    height: 20px;
}

.badge {
    position: absolute;
    top: 0;
    right: 0;
    background-color: var(--danger);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 9999px;
    min-width: 18px;
    text-align: center;
}

.content-wrapper {
    padding: 1.5rem 1.75rem;
    max-width: 1600px;
    margin: 0 auto;
}

/* ============================================
   Messages & Alerts
   ============================================ */
.messages {
    margin-bottom: 1.5rem;
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    border-left: 4px solid;
    font-size: var(--text-sm);
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.alert-error,
.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

.alert-info {
    background-color: rgba(6, 182, 212, 0.1);
    border-color: var(--info);
    color: var(--info);
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    border-color: var(--warning);
    color: var(--warning);
}

/* ============================================
   Breadcrumb
   ============================================ */
.breadcrumb {
    margin-bottom: var(--space-4);
}
.breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: var(--text-xs);
    color: var(--text-muted);
}
.breadcrumb-item {
    display: inline-flex;
    align-items: center;
    color: var(--text-muted);
}
.breadcrumb-item:not(:last-child)::after {
    content: "/";
    margin-left: var(--space-2);
    color: var(--text-muted);
    font-weight: 400;
    opacity: 0.7;
}
.breadcrumb-item a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}
.breadcrumb-item a:hover {
    color: var(--accent-primary);
}
.breadcrumb-item-current {
    color: var(--text-primary);
    font-weight: var(--font-medium);
}
.breadcrumb-item-current::after {
    display: none;
}

/* ============================================
   Page layout & utilities (theme conventions)
   ============================================ */
.page-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    padding: 0;
}
.page-bar-heading .page-heading {
    margin-bottom: var(--space-1);
}
.page-bar-heading .page-subheading {
    margin-bottom: 0;
}
.page-bar .page-bar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}
.page-bar-form {
    display: inline;
}
.page-bar-store {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}
.page-back {
    display: inline-block;
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}
.page-back:hover {
    color: var(--accent-primary);
}
.page-heading {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin: 0 0 var(--space-2) 0;
    line-height: var(--leading-tight);
}
.page-subheading {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin: 0 0 var(--space-4) 0;
    line-height: 1.5;
}

.page-intro {
    margin-bottom: var(--space-6);
}
.page-intro .page-subheading {
    margin-bottom: 0;
}

/* Buttons — use theme variables */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    font-family: var(--font-sans);
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.btn:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}
.btn:active:not(:disabled) {
    transform: scale(0.98);
}
.btn-primary {
    background-color: var(--accent-primary);
    color: #ffffff;
}
.btn-primary:hover:not(:disabled) {
    background-color: var(--accent-hover);
    color: #ffffff;
    box-shadow: 0 2px 8px -2px rgba(13, 148, 136, 0.4);
}
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background-color: var(--border-color);
    border-color: var(--text-muted);
    color: var(--text-primary);
}
.btn-accent {
    background-color: var(--accent-primary);
    color: #ffffff;
}
.btn-accent:hover {
    background-color: var(--accent-hover);
    color: #ffffff;
    box-shadow: 0 2px 8px -2px rgba(13, 148, 136, 0.4);
}
.btn-outline {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-outline:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}
.btn-block {
    width: 100%;
    display: flex;
}

/* Theme cards (Add Review Widget) */
.theme-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
    margin-top: var(--space-6);
}
.theme-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.theme-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--accent-primary);
}
.theme-card h3 {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin: 0 0 var(--space-2) 0;
}
.theme-card .theme-desc {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin: 0 0 var(--space-4) 0;
    line-height: 1.5;
}
.theme-card-form {
    margin-top: var(--space-2);
}
.theme-card .theme-card-form .btn {
    margin-top: 0;
}
.badge-success {
    font-size: var(--text-sm);
    color: var(--success);
    margin-top: var(--space-4);
}

/* Tables — mobile-first: card stack on small, table on md+ */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: var(--space-4);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    box-shadow: var(--shadow-card);
}
.data-table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
    font-size: var(--text-sm);
}
.data-table th,
.data-table td {
    padding: 0.875rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}
.data-table th {
    font-weight: var(--font-semibold);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}
.data-table tbody tr {
    transition: background-color 0.15s ease;
}
.data-table tbody tr:last-child td {
    border-bottom: none;
}
.data-table tbody tr:hover td {
    background-color: var(--bg-secondary);
}
.data-table .cell-muted {
    color: var(--text-muted);
}
.data-table .btn {
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
}
.order-action-form {
    display: inline;
}
.page-empty {
    margin-top: var(--space-4);
    padding: var(--space-6);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-align: center;
    background: var(--bg-primary);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-xl);
}
.order-row-card {
    display: none;
}

/* ============================================
   Dashboard Styles
   ============================================ */
.dashboard {
    max-width: 1400px;
    margin: 0 auto;
    animation: fadeIn 0.4s ease;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background-color: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-card);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--border-color);
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon-primary {
    background-color: var(--accent-light);
    color: var(--accent-primary);
}

.stat-icon-success {
    background-color: var(--success-light);
    color: var(--success);
}

.stat-icon-warning {
    background-color: rgba(217, 119, 6, 0.12);
    color: var(--warning);
}

.stat-icon-info {
    background-color: rgba(8, 145, 178, 0.1);
    color: var(--info);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 0.125rem;
    line-height: var(--leading-tight);
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: 0;
}

.stat-change {
    font-size: 0.75rem;
    font-weight: 600;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
}

.dashboard-card {
    background-color: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.dashboard-card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: var(--text-lg);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.card-action {
    background: none;
    border: none;
    color: var(--accent-primary);
    cursor: pointer;
    font-size: var(--text-sm);
    text-decoration: none;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.card-action:hover {
    background-color: var(--accent-light);
    color: var(--accent-hover);
}

.card-body {
    padding: 1.25rem 1.5rem;
}

/* Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0.875rem;
    border-radius: var(--radius-lg);
    transition: background-color 0.2s ease;
}

.activity-item:hover {
    background-color: var(--bg-secondary);
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon svg {
    width: 20px;
    height: 20px;
}

.activity-icon-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.activity-icon-info {
    background-color: rgba(6, 182, 212, 0.1);
    color: var(--info);
}

.activity-icon-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.activity-icon-primary {
    background-color: rgba(32, 178, 170, 0.1);
    color: var(--accent-primary);
}

.activity-content {
    flex: 1;
}

.activity-text {
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.activity-empty {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    padding: var(--space-4);
    margin: 0;
}

/* Quick Actions */
/* Quick Actions — list view */
.quick-actions-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.quick-actions-list li {
    border-bottom: 1px solid var(--border-color);
}

.quick-actions-list li:last-child {
    border-bottom: none;
}

.quick-action-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    text-decoration: none;
    color: inherit;
    background-color: transparent;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.quick-action-item:hover {
    background-color: var(--bg-tertiary);
}

.quick-action-item:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: -2px;
}

.quick-action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.quick-action-icon svg {
    width: 20px;
    height: 20px;
}

.quick-action-content {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    flex: 1;
    min-width: 0;
}

.quick-action-title {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

.quick-action-desc {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.quick-action-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: color 0.2s ease, transform 0.2s ease;
}

.quick-action-arrow svg {
    width: 18px;
    height: 18px;
}

.quick-action-item:hover .quick-action-arrow {
    color: var(--accent-primary);
    transform: translateX(2px);
}

/* Primary list row — accent icon */
.quick-action-primary .quick-action-icon {
    background-color: var(--accent-light);
    color: var(--accent-primary);
}

.quick-action-primary:hover {
    background-color: var(--bg-tertiary);
}

.quick-action-primary:hover .quick-action-arrow {
    color: var(--accent-primary);
}

/* Secondary list row — neutral icon */
.quick-action-secondary .quick-action-icon {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
}

.quick-action-secondary:hover .quick-action-icon {
    color: var(--text-primary);
}

/* Legacy action-btn (e.g. other pages) */
.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    font-weight: 600;
}

.action-btn svg {
    width: 24px;
    height: 24px;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.action-btn-primary {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.action-btn-primary:hover {
    background-color: var(--accent-primary);
    color: #ffffff;
}

.action-btn-secondary {
    border-color: var(--text-secondary);
    color: var(--text-secondary);
}

.action-btn-secondary:hover {
    background-color: var(--text-secondary);
    color: #ffffff;
}

.action-btn-success {
    border-color: var(--success);
    color: var(--success);
}

.action-btn-success:hover {
    background-color: var(--success);
    color: #ffffff;
}

.action-btn-info {
    border-color: var(--info);
    color: var(--info);
}

.action-btn-info:hover {
    background-color: var(--info);
    color: #ffffff;
}

/* ============================================
   Mobile-first responsive (base = mobile)
   ============================================ */

/* Base: mobile (< 576px) */
.content-wrapper {
    padding: var(--space-4);
}
.header {
    padding: var(--space-4);
    min-height: 64px;
    flex-wrap: wrap;
    gap: var(--space-2);
}
.page-title {
    font-size: var(--text-lg);
}
.header-store-name {
    max-width: 120px;
}
.header-actions .header-btn:not(.theme-toggle) {
    display: none;
}

/* sm: 576px+ */
@media (min-width: 576px) {
    .content-wrapper {
        padding: var(--space-5);
    }
    .theme-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* md: 768px+ */
@media (min-width: 768px) {
    .content-wrapper {
        padding: var(--space-6);
    }
    .header {
        min-height: 72px;
    }
    .page-title {
        font-size: var(--text-xl);
    }
    .header-actions .header-btn {
        display: flex;
    }
    .theme-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* lg: 992px+ */
@media (min-width: 992px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* xl: 1200px+ */
@media (min-width: 1200px) {
    .content-wrapper {
        padding: var(--space-6) var(--space-8);
    }
}

/* Mobile-only: sidebar drawer */
@media (max-width: 767px) {
    .sidebar {
        transform: translateX(-100%);
        width: 272px;
        max-width: 85vw;
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .sidebar.collapsed {
        width: 272px;
    }
    .sidebar.collapsed .nav-text,
    .sidebar.collapsed .logo,
    .sidebar.collapsed .user-name,
    .sidebar.collapsed .user-role,
    .sidebar.collapsed .nav-arrow {
        opacity: 1;
        width: auto;
        overflow: visible;
    }
    .sidebar.collapsed .nav-link {
        justify-content: flex-start;
        padding: 0.875rem 1.5rem;
    }
    .sidebar.collapsed .nav-icon {
        margin-right: 0.75rem;
    }
    .main-content {
        margin-left: 0;
    }
    .mobile-menu-toggle {
        display: block;
    }
    .sidebar-toggle {
        display: block;
    }
    .sidebar-collapse-btn {
        display: none;
    }
    .nav-popover {
        display: none;
    }
}

@media (max-width: 575px) {
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
    }
    .page-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .page-bar .page-bar-actions {
        flex-direction: column;
    }
    .page-bar .page-bar-actions .btn,
    .page-bar .page-bar-actions a.btn {
        width: 100%;
    }
    .page-bar .page-bar-form .btn {
        width: 100%;
    }
    .data-table td {
        padding: var(--space-2);
    }
    .order-action-form .btn {
        width: 100%;
        white-space: nowrap;
    }
}

/* Login/install page responsive padding */
@media (min-width: 576px) {
    body.login-standalone {
        padding: var(--space-6);
    }
}
@media (min-width: 768px) {
    body.login-standalone {
        padding: var(--space-8);
    }
    .login-card {
        padding: var(--space-8);
    }
}

/* ============================================
   Scrollbar Styles
   ============================================ */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard {
    animation: fadeIn 0.5s ease;
}

/* ============================================
   Login / Connect Store (Auth) Page — standalone, no sidebar/header
   ============================================ */
body.login-standalone {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--space-4);
    margin: 0;
    background: linear-gradient(160deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
}

[data-theme="dark"] body.login-standalone {
    background: linear-gradient(160deg, var(--bg-secondary) 0%, var(--bg-primary) 50%);
}

.login-page {
    max-width: 420px;
    width: 100%;
    margin: 0;
}

.login-card {
    background-color: var(--bg-primary);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    padding: var(--space-8);
}

.login-card .login-logo {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent-subtle) 100%);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 1.75rem;
}

.login-card .login-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 0.375rem;
}

.login-card .login-subtitle {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 1.75rem;
    line-height: 1.5;
}
.login-card .login-subtitle-sm {
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
}

.login-card .form-group {
    margin-bottom: 1.25rem;
}

.login-card .form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.login-card .form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-card .form-input::placeholder {
    color: var(--text-muted);
}

.login-card .form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.login-card .btn-install,
.login-card .btn.btn-primary.btn-block {
    width: 100%;
    padding: 0.875rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    background-color: var(--accent-primary);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.login-card .btn-install:hover,
.login-card .btn.btn-primary.btn-block:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 4px 12px -2px rgba(13, 148, 136, 0.35);
}

.login-card .btn-install:active,
.login-card .btn.btn-primary.btn-block:active {
    transform: scale(0.98);
}

.login-card .btn-secondary,
.login-card a.btn.btn-secondary {
    display: block;
    width: 100%;
    text-align: center;
    padding: 0.875rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.login-card .btn-secondary:hover,
.login-card a.btn.btn-secondary:hover {
    background-color: var(--sidebar-hover);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.login-card .login-alert-error {
    background-color: rgba(220, 38, 38, 0.08);
    border-left: 4px solid var(--danger);
    color: var(--danger);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    font-size: var(--text-sm);
}

.login-card .login-alert-success {
    background-color: var(--success-light);
    border-left: 4px solid var(--success);
    color: var(--success);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    font-size: var(--text-sm);
}

.login-card .login-alert-success p {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.login-card .login-alert-info {
    background-color: rgba(8, 145, 178, 0.08);
    border-left: 4px solid var(--info);
    color: var(--info);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    font-size: var(--text-sm);
}

.login-card .login-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 1.5rem 0;
}

.login-card .login-debug {
    font-size: 0.75rem;
    color: var(--text-muted);
    word-break: break-all;
    margin-top: 0.5rem;
}
