/* =============================================================
   PPD Manager — Global Styles
   Clean, modern, professional UI for order tracking
   ============================================================= */

/* Environment badge */
.env-badge {
    position: fixed;
    bottom: 12px;
    right: 12px;
    z-index: 99999;
    background: #f59e0b;
    color: #000;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    padding: 4px 10px;
    border-radius: 4px;
    opacity: 0.85;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    color-scheme: light;
    --color-bg:         #f5f6fa;
    --color-sidebar:    #1a1f36;
    --color-sidebar-hover: #2d3561;
    --color-primary:    #4361ee;
    --color-primary-dark: #3451d1;
    --color-text:       #2d3748;
    --color-muted:      #718096;
    --color-border:     #e2e8f0;
    --color-white:      #ffffff;
    --color-card:       #ffffff;
    --color-success:    #38a169;
    --color-warning:    #d69e2e;
    --color-danger:     #e53e3e;
    --color-info:       #3182ce;
    --radius:           8px;
    --shadow:           0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:        0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
    --sidebar-width:    220px;
    --font:             'Inter', 'Segoe UI', system-ui, sans-serif;
    --color-table-header: #e8f0fe;
    --color-star-empty:  #cbd5e0;
    --color-star-filled: #ecc94b;
    --color-fav-row:       #fff5f5;
    --color-fav-row-hover: #fed7d7;
    --color-placeholder: #c4cdd8;
}

/* Address book cards */
.address-card {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 8px;
    background: var(--color-bg);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.address-card:hover { border-color: var(--color-primary); box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.address-card.address-default {
    border-left: 3px solid var(--color-primary);
    background: color-mix(in srgb, var(--color-primary), transparent 95%);
}
.address-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 6px;
}
.address-label { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.addr-default-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--color-primary);
    color: #fff;
}
.address-actions { display: flex; gap: 4px; align-items: center; }
.addr-default-btn {
    background: color-mix(in srgb, var(--color-primary), transparent 88%) !important;
    color: var(--color-primary) !important;
    border: 1px solid color-mix(in srgb, var(--color-primary), transparent 70%) !important;
    font-size: 11px !important;
    padding: 3px 10px !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
    transition: all 0.15s !important;
}
.addr-default-btn:hover {
    background: var(--color-primary) !important;
    color: #fff !important;
}
.address-card-body { font-size: 13px; color: var(--color-muted); line-height: 1.5; }


/* Dark mode variables */
[data-theme="dark"] {
    color-scheme: dark;
    --color-bg:         #0f172a;
    --color-sidebar:    #0c1222;
    --color-sidebar-hover: #1e293b;
    --color-primary:    #818cf8;
    --color-primary-dark: #6366f1;
    --color-text:       #e2e8f0;
    --color-muted:      #94a3b8;
    --color-border:     #334155;
    --color-white:      #1e293b;
    --color-card:       #1e293b;
    --color-success:    #34d399;
    --color-warning:    #fbbf24;
    --color-danger:     #f87171;
    --color-info:       #60a5fa;
    --color-table-header: #1a2332;
    --color-star-empty:  #475569;
    --color-star-filled: #fbbf24;
    --color-fav-row:       #2a1215;
    --color-fav-row-hover: #3b1a1e;
    --color-placeholder: #4a5568;
    --shadow:           0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md:        0 4px 6px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.2);
}


/* Dark mode specific overrides */
[data-theme="dark"] .top-nav,
[data-theme="dark"] .mobile-topbar {
    background: #0c1222;
    border-color: #334155;
}
[data-theme="dark"] .top-nav-search input {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}
[data-theme="dark"] .top-nav-search input::placeholder { color: var(--color-placeholder); }
[data-theme="dark"] .top-nav-search input:focus {
    border-color: #6366f1;
    background: #1e293b;
}
[data-theme="dark"] .top-nav-notif,
[data-theme="dark"] .top-nav-notif:hover { color: #e2e8f0 !important; }
[data-theme="dark"] .top-nav-notif:hover { background: #334155; }
[data-theme="dark"] .data-table td { border-color: #334155; }
[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,0.7); }
[data-theme="dark"] .modal-box { background: #1e293b; }
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: #0f172a;
    color: #e2e8f0;
    border-color: #334155;
}
[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    border-color: #6366f1;
}

/* Global placeholder styling */
input::placeholder,
textarea::placeholder,
select::placeholder {
    color: var(--color-placeholder);
    opacity: 1;
}

[data-theme="dark"] .btn-ghost { color: #e2e8f0; border-color: #475569; }
[data-theme="dark"] .btn-ghost:hover:not(:disabled) { background: #334155; border-color: #64748b; }
[data-theme="dark"] .btn-clear { background: #422006; color: #fbbf24; border-color: #92400e; }
[data-theme="dark"] .btn-clear:hover { background: #713f12; }
[data-theme="dark"] .btn-edit { background: #172554; color: #93c5fd; border-color: #1e40af; }
[data-theme="dark"] .btn-edit:hover { background: #1e3a5f; }
[data-theme="dark"] .btn-danger-text { color: #fda4af !important; }
[data-theme="dark"] .btn-danger-text:hover { background: #4c0519 !important; }
[data-theme="dark"] .btn-deactivate { background: #4c0519; color: #fda4af; border-color: #881337; }
[data-theme="dark"] .btn-deactivate:hover { background: #881337; }
[data-theme="dark"] .btn-export { background: #1e3a5f; color: #93c5fd; border-color: #1e40af; }
[data-theme="dark"] .btn-export:hover { background: #1e40af; }
[data-theme="dark"] .btn-send-po { background: #047857; border-color: #047857; }
[data-theme="dark"] .btn-send-po:hover { background: #065f46; }
[data-theme="dark"] .comment-bubble.incoming { background: #334155; }
[data-theme="dark"] .pipeline-stage { background: #1a2332; }
[data-theme="dark"] .pipeline-stage.active { background: #1e3a5f; border-color: #6366f1; }
[data-theme="dark"] .proof-file-card { background: #1a2332; border-color: #334155; }
[data-theme="dark"] .proof-file-card.status-approved { background: #052e16; border-color: #166534; }
[data-theme="dark"] .proof-file-card.status-revision_requested { background: #422006; border-color: #92400e; }
[data-theme="dark"] .proof-file-card.status-pending_review { background: #1e3a5f; border-color: #1e40af; }
[data-theme="dark"] .proof-feedback-item.action-approve { background: #052e16; }
[data-theme="dark"] .proof-feedback-item.action-request_revision { background: #422006; }
[data-theme="dark"] .proof-feedback-item.action-comment { background: #1a2332; }
[data-theme="dark"] .orders-summary-bar { background: #1a2332; border-color: #334155; }
[data-theme="dark"] .invoice-summary-group { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .bulk-action-bar { background: #1e3a5f; border-color: #1e40af; color: #93c5fd; }
[data-theme="dark"] .announcement-banner { background: #1e3a5f; color: #93c5fd; border-color: #1e40af; }


html {
    overflow-y: scroll; /* Always reserve scrollbar space */
}

body {
    font-family:      var(--font);
    background-color: var(--color-bg);
    color:            var(--color-text);
    font-size:        14px;
    line-height:      1.6;
}

a { color: var(--color-primary); }
a:hover { color: var(--color-primary-dark); }

/* ---- Layout ---- */
body:not(.login-page) {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    background:  var(--color-sidebar);
    color:       #cbd5e0;
    display:     flex;
    flex-direction: column;
    padding:     0;
    position:    sticky;
    top:         0;
    height:      100vh;
    overflow-y:  auto;
    overflow-x:  hidden;
}

.sidebar-logo {
    padding:       20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo .logo-link {
    display:     flex;
    align-items: center;
    gap:         10px;
    padding:     0;
    text-decoration: none;
}
.sidebar-logo .logo-link,
.sidebar-logo .logo-link:hover,
.sidebar-logo .logo-link.active {
    background: transparent;
    opacity:    1;
}
.sidebar-logo .logo-link:hover {
    opacity: 0.85;
}
.sidebar-logo-img {
    width:         40px;
    height:        40px;
    border-radius: 9px;
    display:       block;
    flex-shrink:   0;
}
.sidebar-logo-name {
    color:          #fff;
    font-size:      15px;
    font-weight:    800;
    letter-spacing: -0.2px;
    white-space:    nowrap;
}

/* Notifications */
.notif-counter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    padding: 0 6px;
}
.notif-counter.zero {
    background: #64748b;
    color: #fff;
}
    display: inline-block;
}
.notification-list {
    overflow-y: auto;
}
.notification-item {
    display: block;
    padding: 10px 16px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
}
.notification-item:hover { background: var(--color-bg); }
.notification-item.unread { background: var(--color-bg); }
.notification-item.unread:hover { background: #dbeafe; }
.notification-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 2px;
}
.notification-item-message {
    font-size: 12px;
    color: var(--color-muted);
}
.notification-item-time {
    font-size: 11px;
    color: var(--color-muted);
    margin-top: 2px;
}
.notification-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--color-muted);
    font-size: 13px;
}

.sidebar-nav {
    padding: 12px 0;
    flex: 1;
}

.nav-group {
    padding: 8px 0;
}
.nav-group + .nav-group {
    margin-top: 4px;
    border-top: 1px solid rgba(255,255,255,0.18);
    padding-top: 12px;
}
.nav-group-label {
    display: none;
}

.nav-link {
    display:     block;
    padding:     10px 20px;
    color:       #a0aec0;
    text-decoration: none;
    font-size:   14px;
    font-weight: 500;
    border-radius: 0;
    transition:  background 0.15s, color 0.15s;
}

.nav-link:hover, .nav-link.active {
    background: var(--color-sidebar-hover);
    color:      #fff;
}

/* Nav submenu (collapsible) */
.nav-submenu { position: relative; }
.nav-submenu-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.nav-submenu-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}
.nav-submenu-toggle.open .nav-submenu-arrow {
    transform: rotate(180deg);
}
.nav-submenu-items {
    padding-left: 12px;
}
.nav-submenu-items.hidden { display: none; }
.nav-submenu-items .nav-link {
    font-size: 13px;
    padding: 6px 12px 6px 16px;
    border-left: 2px solid rgba(255,255,255,0.1);
}
.nav-submenu-items .nav-link:hover,
.nav-submenu-items .nav-link.active {
    border-left-color: var(--color-primary);
}

.nav-link-orders {
    display:        flex;
    flex-direction: row;
    align-items:    center;
    gap:            8px;
}
.nav-link-orders .nav-link-label {}

.open-orders-count {
    font-size: 11px;
    font-weight: 700;
    background: var(--color-primary);
    color: #fff;
    border-radius: 10px;
    padding: 1px 7px;
    min-width: 20px;
    text-align: center;
    line-height: 1.4;
}
.open-orders-count[data-zero="true"] {
    background: var(--color-muted);
    opacity: 0.5;
}

.order-nav-counts {
    display:   none;
}

.order-nav-pill {
    position:        relative;
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    min-width:       20px;
    height:          18px;
    padding:         0 5px;
    border-radius:   999px;
    font-size:       11px;
    font-weight:     700;
    line-height:     1;
    cursor:          pointer;
    transition:      opacity 0.2s, filter 0.15s;
}
.order-nav-pill:hover { filter: brightness(1.25); }

.order-nav-pill[data-zero="true"] { opacity: 0.3; }

/* Same hues as order status badges, adapted for dark sidebar */
.order-nav-pill[data-status="Needs Quoted"]   { background: rgba(229,62,62,0.3);   color: #fed7d7; border: 1px solid rgba(254,215,215,0.25); }
.order-nav-pill[data-status="Lead"]           { background: rgba(49,130,206,0.3);  color: #bee3f8; border: 1px solid rgba(190,227,248,0.25); }
.order-nav-pill[data-status="Quoted"]          { background: rgba(128,90,213,0.3);  color: #e9d8fd; border: 1px solid rgba(233,216,253,0.25); }
.order-nav-pill[data-status="Confirmed"]      { background: rgba(44,122,123,0.3);  color: #b2f5ea; border: 1px solid rgba(178,245,234,0.25); }
.order-nav-pill[data-status="Proof Approval"] { background: rgba(183,121,31,0.3);  color: #fef3c7; border: 1px solid rgba(254,243,199,0.25); }
.order-nav-pill[data-status="Proof Approved"] { background: rgba(5,150,105,0.3);   color: #a7f3d0; border: 1px solid rgba(167,243,208,0.25); }
.order-nav-pill[data-status="In Production"]  { background: rgba(133,100,4,0.3);   color: #fde68a; border: 1px solid rgba(253,230,138,0.25); }
.order-nav-pill[data-status="Shipped"]        { background: rgba(39,103,73,0.3);   color: #9ae6b4; border: 1px solid rgba(154,230,180,0.25); }
.order-nav-pill[data-status="Delivered"]      { background: rgba(34,84,61,0.3);    color: #c6f6d5; border: 1px solid rgba(198,246,213,0.25); }
.order-nav-pill[data-status="Canceled"]      { background: rgba(153,27,27,0.3);   color: #fca5a5; border: 1px solid rgba(252,165,165,0.25); }

.nav-link-leads {
    display:        flex;
    flex-direction: row;
    align-items:    center;
    gap:            8px;
    overflow:       hidden;
}
.nav-link-leads .lead-nav-counts {
    flex-shrink: 1;
    min-width: 0;
}

.lead-nav-counts {
    display:   none;
}

.lead-nav-pill {
    position:      relative;
    display:       inline-flex;
    align-items:   center;
    justify-content: center;
    min-width:     20px;
    height:        18px;
    padding:       0 5px;
    border-radius: 999px;
    font-size:     11px;
    font-weight:   700;
    line-height:   1;
    cursor:        pointer;
    transition:    opacity 0.2s, filter 0.15s;
}
.lead-nav-pill:hover { filter: brightness(1.25); }

/* Tooltip */
.lead-nav-pill[data-tooltip]::after,
.order-nav-pill[data-tooltip]::after {
    content:        attr(data-tooltip);
    position:       absolute;
    left:           50%;
    top:            calc(100% + 8px);
    transform:      translateX(-50%) translateY(4px);
    padding:        5px 10px;
    border-radius:  6px;
    font-size:      11px;
    font-weight:    600;
    letter-spacing: 0.02em;
    white-space:    nowrap;
    color:          #fff;
    background:     rgba(15, 23, 42, 0.92);
    box-shadow:     0 4px 12px rgba(0,0,0,0.25);
    backdrop-filter: blur(6px);
    opacity:        0;
    pointer-events: none;
    transition:     opacity 0.15s ease, transform 0.15s ease;
    z-index:        1000;
}
.lead-nav-pill[data-tooltip]:hover::after,
.order-nav-pill[data-tooltip]:hover::after {
    opacity:   1;
    transform: translateX(-50%) translateY(0);
}

.order-count-pill {
    display:        inline-flex;
    align-items:    center;
    vertical-align: middle;
}

/* Floating tooltip for order count pills */
.pill-tooltip {
    position:       fixed;
    padding:        5px 10px;
    border-radius:  6px;
    font-size:      11px;
    font-weight:    600;
    letter-spacing: 0.02em;
    white-space:    nowrap;
    color:          #fff;
    background:     rgba(15, 23, 42, 0.92);
    box-shadow:     0 4px 12px rgba(0,0,0,0.25);
    backdrop-filter: blur(6px);
    pointer-events: none;
    z-index:        9999;
    opacity:        0;
    transition:     opacity 0.15s ease;
}
.pill-tooltip.visible {
    opacity: 1;
}

.lead-nav-pill[data-zero="true"] { opacity: 0.3; }

/* Colors mirror the lead status badges (.badge-lead-open/converted/lost)
   but adapted for the dark sidebar background */
.lead-nav-open      { background: rgba(29, 78, 216, 0.3);  color: #bfdbfe; border: 1px solid rgba(191,219,254,0.3); }
.lead-nav-converted { background: rgba(21, 128, 61, 0.3);  color: #bbf7d0; border: 1px solid rgba(187,247,208,0.3); }
.lead-nav-lost      { background: rgba(153, 27, 27, 0.35); color: #fecaca; border: 1px solid rgba(254,202,202,0.3); }


/* Sales team card (customer sidebar) */
.sidebar-sales-team {
    margin: 8px 14px;
    padding: 14px 16px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
}
.sidebar-sales-team.hidden { display: none; }
.sales-team-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #64748b;
    margin-bottom: 8px;
}
.sales-team-ppd {
    font-size: 14px;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 2px;
}
.sales-team-rep {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 8px;
}
.sales-team-contact {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.sales-team-link {
    font-size: 12px;
    color: #93c5fd;
    text-decoration: none;
}
.sales-team-link:hover { text-decoration: underline; }
.sales-team-phone {
    font-size: 12px;
    color: #94a3b8;
}

.sidebar-footer {
    padding:        20px;
    border-top:     1px solid rgba(255,255,255,0.08);
    display:        flex;
    flex-direction: column;
    gap:            12px;
}
.sidebar-sub-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 6px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    text-decoration: none;
    transition: background 0.15s;
    cursor: pointer;
}
.sidebar-sub-link:hover { background: rgba(255,255,255,0.1); }
.sidebar-sub-label {
    font-size: 12px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
}
.sidebar-sub-plan {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    color: #e2e8f0;
}
.sidebar-sub-plan[data-plan="free"] { background: rgba(148,163,184,0.2); color: #94a3b8; }
.sidebar-sub-plan[data-plan="individual"] { background: rgba(99,179,237,0.2); color: #63b3ed; }
.sidebar-sub-plan[data-plan="team"] { background: rgba(183,148,244,0.2); color: #b794f4; }
.sidebar-sub-manage {
    font-size: 11px;
    color: #94a3b8;
    transition: color 0.15s;
}
.sidebar-sub-link:hover .sidebar-sub-manage { color: #e2e8f0; }

.theme-toggle {
    display: flex;
    gap: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 3px;
}
.theme-btn {
    flex: 1;
    padding: 4px 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: rgba(255,255,255,0.5);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.theme-btn:hover { color: rgba(255,255,255,0.8); }
.theme-btn.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.user-avatar-btn {
    display:     flex;
    align-items: center;
    gap:         12px;
    width:       100%;
    background:  none;
    border:      none;
    padding:     4px 6px;
    border-radius: var(--radius);
    cursor:      pointer;
    text-align:  left;
    transition:  background 0.15s;
}
.user-avatar-btn:hover {
    background: rgba(255,255,255,0.06);
}
.avatar-circle {
    width:           42px;
    height:          42px;
    border-radius:   50%;
    display:         flex;
    align-items:     center;
    justify-content: center;
    font-size:       14px;
    font-weight:     700;
    color:           #fff;
    letter-spacing:  0.5px;
    flex-shrink:     0;
    user-select:     none;
}
.user-name-col {
    display:        flex;
    flex-direction: column;
    overflow:       hidden;
}
.user-name-text {
    font-size:     13px;
    font-weight:   600;
    color:         #e2e8f0;
    overflow:      hidden;
    text-overflow: ellipsis;
    white-space:   nowrap;
    line-height:   1.3;
}
.user-subtitle {
    font-size:      11px;
    font-weight:    600;
    color:          #a0aec0;
    letter-spacing: 0.03em;
}

#logoutBtn {
    width:       100%;
    justify-content: center;
    font-size:   13px;
    padding:     8px 0;
    color:       #718096;
    border-color: rgba(255,255,255,0.1);
    transition:  background 0.15s, color 0.15s;
}
#logoutBtn:hover {
    background: rgba(255,255,255,0.06);
    color:      #e2e8f0;
    border-color: rgba(255,255,255,0.2);
}

.user-role-badge {
    display:         flex;
    align-items:     center;
    justify-content: center;
    gap:             5px;
    font-size:       10px;
    font-weight:     700;
    letter-spacing:  0.5px;
    text-transform:  uppercase;
    padding:         4px 10px;
    border-radius:   6px;
    width:           100%;
    overflow:        hidden;
    white-space:     nowrap;
}
.user-role-badge svg {
    flex-shrink: 0;
}
.role-badge-label {
    overflow:      hidden;
    text-overflow: ellipsis;
    white-space:   nowrap;
    min-width:     0;
}

/* Admin — amber/gold */
.user-role-badge.role-admin {
    background: rgba(217, 119, 6, 0.25);
    color:      #fcd34d;
    border:     1px solid rgba(252, 211, 77, 0.25);
}

/* PPD User — muted blue */
.user-role-badge.role-ppd-user {
    background: rgba(99, 102, 241, 0.2);
    color:      #a5b4fc;
    border:     1px solid rgba(165, 180, 252, 0.2);
}

/* ---- Top Nav Bar ---- */
.top-nav {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: 52px;
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 90;
    gap: 16px;
}
.top-nav-search {
    position: relative;
    flex: 1;
    max-width: 480px;
}
.top-nav-search input[type="text"] {
    padding: 8px 14px 8px 36px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 13px;
    width: 100%;
    background: #f1f5f9;
    color: var(--color-text);
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.top-nav-search::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background: currentColor;
    opacity: 0.35;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E") no-repeat center;
    pointer-events: none;
    z-index: 1;
}
.top-nav-search input[type="text"]::placeholder {
    color: var(--color-placeholder);
}
.top-nav-search input[type="text"]:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(129,140,248,0.15);
    outline: none;
    background: var(--color-card);
}

/* Global search results dropdown */
.global-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    max-height: 420px;
    overflow-y: auto;
    z-index: 999;
}
.global-search-results.hidden { display: none; }
.search-category {
    padding: 8px 14px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-muted);
}
.search-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.1s;
}
.search-result:hover,
.search-result.active {
    background: color-mix(in srgb, var(--color-primary), transparent 92%);
}
.search-result:last-child {
    border-radius: 0 0 12px 12px;
}
.search-result-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.search-result-icon.type-order { background: var(--color-primary); }
.search-result-icon.type-company { background: #0891b2; }
.search-result-icon.type-customer { background: #059669; }
.search-result-icon.type-lead { background: #d97706; }
.search-result-icon.type-project { background: #7c3aed; }
.search-result-icon.type-supplier { background: #dc2626; }
.search-result-icon.type-supplier-item { background: #be185d; }
.search-result-body { flex: 1; min-width: 0; }
.search-result-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-result-subtitle {
    font-size: 11px;
    color: var(--color-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-result-meta {
    font-size: 11px;
    color: var(--color-muted);
    flex-shrink: 0;
}
.search-no-results {
    padding: 20px 14px;
    text-align: center;
    color: var(--color-muted);
    font-size: 13px;
}
.search-hint {
    padding: 8px 14px;
    text-align: center;
    color: var(--color-muted);
    font-size: 11px;
    border-top: 1px solid var(--color-border);
}
.top-nav-toasts {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    overflow: hidden;
    padding: 0 12px;
    min-width: 0;
}
.top-nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.top-nav-notif {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    text-decoration: none;
    color: var(--color-text);
    transition: background 0.15s;
    position: relative;
}
.top-nav-notif, .top-nav-notif:hover {
    color: var(--color-text) !important;
}
.top-nav-notif:hover { background: #e2e8f0; }

/* ---- Main Content ---- */
.main-content {
    padding:    32px;
    padding-top: 84px;  /* 52px top-nav + 32px padding */
    overflow-y: auto;
    min-height: 100vh;
}

/* Announcement Banner */
.announcement-banner {
    display:        flex;
    align-items:    center;
    justify-content: space-between;
    gap:            12px;
    padding:        12px 16px;
    margin-bottom:  24px;
    border-radius:  var(--radius);
    background:     linear-gradient(135deg, #1d4ed8, #2563eb);
    color:          #fff;
    font-size:      14px;
    font-weight:    500;
    line-height:    1.5;
    box-shadow:     0 2px 8px rgba(37, 99, 235, 0.3);
}
.announcement-dismiss {
    flex-shrink:    0;
    background:     rgba(255,255,255,0.2);
    border:         none;
    color:          #fff;
    font-size:      18px;
    line-height:    1;
    width:          28px;
    height:         28px;
    border-radius:  50%;
    cursor:         pointer;
    transition:     background 0.15s;
}
.announcement-dismiss:hover {
    background: rgba(255,255,255,0.35);
}

/* ---- Page Header ---- */
.page-header {
    display:        flex;
    flex-direction: column;
    gap:            12px;
    margin-bottom:  24px;
}

.header-title-row {
    display:     flex;
    align-items: center;
    gap:         16px;
}

.page-header h1 {
    font-size:   22px;
    font-weight: 700;
    color:       var(--color-text);
    flex:        1;
    margin:      0;
}

.header-buttons {
    display:     flex;
    align-items: center;
    gap:         8px;
    flex-shrink: 0;
}

.header-filter-row {
    display:   flex;
    flex-wrap: wrap;
    gap:       8px;
    align-items: center;
}

/* ---- Cards ---- */
.card {
    background:    var(--color-card);
    border-radius: var(--radius);
    box-shadow:    var(--shadow);
    margin-bottom: 20px;
    overflow:      hidden;
    border:        1px solid var(--color-border);
}

.card-header {
    display:       flex;
    align-items:   center;
    padding:       16px 20px;
    border-bottom: 1px solid var(--color-border);
    gap:           12px;
}

.card-header h2 {
    font-size:   16px;
    font-weight: 600;
    flex:        1;
}

/* ---- Stat Cards ---- */
.stat-cards {
    display:               grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap:                   16px;
    margin-bottom:         24px;
}
#statCards {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin-bottom: 16px;
    padding-bottom: 4px;
}
#statCards .stat-card {
    flex: 0 0 auto;
    min-width: 100px;
    padding: 10px 14px;
    border-left-width: 3px;
}
#statCards .stat-label {
    font-size: 11px;
    white-space: nowrap;
}
#statCards .stat-value {
    font-size: 20px;
}

.stat-card {
    background:    var(--color-card);
    border-radius: var(--radius);
    box-shadow:    var(--shadow);
    padding:       18px 20px;
    border-left:   4px solid var(--color-primary);
    cursor:        pointer;
    text-decoration: none;
    transition:    transform 0.12s, box-shadow 0.12s;
}
.stat-card:hover {
    transform:  translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.stat-card-active {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary), transparent 70%);
}
.notif-stat-unread { border-left-color: #1d4ed8; }
.notif-stat-unread .stat-value { color: #1d4ed8; }
.notif-stat-unread.stat-card-active { border-color: #1d4ed8; box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.2); }
.notif-stat-read { border-left-color: #059669; }
.notif-stat-read .stat-value { color: #059669; }
.notif-stat-read.stat-card-active { border-color: #059669; box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.2); }
[data-theme="dark"] .notif-stat-unread .stat-value { color: #93c5fd; }
[data-theme="dark"] .notif-stat-unread { border-left-color: #93c5fd; }
[data-theme="dark"] .notif-stat-unread.stat-card-active { border-color: #93c5fd; box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.2); }
[data-theme="dark"] .notif-stat-read .stat-value { color: #6ee7b7; }
[data-theme="dark"] .notif-stat-read { border-left-color: #6ee7b7; }
[data-theme="dark"] .notif-stat-read.stat-card-active { border-color: #6ee7b7; box-shadow: 0 0 0 2px rgba(110, 231, 183, 0.2); }
.notif-stat-total { border-left-color: #1e293b; }
.notif-stat-total .stat-value { color: #1e293b; }
.notif-stat-total.stat-card-active { border-color: #1e293b; box-shadow: 0 0 0 2px rgba(30, 41, 59, 0.2); }
[data-theme="dark"] .notif-stat-total { border-left-color: #e2e8f0; }
[data-theme="dark"] .notif-stat-total .stat-value { color: #e2e8f0; }
[data-theme="dark"] .notif-stat-total.stat-card-active { border-color: #e2e8f0; box-shadow: 0 0 0 2px rgba(226, 232, 240, 0.2); }

.stat-card .stat-label {
    font-size:  12px;
    color:      var(--color-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .stat-value {
    font-size:   28px;
    font-weight: 700;
    color:       var(--color-text);
    margin-top:  4px;
}

/* ---- Order Progress Tracker ---- */
.order-progress-tracker {
    display: flex;
    align-items: flex-start;
    position: relative;
}
.progress-step {
    flex: 1;
    text-align: center;
    position: relative;
    z-index: 1;
}
.progress-step .step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    border: 3px solid #e2e8f0;
    background: #fff;
    color: #a0aec0;
    transition: all 0.3s;
    position: relative;
    z-index: 2;
}
.progress-step.completed .step-dot {
    background: #059669;
    border-color: #059669;
    color: #fff;
}
.progress-step.current .step-dot {
    background: var(--color-card);
    border-color: var(--color-primary);
    color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(129,140,248,0.2);
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 4px rgba(129,140,248,0.2); }
    50% { box-shadow: 0 0 0 8px rgba(129,140,248,0.1); }
}
.progress-step .step-label {
    font-size: 10px;
    font-weight: 600;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.3;
}
.progress-step.completed .step-label { color: #059669; }
.progress-step.current .step-label { color: var(--color-primary); font-weight: 700; }
.progress-step .step-date {
    font-size: 10px;
    color: #a0aec0;
    margin-top: 2px;
}
.progress-step.completed .step-date { color: #059669; }
.progress-step.current .step-date { color: var(--color-primary); }
.progress-step.skipped .step-dot {
    background: #059669;
    border-color: #059669;
    color: #fff;
    opacity: 0.5;
}
.progress-step.skipped .step-label { opacity: 0.5; }
.step-date.skipped-label {
    color: #94a3b8;
    font-style: italic;
}

/* Connector line between steps */
.progress-connector {
    flex: 1;
    height: 3px;
    background: #e2e8f0;
    margin-top: 14px;
    position: relative;
    z-index: 0;
    transition: background 0.3s;
}
.progress-connector.completed {
    background: #059669;
}

/* ---- Customer Dashboard ---- */
.customer-pipeline {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.pipeline-stage {
    flex: 1;
    min-width: 100px;
    padding: 12px;
    background: var(--color-bg);
    border-radius: 8px;
    text-align: center;
    border: 2px solid transparent;
    transition: border-color 0.2s;
    cursor: pointer;
}
.pipeline-stage:hover { border-color: var(--color-primary); }
.pipeline-stage .stage-count {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
}
.pipeline-stage .stage-label {
    font-size: 11px;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}
.pipeline-stage.active {
    border-color: var(--color-primary);
    background: #eff6ff;
}
.customer-attention-item, .customer-deadline-item, .customer-activity-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
}
.customer-attention-item:last-child, .customer-deadline-item:last-child, .customer-activity-item:last-child { border-bottom: none; }
.customer-attention-item a, .customer-deadline-item a, .customer-activity-item a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
}
.customer-attention-item a:hover, .customer-deadline-item a:hover { text-decoration: underline; }
.deadline-date {
    font-weight: 600;
    color: var(--color-text);
}
.deadline-urgent { color: #ef4444; }
.customer-empty {
    color: var(--color-muted);
    font-size: 13px;
    padding: 16px 0;
    text-align: center;
}

/* ---- Dashboard Grid ---- */
.dashboard-grid {
    display:               grid;
    grid-template-columns: repeat(3, 1fr);
    gap:                   16px;
    margin-bottom:         24px;
}
.chart-range-select {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-card);
    color: var(--color-text);
    cursor: pointer;
    outline: none;
}
.chart-card {
    background:    var(--color-card);
    border-radius: var(--radius);
    box-shadow:    var(--shadow);
    padding:       16px;
    max-height:    280px;
}
.chart-card canvas {
    max-height:    220px;
}
.chart-card h3 {
    margin:         0 0 8px;
    font-size:      12px;
    font-weight:    700;
    color:          var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ---- Tables ---- */
.table-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

.data-table-compact th,
.data-table-compact td {
    padding: 8px 8px;
    font-size: 12.5px;
}
.data-table-compact th {
    font-size: 11px;
}

.range-sublabel {
    font-size: 10px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 1px;
    line-height: 1;
}

/* Color count hover popup */
.color-hover-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    cursor: default;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.color-hover-trigger:hover {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}
.color-hover-popup {
    display: none;
    flex-direction: column;
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 0;
    min-width: 180px;
    max-height: 280px;
    overflow: hidden;
    z-index: 999;
    white-space: nowrap;
    animation: colorPopupIn 0.15s ease-out;
}
@keyframes colorPopupIn {
    from { opacity: 0; transform: translateX(-50%) translateY(4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.color-hover-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: #fff;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.08));
}
.color-hover-popup::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: var(--color-border);
}
.color-hover-popup-header {
    padding: 8px 14px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border);
}
.color-hover-popup-list {
    max-height: 220px;
    overflow-y: auto;
    padding: 4px 0;
}
.color-hover-trigger:hover .color-hover-popup { display: flex; }
.color-hover-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    font-size: 12.5px;
    font-weight: 400;
    color: var(--color-text);
    line-height: 1.4;
    transition: background 0.1s;
}
.color-hover-item .color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1.5px solid rgba(0,0,0,0.2);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.05);
}
.color-hover-item:hover { background: var(--color-bg); }

/* Stripe invoice progress overlay */
.stripe-progress-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.stripe-progress-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px 48px;
    text-align: center;
    min-width: 360px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: scaleIn 0.25s ease-out;
}
@keyframes scaleIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.stripe-progress-icon {
    font-size: 36px;
    margin-bottom: 12px;
    line-height: 1;
}
.stripe-progress-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 6px;
}
.stripe-progress-status {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 20px;
    min-height: 20px;
    transition: color 0.2s;
}
.stripe-progress-bar-track {
    width: 100%;
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
}
.stripe-progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #635bff, #7c3aed);
    border-radius: 3px;
    transition: width 0.6s ease;
}
.stripe-progress-bar-fill.stripe-progress-error {
    background: linear-gradient(90deg, #e53e3e, #c53030);
}
.stripe-progress-success .stripe-progress-icon {
    color: #22c55e;
    font-size: 42px;
}
.stripe-progress-success .stripe-progress-status {
    color: #22c55e;
    font-weight: 600;
}
.stripe-progress-failed .stripe-progress-icon {
    color: #e53e3e;
    font-size: 42px;
}
.stripe-progress-failed .stripe-progress-status {
    color: #e53e3e;
    font-weight: 600;
}

/* SAGE-style pricing matrix */
.sage-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    overflow: hidden;
}
.sage-matrix th, .sage-matrix td {
    padding: 6px 12px;
    text-align: center;
    border: 1px solid var(--color-border);
    white-space: nowrap;
}
.sage-matrix thead th {
    background: var(--color-bg);
    font-weight: 700;
    font-size: 12px;
    color: var(--color-muted);
}
.sage-matrix .sage-label {
    text-align: left;
    font-weight: 600;
    background: var(--color-bg);
    color: var(--color-text);
    min-width: 120px;
    white-space: nowrap;
}
.sage-matrix tbody tr:first-child td:not(.sage-label) {
    font-weight: 600;
    color: var(--color-text);
}

/* Price tier editor rows */
.price-tier-row input {
    padding:       9px 12px;
    border:        1px solid var(--color-border);
    border-radius: 6px;
    font-size:     13px;
    background:    var(--color-card);
    color:         var(--color-text);
    transition:    border-color 0.15s, box-shadow 0.15s;
}
.price-tier-row input:focus {
    border-color: var(--color-primary);
    box-shadow:   0 0 0 3px rgba(67,97,238,0.12);
    outline:      none;
}

/* Product images grid */
.product-images-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.product-image-card {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    cursor: pointer;
}
.product-image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.product-image-card .product-img-delete {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}
.product-image-card:hover .product-img-delete {
    opacity: 1;
}
/* Product image thumbnail in tables */
.product-thumb {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid var(--color-border);
    vertical-align: middle;
}

.data-table {
    width:           100%;
    border-collapse: collapse;
    font-size:       13.5px;
}

.data-table th {
    text-align:  left;
    padding:     10px 16px;
    font-size:   11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color:       var(--color-muted);
    background:  var(--color-table-header);
    border-bottom: 2px solid var(--color-border);
}
/* ---- Art Files ---- */
.art-files-list { display: flex; flex-direction: column; gap: 4px; }
.art-file-row {
    display:       flex;
    align-items:   center;
    gap:           10px;
    padding:       10px 14px;
    background:    var(--color-bg);
    border:        1px solid var(--color-border);
    border-radius: var(--radius);
    font-size:     13px;
    transition:    background 0.15s;
}
.art-file-row:hover {
    background:    var(--color-card);
}
.art-file-name {
    color:          var(--color-primary);
    text-decoration: none;
    overflow:       hidden;
    text-overflow:  ellipsis;
    white-space:    nowrap;
    flex:           1;
    margin-right:   8px;
}
.art-file-name:hover { text-decoration: underline; }
.art-file-row {
    flex-wrap: wrap;
}
.art-file-actions {
    display: flex;
    gap: 4px;
    width: 100%;
    justify-content: flex-end;
    padding-top: 6px;
    opacity: 0;
    transition: opacity 0.15s;
}
.art-file-row:hover .art-file-actions { opacity: 1; }
.art-file-actions .btn { padding: 2px 8px; font-size: 11px; }

.art-file-approve {
    font-size:      11px;
    padding:        2px 8px;
    border-radius:  999px;
    border:         1px solid #cbd5e1;
    background:     #f8fafc;
    color:          #64748b;
    cursor:         pointer;
    white-space:    nowrap;
    transition:     background 0.12s, border-color 0.12s;
}
.art-file-approve:hover { background: #e2e8f0; }
.art-file-approve.approved {
    background:   #f0fdf4;
    border-color: #86efac;
    color:        #15803d;
    cursor:       pointer;
}
.art-file-approve.approved:hover { background: #dcfce7; }

.file-icon-link {
    display:     inline-flex;
    align-items: center;
    color:       var(--color-primary);
    padding:     2px;
    border-radius: 3px;
    transition:  background 0.12s, color 0.12s;
}
.file-icon-link:hover {
    background: #eff6ff;
    color:      #1d4ed8;
}

.sortable-header {
    cursor: pointer;
    user-select: none;
}
.sortable-header:hover { color: var(--color-text); }
.sort-arrow { font-size: 10px; margin-left: 2px; }

/* Pagination */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid var(--color-border);
    font-size: 13px;
    color: var(--color-muted);
    flex-wrap: wrap;
    gap: 12px;
    background: var(--color-card);
}
.pagination-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.pagination-info strong {
    color: var(--color-text);
    font-weight: 600;
}
.pagination-divider {
    width: 1px;
    height: 16px;
    background: var(--color-border);
}
.pagination-size-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-muted);
}
.pagination-info select,
.page-size-select {
    padding: 4px 24px 4px 8px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 13px;
    background: var(--color-card);
    color: var(--color-text);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23718096' d='M5 7L1 3h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
}
.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}
.pagination-controls button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-card);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    transition: all 0.15s ease;
}
.pagination-controls button:hover:not(:disabled) {
    background: var(--color-bg);
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.pagination-controls button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.pagination-controls .prev-btn,
.pagination-controls .next-btn {
    padding: 0 6px;
}
.pagination-controls .page-btn.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(67, 97, 238, 0.3);
}
.pagination-controls .page-btn.active:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
}
.page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--color-muted);
    font-size: 14px;
    letter-spacing: 2px;
    user-select: none;
}

.data-table td {
    padding:     12px 16px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
.data-table tbody tr[data-id] {
    cursor: pointer;
}
.data-table tbody tr[data-order-id] {
    cursor: pointer;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover { background: var(--color-bg); cursor: pointer; }

.loading-cell {
    text-align: center;
    color:      var(--color-muted);
    padding:    40px !important;
}

/* ---- Status Badges ---- */
.badge {
    display:       inline-block;
    padding:       3px 10px;
    border-radius: 999px;
    font-size:     12px;
    font-weight:   600;
    white-space:   nowrap;
}

/* ---- Favorite button & row ---- */
.favorite-btn {
    background:  none;
    border:      none;
    font-size:   18px;
    line-height: 1;
    color:       var(--color-star-empty);
    cursor:      pointer;
    padding:     2px 4px;
    transition:  color 0.15s, transform 0.15s;
}
.favorite-btn:hover {
    color:     #f56565;
    transform: scale(1.2);
}
.favorite-btn.active {
    color: #e53e3e;
}
.favorite-row {
    background: var(--color-fav-row) !important;
}
.favorite-row:hover {
    background: var(--color-fav-row-hover) !important;
}

/* ---- Star Ratings ---- */
/* Stars are rendered in reverse DOM order (5,4,3,2,1) and flipped
   visually with direction:rtl so CSS ~ targets lower-valued stars. */
.star-rating {
    display:     inline-flex;
    gap:         2px;
    white-space: nowrap;
    direction:   rtl;
}
.star-rating .star {
    font-size:   18px;
    line-height: 1;
    color:       var(--color-star-empty);
    cursor:      pointer;
    transition:  color 0.12s, transform 0.12s;
    direction:   ltr;
}
/* Default state: filled stars are gold */
.star-rating .star.filled { color: var(--color-star-filled); }
/* Hover state: reset ALL stars to grey, then paint hovered + lower gold */
.star-rating:hover .star { color: var(--color-star-empty); }
.star-rating .star:hover,
.star-rating .star:hover ~ .star { color: var(--color-star-filled); }
.star-rating .star:hover { transform: scale(1.15); }

.star-rating-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.star-team-avg {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
}
.star-team-count {
    font-weight: 400;
    color: var(--color-muted);
    font-size: 11px;
}

.badge-lead          { background: #eff6ff; color: #1d4ed8; }
.badge-needs-quoted  { background: #fef2f2; color: #dc2626; }
.badge-quoted        { background: #f5f3ff; color: #7c3aed; }
.badge-confirmed     { background: #ecfdf5; color: #059669; }
.badge-proof         { background: #fff7ed; color: #ea580c; }
.badge-proof-approved { background: #fefce8; color: #a16207; }
.badge-production    { background: #fdf4ff; color: #c026d3; }
.badge-shipped       { background: #e0f2fe; color: #0284c7; }
.badge-delivered     { background: #f0fdf4; color: #15803d; }
.badge-canceled      { background: #fef2f2; color: #991b1b; }

/* ---- Lead-specific status badges ---- */
.badge-lead-open      { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-lead-converted { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-lead-lost      { background: #fdf2f2; color: #991b1b; border: 1px solid #fecaca; opacity: 0.82; }

/* ---- Invoice status badges ---- */
.badge-inv-draft    { background: #f3f4f6; color: #6b7280; border: 1px solid #d1d5db; }
.badge-inv-open     { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-inv-pastdue  { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.badge-inv-paid     { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-inv-refunded { background: #faf5ff; color: #7e22ce; border: 1px solid #e9d5ff; }
.badge-inv-void     { background: #f9fafb; color: #9ca3af; border: 1px solid #e5e7eb; opacity: 0.75; }

/* Supplier invoice statuses */
.badge-sinv-due          { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.badge-sinv-checkphoto   { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.badge-sinv-credit       { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.badge-sinv-complimentary { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.badge-sinv-payshipping  { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.badge-sinv-posubmitted  { background: #eef2ff; color: #4f46e5; border: 1px solid #c7d2fe; }
.badge-sinv-refundneeded { background: #fdf4ff; color: #a21caf; border: 1px solid #f0abfc; }

/* Active/Inactive & utility badges */
.badge-active    { background: #e6fffa; color: #2c7a7b; }
.badge-inactive  { background: #f7fafc; color: #718096; }
.badge-enabled   { background: #dcfce7; color: #166534; }
.badge-disabled  { background: #f1f5f9; color: #64748b; }
.badge-open      { background: #dbeafe; color: #1e40af; }
.badge-completed { background: #dcfce7; color: #166534; }
.badge-muted     { background: #f1f5f9; color: #64748b; }
.badge-success   { background: #dcfce7; color: #166534; }
.badge-error     { background: #fef2f2; color: #991b1b; }
.badge-warning   { background: #fef3c7; color: #92400e; }
.badge-info      { background: #dbeafe; color: #1e40af; }
.badge-urgent    { background: #fef2f2; color: #991b1b; }
.badge-high      { background: #fff7ed; color: #c2410c; }
.badge-medium    { background: #eff6ff; color: #1e40af; }
.badge-low       { background: #f1f5f9; color: #64748b; }

/* Dark mode badge overrides */
[data-theme="dark"] .badge-lead          { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-needs-quoted  { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .badge-quoted        { background: #2e1065; color: #d8b4fe; }
[data-theme="dark"] .badge-confirmed     { background: #052e16; color: #6ee7b7; }
[data-theme="dark"] .badge-proof         { background: #431407; color: #fdba74; }
[data-theme="dark"] .badge-proof-approved { background: #422006; color: #fde68a; }
[data-theme="dark"] .badge-production    { background: #4a044e; color: #f0abfc; }
[data-theme="dark"] .badge-shipped       { background: #0c4a6e; color: #7dd3fc; }
[data-theme="dark"] .badge-delivered     { background: #052e16; color: #86efac; }
[data-theme="dark"] .badge-canceled      { background: #450a0a; color: #fca5a5; }

[data-theme="dark"] .badge-inv-draft    { background: #1e293b; color: #94a3b8; border-color: #475569; }
[data-theme="dark"] .badge-inv-open     { background: #1e3a5f; color: #93c5fd; border-color: #1e40af; }
[data-theme="dark"] .badge-inv-pastdue  { background: #431407; color: #fdba74; border-color: #9a3412; }
[data-theme="dark"] .badge-inv-paid     { background: #052e16; color: #86efac; border-color: #166534; }
[data-theme="dark"] .badge-inv-refunded { background: #2e1065; color: #d8b4fe; border-color: #7e22ce; }
[data-theme="dark"] .badge-inv-void     { background: #1e293b; color: #64748b; border-color: #334155; }

[data-theme="dark"] .badge-sinv-due          { background: #450a0a; color: #fca5a5; border-color: #991b1b; }
[data-theme="dark"] .badge-sinv-checkphoto   { background: #422006; color: #fde68a; border-color: #92400e; }
[data-theme="dark"] .badge-sinv-credit       { background: #052e16; color: #86efac; border-color: #166534; }
[data-theme="dark"] .badge-sinv-complimentary { background: #052e16; color: #86efac; border-color: #166534; }
[data-theme="dark"] .badge-sinv-payshipping  { background: #1e3a5f; color: #93c5fd; border-color: #1e40af; }
[data-theme="dark"] .badge-sinv-posubmitted  { background: #312e81; color: #a5b4fc; border-color: #4338ca; }
[data-theme="dark"] .badge-sinv-refundneeded { background: #4a044e; color: #f0abfc; border-color: #86198f; }

[data-theme="dark"] .badge-active    { background: #134e4a; color: #99f6e4; }
[data-theme="dark"] .badge-inactive  { background: #1e293b; color: #64748b; }
[data-theme="dark"] .badge-enabled   { background: #052e16; color: #86efac; }
[data-theme="dark"] .badge-disabled  { background: #1e293b; color: #64748b; }
[data-theme="dark"] .badge-open      { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-completed { background: #052e16; color: #86efac; }
[data-theme="dark"] .badge-muted     { background: #1e293b; color: #64748b; }
[data-theme="dark"] .badge-success   { background: #052e16; color: #86efac; }
[data-theme="dark"] .badge-error     { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .badge-warning   { background: #422006; color: #fde68a; }
[data-theme="dark"] .badge-info      { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-urgent    { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .badge-high      { background: #431407; color: #fdba74; }
[data-theme="dark"] .badge-medium    { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-low       { background: #1e293b; color: #64748b; }

/* ---- Buttons ---- */
.btn {
    display:       inline-flex;
    align-items:   center;
    gap:           6px;
    padding:       8px 16px;
    border-radius: var(--radius);
    font-size:     14px;
    font-weight:   600;
    cursor:        pointer;
    border:        none;
    transition:    background 0.15s, opacity 0.15s;
    text-decoration: none;
    white-space:   nowrap;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-dark); }

.btn-ghost { background: transparent; color: var(--color-text); border: 1px solid var(--color-border); }
.btn-ghost:hover:not(:disabled) { background: #e2e8f0; border-color: #cbd5e1; }


.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-clear {
    background:    #fef3c7;
    color:         #92400e;
    border:        1px solid #fbbf24;
    font-weight:   600;
}
.btn-clear:hover {
    background: #fde68a;
}
.btn-edit {
    background:    #eff6ff;
    color:         #1d4ed8;
    border:        1px solid #93c5fd;
    font-weight:   600;
}
.btn-edit:hover {
    background: #dbeafe;
}
.btn-danger-text {
    color: var(--color-danger) !important;
}
.btn-danger-text:hover {
    background: #fff1f2 !important;
}
.btn-deactivate {
    background:    #fff1f2;
    color:         #be123c;
    border:        1px solid #fda4af;
    font-weight:   600;
}
.btn-deactivate:hover {
    background: #ffe4e6;
}
.btn-export {
    background:  #eff6ff;
    color:       #1e40af;
    border:      1px solid #93c5fd;
    font-weight: 600;
}
.btn-export:hover { background: #dbeafe; }

.btn-send-po {
    background:    #059669;
    color:         #fff;
    border:        1px solid #059669;
    font-weight:   700;
}
.btn-send-po:hover {
    background: #047857;
}

.status-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    min-width: 200px;
    z-index: 100;
    padding: 4px 0;
    max-height: 400px;
    overflow-y: auto;
}
.status-dropdown.hidden { display: none; }
.status-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 13px;
    color: var(--color-text);
    transition: background 0.1s;
}
.status-dropdown-item:hover { background: var(--color-bg); }
.status-dropdown-item.active {
    font-weight: 700;
    background: color-mix(in srgb, var(--color-primary), transparent 92%);
}
.status-dropdown-item .badge { pointer-events: none; }

.btn-danger {
    background: #ef4444;
    color: #fff;
    border: 1px solid #dc2626;
}
.btn-danger:hover:not(:disabled) { background: #dc2626; }

/* Audit log */
.audit-entry {
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 6px;
    background: var(--color-bg);
    font-size: 13px;
}
/* ---- Product Tour ---- */
.tour-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    pointer-events: none;
    transition: opacity 0.3s;
}
.tour-overlay.hidden { display: none; }
.tour-overlay canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: all;
}
.tour-spotlight {
    position: fixed;
    z-index: 9001;
    border-radius: 8px;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.5), 0 0 0 9999px rgba(0, 0, 0, 0.55);
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.tour-tooltip {
    position: fixed;
    z-index: 9002;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    padding: 20px;
    max-width: 380px;
    min-width: 280px;
    pointer-events: all;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s, transform 0.25s;
}
.tour-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}
.tour-tooltip-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 8px;
    line-height: 1.3;
}
.tour-tooltip-body {
    font-size: 13px;
    color: var(--color-muted);
    line-height: 1.6;
    margin: 0 0 16px;
}
.tour-tooltip-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.tour-tooltip-progress {
    font-size: 11px;
    color: var(--color-muted);
    font-weight: 600;
}
.tour-tooltip-actions {
    display: flex;
    gap: 6px;
}
.tour-tooltip-arrow {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    transform: rotate(45deg);
    z-index: -1;
}
.tour-tooltip-arrow.top    { bottom: -7px; left: 24px; border-top: none; border-left: none; }
.tour-tooltip-arrow.bottom { top: -7px; left: 24px; border-bottom: none; border-right: none; }
.tour-tooltip-arrow.left   { right: -7px; top: 24px; border-bottom: none; border-left: none; }
.tour-tooltip-arrow.right  { left: -7px; top: 24px; border-top: none; border-right: none; }

/* ---- Notification rows ---- */
.notif-unread {
    font-weight: 600;
    background: color-mix(in srgb, var(--color-primary), transparent 92%) !important;
    border-left: 3px solid var(--color-primary);
}
.notif-unread:hover { background: color-mix(in srgb, var(--color-primary), transparent 85%) !important; }
.notif-read {
    opacity: 0.55;
    border-left: 3px solid transparent;
}
.notif-read:hover { opacity: 0.75; }
.notif-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid var(--color-border);
}
.notif-dot.unread {
    background: #ef4444;
    border-color: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}
.notif-read-btn {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    font-weight: 600;
}
.notif-read-btn:hover { background: #d1fae5; }
[data-theme="dark"] .notif-read-btn { background: #052e16; color: #6ee7b7; border-color: #065f46; }
[data-theme="dark"] .notif-read-btn:hover { background: #064e3b; }

.notif-unread-btn {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    font-weight: 600;
}
.notif-unread-btn:hover { background: #dbeafe; }
[data-theme="dark"] .notif-unread-btn { background: #1e3a5f; color: #93c5fd; border-color: #1e40af; }
[data-theme="dark"] .notif-unread-btn:hover { background: #1e40af; }

.tour-btn-help {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    border: none;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, box-shadow 0.15s;
}
.tour-btn-help:hover {
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

/* ---- Email Log Rows ---- */
.email-log-row {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: background 0.1s;
}
.email-log-row:last-child { border-bottom: none; }
.email-log-row:hover { background: color-mix(in srgb, var(--color-primary), transparent 95%); }
.email-log-line1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}
.email-type-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}
.email-log-subject {
    font-size: 13px;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}
.email-log-meta { flex-shrink: 0; }
.email-log-line2 {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--color-muted);
}
.email-log-date { flex-shrink: 0; }

/* ---- Subscription Plan Cards ---- */
/* ---- Subscription: Usage stats ---- */
.sub-usage-section {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 24px 28px;
    margin-bottom: 24px;
}
.sub-usage-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.sub-usage-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 4px;
}
.sub-usage-plan-label {
    font-size: 13px;
    color: var(--color-muted);
    margin: 0;
}
.sub-usage-plan-label strong {
    color: var(--color-text);
}
.sub-usage-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}
.sub-usage-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sub-usage-header {
    display: flex;
    align-items: center;
    gap: 8px;
}
.sub-usage-icon {
    width: 18px;
    height: 18px;
    color: var(--color-primary);
    flex-shrink: 0;
}
.sub-usage-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}
.sub-usage-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    flex: 1;
}
.sub-usage-count {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    white-space: nowrap;
}
.sub-usage-bar-track {
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
}
.sub-usage-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}
.sub-usage-note {
    font-size: 11px;
    color: var(--color-muted);
}

.sub-page-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.sub-plan-card {
    background: var(--color-card);
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 28px 24px;
    position: relative;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.sub-plan-card:hover { border-color: var(--color-primary); }
.sub-plan-current {
    border-color: var(--color-primary);
    border-width: 2px;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-primary), transparent 75%),
                0 8px 24px rgba(67, 97, 238, 0.15);
    background: color-mix(in srgb, var(--color-primary), var(--color-card) 95%);
    transform: scale(1.03);
    z-index: 1;
}
.sub-plan-current .sub-plan-name {
    color: var(--color-primary);
}
.sub-plan-current .sub-plan-amount {
    color: var(--color-primary);
}
.sub-plan-featured { border-color: #805ad5; }
.sub-plan-featured:hover { border-color: #6b46c1; }
.sub-plan-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 4px 16px;
    border-radius: 12px;
    white-space: nowrap;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--color-primary), transparent 50%);
}
.sub-plan-badge-featured { background: #805ad5; }
.sub-plan-name { font-size: 20px; font-weight: 700; margin: 8px 0 4px; }
.sub-plan-desc { font-size: 13px; color: var(--color-muted); margin: 0 0 16px; }
.sub-plan-price { display: flex; align-items: baseline; gap: 2px; margin-bottom: 4px; }
.sub-plan-amount { font-size: 32px; font-weight: 800; color: var(--color-text); }
.sub-plan-period { font-size: 14px; color: var(--color-muted); }
.sub-plan-yearly { font-size: 12px; color: #059669; margin: 0 0 16px; font-weight: 600; }
.sub-plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    flex: 1;
}
.sub-plan-features li {
    font-size: 13px;
    padding: 5px 0;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
}
.sub-plan-features li::before { content: '\2713 '; color: #059669; font-weight: 700; margin-right: 6px; }
.sub-plan-features li.sub-feature-disabled { color: var(--color-muted); text-decoration: line-through; opacity: 0.5; }
.sub-plan-features li.sub-feature-disabled::before { content: '\2717 '; color: var(--color-muted); }
.sub-current-indicator {
    width: 100%;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    border-radius: 8px;
    background: color-mix(in srgb, var(--color-primary), transparent 88%);
    color: var(--color-primary);
    border: 2px solid color-mix(in srgb, var(--color-primary), transparent 70%);
    letter-spacing: 0.3px;
}
.sub-plan-action { margin-top: auto; padding-top: 8px; }
.sub-plan-action .btn {
    width: 100%;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 8px;
    letter-spacing: 0.3px;
}
.sub-plan-action .btn-primary {
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-border);
    box-shadow: none;
}
.sub-plan-action .btn-primary:hover {
    background: color-mix(in srgb, var(--color-primary), transparent 92%);
    border-color: var(--color-primary);
}
.sub-plan-featured .sub-plan-action .btn-primary {
    color: #805ad5;
    background: transparent;
    border: 1px solid var(--color-border);
    box-shadow: none;
}
.sub-plan-featured .sub-plan-action .btn-primary:hover {
    background: rgba(128, 90, 213, 0.08);
    border-color: #805ad5;
}

@media (max-width: 768px) {
    .sub-page-grid { grid-template-columns: 1fr; max-width: 400px; }
    .sub-usage-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .sub-usage-grid { grid-template-columns: 1fr; }
}

/* ---- Email Preview Modal ---- */
.email-preview-box {
    max-width: 700px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}
.email-preview-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    position: relative;
}
.email-preview-subject {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    padding-right: 60px;
    line-height: 1.3;
}
.email-preview-meta {
    padding: 12px 20px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}
.email-meta-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 3px 0;
    font-size: 13px;
}
.email-meta-label {
    font-weight: 700;
    color: var(--color-muted);
    min-width: 48px;
    text-align: right;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.email-meta-value {
    color: var(--color-text);
}
.email-preview-body {
    flex: 1;
    overflow: auto;
    padding: 0;
    background: #fff;
}
[data-theme="dark"] .email-preview-body {
    background: #1e293b;
}

/* ---- Email Templates Preview ---- */
.email-tpl-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}
.email-tpl-tab {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--color-muted);
    background: transparent;
    border: 1px solid transparent;
    transition: all 0.15s;
}
.email-tpl-tab:hover { color: var(--color-text); background: var(--color-card); }
.email-tpl-tab.active {
    color: var(--color-primary);
    background: var(--color-card);
    border-color: var(--color-primary);
}
.email-tpl-view-toggle {
    display: flex;
    gap: 4px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--color-border);
}
.email-tpl-view-btn {
    color: #334155 !important;
}
.email-tpl-view-btn:hover:not(.active) {
    background: #e2e8f0 !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
}
[data-theme="dark"] .email-tpl-view-btn {
    color: #e2e8f0 !important;
}
[data-theme="dark"] .email-tpl-view-btn:hover:not(.active) {
    background: #334155 !important;
    border-color: #64748b !important;
    color: #e2e8f0 !important;
}
.email-tpl-view-btn.active {
    background: var(--color-primary) !important;
    color: #fff !important;
    border-color: var(--color-primary);
}
.email-tpl-subject {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--color-muted);
    border-bottom: 1px solid var(--color-border);
}
.email-tpl-subject strong { color: var(--color-text); }
.email-tpl-frame-wrap {
    padding: 0;
}

.audit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.audit-action {
    font-weight: 600;
    text-transform: capitalize;
    color: var(--color-text);
    font-size: 12px;
}
.audit-meta {
    font-size: 11px;
    color: var(--color-muted);
    white-space: nowrap;
}
.audit-changes {
    margin-top: 4px;
    font-size: 12px;
    color: var(--color-muted);
}
.audit-field {
    font-weight: 600;
    color: var(--color-text);
}

/* Orders summary bar */
.orders-summary-bar {
    padding: 14px 16px;
    background: var(--color-bg);
    border-radius: 10px;
    margin: 0 0 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid var(--color-border);
}
.orders-summary-invoices {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.invoice-summary-group {
    flex: 1;
    min-width: 200px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.invoice-summary-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.invoice-summary-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.invoice-summary-pills .badge {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 6px;
    white-space: nowrap;
    font-weight: 600;
}
a.inv-summary-link {
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
}
a.inv-summary-link:hover {
    opacity: 0.85;
    transform: scale(1.05);
}

/* Bulk action bar */
.bulk-action-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #eff6ff;
    border: 1px solid #93c5fd;
    border-radius: 8px;
    margin: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #1e40af;
}
.bulk-action-bar select {
    padding: 5px 10px;
    border: 1px solid #93c5fd;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
}

/* Order Comments */
.order-comments-thread {
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 0;
}
.comment-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
}
.comment-bubble.outgoing {
    align-self: flex-end;
    background: var(--color-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.comment-bubble.incoming {
    align-self: flex-start;
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-bottom-left-radius: 4px;
}
.comment-meta {
    font-size: 10px;
    margin-top: 4px;
}
.comment-bubble.outgoing .comment-meta { color: rgba(255,255,255,0.6); }
.comment-bubble.incoming .comment-meta { color: var(--color-muted); }
.comment-author {
    font-weight: 700;
    font-size: 11px;
    margin-bottom: 3px;
    letter-spacing: 0.2px;
}
.comment-bubble.incoming .comment-author { color: var(--color-text); }
.comment-bubble.outgoing .comment-author { color: rgba(255,255,255,0.85); }
.comment-empty {
    text-align: center;
    color: var(--color-muted);
    font-size: 13px;
    padding: 20px 0;
}
.comment-role-tag {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 4px;
}
.comment-bubble.incoming .comment-role-tag {
    background: rgba(0,0,0,0.08);
    color: var(--color-muted);
}
.comment-bubble.outgoing .comment-role-tag {
    background: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.8);
}

/* Comment Attachments */
.comment-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.comment-attach-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.2);
    cursor: pointer;
}
.comment-bubble.incoming .comment-attach-thumb {
    border-color: var(--color-border);
}
.comment-attach-file {
    display: inline-block;
    padding: 4px 8px;
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
    font-size: 11px;
    color: inherit;
    text-decoration: none;
}
.comment-bubble.incoming .comment-attach-file {
    background: var(--color-bg);
    color: var(--color-primary);
}
.comment-attach-btn {
    cursor: pointer;
    font-size: 16px !important;
    padding: 4px 8px !important;
    line-height: 1;
}
.comment-file-status {
    font-size: 11px;
    color: var(--color-muted);
    margin-right: auto;
}

/* Comment Attachment Gallery */
.comment-attachments-gallery {
    margin-top: 16px;
    padding: 12px;
    background: var(--color-bg);
    border-radius: 8px;
    border: 1px solid var(--color-border);
}
.comment-gallery-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}
.comment-gallery-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border);
}
.comment-gallery-item:last-child {
    border-bottom: none;
}
.comment-gallery-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--color-border);
    cursor: pointer;
}
.comment-gallery-file-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-card);
    border-radius: 4px;
    border: 1px solid var(--color-border);
    font-size: 10px;
    font-weight: 700;
    color: var(--color-muted);
}
.comment-gallery-info {
    flex: 1;
    min-width: 0;
}
.comment-gallery-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.comment-gallery-name:hover { text-decoration: underline; }
.comment-gallery-meta {
    font-size: 11px;
    color: var(--color-muted);
    margin-top: 2px;
}

/* Proof Review Workflow */
.proof-file-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--color-bg);
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--color-border);
    transition: border-color 0.15s;
}
.proof-file-card.status-approved { border-left: 3px solid #22c55e; }
.proof-file-card.status-revision_requested { border-left: 3px solid #f59e0b; }
.proof-file-card.status-pending_review { border-left: 3px solid var(--color-primary); }
.proof-file-info { flex: 1; min-width: 0; }
.proof-file-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--color-primary);
    text-decoration: none;
}
.proof-file-name:hover { text-decoration: underline; }
.proof-file-meta { font-size: 11px; color: var(--color-muted); margin-top: 4px; }
.proof-status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
    white-space: nowrap;
}
.proof-status-badge.pending { background: #dbeafe; color: #1e40af; }
.proof-status-badge.approved { background: #dcfce7; color: #166534; }
.proof-status-badge.revision { background: #fef3c7; color: #92400e; }
.proof-file-actions { display: flex; gap: 6px; flex-shrink: 0; }
.proof-feedback-thread {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}
.proof-feedback-item {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    border-left: 3px solid transparent;
}
.proof-feedback-item.action-approve { background: var(--color-bg); border-left-color: #22c55e; }
.proof-feedback-item.action-request_revision { background: var(--color-bg); border-left-color: #f59e0b; }
.proof-feedback-item.action-comment { background: var(--color-bg); border-left-color: var(--color-muted); }
.proof-feedback-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.proof-feedback-author { font-weight: 600; font-size: 12px; }
.proof-feedback-time { font-size: 11px; color: var(--color-muted); }
.proof-feedback-action-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 6px;
}

/* Tracking timeline */
.tracking-event {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    position: relative;
}
.tracking-event:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 22px;
    bottom: -8px;
    width: 2px;
    background: #e2e8f0;
}
.tracking-event.latest .tracking-event-desc { font-weight: 600; }
.tracking-event-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}
.tracking-event-content { flex: 1; min-width: 0; }
.tracking-event-desc {
    font-size: 13px;
    color: var(--color-text);
}
.tracking-event-meta {
    font-size: 12px;
    color: var(--color-muted);
    margin-top: 2px;
}

/* ---- File Preview & Lightbox ---- */
.file-thumbnail {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
}
.file-thumbnail:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.file-thumbnail-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--color-muted);
    flex-shrink: 0;
    cursor: pointer;
}
.file-thumbnail-placeholder:hover {
    background: var(--color-card);
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.85);
}
.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    z-index: 1;
}
.lightbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(0,0,0,0.6);
    border-radius: 10px 10px 0 0;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}
.lightbox-header .btn { color: #fff; border-color: rgba(255,255,255,0.3); }
.lightbox-header .btn:hover { background: rgba(255,255,255,0.1); }
.lightbox-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.lightbox-close:hover { background: #dc2626; }
.lightbox-body {
    background: var(--color-card);
    border-radius: 0 0 10px 10px;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}
.lightbox-body img {
    max-width: 100%;
    max-height: 80vh;
    display: block;
}
.lightbox-body iframe {
    width: 80vw;
    height: 80vh;
    border: none;
}
.lightbox-body .lightbox-unsupported {
    padding: 40px;
    text-align: center;
    color: var(--color-muted);
}

.btn-full { width: 100%; justify-content: center; }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }

.form-group label {
    display:     block;
    font-size:   13px;
    font-weight: 600;
    color:       var(--color-text);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width:         100%;
    padding:       9px 12px;
    border:        1px solid var(--color-border);
    border-radius: var(--radius);
    font-size:     14px;
    font-family:   var(--font);
    color:         var(--color-text);
    background:    var(--color-card);
    transition:    border-color 0.15s, box-shadow 0.15s;
    outline:       none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--color-primary);
    box-shadow:   0 0 0 3px rgba(67,97,238,0.12);
}

.optional { font-weight: 400; color: var(--color-muted); }

.checkbox-label {
    display:     flex;
    align-items: center;
    gap:         8px;
    font-size:   14px;
    font-weight: 500;
    cursor:      pointer;
}
.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.filter-bar select,
.filter-bar .filter-input {
    padding:       7px 12px;
    border:        1px solid var(--color-border);
    border-radius: var(--radius);
    font-size:     13px;
    background:    var(--color-card);
    color:         var(--color-text);
}
.filter-bar select {
    cursor:        pointer;
    outline:       none;
    -webkit-appearance: none;
    appearance: none;
    color: #2d3748 !important;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23718096' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}
[data-theme="dark"] .filter-bar select {
    color: #e2e8f0 !important;
    background-color: #1e293b;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}
.filter-bar select.filter-active,
.filter-bar .filter-input.filter-active {
    border-color: var(--color-primary);
    background:   var(--color-bg);
    box-shadow:   0 0 0 2px rgba(129, 140, 248, 0.15);
}

/* ---- Error Message ---- */
.error-msg {
    background:    #fff5f5;
    color:         var(--color-danger);
    border:        1px solid #feb2b2;
    border-radius: var(--radius);
    padding:       10px 14px;
    font-size:     13px;
    margin-bottom: 14px;
}

.success-msg {
    background:    #f0fff4;
    color:         #276749;
    border:        1px solid #9ae6b4;
    border-radius: var(--radius);
    padding:       10px 14px;
    font-size:     13px;
    margin-bottom: 14px;
}

.hidden { display: none !important; }
.non-customer { display: none; }
.ppd-only { display: none; }
.admin-only { display: none; }
.user-admin-only { display: none; }
.show-ppd-col { display: none; }

/* =============================================
   Login Page — Split panel layout
   ============================================= */
.login-page {
    display:    flex;
    flex-direction: column;
    min-height: 100vh;
    background: #0d1126;
}

/* Login top nav bar */
.login-top-nav {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
}
.login-top-nav a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 6px;
    transition: all 0.15s;
}
.login-top-nav a:hover {
    color: #fff;
    background: rgba(255,255,255,0.06);
}
.login-top-nav .login-nav-btn {
    background: rgba(255,255,255,0.08);
    color: #e2e8f0;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.12);
}
.login-top-nav .login-nav-btn:hover {
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.25);
    color: #fff;
}

/* Light background variant for contact/demo pages */
.login-top-nav-light a {
    color: #4a5568;
}
.login-top-nav-light a:hover {
    color: #1a202c;
    background: rgba(0,0,0,0.04);
}
.login-top-nav-light .login-nav-btn {
    background: #4361ee;
    color: #fff;
    border-color: #4361ee;
}
.login-top-nav-light .login-nav-btn:hover {
    background: #3451d1;
    border-color: #3451d1;
    color: #fff;
}

/* View Pricing button — dark bg */
.login-top-nav .login-nav-pricing {
    background: rgba(255,255,255,0.06);
    color: #e2e8f0;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.1);
}
.login-top-nav .login-nav-pricing:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.2);
    color: #fff;
}
/* View Pricing button — light bg */
.login-top-nav-light .login-nav-pricing {
    background: rgba(0,0,0,0.03);
    color: #4a5568;
    font-weight: 600;
    border: 1px solid var(--color-border);
}
.login-top-nav-light .login-nav-pricing:hover {
    background: rgba(0,0,0,0.06);
    border-color: #a0aec0;
    color: #1a202c;
}

/* Signup button (green) — dark bg */
.login-top-nav .login-nav-signup {
    background: #38a169;
    color: #fff;
    font-weight: 600;
    border: 1px solid #38a169;
}
.login-top-nav .login-nav-signup:hover {
    background: #2f855a;
    border-color: #2f855a;
    color: #fff;
}
/* Signup button — light bg */
.login-top-nav-light .login-nav-signup {
    background: #38a169;
    color: #fff;
    border-color: #38a169;
}
.login-top-nav-light .login-nav-signup:hover {
    background: #2f855a;
    border-color: #2f855a;
    color: #fff;
}

.login-split {
    display: flex;
    width:   100%;
    min-height: 100vh;
}

/* ---- Left: Brand / marketing panel ---- */
.login-brand {
    flex:       1 1 50%;
    background: linear-gradient(150deg, #1a1f36 0%, #0d1126 60%, #111827 100%);
    display:    flex;
    align-items: center;
    justify-content: center;
    padding:    60px 56px;
    position:   relative;
    overflow:   hidden;
}

.login-glow {
    position:      absolute;
    border-radius: 50%;
    pointer-events: none;
}
.login-glow-1 {
    width:      700px;
    height:     700px;
    background: radial-gradient(circle, rgba(67,97,238,0.18) 0%, transparent 65%);
    top:        -200px;
    right:      -200px;
}
.login-glow-2 {
    width:      400px;
    height:     400px;
    background: radial-gradient(circle, rgba(124,58,237,0.12) 0%, transparent 65%);
    bottom:     -100px;
    left:       -100px;
}

.login-brand-inner {
    position:   relative;
    z-index:    1;
    max-width:  480px;
    width:      100%;
}

.login-brand-logo {
    display:     flex;
    align-items: center;
    gap:         12px;
    margin-bottom: 52px;
}
.login-brand-mark {
    width:         44px;
    height:        44px;
    border-radius: 10px;
    flex-shrink:   0;
    display:       block;
}
.login-brand-logo span {
    font-size:   18px;
    font-weight: 800;
    color:       #fff;
    letter-spacing: -0.3px;
}

.login-brand-hero {
    margin-bottom: 44px;
}
.login-headline {
    font-size:      clamp(36px, 4.5vw, 52px);
    font-weight:    900;
    line-height:    1.08;
    letter-spacing: -1.5px;
    white-space:    nowrap;
    color:          #fff;
    margin:         0 0 20px;
}
.login-subhead {
    font-size:   16px;
    line-height: 1.65;
    color:       #8892b0;
    margin:      0;
    max-width:   400px;
}

/* Feature list */
.login-features {
    list-style:    none;
    padding:       0;
    margin:        0 0 48px;
    display:       flex;
    flex-direction: column;
    gap:           20px;
}
.login-feature {
    display:     flex;
    align-items: flex-start;
    gap:         16px;
}
.login-feature-icon {
    width:           36px;
    height:          36px;
    border-radius:   8px;
    background:      rgba(67,97,238,0.18);
    border:          1px solid rgba(67,97,238,0.3);
    display:         flex;
    align-items:     center;
    justify-content: center;
    flex-shrink:     0;
    color:           #7b9ef7;
    margin-top:      1px;
}
.login-feature-icon svg {
    width:  18px;
    height: 18px;
}
.login-feature div strong {
    display:     block;
    font-size:   14px;
    font-weight: 700;
    color:       #e2e8f0;
    margin-bottom: 2px;
}
.login-feature div span {
    font-size:   13px;
    line-height: 1.5;
    color:       #6b7a99;
}

/* Bottom divider & tagline */
.login-divider {
    height:       1px;
    background:   rgba(255,255,255,0.07);
    margin-bottom: 16px;
}
.login-tagline {
    font-size:      12px;
    color:          #4a5568;
    letter-spacing: 0.3px;
    margin:         0;
}

/* ---- Trusted logos ---- */
.login-trusted { margin-top: 24px; }
.login-trusted-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #718096;
    margin-bottom: 12px;
}
.login-logos {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.login-logo-pill {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #a0aec0;
    letter-spacing: 0.3px;
}

/* ---- Testimonial ---- */
.login-testimonial {
    margin-top: 24px;
    padding: 20px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
}
.login-quote {
    font-size: 14px;
    line-height: 1.6;
    color: #cbd5e0;
    font-style: italic;
    margin: 0 0 12px;
    quotes: none;
}
.login-quote-author {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.login-quote-author strong {
    font-size: 13px;
    color: #e2e8f0;
}
.login-quote-author span {
    font-size: 11px;
    color: #718096;
}

/* ---- Demo CTA ---- */
.login-cta {
    margin-top: 24px;
}
.login-cta-text {
    font-size: 14px;
    color: #a0aec0;
    margin-bottom: 12px;
}
.login-cta-btn {
    display: inline-block;
    padding: 14px 40px;
    background: #4361ee;
    border: 2px solid #4361ee;
    border-radius: 10px;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    letter-spacing: 0.2px;
    box-shadow: 0 4px 14px rgba(67, 97, 238, 0.4);
}
.login-cta-inline {
    margin-top: 24px;
}

/* Testimonial on right (light) panel */
.login-testimonial-right {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    color: #4a5568;
    margin-top: 24px;
    max-width: 420px;
}
.login-testimonial-right .login-quote {
    color: #4a5568;
}
.login-testimonial-right .login-quote-author strong {
    color: #1a202c;
}
.login-testimonial-right .login-quote-author span {
    color: #718096;
}
.login-cta-btn:hover {
    background: #3451d1;
    border-color: #3451d1;
    color: #fff;
    box-shadow: 0 6px 20px rgba(67, 97, 238, 0.5);
    transform: translateY(-1px);
}

/* ---- Contact cards ---- */
.contact-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}
.contact-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}
a.contact-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.1);
    transform: translateY(-1px);
}
a.contact-card:hover .contact-card-icon {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
a.contact-card:hover .contact-card-arrow {
    color: var(--color-primary);
    transform: translateX(2px);
}
.contact-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(67, 97, 238, 0.08);
    border: 1px solid rgba(67, 97, 238, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--color-primary);
    transition: all 0.2s ease;
}
.contact-card-icon svg {
    width: 18px;
    height: 18px;
}
.contact-card-body {
    flex: 1;
    min-width: 0;
}
.contact-card-body strong {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 2px;
}
.contact-card-body span {
    font-size: 13px;
    color: var(--color-muted);
    line-height: 1.4;
}
.contact-card-arrow {
    color: var(--color-muted);
    flex-shrink: 0;
    transition: all 0.2s ease;
}
.contact-card-static {
    cursor: default;
}

/* ---- Right: Form panel ---- */
.login-form-panel {
    flex:            1 1 50%;
    background:      var(--color-bg);
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    justify-content: center;
    padding:         40px;
}

.login-card {
    background:    var(--color-card);
    border-radius: 12px;
    box-shadow:    var(--shadow-md);
    padding:       40px;
    width:         100%;
    max-width:     380px;
}

.login-logo {
    text-align:    center;
    margin-bottom: 28px;
}
.login-logo h2 {
    font-size:   22px;
    font-weight: 800;
    color:       var(--color-text);
    margin:      0 0 6px;
}
.login-logo p {
    font-size:  13px;
    color:      var(--color-muted);
    margin:     0;
}

/* ---- Account split layout ---- */
.account-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 768px) {
    .account-split { grid-template-columns: 1fr; }
}

/* ---- Email Preferences ---- */
.email-pref-master {
    padding: 12px 16px;
    background: color-mix(in srgb, var(--color-primary), var(--color-card) 92%);
    border: 1px solid color-mix(in srgb, var(--color-primary), transparent 75%);
    border-radius: 8px;
}
.email-pref-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.email-pref-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s;
}
.email-pref-toggle:hover {
    background: var(--color-bg);
}
.email-pref-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: var(--color-primary);
    cursor: pointer;
}
.email-pref-toggle input[type="checkbox"]:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.email-pref-label {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.email-pref-label strong {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}
.email-pref-label span {
    font-size: 12px;
    color: var(--color-muted);
}

/* ---- Mobile: stack vertically ---- */
@media (max-width: 768px) {
    .login-split {
        flex-direction: column;
    }
    .login-brand {
        padding:    40px 28px 36px;
        min-height: auto;
    }
    .login-headline {
        font-size: 32px;
    }
    .login-features {
        display: none;
    }
    .login-brand-footer,
    .login-trusted,
    .login-testimonial,
    .login-cta {
        display: none;
    }
    .login-form-panel {
        width:   100%;
        padding: 28px 20px 40px;
    }
    .login-card {
        box-shadow: none;
        padding:    28px 20px;
    }
}

/* ---- Modal ---- */
.modal {
    position: fixed;
    inset:    0;
    z-index:  1000;
    display:  flex;
    align-items: center;
    justify-content: center;
}
#confirmDialog,
#renameDialog {
    z-index: 1100;
}

.modal-overlay {
    position:   absolute;
    inset:      0;
    background: rgba(0,0,0,0.45);
}

.modal-box {
    position:      relative;
    background:    var(--color-card);
    border-radius: 12px;
    padding:       28px;
    width:         100%;
    max-width:     440px;
    max-height:    90vh;
    overflow-y:    auto;
    box-shadow:    var(--shadow-md);
    z-index:       1;
}

.modal-box h2 { font-size: 18px; font-weight: 700; margin-bottom: 20px; }

.modal-actions-top {
    display:         flex;
    justify-content: flex-end;
    gap:             10px;
    margin-bottom:   16px;
    padding-bottom:  12px;
    border-bottom:   1px solid var(--color-border);
}

.modal-actions {
    display:         flex;
    justify-content: flex-end;
    gap:             10px;
    margin-top:      20px;
}

/* ---- Detail Layout ---- */
.detail-grid {
    display:               grid;
    grid-template-columns: 1fr 1fr;
    gap:                   20px;
}

.detail-card, .timeline-card { padding: 24px; }

.detail-card h3, .timeline-card h3 {
    font-size:     15px;
    font-weight:   700;
    margin-bottom: 16px;
    color:         var(--color-text);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border);
}

.detail-row {
    display:       flex;
    align-items:   baseline;
    gap:           12px;
    padding:       8px 0;
    font-size:     13.5px;
    border-bottom: 1px solid var(--color-border);
}
.detail-row:last-child { border-bottom: none; }

.detail-label {
    font-weight:    600;
    color:          var(--color-muted);
    min-width:      140px;
    flex-shrink:    0;
    font-size:      12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.detail-row span:last-child {
    color: var(--color-text);
    font-weight: 500;
}

/* Form — grouped sections */
.form-section {
    margin-bottom: 20px;
    padding-bottom: 4px;
}
.form-section:last-of-type { margin-bottom: 12px; }
.form-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-muted);
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 2px solid var(--color-primary);
}

/* Order detail — grouped sections */
.order-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 768px) {
    .order-detail-grid { grid-template-columns: 1fr; }
}

.detail-section {
    padding: 0;
}
.detail-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-muted);
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 2px solid var(--color-primary);
}

.detail-section .detail-row {
    padding: 6px 0;
    border-bottom: 1px solid color-mix(in srgb, var(--color-border), transparent 50%);
}
.detail-section .detail-row:last-child { border-bottom: none; }

.detail-section .detail-label {
    min-width: 120px;
    font-size: 11px;
}

.order-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: color-mix(in srgb, var(--color-primary), transparent 92%);
    border-radius: 8px;
    margin-bottom: 16px;
}
.order-hero-number {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
}
.order-hero-status { margin-left: auto; }
.order-hero-total {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary);
}
.order-hero-item {
    text-align: center;
    line-height: 1.3;
}
.order-hero-item-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-muted);
    font-weight: 600;
}
.order-hero-item-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

/* Modal detail improvements */
.modal-box h2 {
    font-size:     18px;
    font-weight:   700;
    color:         var(--color-text);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 16px;
}
.modal-box h3 {
    font-size:     14px;
    font-weight:   700;
    color:         var(--color-text);
}
.modal-actions {
    padding-top: 16px;
    border-top:  1px solid var(--color-border);
    margin-top:  16px;
}

/* ---- Tabs ---- */
.tab-bar {
    display: flex;
    border-bottom: 2px solid var(--color-border);
    background: var(--color-card);
    overflow: visible;
    flex-shrink: 0;
}
.tab-btn {
    padding: 12px 20px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-muted);
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    transition: color 0.15s;
}
.tab-btn:hover { color: var(--color-text); }
.tab-btn.active {
    color: var(--color-primary);
}
.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--color-primary);
}
.tab-count-pill {
    font-size: 10px;
    font-weight: 700;
    background: var(--color-muted);
    color: #fff;
    border-radius: 8px;
    padding: 1px 6px;
    margin-left: 4px;
}
.tab-count-pill:empty { display: none; }
.tab-badge {
    display: inline-block;
    margin-left: 8px;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    vertical-align: middle;
    font-weight: 600;
}
.tab-content {
    position: relative;
    max-height: 600px;
    overflow-y: auto;
    overflow-x: auto;
}
.tab-pane {
    display: none;
    padding: 16px 20px;
}
.tab-pane.active { display: block; }

/* ---- Detail Sections (order detail subsections) ---- */
.detail-section {
    padding: 0 !important;
    overflow: hidden;
}
.detail-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}
.detail-section-header h3 {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-muted);
}
.detail-section-body {
    padding: 16px 20px;
}
.detail-section-body:empty::after {
    content: 'No data available.';
    display: block;
    color: var(--color-muted);
    font-size: 13px;
    text-align: center;
    padding: 12px 0;
}
.detail-section-count {
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 6px;
}

/* Comment compose area */
.comment-compose {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}
.comment-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 13px;
    font-family: var(--font);
    resize: vertical;
    background: var(--color-card);
    color: var(--color-text);
    transition: border-color 0.15s;
}
.comment-textarea:focus {
    border-color: var(--color-primary);
    outline: none;
}
.comment-textarea::placeholder {
    color: var(--color-placeholder);
}
.comment-compose-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

/* Detail value emphasis */
.detail-value-lg {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
}

/* ---- Timeline ---- */
.timeline { list-style: none; padding: 0; position: relative; }

.timeline-item {
    display:     flex;
    gap:         14px;
    padding-bottom: 20px;
    position:    relative;
}

.timeline-item::before {
    content:     '';
    position:    absolute;
    left:        11px;
    top:         22px;
    bottom:      0;
    width:       2px;
    background:  var(--color-border);
}

.timeline-item:last-child::before { display: none; }

.timeline-dot {
    width:         10px;
    height:        10px;
    border-radius: 50%;
    background:    var(--color-primary);
    flex-shrink:   0;
    margin-top:    5px;
}

.timeline-dot-inner { display: none; }

.timeline-content { flex: 1; }

.timeline-status {
    font-weight: 600;
    font-size:   13px;
    color:       var(--color-text);
}

.timeline-date {
    font-size: 12px;
    color:     var(--color-muted);
    margin-top: 2px;
}
.timeline-changed-by {
    font-size: 12px;
    color:     var(--color-muted);
}

.timeline-notes {
    font-size:     13px;
    color:         var(--color-text);
    margin-top:    6px;
    padding:       8px 12px;
    background:    var(--color-bg);
    border-radius: 6px;
    border-left:   3px solid var(--color-primary);
}

/* ---- Mobile Top Bar (hidden on desktop) ---- */
.mobile-topbar {
    display:     none;
    align-items: center;
    gap:         12px;
    position:    fixed;
    top:         0;
    left:        0;
    right:       0;
    height:      56px;
    background:  var(--color-sidebar);
    padding:     0 16px;
    z-index:     150;
    box-shadow:  0 1px 4px rgba(0,0,0,0.2);
}
.mobile-search-toggle {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
}
.mobile-search-toggle:hover { background: rgba(255,255,255,0.1); }
.mobile-topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}
.mobile-topbar-btn {
    position: relative;
    padding: 4px 8px;
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 12px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}
.mobile-btn-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    line-height: 1;
}
.mobile-topbar-btn .notif-counter {
    font-size: 11px;
    min-width: 20px;
    text-align: center;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 700;
    background: var(--color-primary);
    color: #fff;
}
.mobile-topbar-btn .notif-counter.zero {
    background: rgba(255,255,255,0.15);
    color: #94a3b8;
}
.mobile-search-drawer {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--color-sidebar);
    padding: 8px 16px 12px;
    z-index: 149;
    gap: 6px;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.mobile-search-drawer:not(.hidden) { display: flex; }
.mobile-search-drawer input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
    color: #e2e8f0;
    font-size: 13px;
    outline: none;
}
.mobile-search-drawer input[type="text"]::placeholder { color: var(--color-placeholder); }
.mobile-search-drawer input[type="text"]:focus {
    border-color: rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.12);
}
.mobile-search-drawer .global-search-results {
    position: relative;
    top: 0;
    width: 100%;
    max-height: 60vh;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.mobile-brand {
    display:     flex;
    align-items: center;
    gap:         8px;
}
.mobile-brand-logo {
    width:         32px;
    height:        32px;
    border-radius: 7px;
    display:       block;
    flex-shrink:   0;
}
.mobile-brand-name {
    color:          #fff;
    font-size:      15px;
    font-weight:    800;
    letter-spacing: -0.2px;
    white-space:    nowrap;
}

/* ---- Hamburger Button ---- */
.hamburger {
    display:        flex;
    flex-direction: column;
    justify-content: center;
    gap:            5px;
    width:          36px;
    height:         36px;
    padding:        6px;
    background:     transparent;
    border:         none;
    cursor:         pointer;
    border-radius:  var(--radius);
    flex-shrink:    0;
}

.hamburger span {
    display:    block;
    width:      100%;
    height:     2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---- Sidebar Overlay (mobile) ---- */
.sidebar-overlay {
    position:   fixed;
    inset:      0;
    background: rgba(0,0,0,0.5);
    z-index:    190;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    /* Layout */
    body:not(.login-page) {
        display:        block;
        padding-top:    56px; /* room for topbar */
    }

    .mobile-topbar { display: flex; }

    /* Hide desktop top nav on mobile */
    .top-nav { display: none; }

    /* Sidebar becomes a fixed drawer */
    .sidebar {
        position:   fixed;
        top:        0;
        left:       0;
        height:     100vh;
        z-index:    200;
        transform:  translateX(-100%);
        transition: transform 0.25s ease;
        width:      var(--sidebar-width);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Main content — no top-nav offset on mobile */
    .main-content {
        padding:     16px;
        padding-top: 16px !important;
        min-height:  calc(100vh - 56px);
    }

    /* Page header */
    .page-header {
        gap: 8px;
        margin-bottom: 12px;
    }

    .header-title-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .page-header h1 { font-size: 18px; }

    .header-buttons {
        flex-wrap: wrap;
        gap: 6px;
    }

    .header-filter-row {
        gap: 6px;
    }

    .filter-bar {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
    }
    .filter-bar select,
    .filter-bar .filter-input {
        width: 100%;
    }

    /* Stat cards: 2 columns on mobile */
    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-bottom: 12px;
    }

    .stat-card { padding: 12px; }
    .stat-card .stat-value { font-size: 20px; }
    .stat-card .stat-label { font-size: 11px; }

    /* Dashboard grid: single column on mobile */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .dashboard-grid .chart-card[style*="grid-column"] {
        grid-column: auto !important;
    }

    /* Detail grid: single column */
    .detail-grid { grid-template-columns: 1fr; }

    /* Tables: enable horizontal scroll */
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .data-table {
        min-width: 600px;
    }
    .data-table th,
    .data-table td {
        padding: 8px 10px;
        font-size: 12px;
    }

    /* Order progress tracker: compact */
    .order-progress-tracker {
        gap: 2px;
    }
    .progress-step .step-dot {
        width: 22px;
        height: 22px;
        font-size: 10px;
    }
    .progress-step .step-label {
        font-size: 8px;
    }
    .progress-step .step-date {
        font-size: 8px;
    }
    .progress-connector {
        margin-top: 11px;
    }

    /* Comments: full width bubbles */
    .comment-bubble {
        max-width: 95%;
    }

    /* Proof file cards: stack */
    .proof-file-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .proof-file-actions {
        width: 100%;
    }
    .proof-file-actions .btn {
        flex: 1;
    }

    /* Bulk action bar */
    .bulk-action-bar {
        flex-wrap: wrap;
        font-size: 12px;
        padding: 8px 12px;
    }

    /* Pagination: stack on very small */
    .pagination-bar {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }

    /* Modals: full-width with margin, scrollable */
    .modal { align-items: flex-end; }

    .modal-box {
        max-width:     100% !important;
        width:         100%;
        border-radius: 16px 16px 0 0;
        padding:       20px 16px;
        max-height:    90vh;
        overflow-y:    auto;
    }

    /* Card */
    .card { padding: 16px; }

    /* Card header stacking */
    .card-header {
        flex-wrap: wrap;
        gap:       10px;
    }

    /* Login card */
    .login-card { padding: 28px 20px; }

    /* Customer pipeline: wrap 2 per row */
    .customer-pipeline {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    .pipeline-stage {
        min-width: 0;
        padding: 8px;
    }
    .pipeline-stage .stage-count { font-size: 20px; }
    .pipeline-stage .stage-label { font-size: 9px; }

    /* Invoice summary: stack */
    .orders-summary-invoices {
        flex-direction: column;
        gap: 8px;
    }
    .invoice-summary-group {
        gap: 4px;
    }

    /* Notification bar in top area */
    .notification-bar { padding: 4px 12px 0; }
}

/* Small phones */
@media (max-width: 480px) {
    .stat-cards {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .filter-bar {
        flex: 1 1 100%;
    }

    .customer-pipeline {
        grid-template-columns: repeat(2, 1fr);
    }

    .page-header h1 { font-size: 16px; }
}

/* =============================================================
   Google Places Autocomplete
   ============================================================= */
.pac-container {
    z-index: 10000 !important;
    font-family: var(--font-sans);
    border-radius: 8px;
    border: 1px solid var(--color-border);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    margin-top: 4px;
}
.pac-item {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    border-top: 1px solid var(--color-border);
}
.pac-item:first-child { border-top: none; }
.pac-item:hover,
.pac-item-selected { background: var(--color-primary-light); }
.pac-icon { display: none; }
.pac-item-query { font-weight: 600; color: var(--color-text); }
.pac-matched { font-weight: 700; }
