/* GarageLists Seller Dashboard — styles.css | tokens, layout, components */
:root {
  /* Color tokens — light mode */
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-alt: #f1f3f6;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-muted: #6b7280;
  --text-subtle: #9ca3af;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #dbeafe;

  --success: #16a34a;
  --success-soft: #dcfce7;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --danger: #dc2626;

  /* Layout tokens */
  --sidebar-w: 240px;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, .10);

  /* Spacing scale (4-pt) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --surface: #111827;
    --surface-alt: #1f2937;
    --border: #1f2937;
    --border-strong: #374151;
    --text: #f3f4f6;
    --text-muted: #9ca3af;
    --text-subtle: #6b7280;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-soft: rgba(59, 130, 246, .15);
    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, .15);
    --warn-soft: rgba(217, 119, 6, .18);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, .35), 0 1px 2px rgba(0, 0, 0, .2);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, .5);
  }
}

/* Reset + base */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font-sans); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, h4, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--radius-sm); }

.skip-link { position: absolute; left: -9999px; top: 0; background: var(--primary); color: #fff; padding: var(--s-2) var(--s-4); border-radius: 0 0 var(--radius) 0; z-index: 100; }
.skip-link:focus { left: 0; }

/* Shell */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

/* Sidebar */
.sidebar { display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--border); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar-brand { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-6) var(--s-5); font-weight: 700; font-size: 17px; }
.brand-mark { color: var(--primary); flex: 0 0 auto; }
.brand-name { letter-spacing: -.01em; }
.nav { padding: 0 var(--s-3); flex: 1; }
.nav-list { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3); border-radius: var(--radius-sm); color: var(--text-muted); font-weight: 500; font-size: 14px; transition: background-color .15s, color .15s; }
.nav-item:hover { background: var(--surface-alt); color: var(--text); }
.nav-item.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item svg { flex: 0 0 auto; }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; line-height: 1.4; }
.sidebar-footer { border-top: 1px solid var(--border); padding: var(--s-4) var(--s-5); display: flex; flex-direction: column; gap: var(--s-3); }
.seller-info { display: flex; align-items: center; gap: var(--s-3); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #7c3aed); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: 0 0 auto; }
.seller-meta { display: flex; flex-direction: column; min-width: 0; }
.seller-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seller-role { font-size: 12px; color: var(--text-muted); }
.logout-link { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--text-muted); font-size: 13px; padding: var(--s-2); border-radius: var(--radius-sm); }
.logout-link:hover { color: var(--danger); background: var(--surface-alt); }

/* Main */
.main { display: flex; flex-direction: column; gap: var(--s-6); padding: var(--s-6) var(--s-8); max-width: 1200px; width: 100%; }
.topbar { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; }
.menu-toggle { display: none; background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--s-2); color: var(--text); }
.topbar-title { flex: 1; min-width: 200px; }
.topbar-title h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 2px; }
.greeting { color: var(--text-muted); font-size: 14px; }

/* Toggle */
.toggle { display: inline-flex; align-items: center; gap: var(--s-3); cursor: pointer; user-select: none; }
.toggle-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.toggle-pill { display: inline-flex; align-items: center; gap: var(--s-2); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { width: 40px; height: 22px; background: var(--border-strong); border-radius: 999px; position: relative; transition: background-color .2s; }
.toggle-thumb { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background: #fff; border-radius: 50%; box-shadow: var(--shadow-sm); transition: transform .2s; }
.toggle input:checked + .toggle-track { background: var(--success); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(18px); }
.toggle-state { font-size: 12px; font-weight: 600; color: var(--text-muted); min-width: 22px; text-align: right; }
.toggle input:checked ~ .toggle-state { color: var(--success); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4); }
.stat-card { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-2); position: relative; }
.stat-head { display: flex; align-items: center; justify-content: space-between; }
.stat-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.stat-icon { color: var(--text-subtle); }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; margin-top: var(--s-2); }
.stat-sub { font-size: 13px; color: var(--text-muted); }
.stat-sub .delta-up { color: var(--success); font-weight: 600; }
.stat-sub .delta-down { color: var(--danger); font-weight: 600; }
.sparkline { width: 100%; height: 36px; color: var(--primary); opacity: .85; margin-top: var(--s-2); }

/* Sale panel */
.sale-panel { padding: var(--s-6); }
.sale-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-5); flex-wrap: wrap; }
.sale-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--success); display: block; margin-bottom: 4px; }
.sale-title { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.sale-details { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4); }
.sale-details div { padding: var(--s-3) 0; border-top: 1px solid var(--border); }
.sale-details dt { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.sale-details dd { font-size: 14px; font-weight: 500; }

/* Badges + buttons */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .01em; }
.badge-on { background: var(--success-soft); color: var(--success); }
.badge-pending { background: var(--warn-soft); color: var(--warn); }
.badge-sold { background: var(--surface-alt); color: var(--text-muted); }
.btn { display: inline-flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-4); border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 600; font-size: 13px; transition: background-color .15s, border-color .15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); }
.btn-danger { background: transparent; color: var(--danger); }
.btn-danger:hover { background: var(--surface-alt); }

/* Inventory */
.inventory-section { padding: 0; overflow: hidden; }
.section-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s-5) var(--s-6); border-bottom: 1px solid var(--border); }
.section-head h2 { font-size: 17px; font-weight: 700; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table thead th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); padding: var(--s-3) var(--s-6); background: var(--surface-alt); position: sticky; top: 0; border-bottom: 1px solid var(--border); }
.data-table tbody td { padding: var(--s-4) var(--s-6); border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:nth-child(even) td { background: var(--surface-alt); }
.data-table tbody tr:hover td { background: var(--primary-soft); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .col-actions { text-align: right; white-space: nowrap; }
.row-actions { display: inline-flex; gap: var(--s-2); }
.empty-row td { padding: var(--s-10) var(--s-6); text-align: center; border-bottom: 0; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); color: var(--text-muted); }
.empty-state svg { color: var(--text-subtle); }
.empty-state p { font-size: 14px; }

/* Responsive */
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 0; left: 0; width: 280px; height: 100vh; z-index: 50; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  .sidebar.is-open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; }
  .main { padding: var(--s-4); gap: var(--s-4); }
  .stats, .sale-details { grid-template-columns: 1fr; }
  .data-table thead th, .data-table tbody td { padding: var(--s-3) var(--s-4); }
  .section-head { padding: var(--s-4); }
  .topbar-title h1 { font-size: 22px; }
}