/* MostStack design system: tokens, app shell, components. Light and dark. */

/* Dark is the default theme; [data-theme="light"] switches. */
:root, :root[data-theme="dark"] {
  --bg: #0a0e16;
  --bg-glow: radial-gradient(1200px 600px at 85% -10%, rgba(45, 212, 191, 0.08), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(56, 189, 248, 0.06), transparent 60%);
  --surface: #111725;
  --surface-2: #161d2e;
  --surface-3: #1e2638;
  --border: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.22);
  --text: #eef2f7;
  --text-2: #cbd5e1;
  --muted: #8b97ab;
  --accent: #2dd4bf;
  --accent-2: #38bdf8;
  --accent-hover: #5eead4;
  --accent-text: #04201c;
  --accent-grad: linear-gradient(135deg, #2dd4bf 0%, #38bdf8 100%);
  --accent-soft: rgba(45, 212, 191, 0.12);
  --accent-soft-text: #5eead4;
  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.12);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.12);
  --info: #7dd3fc;
  --info-soft: rgba(125, 211, 252, 0.1);
  --ring: 0 0 0 3px rgba(45, 212, 191, 0.28);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px -12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.7);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar: 260px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f6fa;
  --bg-glow: radial-gradient(1200px 600px at 85% -10%, rgba(13, 148, 136, 0.07), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f3f5f9;
  --surface-3: #e8ecf2;
  --border: #e3e8ef;
  --border-strong: #cfd6e0;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --accent: #0d9488;
  --accent-2: #0284c7;
  --accent-hover: #0f766e;
  --accent-text: #ffffff;
  --accent-grad: linear-gradient(135deg, #0d9488 0%, #0284c7 100%);
  --accent-soft: #e6f6f4;
  --accent-soft-text: #0f766e;
  --ok: #15803d;
  --ok-soft: #e8f7ee;
  --warn: #b45309;
  --warn-soft: #fef5e6;
  --bad: #b91c1c;
  --bad-soft: #fdeeee;
  --info: #0369a1;
  --info-soft: #eaf5fc;
  --ring: 0 0 0 3px rgba(13, 148, 136, 0.22);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 6px 20px -10px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, 0.22);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg-glow), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 14px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 22px; height: 22px; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  /* Its own layer above the page (the blur makes one anyway), so its menus and tooltips cover the page's switches. */
  position: sticky; top: 0; z-index: 35; height: 100vh; display: flex; flex-direction: column; gap: 2px;
  padding: 20px 14px; background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(12px); border-right: 1px solid var(--border); overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; font-weight: 700; font-size: 16px; color: var(--text); letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.ws-wrap { position: relative; margin-bottom: 10px; }
.ws-button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text);
  font: inherit; cursor: pointer; text-align: left;
}
.ws-button:hover { border-color: var(--border-strong); }
.ws-button .ws-text { flex: 1; min-width: 0; }
.ws-button .ws-name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-button .ws-label { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.avatar {
  width: 32px; height: 32px; border-radius: 10px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-grad); color: var(--accent-text); font-weight: 700; font-size: 12px;
}
.avatar.round { border-radius: 50%; background: var(--surface-3); color: var(--text-2); }
.nav-section { padding: 16px 10px 4px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin: 1px 0; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--accent-soft); color: var(--accent-soft-text); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.nav-link .count { margin-left: auto; font-size: 11.5px; font-weight: 600; padding: 0 7px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }
.sidebar .spacer { flex: 1; }
.userbox { position: relative; display: flex; align-items: center; gap: 6px; padding: 10px 0 0; margin-top: 8px; border-top: 1px solid var(--border); }
/* Your profile: opens the menu with light / dark and sign out. Notices sit next to it. */
.userbtn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.userbtn:hover, .userbtn[aria-expanded="true"] { background: var(--surface-2); }
.userbox .who { flex: 1; min-width: 0; font-size: 13px; }
.userbox .who > span, .usermenu-head > div { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userbox .who .name { font-weight: 600; }
.userbox .usermenu { top: auto; bottom: calc(100% + 6px); left: 0; right: 0; min-width: 220px; max-height: none; }
.usermenu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.usermenu-head .name { font-weight: 600; }
.usermenu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.usermenu button:hover { background: var(--surface-2); }
.usermenu a.menuitem { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.usermenu a.menuitem:hover { background: var(--surface-2); }
/* Opened from the Shopify admin: one store, so no members to manage here. */
.app-mode .tabs a[href^="/members"] { display: none; }
.usermenu .theme-toggle > span { align-items: center; gap: 10px; }
.usermenu .theme-toggle .moon { display: inline-flex; }
.mainarea { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
/* Grows with the window (zoomed out or a wide screen) so tables get the room; text blocks keep their own line length. */
.content { width: 100%; max-width: 1840px; margin: 0 auto; padding: 36px 40px 80px; }
.content > * + *, .stack > * + * { margin-top: 24px; }
.content > .crumbs + .page-head { margin-top: 8px; }
.banner { display: flex; gap: 8px; align-items: center; padding: 10px 32px; background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: 13px; }

/* Popover menu (workspace switcher) */
.popover {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px); max-height: 60vh; overflow: auto; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.popover a {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text);
}
.popover a:hover { background: var(--surface-2); text-decoration: none; }
.popover .sep { height: 1px; background: var(--border); margin: 6px 0; }
.popover .current { font-weight: 600; }
.popover .current::after { content: "✓"; margin-left: auto; color: var(--accent); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 50; transform: translateX(-102%); transition: transform 0.2s ease; box-shadow: var(--shadow-lg); }
  .shell.nav-open .sidebar { transform: none; }
  .scrim { display: none; }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 45; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
  .topbar .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .content { padding: 20px 16px 56px; }
  .content > * + *, .stack > * + * { margin-top: 18px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .stat .value { font-size: 22px; }
  .page-head h1 { font-size: 22px; }
  .banner { padding: 10px 16px; }
}
@media (min-width: 901px) { .scrim { display: none; } }

/* ---------- Collapsed sidebar (wide screens): an icon rail, labels as tooltips ---------- */
.sidebar-toggle { color: var(--muted); }
@media (max-width: 900px) { .sidebar .sidebar-toggle { display: none; } }
@media (min-width: 901px) {
  .shell { transition: grid-template-columns 0.2s ease; }
  :root[data-sidebar="collapsed"] { --sidebar: 76px; }
  :root[data-sidebar="collapsed"] .sidebar { padding-left: 12px; padding-right: 12px; overflow: visible; }
  :root[data-sidebar="collapsed"] .brand-row { flex-direction: column; gap: 6px; }
  :root[data-sidebar="collapsed"] .brand-row .brand { padding: 4px 0 6px; }
  :root[data-sidebar="collapsed"] .brand-row .brand > span:not(.brand-expand) { display: none; }
  /* Collapsed, the logo turns into the expand button on hover; the panel button itself goes. */
  :root[data-sidebar="collapsed"] .sidebar-toggle { display: none; }
  /* Collapsed: the empty space below the menu expands it, shown by an expand cursor (the logo turns into the expand icon itself). */
  :root[data-sidebar="collapsed"] .brand { cursor: pointer; }
  :root[data-sidebar="collapsed"] .sidebar .spacer { cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect width='18' height='18' x='3' y='3' rx='3' fill='%23111' stroke='white'/><path d='M9 3v18'/><path d='m14 9 3 3-3 3'/></svg>") 12 12, e-resize; }
  :root[data-sidebar="collapsed"] .brand:hover img { display: none; }
  :root[data-sidebar="collapsed"] .brand:hover .brand-expand { display: grid; }
  :root[data-sidebar="collapsed"] .sidebar .spacer { min-height: 40px; }
  :root[data-sidebar="collapsed"] .ws-button { justify-content: center; padding: 8px 0; }
  :root[data-sidebar="collapsed"] .ws-button > :not(.avatar) { display: none; }
  :root[data-sidebar="collapsed"] .ws-wrap .popover { right: auto; width: 260px; }
  :root[data-sidebar="collapsed"] .nav-section { font-size: 0; padding: 0; height: 1px; margin: 12px 6px; background: var(--border); }
  :root[data-sidebar="collapsed"] .nav-link { position: relative; justify-content: center; padding: 10px 0; }
  :root[data-sidebar="collapsed"] .nav-link > span { display: none; }
  :root[data-sidebar="collapsed"] .nav-link::after {
    content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
    padding: 6px 11px; border-radius: 10px; background: #0b0d12; color: #f3f4f6; font-size: 13px; font-weight: 550; white-space: nowrap;
    box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity 0.12s; z-index: 70;
  }
  :root[data-sidebar="collapsed"] .nav-link:hover::after, :root[data-sidebar="collapsed"] .nav-link:focus-visible::after { opacity: 1; }
  :root[data-sidebar="collapsed"] .userbox { flex-direction: column; gap: 6px; padding-left: 0; padding-right: 0; }
  :root[data-sidebar="collapsed"] .userbox .who { display: none; }
  :root[data-sidebar="collapsed"] .userbtn { flex: none; justify-content: center; }
  :root[data-sidebar="collapsed"] .userbox .usermenu { left: 0; right: auto; width: 240px; }
}
@media (prefers-reduced-motion: reduce) { .shell { transition: none; } }
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* ---------- Page header, breadcrumbs, tabs ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; }
.page-head .titles { flex: 1; min-width: 240px; }
.page-head h1 { font-size: 26px; font-weight: 700; line-height: 1.25; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head .sub { margin: 6px 0 0; color: var(--muted); max-width: 720px; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* The underline is drawn inside each tab (no negative margin), so the bar never overflows
   vertically; on narrow screens it scrolls sideways without showing a scrollbar. */
.tabs { display: flex; gap: 4px; box-shadow: inset 0 -1px 0 var(--border); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 10px 14px 12px; color: var(--muted); font-weight: 600; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.tab-sub { margin: 18px 0 0; color: var(--muted); max-width: 760px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  font: inherit; font-weight: 600; font-size: 13.5px; color: var(--text-2); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent-grad); border-color: transparent; color: var(--accent-text); box-shadow: 0 6px 18px -8px rgba(45, 212, 191, 0.6); }
.btn.primary:hover { filter: brightness(1.08); color: var(--accent-text); }
.btn.ghost { background: none; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon-only { width: 38px; padding: 0; }
.btn.sm.icon-only { width: 30px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 16px; }
.field > .label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.hint { display: block; font-size: 12.5px; color: var(--muted); margin-top: 6px; font-weight: 400; }
.input, .select, .textarea {
  display: block; width: 100%; height: 40px; padding: 0 12px; font: inherit; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
}
.textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.input.inline, .select.inline { display: inline-block; width: auto; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; color: var(--text-2); }
.check input[type="radio"] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
/* On/off settings are switches, not ticks: easier to read at a glance. */
.check input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 42px; height: 24px; margin: 0;
  border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.check input[type="checkbox"]::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--muted); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); transition: transform 0.15s ease, background 0.15s ease;
}
.check input[type="checkbox"]:checked { background: var(--accent-grad); border-color: transparent; }
.check input[type="checkbox"]:checked::after { transform: translateX(18px); background: #fff; }
.check input[type="checkbox"]:focus-visible { box-shadow: var(--ring); }
.check input[type="checkbox"]:disabled { opacity: 0.5; cursor: not-allowed; }
.check:has(input[type="checkbox"]) { font-weight: 600; color: var(--text); gap: 12px; padding: 4px 0; }
@media (prefers-reduced-motion: reduce) { .check input[type="checkbox"], .check input[type="checkbox"]::after { transition: none; } }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 20px; }
.searchbox { position: relative; }
.searchbox .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.searchbox .input { padding-left: 36px; }
.copyfield { display: flex; align-items: center; gap: 8px; padding: 5px 5px 5px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.copyfield code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

/* ---------- Cards and layout ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 18px 24px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.card-head .sub { order: 2; color: var(--muted); font-size: 13px; flex-basis: 100%; margin-top: -8px; }
.card-head .actions { order: 1; margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.card-body { padding: 24px; }
.card-body.tight { padding: 0; }
.card-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 24px; align-items: start; }
.cols > * { min-width: 0; }
@media (max-width: 1000px) { .cols { grid-template-columns: 1fr; } }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat { display: block; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); text-align: left; font: inherit; color: inherit; }
.stat .label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 500; }
.stat .value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .foot { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
button.stat { cursor: pointer; }
button.stat:hover { border-color: var(--border-strong); }
button.stat.on { border-color: var(--accent); box-shadow: var(--ring); }
.stats.compact { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stats.compact .stat { padding: 12px 14px; }
.stats.compact .value { font-size: 20px; margin-top: 2px; }

/* Tables */
.table-wrap { overflow-x: auto; overflow-y: hidden; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th {
  text-align: left; padding: 11px 20px; background: var(--surface-2);
  color: var(--muted); font-size: 12px; font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: var(--surface-2); }
.table tr.dim td { color: var(--muted); }
.table .primary-cell { font-weight: 600; color: var(--text); }
.table .sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; font-weight: 400; }
.table th.num, .table td.num { text-align: right; }
.card > .table-wrap:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.card > .table-wrap:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--border); }

/* Status pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.pill.plain::before { display: none; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.accent { background: var(--accent-soft); color: var(--accent-soft-text); }

/* Callouts and empty states */
.callout { display: flex; gap: 12px; padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--info-soft); color: var(--text-2); }
.callout > .icon { color: var(--info); margin-top: 1px; }
.callout.ok { background: var(--ok-soft); } .callout.ok > .icon { color: var(--ok); }
.callout.warn { background: var(--warn-soft); } .callout.warn > .icon { color: var(--warn); }
.callout.bad { background: var(--bad-soft); } .callout.bad > .icon { color: var(--bad); }
.callout .grow { flex: 1; min-width: 0; }
.callout .title { font-weight: 650; color: var(--text); }
.callout + .callout { margin-top: 12px; }
.callout + .table-wrap, .stats + .callout { margin-top: 16px; }
.callout ul, .callout ol { margin: 6px 0 0; padding-left: 18px; }
.callout .examples { font-size: 12.5px; color: var(--muted); margin-top: 2px; word-break: break-word; }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 48px 24px; color: var(--muted); }
.empty .icon-wrap { width: 52px; height: 52px; border-radius: 16px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-soft-text); margin-bottom: 8px; }
.empty h3 { color: var(--text); font-size: 16px; }
.empty p { margin: 0 0 10px; max-width: 440px; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 14px; padding: 14px 24px; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; overflow-wrap: anywhere; }
.list .meta { font-size: 12.5px; color: var(--muted); }
.list > li.link { cursor: pointer; }
.list > li.link:hover { background: var(--surface-2); }
.tile-icon { width: 40px; height: 40px; border-radius: 12px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.tile-icon.accent { background: var(--accent-soft); color: var(--accent-soft-text); border-color: transparent; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; word-break: break-word; }
ol.steps-list { margin: 0; padding-left: 20px; }
ol.steps-list li { margin-bottom: 6px; }

/* Wizard */
.stepper { display: flex; gap: 10px; flex-wrap: wrap; }
.stepper .s { display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 13px; background: var(--surface); border: 1px solid var(--border); }
.stepper .s .n { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-3); font-size: 12px; }
.stepper .s.active { color: var(--text); border-color: var(--accent); }
.stepper .s.active .n { background: var(--accent); color: var(--accent-text); }
.stepper .s.done { color: var(--text-2); cursor: pointer; }
.stepper .s.done .n { background: var(--accent-soft); color: var(--accent-soft-text); }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.choice {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 20px; text-align: left; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; box-shadow: var(--shadow-sm);
}
.choice:hover { border-color: var(--border-strong); }
.choice.on { border-color: var(--accent); box-shadow: var(--ring); }
.choice .t { font-weight: 650; }
.choice .d { color: var(--muted); font-size: 13px; }
.choice .corner { position: absolute; top: 14px; right: 14px; }
.wizard-foot { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 10px; align-items: center; padding: 14px 0 18px; background: linear-gradient(to top, var(--bg) 75%, transparent); }
.wizard-foot .grow { flex: 1; }

/* Column mapping */
.maprow { display: grid; grid-template-columns: 220px minmax(200px, 1fr) minmax(160px, 1fr); gap: 8px 20px; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--border); }
.maprow:last-child { border-bottom: 0; }
.maprow .fname { font-weight: 600; }
.maprow .fname .req { color: var(--bad); margin-left: 2px; }
.maprow .fname .hint { margin-top: 2px; }
.maprow .sample { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Each option on its own line, starting under the column picker. */
.maprow .opts { grid-column: 2 / -1; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.maprow .opts > label.small { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.maprow .opts .hint { display: block; margin-top: -4px; }
.calcbox { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.calcbox > label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.calcbox details { width: min(520px, 100%); }
.calcbox details[open] > summary { margin-bottom: 8px; }
.maprow .fixed { margin-top: 6px; }
@media (max-width: 760px) { .maprow { grid-template-columns: 1fr; } .maprow .opts { grid-column: auto; } .maprow .sample { white-space: normal; } }

/* File browser */
.browser { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.browser .path { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 13px; }
.browser .path button { background: none; border: 0; padding: 2px 6px; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; border-radius: 4px; }
.browser .entries { max-height: 360px; overflow: auto; }
.browser .entry { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 14px; background: none; border: 0; border-bottom: 1px solid var(--border); font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.browser .entry:last-child { border-bottom: 0; }
.browser .entry:hover { background: var(--surface-2); }
.browser .entry.on { background: var(--accent-soft); }
.browser .entry .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Dialogs */
dialog.modal { width: min(560px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border-strong); border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog.modal.wide { width: min(780px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(12, 17, 29, 0.55); backdrop-filter: blur(2px); }
dialog.modal .modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px 0; }
dialog.modal .modal-head h2 { flex: 1; font-size: 17px; }
dialog.modal .modal-body { padding: 16px 22px; max-height: 70vh; overflow: auto; }
dialog.modal .modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; border-top: 1px solid var(--border); }

/* Toasts, loaders, disclosure */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; max-width: min(380px, calc(100vw - 40px)); pointer-events: none; }
.toast { padding: 12px 14px; border-radius: var(--radius); background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 13.5px; pointer-events: auto; }
.toast.bad { background: var(--bad); color: #fff; }
.loader { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 48px 20px; color: var(--muted); }
.loader.inline { padding: 8px 0; justify-content: flex-start; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin 0.7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
details.disclose > summary { cursor: pointer; color: var(--accent); font-weight: 600; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose > summary::before { content: "▸"; font-size: 11px; transition: transform 0.15s; }
details.disclose[open] > summary::before { transform: rotate(90deg); }
details.disclose[open] > summary { margin-bottom: 14px; }

/* Sign-in */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(ellipse at top, var(--accent-soft), transparent 60%), var(--bg); }
.auth .card { width: min(420px, 100%); padding: 36px; border-radius: 22px; }
.auth .brand { justify-content: center; padding: 0 0 6px; font-size: 20px; }
.auth h1 { font-size: 20px; text-align: center; margin-top: 14px; }
.auth .sub { text-align: center; color: var(--muted); margin: 6px 0 22px; }
.auth .btn.primary { width: 100%; height: 40px; }
.auth .msg { margin-top: 14px; font-size: 13px; text-align: center; }
.auth .msg.error { color: var(--bad); }
.auth .switch { text-align: center; margin-top: 18px; font-size: 13px; }

/* Theme switch */
.theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: inline-flex; }
:root[data-theme="light"] .theme-toggle .moon { display: none; }
.form-grid + .check, .field + .check { margin-top: 4px; }
.kv .mono { word-break: break-all; }

/* Notices */
.nav-link .count.info { background: var(--info-soft); color: var(--info); }
/* Notices bell, next to the logo (and in the phone top bar) */
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0 22px; }
.brand-row .brand { padding-bottom: 0; }
.bell { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--text-2); }
.bell:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.bell.active { background: var(--accent-soft); color: var(--accent-soft-text); }
.bell .badge { position: absolute; top: 1px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; line-height: 1; background: var(--bad); color: #fff; box-shadow: 0 0 0 2px var(--surface); }
.bell .badge.info { background: var(--accent); }
.topbar .bell-slot { margin-left: auto; }
/* A switch alone in a table row or a page header */
.table th.shrink, .table td.shrink { width: 1%; white-space: nowrap; }
.check.onoff { padding: 0; font-weight: 600; }
.page-head .actions .check.onoff { margin-right: 6px; }
.tile-icon.sev-bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.tile-icon.sev-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tile-icon.sev-info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.list > li.unread .title::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: middle; }
/* Notices can wrap to several lines: keep their icon and buttons level with the title. Every
   other list row stays vertically centred. */
.list > li.notice { align-items: flex-start; }
.list > li.notice > .btn { margin-top: 2px; }
.list > li > .pill, .list > li > .btn, .list > li > .select { flex: none; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Schedule picker */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; flex-wrap: wrap; }
.segmented button { border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; padding: 7px 14px; border-radius: 9px; cursor: pointer; }
.segmented button:hover { color: var(--text); }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.sched-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 12px; }
.daypick { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.daypick button { width: 48px; height: 34px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.daypick button.on { background: var(--accent-soft); color: var(--accent-soft-text); border-color: var(--accent); }
.timechip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-soft-text); font-weight: 600; font-variant-numeric: tabular-nums; }
.timechip button { border: 0; background: none; color: inherit; cursor: pointer; display: inline-flex; padding: 2px; border-radius: 50%; }
.timechip button:hover { background: var(--surface-3); }
.sched-next { margin-top: 12px; color: var(--text-2); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.table tbody tr.selected td { background: var(--accent-soft); }
.bar { flex: 1; min-width: 80px; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--accent-grad); }
.qtywords { width: 100%; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.qtyword { display: inline-flex; align-items: center; gap: 8px; margin: 0 18px 8px 0; }

/* A supplier's notes: kept as written, line breaks included */
.notes-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; color: var(--text-2); }

/* Dropdown with a search box (brands) */
.ss { position: relative; display: inline-block; min-width: 200px; max-width: 280px; }
.ss-btn { display: flex; align-items: center; width: 100%; height: 38px; text-align: left; cursor: pointer; }
.ss-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-pop { position: absolute; z-index: 45; top: calc(100% + 6px); left: 0; width: max(100%, 300px); padding: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.ss-pop ul { list-style: none; margin: 8px 0 0; padding: 0; max-height: 320px; overflow: auto; }
.ss-pop li { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text); }
.ss-pop li .meta { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.ss-pop li.active { background: var(--surface-2); }
.ss-pop li.current { font-weight: 600; color: var(--accent-soft-text); }
.ss-pop li.none { color: var(--muted); cursor: default; }

/* Progress while a new supplier's first import runs */
.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress span { display: block; height: 100%; width: 5%; border-radius: inherit; background: var(--accent-grad); transition: width 0.2s linear; }
.steps { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 10px; }
.steps li { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.steps li::before { content: ""; flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); }
.steps li.now { color: var(--text); font-weight: 600; }
.steps li.now::before { border-color: var(--accent); border-right-color: transparent; animation: spin 0.8s linear infinite; }
.steps li.done { color: var(--text-2); }
.steps li.done::before { border-color: var(--ok, #22c55e); background: var(--ok, #22c55e); box-shadow: inset 0 0 0 3px var(--surface); }

/* Confirmation windows (instead of the browser's own) */
.ask-body { display: flex; gap: 16px; align-items: flex-start; padding: 24px 24px 18px; }
.ask-body h2 { margin: 2px 0 6px; font-size: 17px; line-height: 1.35; }
.ask-text { color: var(--text-2); line-height: 1.55; }
.ask-icon { flex: none; }
.ask-icon.danger { background: var(--bad-soft); color: var(--bad); }
.ask-icon.live, .ask-icon.primary { background: var(--accent-soft); color: var(--accent-soft-text); }
.ask-icon.warn { background: var(--warn-soft); color: var(--warn); }
.btn.danger-solid { background: var(--bad); border-color: transparent; color: #fff; }
.btn.danger-solid:hover { filter: brightness(1.08); }

/* Password field with a show/hide eye */
.pw { position: relative; }
.pw .input { padding-right: 44px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.pw-eye:hover { color: var(--text); background: var(--surface-2); }
.pw-eye:disabled { opacity: 0.5; cursor: wait; }

/* New products: review before creating in Shopify */
.np-tools { gap: 10px; padding: 12px 20px; }
.np-tools .grow { flex: 1; }
.np-bulk { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.np-head, .np-row { display: grid; grid-template-columns: 52px minmax(260px, 1fr) 150px 150px 96px 96px 90px 38px; gap: 8px; align-items: start; padding: 0 20px; }
.np-head { padding-top: 10px; padding-bottom: 10px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--muted); position: sticky; top: 0; z-index: 6; }
/* Reordering variants: a line where the dragged one will land. */
.np-var.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.np-var.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
/* Right-aligned like the numbers in the fields below (same inner padding). */
.np-head .num { text-align: right; padding-right: 13px; }
.np-product { border-bottom: 1px solid var(--border); padding: 12px 0; transition: background 0.12s, box-shadow 0.12s; }
.np-product:last-child { border-bottom: 0; }
.np-product.group { background: color-mix(in srgb, var(--accent-soft) 35%, transparent); }
.np-product.dim { opacity: 0.55; }
.np-product.dropon { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.np-row + .np-row { margin-top: 6px; }
.np-var { padding-top: 0; }
.np-var .np-titlecell { padding-left: 18px; border-left: 2px solid var(--border-strong); margin-left: 4px; display: flex; gap: 10px; align-items: center; }
.np-var .np-titlecell .input { max-width: 200px; }
.np-orig { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.np-row.dragging { opacity: 0.4; }
.np-grip { display: flex; align-items: center; gap: 6px; height: 36px; }
.np-grip input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.handle { display: inline-grid; place-items: center; width: 22px; height: 28px; border-radius: 6px; color: var(--muted); cursor: grab; }
.handle:hover { background: var(--surface-3); color: var(--text); }
.np-titlecell { min-width: 0; }
.np-sub { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.np-sub .input { flex: 1 1 140px; min-width: 120px; }
/* A brand is a short word: its field stays narrow, the option names get the rest. */
.np-sub .input[data-f="vendor"] { flex: 0 1 170px; }
.np-sub .input[data-f="option"] { flex: 0 1 240px; }
.np-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.np-in { height: 36px; padding: 0 10px; }
.np-in.sm { height: 32px; font-size: 13px; }
.np-in.num { text-align: right; padding-right: 12px; }
.np-in.np-title { font-weight: 600; }
.np-in.missing { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.np-in.clash { border-color: var(--bad); background: var(--bad-soft); }
.np-in.warnf { border-color: var(--warn); }
.np-in.newval { border-style: dashed; }
.np-actions { display: flex; justify-content: flex-end; height: 36px; align-items: center; }
.np-sugg { margin: 6px 0 0; padding-left: 18px; max-height: 280px; overflow: auto; }
.np-sugg li { margin-bottom: 4px; }
.np-confirm { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 8px; }
.np-confirm li { display: flex; gap: 8px; align-items: flex-start; }
.np-confirm .icon { margin-top: 2px; color: var(--muted); }
.np-results { max-height: 50vh; overflow: auto; }
.np-results > li { padding: 10px 0; }
/* The variant fields line up under the header on wide screens, and stack two by two on narrow ones. */
.np-cells { display: contents; }
.np-cells.np-empty::before { content: ""; grid-column: span 5; }
@media (max-width: 1100px) {
  .np-head { display: none; }
  .np-row { grid-template-columns: 52px minmax(0, 1fr) 36px; }
  .np-titlecell, .np-cells { grid-column: 2; }
  .np-actions { grid-column: 3; grid-row: 1; }
  .np-cells { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px; }
  .np-cells.np-empty { display: none; }
  .np-var .np-titlecell { margin-left: 0; }
  .np-tools { padding: 12px 16px; }
  .np-head, .np-row { padding: 0 12px; }
}
@media (max-width: 600px) {
  .np-row { grid-template-columns: 30px minmax(0, 1fr) 32px; gap: 6px; }
  .np-grip { flex-direction: column; height: auto; gap: 4px; padding-top: 6px; }
  .np-cells { grid-template-columns: 1fr 1fr; }
  .np-var .np-titlecell { flex-wrap: wrap; padding-left: 10px; }
  .np-orig { display: none; }
  .np-all { padding-left: 0; }
  .wizard-foot { flex-wrap: wrap; }
  .wizard-foot #footInfo { order: -1; flex-basis: 100%; }
}

/* Supplier products: picking products to create in Shopify */
.pickbar { position: sticky; bottom: 0; z-index: 6; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px; margin-top: 16px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--accent); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.pickbar .grow { flex: 1; }
.table td.pickcell, .table th.pickcell { width: 1%; padding-right: 0; }
.table td.pickcell input, .table th.pickcell input { width: 16px; height: 16px; accent-color: var(--accent); }
.table tr.picked td { background: var(--accent-soft); }

/* Store products: drop a product list */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 20px; text-align: center; border: 2px dashed var(--border-strong); border-radius: var(--radius); color: var(--muted); cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.dropzone .icon-wrap { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-soft-text); }
.dropzone b { color: var(--text); }
.np-all { height: auto; padding-left: 28px; }

/* Store products: the store's cost differs from a supplier file's (quiet, look when convenient). */
.costdiff { display: inline-flex; vertical-align: -2px; margin-left: 5px; color: var(--warn); cursor: help; }

/* Supplier products from a Shopify store: a product with its variants folded underneath. */
.table .prow .primary-cell { display: flex; align-items: center; gap: 6px; }
.vtoggle { margin-left: -6px; flex: none; }
.vtoggle .icon { transition: transform 0.15s ease; }
.vtoggle.open .icon { transform: rotate(90deg); }
.vchips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; max-width: 520px; }
.vchips[hidden] { display: none; }
.vchip { display: inline-flex; align-items: center; gap: 6px; padding: 1px 2px 1px 8px; min-height: 22px; border-radius: 999px; font-size: 11.5px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.vchip:not(:has(.vq)) { padding-right: 8px; }
/* Stock as its own small count, so "120cm 3" doesn't read as one name. */
.vchip .vq { min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-weight: 650; font-size: 11px; line-height: 17px; text-align: center; font-variant-numeric: tabular-nums; }
.vchip.ok { color: var(--text-2); }
.vchip.instore { border-style: dashed; opacity: 0.7; }
.table tr.vrow td { background: color-mix(in srgb, var(--surface-2) 45%, transparent); padding-top: 7px; padding-bottom: 7px; }
.table tr.vrow td:nth-child(1):not(.pickcell), .table tr.vrow td.pickcell + td { padding-left: 46px; }
.table tr.vrow .vname { font-weight: 550; }
@media (prefers-reduced-motion: reduce) { .vtoggle .icon { transition: none; } }

/* Expand / collapse navigation: the logo's stand-in and the tooltip with its shortcut. */
.brand-expand { display: none; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); color: var(--text); }
.navtip {
  position: fixed; z-index: 200; transform: translateY(-50%); display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 11px;
  border-radius: 10px; background: #0b0d12; color: #f3f4f6; font-size: 13px; font-weight: 550; white-space: nowrap; pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.navtip[hidden] { display: none; }
.navtip span { margin-right: 4px; }
.navtip kbd { min-width: 22px; height: 22px; padding: 0 5px; display: grid; place-items: center; border-radius: 6px; background: #2a2d35; color: #e5e7eb; font: 600 12px/1 inherit; font-family: inherit; }

/* New products: variants for a product the store already has. */
.np-addto { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 38px; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent-soft-text); font-weight: 600; }
.np-addto a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* Add new products: the two ways in, compact and side by side, so the lists below get the attention. */
.add-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: stretch; }
.add-grid > .card { margin: 0; }
.add-way { display: flex; flex-direction: column; gap: 14px; padding: 20px 24px; }
.add-way-head h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 15px; }
.add-way-head .sub { color: var(--muted); font-size: 13px; }
.add-way-body { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: auto; }
.add-way-body > span { flex: 1; min-width: 180px; }
.dropzone.compact { flex-direction: row; justify-content: flex-start; gap: 14px; padding: 14px 16px; text-align: left; margin-top: auto; }
.dropzone.compact .icon-wrap { width: 40px; height: 40px; border-radius: 12px; flex: none; }
.dropzone.compact .dz-text { display: flex; flex-direction: column; gap: 2px; }
.supplier-pick { max-height: 60vh; overflow: auto; }
.supplier-pick li[hidden] { display: none; }
@media (max-width: 1100px) { .add-grid { grid-template-columns: 1fr; } }

/* Number fields have no spinner arrows: a stray click (or scroll, see common.js) could change a price. */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* New products: a Compare-at column when the pricing rules set one. */
.np-head.np-compare, .np-compare .np-row { grid-template-columns: 52px minmax(260px, 1fr) 135px 135px 92px 92px 92px 82px 38px; }
.np-compare .np-cells.np-empty::before { grid-column: span 6; }
.np-rules { margin: 0; padding: 8px 20px; border-bottom: 1px solid var(--border); }
/* A product with the same name already in the store: which one, and the Replace choice. */
.np-same { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; padding: 7px 10px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--text-2); font-size: 12.5px; }
.np-same a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.np-same .np-replace { margin-top: 2px; font-weight: 600; color: var(--text); }

/* New products: the overview before creating. */
dialog.modal.xwide { width: min(1240px, calc(100vw - 32px)); }
.np-ov { max-height: 52vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 14px; }
.np-ov-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Supplier overview: per brand, how much of it is in the store. */
.brandlist li { align-items: center; }
.brandlist .bar { flex: none; min-width: 0; height: 4px; margin-top: 7px; max-width: 280px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.brandlist .bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent-grad); }

/* Linked blocks (stat tiles, cards, pills) show hover with their background and border, never an underline;
   only plain text links underline. */
a.stat, a.card, a.pill { text-decoration: none; }
a.stat, a.card { color: inherit; transition: background 0.12s, border-color 0.12s; }
a.stat:hover, a.card:hover { text-decoration: none; background: var(--surface-2); border-color: var(--border-strong); }
a.pill:hover { text-decoration: none; filter: brightness(1.25); }

/* Skeleton loaders: grey shapes where the content will be, with a soft shimmer. */
.skeleton { --sk-base: var(--surface-3); --sk-shine: color-mix(in srgb, var(--surface-3) 55%, var(--text) 8%); padding: 18px 20px; }
.skeleton .sk { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--sk-base) 0%, var(--sk-shine) 40%, var(--sk-base) 80%) 0 0 / 300% 100%; animation: sk-shine 1.4s ease-in-out infinite; }
.skeleton .sk.sm { height: 9px; opacity: 0.7; }
.sk-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.sk-row:last-of-type { border-bottom: 0; }
.sk-row .sk-dot { width: 30px; height: 30px; border-radius: 9px; flex: none; }
.sk-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sk-row .sk-pill { width: 64px; height: 20px; border-radius: 999px; flex: none; }
.sk-page { padding: 0; display: flex; flex-direction: column; gap: 10px; }
.sk-page .sk-title { width: 260px; max-width: 60%; height: 28px; border-radius: 8px; margin-bottom: 4px; }
.sk-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 22px; }
.sk-tile, .sk-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.sk-tile { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.sk-tile .sk-num { width: 40%; height: 24px; }
.sk-card { margin-top: 14px; padding: 6px 20px; }
.sk-caption { margin-top: 12px; color: var(--muted); font-size: 13px; }
@keyframes sk-shine { from { background-position: 100% 0; } to { background-position: -50% 0; } }
@media (max-width: 900px) { .sk-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) { .skeleton .sk { animation: none; } }

/* Column mapping: a row's rules (Price, RRP, Cost) folded into one panel; the summary says what's on. */
.maprow .opts > .rules { align-self: stretch; }
.rules { max-width: 760px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.rules > summary { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; list-style: none; border-radius: inherit; }
.rules > summary::-webkit-details-marker { display: none; }
.rules > summary::after { content: ""; width: 7px; height: 7px; margin-left: auto; flex: none; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-2px); transition: transform 0.15s; }
.rules[open] > summary::after { transform: rotate(225deg) translateY(-2px); }
.rules > summary:hover { background: var(--surface-2); }
.rules-name { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; color: var(--text-2); flex: none; }
.rules-sum { min-width: 0; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rules-body { padding: 2px 14px 6px; border-top: 1px solid var(--border); }
.rule { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 18px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border); }
.rule:last-child { border-bottom: 0; }
.rule-title { font-weight: 550; font-size: 13.5px; }
.rule .hint { margin-top: 2px; }
.rule-control { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.rule-control .select.inline { height: 34px; }
.rule .pct { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.rule .pct .input { width: 76px; height: 34px; }
.rule.rule-wide { grid-template-columns: 1fr; }
.rule.rule-wide [data-calc-brands]:empty { display: none; }
.rule.rule-wide .btn { justify-self: start; }
@media (max-width: 760px) { .rule { grid-template-columns: 1fr; } .rule-control { justify-content: flex-start; flex-wrap: wrap; } }

/* A store product's status next to its name (Active / Draft / Archived). */
.pstatus { display: inline-flex; margin-left: 8px; vertical-align: 1px; font-weight: 500; }

/* Review screen: the copy switch (title, its explanation below) and the pricing note, each on its own row. */
.np-rules { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.np-copyall { align-items: flex-start; gap: 12px; }
.np-copy-text { display: flex; flex-direction: column; gap: 2px; }
.np-copy-title { font-weight: 600; font-size: 13.5px; color: var(--text); }
.np-copy-sub { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.np-pricing-note { color: var(--muted); }

/* A value filled in as a suggestion (e.g. cost and weight from the product's other variants). */
.np-in.suggested { border-style: dashed; border-color: var(--accent); color: var(--accent-soft-text); }
/* The expand icon fills the logo's place at the logo's own size. */
.brand-expand .icon { width: 20px; height: 20px; }

/* The link to the content generation tool: in the sidebar and on Settings. */
.nav-link .ext { margin-left: auto; width: 13px; height: 13px; opacity: 0.6; }
@media (min-width: 901px) { :root[data-sidebar="collapsed"] .nav-link .ext { display: none; } }
.linked-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.linked-row .grow { flex: 1; min-width: 0; }

/* Prices & weight on New products: rules, a preview of what they'd do, and the values they worked out. */
.np-in.calculated { border-color: color-mix(in srgb, var(--info) 55%, var(--border)); background: color-mix(in srgb, var(--info-soft) 60%, var(--surface)); }
.np-pricing-sum { display: flex; align-items: flex-start; gap: 8px; padding: 10px 24px; font-size: 13px; color: var(--text-2); border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--info-soft) 45%, transparent); }
.np-pricing-sum .icon { color: var(--info); margin-top: 2px; }
.pr-rules { display: flex; flex-direction: column; gap: 10px; margin: 14px 0 16px; }
.pr-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.pr-name { width: 92px; font-weight: 650; }
.pr-ops { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pr-ops[hidden] { display: none; }
.pr-row .pct { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.pr-row .pct .input { width: 80px; }
.pr-row .select.inline, .pr-row .input.inline { height: 34px; }
.pr-scope { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 6px; }
.pr-h { font-size: 14px; margin: 16px 0 8px; }
.pr-table { max-height: 42vh; overflow: auto; }
.pr-table td.pr-changed { color: var(--text); font-weight: 650; }
.pr-old { color: var(--muted); font-weight: 400; text-decoration: line-through; margin-right: 6px; }
.pr-table td.pr-warn { color: var(--warn); }
#prWarn .callout { margin-bottom: 10px; }
/* Prices & weight: each rule reads as a formula, with a worked example under it. */
.pr-formula { flex-direction: column; align-items: stretch; }
.pr-formula .pr-name { width: auto; }
.pr-eq { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pr-op { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.pr-eq select[data-r="sign"] { width: 58px; font-weight: 700; text-align: center; }
.pr-example { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; min-height: 26px; }
.pr-example:empty { display: none; }
.pr-step { display: inline-flex; align-items: baseline; gap: 6px; padding: 3px 9px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.pr-step-l { color: var(--muted); }
.pr-step.final { border-color: var(--accent); background: var(--accent-soft); }
.pr-arrow { color: var(--muted); }

/* Settings → General: retries and email alerts */
.set-form { display: flex; flex-direction: column; gap: 12px; }
.set-row { display: flex; flex-direction: column; gap: 6px; }
.set-row[hidden], .set-checks[hidden], .set-form .check[hidden] { display: none; }
.set-checks { display: flex; flex-direction: column; gap: 8px; padding-left: 4px; }
.set-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Store products → Across suppliers */
.ov-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ov-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12.5px; border: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.ov-chip.on { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.ov-chip.on .icon { color: var(--ok); }
.ov-chip.off { border-style: dashed; }
.ov-chip.bad { border-color: var(--bad); }
.ov-pairs { display: flex; flex-wrap: wrap; gap: 8px; }
.ov-pair { padding: 5px 11px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; }
tr.ov-conflict td:first-child { box-shadow: inset 3px 0 0 var(--bad); }

/* Find variants with AI */
.ai-prompt { margin: 12px 0; }
.ai-prompt > summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.ai-prompt textarea { width: 100%; margin-top: 8px; font-family: inherit; font-size: 13px; line-height: 1.45; resize: vertical; }
.ai-prompt-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.ai-groups { border: 1px solid var(--border); border-radius: 10px; max-height: 52vh; overflow: auto; margin-top: 8px; }
.ai-groups > li { align-items: flex-start; padding: 12px 16px; }
.ai-members { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.ai-member { display: inline-flex; gap: 6px; max-width: 100%; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-rejected { margin-top: 10px; font-size: 13px; }
.ai-rejected > summary { cursor: pointer; color: var(--muted); }
.ai-rejected ul { margin: 6px 0 0; padding-left: 18px; }

/* One line on whether a sync has sent the supplier's latest import to Shopify (sync page). */
.strip-note { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--muted); font-size: 13px; }
.strip-note.ok { background: var(--ok-soft); color: var(--text); border-color: transparent; }
.strip-note.ok svg { color: var(--ok); }

/* Stock history chart: one series in the accent colour, a quiet grid, crosshair and tip on hover. */
.schart { margin: 0 0 16px; }
.schart figcaption { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.schart figcaption b { color: var(--text); font-weight: 600; }
.schart-plot { position: relative; }
.schart svg { display: block; inline-size: 100%; block-size: auto; touch-action: pan-y; }
.schart .g { stroke: var(--border); stroke-width: 1; }
.schart .ax { fill: var(--muted); font-size: 11px; }
.schart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.schart .cross { stroke: var(--border-strong); stroke-width: 1; }
.schart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.schart-tip { position: absolute; top: 0; transform: translateX(-50%); display: flex; gap: 8px; padding: 4px 8px; border-radius: 8px; background: var(--surface-3); color: var(--text); font-size: 12px; white-space: nowrap; pointer-events: none; box-shadow: var(--shadow-sm); }
/* Written history: one line per entry, details on click. */
.hist .hist-item { padding: 0; display: block; }
.hist details summary { display: flex; gap: 10px; align-items: center; padding: 10px 0; cursor: pointer; list-style: none; }
.hist details summary::-webkit-details-marker { display: none; }
.hist details.plain summary { cursor: default; }
.hist details[open] summary svg:last-child { transform: rotate(180deg); }
.hist .grow { display: grid; min-width: 0; flex: 1; }
.hist .title { white-space: normal; }
.hist .meta { color: var(--muted); font-size: 12px; }
.hist-details { margin: 0 0 12px 42px; font-size: 13px; color: var(--muted); display: grid; gap: 4px; }
.schart-ranges { margin-left: auto; display: inline-flex; gap: 4px; }
.schart-ranges .btn.on { background: var(--accent-soft); color: var(--accent-soft-text); border-color: transparent; }
.hist-end { margin: 12px 0 0; }

/* Quick tooltips (data-hint): shown at once, kept short; line breaks kept. */
.tip-pop { position: fixed; z-index: 1000; max-width: 300px; padding: 6px 10px; border-radius: 8px; background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-size: 12.5px; line-height: 1.45; white-space: pre-line; pointer-events: none; }
.tip-pop[hidden] { display: none; }

/* The name as drawn in the logo (MOST light, STACK bold, INVENTORY underneath), in the text colour of the theme. */
.wordmark { display: inline-block; block-size: 23px; aspect-ratio: 410 / 74; background-color: currentColor;
  -webkit-mask: url("/brand/moststack-inventory-wordmark.svg") no-repeat center / contain; mask: url("/brand/moststack-inventory-wordmark.svg") no-repeat center / contain; }
.auth .brand .wordmark, .login .brand .wordmark { block-size: 30px; }

/* Adding a supplier whose connection doesn't exist yet: connect it right on the File step. */
.connect-panel { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); }
.connect-panel .title { font-weight: 600; }

/* Send feedback: the button above your profile, and the kind chooser in its dialog. */
.feedback-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; margin-bottom: 8px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted); font: inherit; font-size: 13.5px; cursor: pointer; text-align: left; }
.feedback-btn:hover { background: var(--surface-2); color: var(--text); }
.fb-kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fb-kinds label { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.fb-kinds label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.fb-kinds input { position: absolute; opacity: 0; pointer-events: none; }
.fb-kinds .t { font-weight: 600; font-size: 13.5px; }
.fb-kinds .d { font-size: 12px; color: var(--muted); }
@media (max-width: 560px) { .fb-kinds { grid-template-columns: 1fr; } }
:root[data-sidebar="collapsed"] .feedback-btn span { display: none; }
:root[data-sidebar="collapsed"] .feedback-btn { justify-content: center; }
