﻿  :root {
    /* ── Sidebar ── */
    --sidebar-bg: #ffffff;
    --sidebar-border: #e8e8e8;
    --sidebar-text: #78716c;
    --sidebar-text-active: #ffffff;
    --sidebar-hover: #f0f0f0;
    --sidebar-active-bg: #f97316;
    --sidebar-active: #f97316;
    --sidebar-child-bg: transparent;
    /* ── Topbar ── */
    --topbar-bg: #ffffff;
    --topbar-border: #e8e8e8;
    /* ── Content ── */
    --main-bg: #f5f5f5;
    --card-bg: #ffffff;
    --border: #e8e8e8;
    --border-strong: #d0d0d0;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --bg-secondary: #f0f0f0;
    /* ── Accent ── */
    --primary: #f97316;
    --primary-light: #fff4ed;
    --primary-hover: #ea580c;
    /* ── Status ── */
    --success: #16a34a;
    --success-bg: #dcfce7;
    --warning: #d97706;
    --warning-bg: #fef3c7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --info: #2563eb;
    --info-bg: #dbeafe;
    /* ── Elevation ── */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.05);
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f5f5f5;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
  }
  .app {
    display: grid;
    grid-template-columns: 240px 1fr;
    grid-template-rows: 56px 1fr;
    height: 100vh;
    overflow: hidden;
  }

  /* SIDEBAR */
  .sidebar {
    grid-row: 1 / span 2;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border-right: 1px solid var(--sidebar-border);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }
  .sidebar-logo {
    height: 56px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 16px;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
    letter-spacing: -0.2px;
  }
  .logo-mark {
    width: 28px; height: 28px;
    background: var(--primary);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 800;
    font-size: 13px;
    flex-shrink: 0;
  }
  /* Sidebar user card */
  .sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin: 10px 8px 4px;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    transition: background 0.12s, border-color 0.12s;
    flex-shrink: 0;
  }
  .sidebar-user-card:hover { background: var(--primary-light); border-color: var(--primary); }
  .sidebar-user-info { flex: 1; min-width: 0; }
  .sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .sidebar-user-role {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
    text-transform: capitalize;
  }
  .sidebar-user-chevron { color: var(--text-muted); flex-shrink: 0; }
  .sidebar-section {
    padding: 14px 16px 5px;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    font-weight: 700;
  }
  .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin: 1px 8px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--sidebar-text);
    font-size: 13.5px;
    font-weight: 500;
    transition: background 0.12s, color 0.12s;
    user-select: none;
    position: relative;
  }
  .nav-item:hover { background: var(--sidebar-hover); color: var(--text-primary); }
  .nav-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-text-active); font-weight: 600; }
  .nav-item.active .badge { background: rgba(255,255,255,0.25); color: #ffffff; }
  .nav-item .icon { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.7; transition: opacity 0.12s; }
  .nav-item:hover .icon, .nav-item.active .icon { opacity: 1; }
  .nav-item .badge {
    margin-left: auto;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 700;
  }
  .nav-item .chevron {
    margin-left: auto;
    width: 14px; height: 14px;
    transition: transform 0.2s;
    opacity: 0.4;
    flex-shrink: 0;
  }
  .nav-group.expanded > .nav-item .chevron { transform: rotate(90deg); }
  .nav-group.expanded > .nav-item { color: var(--text-primary); }
  .nav-children {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .nav-group.expanded .nav-children { max-height: 400px; }
  .nav-child {
    padding: 7px 12px 7px 40px;
    margin: 0 8px;
    border-radius: 7px;
    font-size: 13px;
    color: var(--sidebar-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
    transition: background 0.12s, color 0.12s;
  }
  .nav-child::before {
    content: '';
    width: 5px; height: 5px;
    background: var(--border-strong);
    border-radius: 50%;
    flex-shrink: 0;
    transition: background 0.12s;
  }
  .nav-child:hover { background: var(--sidebar-hover); color: var(--text-primary); }
  .nav-child:hover::before { background: var(--text-muted); }
  .nav-child.active { background: var(--sidebar-active-bg); color: var(--sidebar-text-active); font-weight: 600; }
  .nav-child.active::before { background: rgba(255,255,255,0.7); }
  .sidebar-footer {
    margin-top: auto;
    padding: 12px;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
  }
  .lang-toggle {
    display: flex;
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 3px;
    border: 1px solid var(--border);
  }
  .lang-toggle button {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s, color 0.12s;
  }
  .lang-toggle button.active {
    background: white;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
  }

  /* TOPBAR */
  .topbar {
    background: var(--topbar-bg);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    border-bottom: 1px solid var(--topbar-border);
  }
  .search-bar {
    flex: 1;
    max-width: 540px;
    margin: 0 auto;
    position: relative;
  }
  .search-bar input {
    width: 100%;
    height: 34px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0 36px 0 36px;
    border-radius: 10px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  }
  .search-bar input::placeholder { color: var(--text-muted); }
  .search-bar input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px var(--primary-light);
  }
  .search-bar .search-icon {
    position: absolute; left: 11px; top: 9px;
    width: 16px; height: 16px; color: var(--text-muted);
    pointer-events: none;
  }
  .search-bar .topbar-scan-btn {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); padding: 4px; border-radius: 5px;
    transition: color 0.12s, background 0.12s;
  }
  .search-bar .topbar-scan-btn:hover { color: var(--text-primary); background: var(--border); }
  .search-bar input { padding-right: 36px; }
  .topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
  .icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 34px; height: 34px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    position: relative;
    transition: background 0.12s, color 0.12s;
  }
  .icon-btn:hover { background: var(--bg-secondary); color: var(--text-primary); }
  .icon-btn .dot {
    position: absolute; top: 6px; right: 7px;
    width: 7px; height: 7px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--topbar-bg);
  }

  /* NOTIFICATIONS */
  .notif-wrap { position: relative; }
  .notif-badge {
    position: absolute;
    top: 2px; right: 2px;
    min-width: 16px; height: 16px;
    background: var(--danger);
    color: white;
    border-radius: 8px;
    border: 2px solid var(--topbar-bg);
    font-size: 9.5px;
    font-weight: 700;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }
  .notif-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    max-height: 480px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.18);
    z-index: 200;
    overflow: hidden;
    flex-direction: column;
  }
  .notif-dropdown.show { display: flex; }
  .notif-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
  }
  .notif-list {
    overflow-y: auto;
    max-height: 420px;
    flex: 1;
  }
  .notif-section-title {
    padding: 8px 16px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    font-weight: 600;
    background: var(--bg-secondary);
    border-bottom: 1px solid #f1f1f1;
  }
  .notif-item {
    padding: 10px 16px;
    border-bottom: 1px solid #f1f1f1;
    cursor: pointer;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    transition: background 0.1s;
  }
  .notif-item:last-child { border-bottom: none; }
  .notif-item:hover { background: #f6f6f7; }
  .notif-item.unread { background: #f0f7ff; }
  .notif-item.unread:hover { background: #e7f0fb; }
  .notif-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
  }
  .notif-icon.warning { background: var(--warning-bg); }
  .notif-icon.danger { background: var(--danger-bg); }
  .notif-icon.info { background: var(--info-bg); }
  .notif-icon.success { background: var(--success-bg); }
  .notif-content { flex: 1; min-width: 0; }
  .notif-title { font-weight: 600; font-size: 13px; color: var(--text-primary); margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .notif-msg { font-size: 12px; color: var(--text-secondary); }
  .notif-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
  body.dark-mode .notif-dropdown { background: #1a1d24; }
  body.dark-mode .notif-header { background: #14171c; }
  body.dark-mode .notif-section-title { background: #14171c; border-bottom-color: #2a2d35; }
  body.dark-mode .notif-item:hover { background: #1f222b; }
  body.dark-mode .notif-item.unread { background: #1a2530; }
  .avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5c6ac4, #2c6ecb);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
  }

  /* LOGIN PAGE */
  #loginOverlay {
    position: fixed; inset: 0; z-index: 9999;
    background: var(--main-bg);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
  }
  body.dark-mode #loginOverlay { background: #111827; }
  body.dark-mode #loadingScreen { background: #111827; }
  .login-card {
    background: #ffffff; border: 1px solid #e1e3e5;
    border-radius: 16px; padding: 36px 32px;
    width: 100%; max-width: 380px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.10);
  }
  body.dark-mode .login-card { background: #1e2635; border-color: #2d3748; }
  .login-logo {
    font-size: 20px; font-weight: 700; color: #2c6ecb;
    margin-bottom: 4px; letter-spacing: -0.3px;
  }
  .login-subtitle {
    font-size: 13px; color: #8c9196; margin-bottom: 24px;
  }
  .login-card input {
    background: #f9fafb; color: #202223;
    border: 1px solid #e1e3e5;
  }
  body.dark-mode .login-card input { background: #2d3748; color: #e2e8f0; border-color: #4a5568; }
  .login-card input:focus { outline: none; border-color: #2c6ecb; box-shadow: 0 0 0 3px rgba(44,110,203,0.15); }

  /* USER MENU */
  .user-menu-wrap { position: relative; }
  .user-menu-trigger { cursor: pointer; }
  .user-menu-dropdown {
    position: absolute; right: 0; top: 40px;
    background: #ffffff; border: 1px solid #e1e3e5;
    border-radius: 10px; min-width: 220px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12); z-index: 500;
    display: none; overflow: hidden;
  }
  body.dark-mode .user-menu-dropdown { background: #1e2635; border-color: #2d3748; }
  .user-menu-dropdown.show { display: block; }
  .user-menu-info { padding: 14px 16px 12px; border-bottom: 1px solid #e1e3e5; }
  body.dark-mode .user-menu-info { border-color: #2d3748; }
  .user-menu-name { font-weight: 700; font-size: 14px; color: #202223; }
  body.dark-mode .user-menu-name { color: #e2e8f0; }
  .user-menu-role { font-size: 12px; color: #2c6ecb; font-weight: 600; margin-top: 2px; }
  .user-menu-email { font-size: 11.5px; color: #8c9196; margin-top: 2px; }
  .user-menu-divider { height: 1px; background: #e1e3e5; }
  body.dark-mode .user-menu-divider { background: #2d3748; }
  .user-menu-item {
    padding: 10px 16px; cursor: pointer; font-size: 13px;
    color: #202223; transition: background 0.1s;
  }
  body.dark-mode .user-menu-item { color: #e2e8f0; }
  .user-menu-item:hover { background: #f1f1f1; }
  body.dark-mode .user-menu-item:hover { background: #2d3748; }

  /* COST COLUMN HIDING (role-based) */
  table.no-cost [data-col="cost"],
  table.no-cost [data-col="profit"] { display: none; }
  [data-col="cost"], [data-col="profit"] { white-space: nowrap; }

  /* MAIN */
  .main {
    overflow-y: auto;
    padding: 24px 32px 0 32px;
  }
  .page { display: none; padding-bottom: 48px; }
  .page.active { display: block; animation: fade 0.2s ease; }
  #page-orders { padding-bottom: 0; }
  #page-orders .table-card { margin: 0 0 80px 0; }
  @keyframes fade {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
  }

  /* PAGE HEADER */
  .page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
  }
  .page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
  }
  .page-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 2px;
  }
  .breadcrumb {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
  }
  .breadcrumb span { color: var(--text-secondary); }
  .header-actions { display: flex; gap: 8px; align-items: center; }
  .btn {
    border: 1px solid var(--border-strong);
    background: white;
    color: var(--text-primary);
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.1s;
  }
  .btn:hover { background: #f6f6f7; }
  .btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
  }
  .btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
  .btn-danger { color: var(--danger); border-color: var(--danger); }
  .btn-danger:hover { background: var(--danger-bg); }
  .btn-sm { padding: 5px 10px; font-size: 12px; }
  .btn-icon { padding: 5px 8px; }

  /* DATE FILTER */
  .filter-row {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    flex-wrap: wrap;
  }
  .pill {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12.5px;
    cursor: pointer;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
  }
  .pill:hover { border-color: var(--border-strong); }
  .pill.active { background: var(--primary); color: white; border-color: var(--primary); }

  /* KPI CARDS */
  .kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
  }
  .kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
  }
  .kpi-label {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
  }
  .kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
  }
  .kpi-trend {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
  }
  .trend-up { color: var(--success); background: var(--success-bg); }
  .trend-down { color: var(--danger); background: var(--danger-bg); }
  .kpi-spark {
    height: 32px;
    margin-top: 10px;
  }
  .kpi-sublabel {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 5px;
  }
  .dash-empty-state {
    padding: 28px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
  }
  .dash-stock-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: opacity 0.15s;
  }
  .dash-stock-item:last-child { border-bottom: none; }
  .dash-stock-item:hover { opacity: 0.75; }
  .stock-bar-wrap {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 6px;
  }
  .stock-bar {
    height: 100%;
    border-radius: 2px;
    min-width: 2px;
    transition: width 0.4s ease;
  }

  /* Scrollable dashboard widget lists */
  #dash-action-orders, #dash-low-stock-list { max-height:264px; overflow-y:auto; }

  /* DASHBOARD MAIN GRID (chart + kpi tiles) */
  .dash-main-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
  }
  .dash-chart-hdr {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
    gap: 12px;
  }
  .dash-bal-label { font-size: 13px; font-weight: 500; color: var(--text-muted); margin-bottom: 4px; }
  .dash-bal { font-size: 26px; font-weight: 700; color: var(--text-primary); line-height: 1.1; }
  .dash-bal-sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
  .dash-legend { display: flex; gap: 14px; align-items: center; flex-shrink: 0; }
  .dash-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
  .dash-legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

  /* DASHBOARD KPI TILES (2×2 right column) */
  .dash-kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 12px;
    height: 100%;
  }
  .dash-kpi-tile {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 14px 14px 16px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    transition: box-shadow 0.15s, transform 0.12s;
    overflow: hidden;
  }
  .dash-kpi-tile:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
  .dash-kpi-content { flex: 1; min-width: 0; }
  .dash-kpi-lbl { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 3px; }
  .dash-kpi-pct { font-size: 11.5px; font-weight: 600; min-height: 17px; margin-bottom: 4px; display: flex; align-items: center; gap: 3px; }
  .dash-kpi-pct.up { color: #16a34a; }
  .dash-kpi-pct.down { color: var(--danger); }
  .dash-kpi-pct .pct-label { font-weight: 400; color: var(--text-muted); }
  .dash-kpi-val { font-size: 30px; font-weight: 700; color: var(--text-primary); line-height: 1.1; }
  .dash-kpi-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
  .dash-kpi-icon { color: var(--primary); flex-shrink: 0; opacity: 0.85; }

  /* DASHBOARD GRID (bottom panels) */
  .dash-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
  }
  .card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    box-shadow: var(--shadow-sm);
  }
  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
  }
  .card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
  }
  .card-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
  }
  .big-number {
    font-size: 26px;
    font-weight: 700;
    margin: 2px 0 14px 0;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .chart-container {
    position: relative;
    height: 260px;
  }
  .chart-container.small { height: 200px; }

  /* BREAKDOWN LIST */
  .breakdown-list { list-style: none; }
  .breakdown-list li {
    display: flex;
    justify-content: space-between;
    padding: 11px 0;
    border-bottom: 1px solid #f1f1f1;
    font-size: 13px;
  }
  .breakdown-list li:last-child { border-bottom: none; }
  .breakdown-list .label { color: var(--text-secondary); }
  .breakdown-list .value {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  /* SECONDARY GRID */
  .triple-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }

  /* TABLE */
  .table-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: clip;
    box-shadow: var(--shadow-sm);
  }
  .table-toolbar {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
  }
  .table-toolbar input, .table-toolbar select {
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 10px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
    background: white;
  }
  .table-toolbar input { flex: 1; min-width: 180px; }
  .table-toolbar input:focus, .table-toolbar select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light); }
  .table-toolbar select { cursor: pointer; }
  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
  }
  thead th {
    text-align: left;
    padding: 10px 14px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }
  tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f1f1;
    color: var(--text-primary);
  }
  tbody tr:hover { background: var(--bg-secondary); }
  tbody tr.row-selected td { background: var(--primary-light, #e8f0fe) !important; }
  tbody tr:last-child td { border-bottom: none; }
  .product-cell { display: flex; align-items: center; gap: 10px; }
  .product-icon {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: #f1f1f1;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
  }
  .product-name { font-weight: 600; }
  .product-sku { font-size: 11.5px; color: var(--text-muted); }
  .row-actions { display: flex; gap: 4px; }
  .row-actions .btn { padding: 4px 8px; font-size: 11.5px; }

  /* BADGES */
  .badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
  }
  .badge::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
  }
  .badge-success { color: var(--success); background: var(--success-bg); }
  .badge-warning { color: var(--warning); background: var(--warning-bg); }
  .badge-danger { color: var(--danger); background: var(--danger-bg); }
  .badge-info { color: var(--info); background: var(--info-bg); }
  .badge-purple { color: #7c3aed; background: #ede9fe; }
  .badge-orange { color: #c2410c; background: #ffedd5; }
  .badge-primary { color: var(--primary); background: var(--primary-light); }
  .badge-gray { color: var(--text-secondary); background: var(--bg-secondary); }
  body.dark-mode .badge-purple { color: #a78bfa; background: #4c1d9533; }
  body.dark-mode .badge-orange { color: #fb923c; background: #431407; }
  body.dark-mode .badge-gray { color: #9ca3af; background: #374151; }


  /* ORDER STATUS TABS */
  .order-status-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
    padding: 0 4px;
  }
  .order-status-tabs::-webkit-scrollbar { display: none; }
  .ost-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 11px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    margin-bottom: -1px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s, border-color 0.15s;
    font-family: inherit;
  }
  .ost-tab:hover { color: var(--text-primary); }
  .ost-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
  .ost-count {
    background: #e0e0e0;
    color: #555;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
    line-height: 1.6;
  }
  .ost-tab.active .ost-count { background: var(--primary); color: white; }
  .ost-count:empty { display: none; }
  body.dark-mode .ost-count { background: #333; color: #aaa; }
  body.dark-mode .ost-tab.active .ost-count { background: var(--primary); color: white; }

  /* ORDER TIMELINE */
  .order-timeline { padding: 4px 0; }
  .otl-item {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    position: relative;
  }
  .otl-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 24px;
    bottom: -8px;
    width: 2px;
    background: var(--border);
  }
  .otl-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
    margin-top: 3px;
    border: 2px solid var(--main-bg);
    box-shadow: 0 0 0 2px var(--border);
  }
  .otl-dot.dot-new      { background: var(--info);    box-shadow: 0 0 0 2px var(--info-bg); }
  .otl-dot.dot-processing { background: var(--warning); box-shadow: 0 0 0 2px var(--warning-bg); }
  .otl-dot.dot-shipped  { background: #7c3aed;         box-shadow: 0 0 0 2px #ede9fe; }
  .otl-dot.dot-completed { background: var(--success); box-shadow: 0 0 0 2px var(--success-bg); }
  .otl-dot.dot-cancelled { background: #6d7175;        box-shadow: 0 0 0 2px #f1f1f1; }
  .otl-dot.dot-refund   { background: var(--danger);   box-shadow: 0 0 0 2px var(--danger-bg); }
  .otl-label { font-weight: 600; font-size: 13px; line-height: 1.3; }
  .otl-meta  { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

  /* NET EARNINGS ROW */
  .totals-row.net-earnings {
    font-weight: 700;
    font-size: 14px;
    color: var(--primary);
    border-top: 2px solid var(--border);
    padding-top: 10px;
    margin-top: 6px;
  }

  /* TABLE FOOTER */
  .table-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 12.5px;
  }

  /* MODAL */
  .modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 100;
    align-items: center;
    justify-content: center;
  }
  .modal-overlay.show { display: flex; }
  .modal {
    background: white;
    border-radius: 14px;
    width: 92%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  }
  .modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .modal-title { font-size: 16px; font-weight: 700; }
  .modal-body { padding: 18px 22px; }
  .modal-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
  }
  .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
  }
  .form-group { display: flex; flex-direction: column; }
  .form-group.full { grid-column: 1 / -1; }
  .form-group label {
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-primary);
  }
  .form-group input, .form-group select, .form-group textarea {
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    background: white;
  }
  .form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
  }

  /* DETAIL VIEW */
  .detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 18px;
  }
  .detail-item {
    background: var(--bg-secondary);
    padding: 12px;
    border-radius: 8px;
  }
  .detail-label {
    font-size: 11.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
  }
  .detail-value {
    font-size: 14px;
    font-weight: 600;
  }

  /* KANBAN */
  .kanban {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
  .kanban-col {
    background: #f6f6f7;
    border-radius: 12px;
    padding: 14px;
    min-height: 400px;
  }
  .kanban-col-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid;
  }
  .kanban-col-header.col-new { border-color: var(--info); }
  .kanban-col-header.col-quote { border-color: var(--warning); }
  .kanban-col-header.col-closed { border-color: var(--success); }
  .kanban-col-title {
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .kanban-col-count {
    background: white;
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 12px;
    color: var(--text-secondary);
  }
  .kanban-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    cursor: grab;
    transition: box-shadow 0.15s, transform 0.1s;
  }
  .kanban-card:hover { box-shadow: var(--shadow-md); }
  .kanban-card:active { cursor: grabbing; transform: scale(1.02); }
  .kanban-card.dragging { opacity: 0.4; }
  .kanban-card-name {
    font-weight: 600;
    font-size: 13.5px;
    margin-bottom: 4px;
  }
  .kanban-card-email {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
  }
  .kanban-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11.5px;
    color: var(--text-muted);
  }
  .kanban-col.drag-over { background: #ebebed; outline: 2px dashed #999; }

  /* CATEGORY LIST TABLE (Shopee-style) */
  .cat-list-table { width:100%; border-collapse:collapse; }
  .cat-list-table th { text-align:left; padding:10px 16px; font-size:12px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:.4px; border-bottom:1px solid var(--border); }
  .cat-list-table td { padding:12px 16px; border-bottom:1px solid var(--border); vertical-align:middle; }
  .cat-list-table tbody tr:last-child td { border-bottom:none; }
  .cat-list-table tbody tr:hover td { background:var(--bg-secondary); }
  .cat-thumb { width:48px; height:48px; border-radius:8px; background:var(--bg-secondary); border:1px solid var(--border); display:flex; align-items:center; justify-content:center; font-size:22px; overflow:hidden; flex-shrink:0; }
  .cat-thumb img { width:100%; height:100%; object-fit:cover; display:block; }

  /* Toggle switch */
  .cat-toggle-wrap { display:inline-flex; align-items:center; gap:8px; cursor:pointer; user-select:none; }
  .cat-toggle-track { width:40px; height:22px; border-radius:11px; background:#d1d5db; position:relative; transition:background .2s; flex-shrink:0; }
  .cat-toggle-track.on { background:var(--primary); }
  .cat-toggle-knob { position:absolute; top:3px; left:3px; width:16px; height:16px; border-radius:50%; background:white; transition:left .2s; box-shadow:0 1px 3px rgba(0,0,0,.2); }
  .cat-toggle-track.on .cat-toggle-knob { left:21px; }

  /* CATEGORY DETAIL PAGE */
  .cd-header { display:flex; align-items:flex-start; gap:20px; margin-bottom:24px; }
  .cd-cover { width:88px; height:88px; border-radius:12px; background:var(--bg-secondary); border:2px dashed var(--border); display:flex; align-items:center; justify-content:center; cursor:pointer; font-size:30px; overflow:hidden; position:relative; flex-shrink:0; }
  .cd-cover img { width:100%; height:100%; object-fit:cover; display:block; }
  .cd-cover-overlay { position:absolute; inset:0; background:rgba(0,0,0,.45); display:flex; align-items:center; justify-content:center; opacity:0; transition:opacity .15s; border-radius:10px; }
  .cd-cover:hover .cd-cover-overlay { opacity:1; }
  .cd-cover-overlay svg { color:white; }
  .cd-meta { flex:1; }
  .cd-name-row { display:flex; align-items:center; gap:8px; margin-bottom:6px; }
  .cd-name-display { font-size:20px; font-weight:700; }
  .cd-name-input { font-size:18px; font-weight:700; border:1px solid var(--primary); border-radius:6px; padding:4px 8px; outline:none; background:var(--main-bg); color:var(--text-primary); }
  .cd-info-row { font-size:12.5px; color:var(--text-muted); margin-bottom:8px; }
  .cd-tabs { display:flex; gap:0; border-bottom:1px solid var(--border); margin-bottom:20px; }
  .cd-tab { padding:10px 18px; font-size:14px; font-weight:500; cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-1px; color:var(--text-secondary); transition:color .15s; }
  .cd-tab.active { color:var(--primary); border-bottom-color:var(--primary); }

  /* SHOPEE STATUS TABS */
  .shopee-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .shopee-tabs::-webkit-scrollbar { display: none; }
  .shopee-tab {
    padding: 10px 18px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: color .15s;
  }
  .shopee-tab:hover { color: var(--text-primary); }
  .shopee-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

  /* SHOPEE STATUS BADGES */
  .badge-shopee-live         { background:#e3f5eb; color:#1a7e5a; }
  .badge-shopee-draft        { background:#f1f1f1; color:#666;    }
  .badge-shopee-under_review { background:#fff3cd; color:#b45309; }
  .badge-shopee-unlisted     { background:#fde8e8; color:#c0392b; }
  body.dark-mode .badge-shopee-live         { background:rgba(26,126,90,.2); color:#4ade80; }
  body.dark-mode .badge-shopee-draft        { background:#333; color:#aaa; }
  body.dark-mode .badge-shopee-under_review { background:rgba(180,83,9,.2); color:#fbbf24; }
  body.dark-mode .badge-shopee-unlisted     { background:rgba(192,57,43,.2); color:#ff7b6b; }

  /* Inline status select on product detail */
  .pd-shopee-select {
    appearance: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px 24px 3px 8px;
    font-size: 12px;
    cursor: pointer;
    background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' fill='none'/%3E%3C/svg%3E") no-repeat right 8px center;
    color: var(--text-primary);
  }
  .cd-toolbar { display:flex; align-items:center; gap:10px; margin-bottom:14px; }
  .cd-search { flex:1; max-width:260px; }

  /* SHARED BULK ACTION BAR — sticky bottom, sticks to viewport bottom on scroll */
  .bulk-action-bar {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    border-radius: 0 0 12px 12px;
    font-size: 13px;
    z-index: 10;
  }
  .bulk-action-bar.is-stuck { box-shadow: 0 -4px 16px rgba(0,0,0,0.10); }
  .bulk-action-bar label { display:flex; align-items:center; gap:6px; cursor:pointer; font-weight:500; }
  /* Category detail bulk bar — break out of .card padding so it spans full card width */
  #cd-product-table .bulk-action-bar { margin: 8px -24px -20px; border-radius: 0 0 12px 12px; }

  /* CATEGORY DETAIL — BULK BAR (legacy, kept for fallback) */
  .cd-bulk-bar { display:flex; align-items:center; gap:12px; padding:11px 14px; border-top:2px solid var(--border); background:var(--main-bg); border-radius:0 0 10px 10px; }
  .cd-bulk-bar label { display:flex; align-items:center; gap:6px; cursor:pointer; font-size:13px; font-weight:500; }
  .cd-table-wrap { overflow-x:auto; }
  .cd-prod-table { width:100%; border-collapse:collapse; }
  .cd-prod-table th { padding:10px 14px; text-align:left; font-size:12px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:.4px; border-bottom:2px solid var(--border); background:var(--bg-secondary); white-space:nowrap; }
  .cd-prod-table td { padding:11px 14px; border-bottom:1px solid var(--border); vertical-align:middle; }
  .cd-prod-table tbody tr:hover td { background:var(--bg-secondary); }
  .cd-prod-table tbody tr.cd-row-sel td { background:#fff8f0; }
  body.dark-mode .cd-prod-table tbody tr.cd-row-sel td { background:#2a2010; }
  .cd-hapus-link { color:var(--danger); cursor:pointer; font-size:13px; font-weight:500; white-space:nowrap; }
  .cd-hapus-link:hover { text-decoration:underline; }
  .cd-pagination { display:flex; justify-content:flex-end; align-items:center; gap:4px; padding:10px 14px; border-top:1px solid var(--border); }
  .cd-pg-btn { width:30px; height:30px; border-radius:6px; border:1px solid var(--border); background:var(--main-bg); font-size:13px; cursor:pointer; display:flex; align-items:center; justify-content:center; color:var(--text-primary); }
  .cd-pg-btn:hover:not(:disabled) { background:var(--bg-secondary); }
  .cd-pg-btn.active { background:var(--primary); color:white; border-color:var(--primary); }
  .cd-pg-btn:disabled { opacity:.4; cursor:default; }

  /* PILIH PRODUK MODAL */
  .ppm-product-list { max-height:420px; overflow-y:auto; border:1px solid var(--border); border-radius:8px; }
  .ppm-row-grey { opacity:.5; pointer-events:none; }
  .ppm-row { display:flex; align-items:center; gap:12px; padding:10px 14px; border-bottom:1px solid var(--border); cursor:pointer; transition:background .12s; }
  .ppm-row:last-child { border-bottom:none; }
  .ppm-row:hover { background:var(--bg-secondary); }
  .ppm-thumb { width:40px; height:40px; border-radius:6px; background:var(--bg-secondary); border:1px solid var(--border); flex-shrink:0; display:flex; align-items:center; justify-content:center; font-size:18px; overflow:hidden; }
  .ppm-thumb img { width:100%; height:100%; object-fit:cover; display:block; }
  .ppm-name { flex:1; font-size:13.5px; font-weight:500; line-height:1.3; }
  .ppm-check { width:18px; height:18px; accent-color:var(--primary); flex-shrink:0; cursor:pointer; }

  /* EMPTY STATE */
  .empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
  }
  .empty-icon {
    font-size: 40px;
    margin-bottom: 10px;
  }

  /* ========== PRODUCT DETAIL (Shopee-style) ========== */
  .pd-top-grid { display:grid; grid-template-columns:460px 1fr; gap:28px; align-items:start; margin-bottom:20px; }
  .pd-gallery { display:flex; flex-direction:column; gap:10px; }
  .pd-main-img { width:100%; aspect-ratio:1/1; border-radius:12px; overflow:hidden; border:1px solid var(--border); background:var(--bg-secondary); }
  .pd-main-img img { width:100%; height:100%; object-fit:cover; display:block; }
  .pd-thumbs { display:flex; gap:8px; flex-wrap:wrap; }
  .pd-thumb { width:60px; height:60px; border-radius:8px; overflow:hidden; border:2px solid transparent; cursor:pointer; transition:border-color .15s; flex-shrink:0; }
  .pd-thumb:hover { border-color:var(--border-hover,#bbb); }
  .pd-thumb.active { border-color:var(--primary); }
  .pd-thumb img { width:100%; height:100%; object-fit:cover; display:block; }
  .pd-info { display:flex; flex-direction:column; gap:20px; }
  .pd-product-name { font-size:20px; font-weight:700; line-height:1.35; color:var(--text-primary); }
  .pd-meta { font-size:13px; color:var(--text-muted); margin-top:5px; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
  .pd-price-display { font-size:26px; font-weight:700; color:var(--text-primary); letter-spacing:-.5px; }
  .pd-variation-section { display:flex; flex-direction:column; gap:14px; }
  .pd-section-label { font-size:11.5px; font-weight:700; color:var(--text-muted); text-transform:uppercase; letter-spacing:.6px; margin-bottom:7px; }
  .pd-chips { display:flex; flex-wrap:wrap; gap:8px; }
  .pd-chip { display:inline-flex; align-items:center; gap:6px; padding:5px 14px; border-radius:20px; border:1.5px solid var(--border); font-size:13px; background:var(--bg); color:var(--text-primary); white-space:nowrap; }
  .pd-chip.clickable { cursor:pointer; transition:border-color .15s,background .15s; }
  .pd-chip.clickable:hover { border-color:var(--primary); }
  .pd-chip.active { border-color:var(--primary); background:var(--primary-light,#f0f0ff); font-weight:600; }
  .pd-stats-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px 32px; }
  .pd-stat-label { font-size:11.5px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.4px; margin-bottom:3px; }
  .pd-stat-value { font-size:15px; font-weight:600; color:var(--text-primary); }
  @media (max-width:900px) { .pd-top-grid { grid-template-columns:1fr; } }

  /* RESPONSIVE */
  @media (max-width: 1100px) {
    .dash-main-grid { grid-template-columns: 1fr; }
    .dash-kpi-grid { grid-template-columns: repeat(4, 1fr); grid-template-rows: auto; height: auto; }
    .dash-grid { grid-template-columns: 1fr; }
    .triple-grid { grid-template-columns: 1fr; }
    .kanban { grid-template-columns: 1fr; }
  }
  @media (max-width: 720px) {
    .dash-kpi-grid { grid-template-columns: 1fr 1fr; }
    .app { grid-template-columns: 60px 1fr; }
    .sidebar-logo span, .nav-item span:not(.icon), .nav-item .badge, .nav-item .chevron, .sidebar-section, .lang-toggle, .nav-children { display: none; }
    .nav-item { justify-content: center; }
    .main { padding: 16px; }
    .form-row { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
  }

  /* DATE PICKER */
  .date-picker-wrap { position: relative; display: inline-block; }
  .date-picker-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border-strong);
    padding: 7px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
  }
  .date-picker-btn:hover { background: #fafbfc; }
  .date-picker-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
    z-index: 50;
    overflow: hidden;
  }
  @media (max-width: 1300px) {
    .date-picker-dropdown { flex-direction: column; }
    .dp-presets {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      padding: 10px 12px;
      border-right: none;
      border-bottom: 1px solid var(--border);
      min-width: 0;
    }
    .dp-preset { padding: 6px 12px; border-radius: 6px; background: #f1f1f1; font-size: 12px; }
    .dp-preset.active { background: var(--primary); color: white; }
    .dp-calendars { flex-direction: column; }
  }
  .date-picker-dropdown.show { display: flex; }
  .dp-presets {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 12px 0;
    min-width: 140px;
  }
  .dp-preset {
    padding: 8px 18px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
  }
  .dp-preset:hover { background: #f1f1f1; }
  .dp-preset.active { background: #e7f0fb; color: var(--primary); font-weight: 600; }
  .dp-calendars { display: flex; gap: 14px; padding: 14px 18px; }
  .dp-month { min-width: 220px; }
  .dp-month-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 13.5px;
  }
  .dp-nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-family: inherit;
  }
  .dp-nav-btn:hover { background: #f1f1f1; color: var(--text-primary); }
  .dp-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
  }
  .dp-dow {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    padding: 6px 0;
  }
  .dp-day {
    text-align: center;
    padding: 6px 0;
    font-size: 12.5px;
    cursor: pointer;
    border-radius: 4px;
    color: var(--text-primary);
  }
  .dp-day.muted { color: #d1d1d1; cursor: default; }
  .dp-day:not(.muted):hover { background: #f1f1f1; }
  .dp-day.in-range { background: #e7f0fb; color: var(--primary); border-radius: 0; }
  .dp-day.range-start, .dp-day.range-end, .dp-day.selected { background: var(--primary); color: white; font-weight: 600; }
  .dp-day.today { color: var(--danger); font-weight: 700; }

  /* ROW ACTION MENU */
  .row-menu-wrap { position: relative; display: inline-block; }
  .row-menu-btn {
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1;
  }
  .row-menu-btn:hover { background: #f1f1f1; border-color: var(--border); }
  .row-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.1);
    z-index: 30;
    min-width: 140px;
    overflow: hidden;
  }
  .row-menu.show { display: block; }
  .row-menu-item {
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .row-menu-item:hover { background: #f6f6f7; }
  .row-menu-item.danger { color: var(--danger); }
  .row-menu-item.danger:hover { background: var(--danger-bg); }

  /* DETAIL PAGE */
  .detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
    padding: 18px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
  }
  .detail-avatar {
    width: 64px; height: 64px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 30px;
    background: #f1f1f1;
    flex-shrink: 0;
  }
  .detail-name {
    font-size: 18px;
    font-weight: 700;
  }
  .detail-meta {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 2px;
  }
  .detail-cols {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 14px;
  }
  .info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f1f1f1;
    font-size: 13.5px;
  }
  .info-row:last-child { border-bottom: none; }
  .info-row .label { color: var(--text-secondary); }
  .info-row .value { font-weight: 600; }
  .info-row.editable input,
  .info-row.editable select,
  .info-row.editable textarea {
    display: none;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 13px;
    font-family: inherit;
    width: 180px;
    background: white;
    text-align: right;
  }
  .info-row.editable textarea { width: 100%; height: 60px; resize: vertical; text-align: left; }
  .page.edit-mode .info-row.editable .value { display: none; }
  .page.edit-mode .info-row.editable input,
  .page.edit-mode .info-row.editable select,
  .page.edit-mode .info-row.editable textarea { display: block; }
  .edit-mode-only { display: none !important; }
  .view-mode-only { display: inline-flex; }
  .page.edit-mode .edit-mode-only { display: inline-flex !important; }
  .page.edit-mode .view-mode-only { display: none; }

  /* ORDER LINES */
  .line-item {
    display: grid;
    grid-template-columns: 40px 1fr auto auto auto;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f1f1;
    align-items: center;
  }
  .line-item:last-child { border-bottom: none; }
  .line-item .item-icon {
    width: 36px; height: 36px;
    background: #f1f1f1;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
  }
  .line-item .item-name { font-weight: 600; font-size: 13.5px; }
  .line-item .item-sku { font-size: 11.5px; color: var(--text-muted); }
  .line-item .item-qty { color: var(--text-secondary); font-size: 13px; }
  .line-item .item-price { color: var(--text-secondary); font-size: 13px; }
  .line-item .item-total { font-weight: 700; font-size: 13.5px; }

  .totals-row {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    font-size: 13.5px;
  }
  .totals-row.grand {
    border-top: 2px solid var(--text-primary);
    margin-top: 8px;
    padding-top: 12px;
    font-weight: 700;
    font-size: 16px;
  }

  /* TOAST */
  #toastContainer {
    position: fixed;
    top: 70px;
    right: 24px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .toast {
    background: #1a1a1a;
    color: white;
    padding: 11px 18px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    font-size: 13.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.25s ease, toastOut 0.25s ease 2.5s forwards;
    min-width: 220px;
  }
  .toast.success { background: #008060; }
  .toast.danger { background: #d72c0d; }
  .toast.info { background: #2c6ecb; }
  .toast .toast-icon {
    width: 18px; height: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  @keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
  }
  @keyframes toastOut {
    to { opacity: 0; transform: translateX(20px); }
  }

  /* SORTABLE HEADERS */
  thead th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 22px;
  }
  thead th.sortable:hover { color: var(--text-primary); }
  thead th.sortable::after {
    content: '↕';
    position: absolute;
    right: 8px;
    opacity: 0.35;
    font-size: 11px;
  }
  thead th.sort-asc::after { content: '↑'; opacity: 1; color: var(--primary); }
  thead th.sort-desc::after { content: '↓'; opacity: 1; color: var(--primary); }

  /* PAGINATION */
  .pagination {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .pagination button {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    color: var(--text-primary);
    min-width: 28px;
  }
  .pagination button:hover:not(:disabled) { background: #f6f6f7; }
  .pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
  .pagination button.active { background: #1a1a1a; color: white; border-color: #1a1a1a; }
  .page-size {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px 6px;
    font-size: 12px;
    font-family: inherit;
    background: white;
    margin-right: 8px;
  }

  /* IMAGE PICKER */
  .image-picker {
    border: 2px dashed var(--border-strong);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-secondary);
  }
  .image-picker .ip-preview {
    width: 72px; height: 72px;
    background: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    border: 1px solid var(--border);
    overflow: hidden;
    flex-shrink: 0;
  }
  .image-picker .ip-preview img {
    width: 100%; height: 100%;
    object-fit: cover;
  }
  .ip-actions { flex: 1; }
  .ip-emoji-row {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 6px;
  }
  .ip-emoji {
    width: 28px; height: 28px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
  }
  .ip-emoji:hover { background: #f1f1f1; }
  .ip-emoji.selected { border-color: var(--primary); background: var(--info-bg); }

  /* SIDEBAR COLLAPSE */
  .sidebar.collapsed { width: 60px; }
  .app.sidebar-collapsed { grid-template-columns: 60px 1fr; }
  .sidebar.collapsed .sidebar-logo span,
  .sidebar.collapsed .nav-item span:not(.icon),
  .sidebar.collapsed .nav-item .badge,
  .sidebar.collapsed .nav-item .chevron,
  .sidebar.collapsed .sidebar-section,
  .sidebar.collapsed .lang-toggle,
  .sidebar.collapsed .nav-children { display: none; }
  .sidebar.collapsed .nav-item { justify-content: center; padding-left: 14px; padding-right: 14px; }
  .sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    margin-left: auto;
  }
  .sidebar-toggle:hover { background: var(--sidebar-hover); color: white; }

  /* GLOBAL SEARCH DROPDOWN */
  .search-results {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.15);
    max-height: 420px;
    overflow-y: auto;
    z-index: 60;
  }
  .search-results.show { display: block; }
  .search-section {
    padding: 10px 16px 4px 16px;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
  }
  .search-item {
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-primary);
  }
  .search-item:hover { background: #f6f6f7; }
  .search-item .si-icon { width: 28px; height: 28px; background: #f1f1f1; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 14px; }
  .search-item .si-meta { color: var(--text-muted); font-size: 11.5px; margin-left: auto; }

  /* TOAST */
  .toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
  }
  .toast {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-left: 4px solid var(--success);
    border-radius: 10px;
    padding: 12px 18px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 240px;
    max-width: 360px;
    pointer-events: auto;
    animation: toastIn 0.25s ease-out;
    font-size: 13.5px;
  }
  .toast.error, .toast.danger { border-left-color: var(--danger); }
  .toast.info { border-left-color: var(--primary); }
  .toast.warning { border-left-color: var(--warning); }
  .toast.fade-out { animation: toastOut 0.25s ease-in forwards; }
  @keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
  }
  @keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
  }
  .toast-icon { font-size: 16px; flex-shrink: 0; }
  .toast-msg { flex: 1; color: var(--text-primary); font-weight: 500; }
  .toast-close { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 16px; padding: 0 4px; }

  /* GLOBAL SEARCH RESULTS */
  .search-results {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.18);
    max-height: 400px;
    overflow-y: auto;
    z-index: 100;
  }
  .search-results.show { display: block; }
  .search-section {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
  }
  .search-section:last-child { border-bottom: none; }
  .search-section-title {
    padding: 6px 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    font-weight: 600;
  }
  .search-result {
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-size: 13px;
  }
  .search-result:hover { background: #f6f6f7; }
  .search-result-icon {
    width: 28px; height: 28px;
    border-radius: 6px;
    background: #f1f1f1;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
  }
  .search-result-name { font-weight: 500; }
  .search-result-meta { color: var(--text-muted); font-size: 11.5px; margin-left: auto; }

  /* SIDEBAR COLLAPSE */
  .app.sidebar-collapsed { grid-template-columns: 64px 1fr; }
  .app.sidebar-collapsed .sidebar-logo span,
  .app.sidebar-collapsed .nav-item span:not(.icon),
  .app.sidebar-collapsed .nav-item .badge,
  .app.sidebar-collapsed .nav-item .chevron,
  .app.sidebar-collapsed .sidebar-section,
  .app.sidebar-collapsed .lang-toggle,
  .app.sidebar-collapsed .nav-children { display: none; }
  .app.sidebar-collapsed .nav-item { justify-content: center; padding: 9px; }
  .app.sidebar-collapsed .nav-group { /* collapsed groups treat parent as single icon */ }
  .sidebar { position: relative; overflow: visible; }
  .sidebar-inner { overflow-y: auto; height: 100%; }
  .sidebar-collapse-btn {
    position: absolute;
    top: 18px;
    right: -14px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 60;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    transition: transform 0.2s, background 0.15s;
  }
  .sidebar-collapse-btn:hover { background: var(--sidebar-hover); }
  .app.sidebar-collapsed .sidebar-collapse-btn { transform: rotate(180deg); }

  /* IMAGE UPLOAD */
  .image-picker {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
  }
  .image-preview {
    width: 64px; height: 64px;
    border-radius: 12px;
    background: #f1f1f1;
    display: flex; align-items: center; justify-content: center;
    font-size: 32px;
    overflow: hidden;
    border: 1px solid var(--border);
  }
  .image-preview img { width: 100%; height: 100%; object-fit: cover; }
  .image-picker-actions { display: flex; gap: 6px; flex-wrap: wrap; }
  .emoji-options {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 6px;
  }
  .emoji-btn {
    width: 30px; height: 30px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 16px;
    display: flex; align-items: center; justify-content: center;
  }
  .emoji-btn:hover { background: #f1f1f1; }
  .emoji-btn.selected { border-color: var(--primary); background: #e7f0fb; }

  /* VARIATION TOGGLE SWITCH */
  .ap-toggle-wrap { position:relative; display:inline-block; width:44px; height:24px; flex-shrink:0; }
  .ap-toggle-wrap input { opacity:0; width:0; height:0; position:absolute; }
  .ap-toggle-slider { position:absolute; cursor:pointer; top:0; left:0; right:0; bottom:0; background:#ccc; border-radius:24px; transition:.25s; }
  .ap-toggle-slider::before { content:''; position:absolute; height:18px; width:18px; left:3px; bottom:3px; background:white; border-radius:50%; transition:.25s; box-shadow:0 1px 3px rgba(0,0,0,.2); }
  .ap-toggle-wrap input:checked + .ap-toggle-slider { background:var(--primary); }
  .ap-toggle-wrap input:checked + .ap-toggle-slider::before { transform:translateX(20px); }

  /* VARIATION EDITOR */
  .ap-activate-var-btn { border:1.5px dashed var(--border); background:transparent; color:var(--primary); padding:8px 18px; border-radius:8px; cursor:pointer; font-size:13px; font-weight:600; transition:border-color .15s,background .15s; display:inline-flex; align-items:center; gap:6px; }
  .ap-activate-var-btn:hover { border-color:var(--primary); background:var(--primary-light,rgba(255,90,60,.06)); }
  .ap-tier-box { border:1px solid var(--border); border-radius:10px; padding:14px; margin-bottom:14px; background:var(--bg); }
  .ap-tier-box-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; gap:8px; }
  .ap-tier-label { font-size:13px; font-weight:700; color:var(--text-primary); }
  .ap-tier-stock-hint { font-size:11.5px; color:var(--primary); margin-left:8px; font-weight:400; }
  .ap-tier-close { background:none; border:none; cursor:pointer; color:var(--text-muted); font-size:20px; line-height:1; padding:0 4px; flex-shrink:0; }
  .ap-tier-close:hover { color:var(--danger); }
  .ap-tier-name-input { width:100%; max-width:280px; padding:7px 10px; border:1px solid var(--border); border-radius:7px; font-size:13px; background:var(--bg); color:var(--text); }
  .ap-tier-name-input:focus { outline:none; border-color:var(--primary); }
  .ap-options-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
  .ap-option-row { display:flex; align-items:center; gap:5px; }
  .ap-option-input { flex:1; padding:6px 10px; border:1px solid var(--border); border-radius:6px; font-size:13px; background:var(--bg); color:var(--text); min-width:0; }
  .ap-option-input:focus { outline:none; border-color:var(--primary); }
  .ap-option-del { background:none; border:none; cursor:pointer; color:var(--text-muted); font-size:17px; line-height:1; padding:2px 4px; flex-shrink:0; }
  .ap-option-del:hover { color:var(--danger); }
  .ap-drag-handle { cursor:grab; color:var(--text-muted); font-size:15px; user-select:none; padding:0 2px; flex-shrink:0; line-height:1; }
  .ap-drag-handle:active { cursor:grabbing; }
  .ap-option-ghost { opacity:0.35; background:var(--border); border-radius:6px; }
  .ap-var-img-slot { width:48px; height:48px; border-radius:6px; overflow:hidden; cursor:pointer; border:1.5px dashed var(--border); display:flex; align-items:center; justify-content:center; flex-shrink:0; transition:border-color .15s; position:relative; }
  .ap-var-img-slot:hover { border-color:var(--primary); }
  .ap-apply-row { display:flex; gap:8px; align-items:center; margin-bottom:10px; padding:10px 12px; background:var(--bg-secondary); border-radius:8px; flex-wrap:wrap; }

  /* MULTI-IMAGE SLOTS */
  .ap-img-slots { display:flex; flex-wrap:wrap; gap:8px; }
  .ap-img-slot { width:96px; height:96px; border-radius:8px; position:relative; flex-shrink:0; }
  .ap-img-slot-filled { border:1.5px solid var(--border); overflow:hidden; cursor:grab; user-select:none; }
  .ap-img-slot-filled img { width:100%; height:100%; object-fit:cover; display:block; pointer-events:none; }
  .ap-img-slot { user-select:none; }
  .ap-img-remove-btn { position:absolute; top:4px; right:4px; width:20px; height:20px; border-radius:50%; background:rgba(0,0,0,.55); color:#fff; border:none; cursor:pointer; font-size:14px; line-height:20px; text-align:center; padding:0; opacity:0; transition:opacity .15s; }
  .ap-img-slot-filled:hover .ap-img-remove-btn { opacity:1; }
  .ap-img-thumb-label { position:absolute; bottom:0; left:0; right:0; background:rgba(0,0,0,.45); color:#fff; font-size:10px; text-align:center; padding:2px 0; pointer-events:none; }
  .ap-img-slot-add { border:1.5px dashed var(--border); border-radius:8px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; color:var(--text-muted); font-size:10.5px; text-align:center; padding:6px; cursor:pointer; transition:border-color .15s, background .15s, color .15s; }
  .ap-img-slot-add:hover { border-color:var(--primary); background:var(--primary-light, #fff5f5); color:var(--primary); }
  .ap-img-slot-add svg { width:22px; height:22px; opacity:.7; }
  .ap-img-slot.ap-dragover { outline:2px solid var(--primary); outline-offset:2px; border-radius:8px; }

  /* SORTABLE COLUMNS */
  thead th.sortable { cursor: pointer; user-select: none; }
  thead th.sortable:hover { background: #f1f1f1; color: var(--text-primary); }
  thead th .sort-icon { font-size: 10px; margin-left: 4px; opacity: 0.5; }
  thead th.sort-asc .sort-icon::after { content: '▲'; opacity: 1; }
  thead th.sort-desc .sort-icon::after { content: '▼'; opacity: 1; }

  /* PAGINATION */
  .pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
  }
  .page-btn {
    padding: 4px 10px;
    border: 1px solid var(--border);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12.5px;
    font-family: inherit;
    color: var(--text-primary);
  }
  .page-btn:hover:not(:disabled) { background: #f1f1f1; }
  .page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
  .page-btn.active { background: #1a1a1a; color: white; border-color: #1a1a1a; }
  .page-size-select { padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 12.5px; background: white; }

  /* CREATE ORDER LINE ITEMS */
  .co-line {
    display: grid;
    grid-template-columns: 1fr 80px 100px 100px 32px;
    gap: 10px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f1f1f1;
  }
  .co-line:last-child { border-bottom: none; }
  .co-line select, .co-line input {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 28px 6px 8px;
    font-size: 13px;
    font-family: inherit;
    width: 100%;
    outline: none;
    text-overflow: ellipsis;
  }
  .co-line input:focus, .co-line select:focus { border-color: var(--primary); }
  .co-line .co-total { font-weight: 700; text-align: right; }
  .co-line-remove {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--danger);
    width: 28px; height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
  }
  .co-line-remove:hover { background: var(--danger-bg); }
  .co-line-header {
    display: grid;
    grid-template-columns: 1fr 80px 100px 100px 32px;
    gap: 10px;
    padding: 6px 0;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
  }

  /* INVOICE — hidden on screen unless preview mode, shown on print */
  .print-invoice { display: none; }
  body.invoice-preview-mode .print-invoice,
  body.printing-invoice .print-invoice {
    display: block !important;
    color: #000;
    font-family: 'Inter', Arial, sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 32px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  }
  body.printing-invoice .print-invoice {
    padding: 0;
    border: none;
    box-shadow: none;
    border-radius: 0;
  }
  /* In screen preview mode, hide the regular detail view */
  body.invoice-preview-mode #page-order-detail .detail-cols { display: none !important; }
  body.invoice-preview-mode .invoice-preview-only { display: inline-flex !important; }
  .invoice-preview-only { display: none; }
  body.invoice-preview-mode .invoice-preview-hide { display: none !important; }
  .pi-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 3px solid #000;
    padding-bottom: 18px;
    margin-bottom: 24px;
  }
  .pi-company { display: flex; gap: 14px; align-items: flex-start; }
  .pi-logo {
    width: 56px; height: 56px;
    border-radius: 12px;
    background: #f0f0f0;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
    overflow: hidden;
  }
  .pi-logo img { width:100%; height:100%; object-fit:cover; }
  .pi-company-name {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
  }
  .pi-company-info {
    font-size: 12px;
    color: #555;
    line-height: 1.5;
  }
  .pi-title-block { text-align: right; }
  .pi-title {
    font-size: 36px;
    font-weight: 900;
    letter-spacing: 3px;
    color: #000;
    margin-bottom: 10px;
  }
  .pi-meta {
    font-size: 12px;
    margin-bottom: 2px;
  }
  .pi-meta-label {
    color: #777;
    margin-right: 6px;
  }
  .pi-meta-val {
    font-weight: 600;
  }
  .pi-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 24px;
  }
  .pi-party-title {
    font-size: 10px;
    letter-spacing: 1.5px;
    color: #777;
    font-weight: 700;
    margin-bottom: 6px;
  }
  .pi-party-name {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 2px;
  }
  .pi-party-line {
    font-size: 12px;
    color: #555;
    line-height: 1.5;
  }
  .pi-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 18px;
  }
  .pi-table thead th {
    text-align: left;
    background: #1a1a1a;
    color: #fff !important;
    padding: 10px 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
  }
  .pi-table th.num,
  .pi-table td.num { text-align: right; }
  .pi-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    font-size: 12.5px;
    vertical-align: top;
  }
  .pi-table tbody tr:last-child td { border-bottom: 1px solid #999; }
  .pi-table .item-name { font-weight: 600; }
  .pi-table .item-sku { font-size: 10.5px; color: #888; margin-top: 2px; }
  .pi-totals {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-bottom: 30px;
  }
  .pi-totals-row {
    display: flex;
    justify-content: space-between;
    width: 280px;
    padding: 5px 0;
    font-size: 13px;
  }
  .pi-totals-row span:first-child { color: #555; }
  .pi-totals-row span:last-child { font-weight: 600; }
  .pi-totals-row.grand {
    border-top: 2px solid #000;
    margin-top: 6px;
    padding-top: 10px;
    font-size: 16px;
    font-weight: 800;
  }
  .pi-totals-row.grand span { color: #000 !important; font-weight: 800; }
  .pi-footer {
    border-top: 1px solid #ddd;
    padding-top: 18px;
    font-size: 12px;
  }
  .pi-payment { margin-bottom: 8px; }
  .pi-notes { margin-bottom: 14px; padding: 10px 12px; background: #fafafa; border-left: 3px solid #1a1a1a; }
  .pi-thanks {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    margin: 18px 0 4px;
    color: #1a1a1a;
  }
  .pi-generated {
    text-align: center;
    font-size: 10px;
    color: #999;
  }

  /* PACKING SLIP */
  .print-packing-slip { display: none; }
  body.printing-packing-slip .print-packing-slip { display: block !important; }
  .ps-header { display:flex; justify-content:space-between; align-items:flex-start; border-bottom:2px solid #000; padding-bottom:14px; margin-bottom:16px; color:#000; font-family:'Inter',Arial,sans-serif; }
  .ps-label { font-size:9px; text-transform:uppercase; letter-spacing:1px; color:#888; margin-bottom:3px; }
  .ps-from-name { font-size:18px; font-weight:800; margin-bottom:3px; }
  .ps-from-info { font-size:11px; color:#555; line-height:1.5; }
  .ps-order-no { font-size:20px; font-weight:800; }
  .ps-order-date { font-size:12px; color:#555; margin-top:2px; }
  .ps-shopee-sn { font-size:11px; color:#888; margin-top:2px; }
  .ps-to-box { background:#f5f5f5; border-radius:8px; padding:12px 16px; margin-bottom:14px; color:#000; }
  .ps-to-name { font-size:16px; font-weight:700; margin-bottom:3px; }
  .ps-to-info { font-size:12px; color:#555; line-height:1.6; }
  .ps-shipping-box { display:flex; gap:28px; margin-bottom:16px; padding:10px 14px; border:1px solid #ddd; border-radius:6px; }
  .ps-shipping-col { display:flex; flex-direction:column; gap:3px; }
  .ps-shipping-val { font-size:13px; font-weight:600; color:#000; }
  .ps-items-table { width:100%; border-collapse:collapse; font-size:13px; margin-bottom:14px; color:#000; }
  .ps-items-table th { text-align:left; border-bottom:1.5px solid #000; padding:6px 8px; font-size:10px; text-transform:uppercase; letter-spacing:0.5px; }
  .ps-items-table td { padding:8px; border-bottom:1px solid #e8e8e8; }
  .ps-items-table td:last-child { text-align:center; font-weight:700; }
  .ps-notes-box { margin-bottom:14px; padding:10px 14px; background:#fffbe6; border-left:3px solid #f0c000; font-size:12px; color:#000; }
  .ps-footer { font-size:10px; color:#aaa; text-align:center; padding-top:12px; border-top:1px solid #eee; }

  @media print {
    body.printing-packing-slip .sidebar,
    body.printing-packing-slip .topbar,
    body.printing-packing-slip .page-header,
    body.printing-packing-slip .toast-container,
    body.printing-packing-slip .modal-overlay,
    body.printing-packing-slip .detail-cols,
    body.printing-packing-slip .print-invoice,
    body.printing-packing-slip button { display: none !important; }
    body.printing-packing-slip .app { display: block; height: auto; }
    body.printing-packing-slip .main { padding: 20px; overflow: visible; }
    body.printing-packing-slip .page { display: none; }
    body.printing-packing-slip .page#page-order-detail { display: block !important; }
    body.printing-packing-slip .print-packing-slip { display: block !important; border: none; box-shadow: none; }
    @page { margin: 1.5cm; }
  }

  @media print {
    body.printing-invoice .sidebar,
    body.printing-invoice .topbar,
    body.printing-invoice .page-header,
    body.printing-invoice .toast-container,
    body.printing-invoice .modal-overlay,
    body.printing-invoice .row-menu-wrap,
    body.printing-invoice .nav-item,
    body.printing-invoice .detail-cols,
    body.printing-invoice button { display: none !important; }
    body.printing-invoice .app { display: block; height: auto; }
    body.printing-invoice .main { padding: 20px; overflow: visible; }
    body.printing-invoice .page { display: none; }
    body.printing-invoice .page#page-order-detail { display: block !important; }
    body.printing-invoice .print-invoice { display: block !important; }
    @page { margin: 1.5cm; }
  }

  /* SETTINGS */
  .settings-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 6px;
  }
  .settings-tab {
    background: transparent;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-secondary);
    font-weight: 500;
  }
  .settings-tab:hover { background: #f6f6f7; color: var(--text-primary); }
  .settings-tab.active { background: #1a1a1a; color: white; }
  .settings-section { display: none; }
  .settings-section.active { display: block; animation: fade 0.2s ease; }
  .settings-section .card { margin-bottom: 14px; }
  .setting-row {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 16px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f1f1f1;
  }
  .setting-row:last-child { border-bottom: none; }
  .setting-row > label { font-size: 13.5px; font-weight: 500; color: var(--text-primary); }
  .setting-row input[type="text"],
  .setting-row input[type="number"],
  .setting-row input[type="email"],
  .setting-row input[type="tel"],
  .setting-row select,
  .setting-row textarea {
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 13px;
    font-family: inherit;
    background: white;
    width: 100%;
    max-width: 380px;
    outline: none;
  }
  .setting-row input:focus, .setting-row select:focus, .setting-row textarea:focus { border-color: var(--primary); }
  .setting-row textarea { resize: vertical; min-height: 60px; }

  /* Toggle switch */
  .toggle { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
  .toggle input { opacity: 0; width: 0; height: 0; }
  .toggle-slider {
    position: absolute; inset: 0;
    cursor: pointer;
    background: #ccc;
    border-radius: 24px;
    transition: 0.2s;
  }
  .toggle-slider:before {
    content: '';
    position: absolute;
    left: 3px; bottom: 3px;
    width: 18px; height: 18px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
  }
  .toggle input:checked + .toggle-slider { background: var(--success); }
  .toggle input:checked + .toggle-slider:before { transform: translateX(18px); }

  .theme-btn.active { background: #1a1a1a; color: white; border-color: #1a1a1a; }
  .brand-color {
    width: 32px; height: 32px;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: border-color 0.15s;
  }
  .brand-color.active { border-color: var(--text-primary); }

  .team-member {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f1f1;
  }
  .team-member:last-child { border-bottom: none; }
  .team-member-info { flex: 1; }
  .team-member-name { font-weight: 600; font-size: 13.5px; }
  .team-member-email { font-size: 12px; color: var(--text-secondary); }

  /* DARK MODE */
  body.dark-mode {
    --main-bg: #0f1117;
    --card-bg: #1a1d24;
    --border: #2a2d35;
    --border-strong: #3a3d45;
    --text-primary: #e7e9ea;
    --text-secondary: #9aa0a6;
    --text-muted: #6d7175;
    --primary-light: #1a2a3d;
    --bg-secondary: #23262f;
  }
  body.dark-mode thead th { background: #1f222b; }
  body.dark-mode tbody tr:hover { background: #1f222b; }
  body.dark-mode .pill { background: #1a1d24; }
  body.dark-mode .btn { background: #1a1d24; color: #e7e9ea; }
  body.dark-mode .btn-primary { background: #ffffff; color: #1a1a1a; }
  body.dark-mode .topbar { background: #0f1117; border-bottom-color: #2a2d35; }
  body.dark-mode .search-bar input { background: #1a1d24; color: white; border-color: #2a2d35; }
  body.dark-mode .modal { background: #1a1d24; color: #e7e9ea; }
  body.dark-mode .info-row { border-bottom-color: #2a2d35; }
  body.dark-mode .breakdown-list li, body.dark-mode tbody td { border-bottom-color: #2a2d35; }
  body.dark-mode .detail-item, body.dark-mode .kanban-col { background: #1f222b; }
  body.dark-mode .form-group input, body.dark-mode .form-group select, body.dark-mode .form-group textarea,
  body.dark-mode .setting-row input, body.dark-mode .setting-row select, body.dark-mode .setting-row textarea {
    background: #1a1d24; color: #e7e9ea; border-color: #3a3d45;
  }
  body.dark-mode .settings-tabs { background: #1a1d24; }
  body.dark-mode .settings-tab.active { background: white; color: #1a1a1a; }

  /* CLICKABLE KPI TILES */
  .kpi-card.kpi-clickable { cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s; user-select: none; }
  .kpi-card.kpi-clickable:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
  .kpi-card.kpi-clickable:active { transform: scale(0.99); }
  .kpi-card.kpi-clickable.active { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(44,110,203,0.18); background: #f6faff; }
  .kpi-card.kpi-clickable.active .kpi-label { color: var(--primary); font-weight: 600; }

  /* ACTIVITY LOG — user detail widget (compact, keeps old classes) */
  .act-item {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    gap: 14px;
    align-items: flex-start;
    padding: 14px 18px;
    border-bottom: 1px solid #f1f1f1;
  }
  .act-item:last-child { border-bottom: none; }
  .act-item:hover { background: #fafbfc; }
  body.dark-mode .act-item:hover { background: #1f222b; }
  .act-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
  }
  .act-icon.create { background: var(--success-bg); }
  .act-icon.update { background: var(--info-bg); }
  .act-icon.delete { background: var(--danger-bg); }
  .act-icon.restock { background: var(--warning-bg); }
  .act-icon.duplicate { background: #f1f1f1; }
  .act-icon.login { background: #ede9fe; }
  .act-msg { font-size: 13.5px; color: var(--text-primary); line-height: 1.45; }
  .act-msg b { font-weight: 600; }
  .act-msg .act-actor { font-weight: 600; color: var(--primary); }
  .act-msg .act-old { color: var(--text-muted); text-decoration: line-through; font-size: 12.5px; }
  .act-msg .act-new { color: var(--success); font-weight: 600; font-size: 12.5px; }
  .act-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
  .act-time {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    text-align: right;
    line-height: 1.4;
  }
  .act-time .act-date { display: block; font-size: 11px; }

  /* ACTIVITY LOG — main timeline (new al-* classes) */
  .al-group { }
  .al-group-header {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 14px 20px 8px;
    border-bottom: 1px solid var(--border);
    background: var(--main-bg);
    position: sticky;
    top: 0;
    z-index: 1;
  }
  body.dark-mode .al-group-header { background: var(--card-bg); }
  .al-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 11px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    transition: background 0.12s;
  }
  body.dark-mode .al-item { border-bottom-color: rgba(255,255,255,0.05); }
  .al-item:last-child { border-bottom: none; }
  .al-item:hover { background: rgba(0,0,0,0.025); }
  body.dark-mode .al-item:hover { background: rgba(255,255,255,0.04); }
  .al-time {
    font-size: 11.5px;
    color: var(--text-muted);
    min-width: 74px;
    flex-shrink: 0;
    padding-top: 3px;
    letter-spacing: 0.01em;
  }
  .al-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    margin-top: 1px;
  }
  .al-content { flex: 1; min-width: 0; }
  .al-main { font-size: 13.5px; line-height: 1.45; color: var(--text-primary); }
  .al-actor { font-weight: 600; }
  .al-verb { color: var(--text-secondary); }
  .al-type-label { color: var(--text-muted); font-size: 12.5px; }
  .al-target { font-weight: 600; color: var(--text-primary); }
  .al-changes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
    align-items: center;
  }
  .al-change-row {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
  }
  .al-field { color: var(--text-muted); font-size: 11.5px; }
  .al-arrow { color: var(--text-muted); font-size: 11px; }
  .al-chip {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11.5px;
    font-weight: 500;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .al-chip-old { background: rgba(215,44,13,0.08); color: #c0392b; }
  .al-chip-new { background: rgba(26,126,90,0.10); color: #1a7e5a; }
  body.dark-mode .al-chip-old { background: rgba(215,44,13,0.18); color: #ff7b6b; }
  body.dark-mode .al-chip-new { background: rgba(26,126,90,0.2); color: #4ade80; }
  .al-msg {
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-secondary);
    background: rgba(0,0,0,0.04);
    padding: 5px 10px;
    border-radius: 6px;
    border-left: 2px solid var(--border);
  }
  body.dark-mode .al-msg { background: rgba(255,255,255,0.05); }
  .al-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
  }
  .al-pagination .al-pg-btns { display: flex; gap: 4px; align-items: center; }
  .al-pg-num {
    padding: 4px 12px;
    background: var(--primary);
    color: #fff;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12.5px;
  }

  /* STOCK ADJUSTMENT */
  .adj-type-toggle { display:flex; border:1px solid var(--border); border-radius:8px; overflow:hidden; margin-bottom:16px; }
  .adj-type-btn { flex:1; padding:11px 16px; border:none; background:none; font-size:13.5px; font-weight:500; cursor:pointer; color:var(--text-secondary); transition:background .15s,color .15s; }
  .adj-type-btn:hover:not(.active-in):not(.active-out) { background:rgba(0,0,0,.04); }
  .adj-type-btn.active-in  { background:var(--success-bg); color:var(--success); font-weight:600; }
  .adj-type-btn.active-out { background:var(--danger-bg);  color:var(--danger);  font-weight:600; }
  body.dark-mode .adj-type-btn.active-in  { background:rgba(26,126,90,.2); }
  body.dark-mode .adj-type-btn.active-out { background:rgba(192,57,43,.2); }
  .adj-stock-preview { padding:10px 14px; background:var(--main-bg); border:1px solid var(--border); border-radius:8px; font-size:12.5px; margin-bottom:14px; display:flex; align-items:center; gap:6px; flex-wrap:wrap; }

  /* SCROLLBAR */
  ::-webkit-scrollbar { width: 8px; height: 8px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: #d0d0d0; border-radius: 4px; }
  ::-webkit-scrollbar-thumb:hover { background: #b0b0b0; }
  .sidebar ::-webkit-scrollbar-thumb { background: #444; }

  /* ========== BARCODE / SKU LOOKUP ========== */
  /* Inline scan bar (Create Order + Adjustment Modal) */
  .co-scan-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--main-bg);
    border: 1.5px dashed var(--border-strong);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
    transition: border-color .15s, background .15s;
  }
  .co-scan-bar:focus-within {
    border-color: var(--primary);
    border-style: solid;
    background: var(--card-bg);
  }
  .co-scan-bar input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 13.5px;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
  }
  .co-scan-bar input::placeholder { color: var(--text-muted); font-size: 13px; }

  .barcode-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg);
    border: 2px solid var(--border-strong);
    border-radius: 12px;
    padding: 12px 16px;
    transition: border-color .15s;
  }
  .barcode-input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(44,110,203,0.12);
  }
  .barcode-input-wrap input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
    min-width: 0;
  }
  .barcode-input-wrap input::placeholder { color: var(--text-muted); }
  .barcode-suggestions {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-top: 6px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  }
  .barcode-suggestion {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    transition: background .1s;
  }
  .barcode-suggestion:last-child { border-bottom: none; }
  .barcode-suggestion:hover { background: var(--main-bg); }
  .barcode-result-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  }
  .barcode-stock-row {
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
    margin-top: 10px;
  }
  .barcode-stock-bar {
    height: 5px;
    background: var(--border);
    border-radius: 3px;
    margin: 5px 0 3px;
    width: 100px;
    overflow: hidden;
  }
  .barcode-stock-bar > div {
    height: 100%;
    border-radius: 3px;
    transition: width .3s;
  }
  .barcode-no-result {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    background: var(--card-bg);
    border: 1px dashed var(--border-strong);
    border-radius: 14px;
  }

  /* ========== USER ROLE BADGES ========== */
  .user-role-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 12px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
  }
  .badge-role-superadmin { background: #e8eaf6; color: #3949ab; }
  .badge-role-admin      { background: #e3f2fd; color: #1565c0; }
  .badge-role-staff      { background: #e8f5e9; color: #2e7d32; }
  .badge-role-analyst    { background: #fff3e0; color: #e65100; }
  .badge-role-custom     { background: #f3e5f5; color: #6a1b9a; }
  body.dark-mode .badge-role-superadmin { background: #303f9f33; color: #7986cb; }
  body.dark-mode .badge-role-admin      { background: #1565c033; color: #64b5f6; }
  body.dark-mode .badge-role-staff      { background: #2e7d3233; color: #81c784; }
  body.dark-mode .badge-role-analyst    { background: #e65100aa; color: #ffcc80; }
  body.dark-mode .badge-role-custom     { background: #6a1b9a33; color: #ce93d8; }

  /* ========== USER STATUS BADGES ========== */
  .user-status-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 12px;
    font-size: 11.5px;
    font-weight: 600;
  }
  .badge-status-active   { background: #e8f5e9; color: #2e7d32; }
  .badge-status-inactive { background: #fafafa; color: #9e9e9e; border: 1px solid #e0e0e0; }
  body.dark-mode .badge-status-active   { background: #2e7d3233; color: #81c784; }
  body.dark-mode .badge-status-inactive { background: #333; color: #888; border-color: #444; }

  /* ========== BUILTIN ROLE LIST ========== */
  .builtin-role-row {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
  }
  .builtin-role-row:last-child { border-bottom: none; }
  .builtin-role-name { margin-bottom: 3px; }
  .builtin-role-desc { font-size: 12.5px; color: var(--text-secondary); }

  /* ========== CUSTOM ROLE CARDS ========== */
  .custom-role-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    background: var(--card-bg);
  }
  .custom-role-card:last-child { margin-bottom: 0; }
  .custom-role-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
  }
  .custom-role-name-input {
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 10px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-family: inherit;
    width: 180px;
  }
  .custom-role-name-input:focus { outline: none; border-color: var(--primary); }
  .custom-role-desc-input {
    width: 100%;
    box-sizing: border-box;
    font-size: 12.5px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 10px;
    margin-bottom: 14px;
    background: var(--input-bg);
    color: var(--text-secondary);
    font-family: inherit;
  }
  .custom-role-desc-input:focus { outline: none; border-color: var(--primary); }

  /* ========== PERMISSION TABLE ========== */
  .perm-table-wrap { overflow-x: auto; }
  .perm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
  }
  .perm-table th {
    text-align: center;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--main-bg);
  }
  .perm-table th:first-child { text-align: left; }
  .perm-table tr:last-child .perm-cell { border-bottom: none; }
  .perm-module {
    padding: 8px 10px 8px 0;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    color: var(--text-primary);
  }
  .perm-cell {
    text-align: center;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
  }
  .perm-na { color: var(--text-muted); font-size: 12px; }
  .perm-check { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); }

  /* ========== USER DETAIL PAGE ========== */
  @media (max-width: 700px) {
    #page-user-detail > div[style*="grid"],
    #page-my-profile > div[style*="grid"] { grid-template-columns: 1fr !important; }
  }
  .user-table-row:hover td { background: var(--main-bg); }

.page.edit-mode #od-quick-actions { display: none; }

/* ========== ORDER STATUS QUICK-ACTIONS BAR ========== */
.qa-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 20px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.qa-steps {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.qa-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.qa-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--border);
  transition: background 0.2s, border-color 0.2s;
}
.qa-step.active .qa-dot {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}
.qa-step.done .qa-dot {
  background: var(--success);
  border-color: var(--success);
}
.qa-step-label {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
}
.qa-step.active .qa-step-label { color: var(--primary); font-weight: 600; }
.qa-step.done .qa-step-label { color: var(--success); }
.qa-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 16px;
  transition: background 0.2s;
}
.qa-line.done { background: var(--success); }
.qa-action { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.qa-ship-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.qa-ship-form select,
.qa-ship-form input {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--main-bg);
  color: var(--text);
  outline: none;
}
.qa-ship-form select:focus,
.qa-ship-form input:focus { border-color: var(--primary); }
.qa-ship-form input { min-width: 160px; }

/* ========== BUKTI PACKING ==========  */
.op-photos-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}
.op-photo-slot {
  width: 86px;
  height: 86px;
  border-radius: 10px;
  border: 2px dashed var(--border);
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  background: var(--main-bg);
}
.op-photo-slot.filled { border: 2px solid transparent; cursor: zoom-in; }
.op-photo-slot.add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.op-photo-slot.add:hover { border-color: var(--primary); color: var(--primary); }
.op-photo-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.op-photo-del {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,.6);
  border: none;
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  transition: opacity .15s;
}
.op-photo-slot.filled:hover .op-photo-del { opacity: 1; }
.op-photo-time {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: 9px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.55));
  text-align: center;
  padding: 6px 2px 2px;
  white-space: pre-line;
  line-height: 1.2;
}
.op-video-wrap { background: var(--main-bg); border-radius: 8px; padding: 8px; }

/* Bukti Packing — video cards */
.op-video-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.op-video-card video {
  width: 100%;
  max-height: 200px;
  display: block;
  background: #000;
}
.op-video-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  font-size: 11px;
  color: var(--text-muted);
  gap: 8px;
}
.op-video-meta span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-video-del {
  background: none;
  border: none;
  color: #d72c0d;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  white-space: nowrap;
}
.op-video-del:hover { background: #fff4f4; }

/* Choice popup buttons */
.op-choice-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  background: none;
  border: none;
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-primary);
  text-align: left;
  white-space: nowrap;
}
.op-choice-btn:hover { background: var(--main-bg); }

/* Photo lightbox — show as flex when active */
#photoLightbox.lb-open { display: flex !important; }

/* ========== PRESENCE LOCK BADGE ========== */
.lock-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.lock-badge-mine {
  background: #e8f0fe;
  border-color: #c6d6f7;
  color: #1a56db;
}
.lock-badge-other {
  background: #fff8e1;
  border-color: #ffe082;
  color: #8a6000;
}
.dark-theme .lock-badge-mine {
  background: rgba(44, 110, 203, 0.15);
  border-color: rgba(44, 110, 203, 0.35);
  color: #90b4f7;
}
.dark-theme .lock-badge-other {
  background: rgba(180, 120, 0, 0.15);
  border-color: rgba(180, 120, 0, 0.35);
  color: #f5c842;
}
.lock-badge-icon { font-size: 16px; flex-shrink: 0; }
.lock-badge-text { flex: 1; line-height: 1.4; }
.lock-badge-text strong { font-weight: 600; }
.lock-badge-time { font-size: 11px; opacity: 0.75; }
.lock-badge-force {
  background: none;
  border: 1px solid currentColor;
  color: inherit;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  opacity: 0.8;
  white-space: nowrap;
  font-family: inherit;
}
.lock-badge-force:hover { opacity: 1; }


/* ═══════════════════════════════════════════════════════════
   COLOR PALETTES
   Switch by setting data-palette on <body>
═══════════════════════════════════════════════════════════ */

/* TEAL */
[data-palette="teal"] {
  --primary: #0d9488;
  --primary-light: #f0fdfa;
  --primary-hover: #0f766e;
  --sidebar-text-active: #ffffff;
  --sidebar-active-bg: #0d9488;
  --main-bg: #f4faf8;
}

/* VIOLET */
[data-palette="violet"] {
  --primary: #7c3aed;
  --primary-light: #f5f3ff;
  --primary-hover: #6d28d9;
  --sidebar-text-active: #ffffff;
  --sidebar-active-bg: #7c3aed;
  --main-bg: #faf9ff;
}

/* OCEAN BLUE */
[data-palette="blue"] {
  --primary: #2563eb;
  --primary-light: #eff6ff;
  --primary-hover: #1d4ed8;
  --sidebar-text-active: #ffffff;
  --sidebar-active-bg: #2563eb;
}

/* MIDNIGHT — dark sidebar, blue accent */
[data-palette="midnight"] {
  --sidebar-bg: #1a1a1a;
  --sidebar-border: #2a2a2a;
  --sidebar-text: #b5b5b5;
  --sidebar-text-active: #ffffff;
  --sidebar-hover: #2a2a2a;
  --sidebar-active-bg: #303030;
  --sidebar-active: #303030;
  --topbar-bg: #1a1a1a;
  --topbar-border: #2a2a2a;
  --primary: #2c6ecb;
  --primary-light: #e8f0fb;
  --primary-hover: #1f5fb8;
}
[data-palette="midnight"] .sidebar-logo { color: #ffffff; }
[data-palette="midnight"] .logo-mark { background: linear-gradient(135deg,#00a96e,#00866c); }
[data-palette="midnight"] .sidebar-collapse-btn { background: #1a1a1a; border-color: #333; color: #aaa; }
[data-palette="midnight"] .sidebar-collapse-btn:hover { background: #2a2a2a; }
[data-palette="midnight"] .sidebar-section { color: #555; }
[data-palette="midnight"] .nav-item:hover { color: #ffffff; }
[data-palette="midnight"] .nav-group.expanded > .nav-item { color: #ffffff; }
[data-palette="midnight"] .nav-item.active { color: #ffffff; }
[data-palette="midnight"] .nav-child { color: #888; }
[data-palette="midnight"] .nav-child:hover { color: #ffffff; }
[data-palette="midnight"] .nav-child.active { color: #ffffff; }
[data-palette="midnight"] .nav-child::before { background: #444; }
[data-palette="midnight"] .nav-child.active::before { background: #2c6ecb; }
[data-palette="midnight"] .sidebar-footer { border-top-color: #2a2a2a; }
[data-palette="midnight"] .lang-toggle { background: #2a2a2a; border-color: #3a3a3a; }
[data-palette="midnight"] .lang-toggle button { color: #999; }
[data-palette="midnight"] .lang-toggle button.active { background: #3a3a3a; color: #fff; box-shadow: none; }
[data-palette="midnight"] .topbar .search-bar input { background: #252525; border-color: #3a3a3a; color: #e0e0e0; }
[data-palette="midnight"] .topbar .search-bar input::placeholder { color: #666; }
[data-palette="midnight"] .topbar .search-bar input:focus { background: #2c2c2c; border-color: #555; box-shadow: none; }
[data-palette="midnight"] .topbar .search-bar .search-icon { color: #666; }
[data-palette="midnight"] .topbar .search-bar .topbar-scan-btn { color: #666; }
[data-palette="midnight"] .topbar .search-bar .topbar-scan-btn:hover { background: #333; color: #aaa; }
[data-palette="midnight"] .icon-btn { color: #888; }
[data-palette="midnight"] .icon-btn:hover { background: #252525; color: #fff; }
[data-palette="midnight"] .icon-btn .dot { border-color: #1a1a1a; }
[data-palette="midnight"] .notif-badge { border-color: #1a1a1a; }
[data-palette="midnight"] .nav-item .badge { background: #2a3a5c; color: #6ea8fe; }

/* Palette picker UI */
.palette-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.palette-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 10px;
  border: 2px solid transparent;
  transition: border-color 0.15s, background 0.15s;
  min-width: 72px;
}
.palette-swatch:hover { background: var(--bg-secondary); }
.palette-swatch.active { border-color: var(--primary); background: var(--primary-light); }
.palette-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.6);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.palette-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}
.palette-swatch.active .palette-label { color: var(--primary); }
