/* ─── Apple "Liquid Glass" Light Theme ──────────────────────────────────────
   Translucent frosted surfaces over a soft ambient backdrop. Top-level
   surfaces use backdrop-filter blur; nested fills stay simple to avoid muddy
   double-frost. Lit top edges (inset white) give the glass its sheen. */
:root {
  /* Base tint behind the ambient gradient (mostly covered) */
  --bg:          #eaeef9;

  /* Frosted glass surfaces (translucent — paired with backdrop-filter) */
  --surface:     rgba(255,255,255,0.40);
  --sidebar-bg:  rgba(250,250,254,0.42);
  --card:        rgba(255,255,255,0.38);
  --card-hover:  rgba(255,255,255,0.60);
  --glass-edge:  rgba(255,255,255,0.60);   /* lit outer edge of glass */

  /* Internal hairline separators (table rows, dividers, input borders) */
  --border:      rgba(60,70,110,0.12);
  --border-hi:   rgba(60,70,110,0.22);

  --text:        #1d1d1f;
  --text-muted:  #56565f;
  --text-dim:    #93939d;

  --blue:        #007aff;
  --blue-dim:    rgba(0,122,255,0.13);
  --blue-glow:   rgba(0,122,255,0.18);
  --green:       #34c759;
  --green-dim:   rgba(52,199,89,0.15);
  --red:         #ff3b30;
  --red-dim:     rgba(255,59,48,0.13);
  --amber:       #ff9500;
  --amber-dim:   rgba(255,149,0,0.15);
  --purple:      #af52de;
  --purple-dim:  rgba(175,82,222,0.15);

  --font: system-ui, -apple-system, 'SF Pro Display', sans-serif;

  --radius:    10px;
  --radius-lg: 16px;

  /* Frosted-glass filters — kept modest so compositing stays cheap */
  --glass-blur:        saturate(160%) blur(16px);
  --glass-blur-strong: saturate(170%) blur(26px);

  /* Soft drop shadow + lit top edge */
  --shadow:    0 4px 18px rgba(25,35,70,0.10), inset 0 1px 0 rgba(255,255,255,0.55);
  --shadow-lg: 0 18px 50px rgba(25,35,70,0.22), inset 0 1px 0 rgba(255,255,255,0.6);
  --sidebar-w: 210px;
  color-scheme: light;
}

/* ─── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  /* Soft ambient backdrop so the frosted glass has colour to refract */
  background:
    radial-gradient(1200px 820px at 6% -8%,  rgba(108,150,255,0.38), transparent 55%),
    radial-gradient(1050px 720px at 102% 0%, rgba(255,138,194,0.30), transparent 52%),
    radial-gradient(950px 900px at 50% 118%, rgba(86,202,250,0.34), transparent 55%),
    linear-gradient(160deg, #e9eefb 0%, #f1ecfb 50%, #e7f4fb 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── Layout ─────────────────────────────────────────────────────────────── */
#app { display: flex; height: 100vh; }

/* ─── Glass surfaces ─────────────────────────────────────────────────────────
   Top-level surfaces (sitting directly over the ambient backdrop) get the
   real frosted-glass blur + a lit edge. Nested fills are kept simple. */
.stat-card, .chart-card, .tool-card, .section-card,
.pullsheet-card, .ps-summary {
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge);
}
/* Big scrollable data tables: a solid-ish fill (no backdrop blur) so scrolling
   thousands of rows stays smooth — blurring that whole surface is very costly. */
.table-wrap {
  background: rgba(255,255,255,0.82);
  border: 1px solid var(--glass-edge);
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  backdrop-filter: var(--glass-blur-strong);
  -webkit-backdrop-filter: var(--glass-blur-strong);
  border-right: 1px solid var(--glass-edge);
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.4);
  display: flex;
  flex-direction: column;
  padding-top: 8px;
  user-select: none;
}

.logo-block {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 14px 18px;
  border-bottom: 1px solid var(--border);
}
.brand-logo {
  width: 140px;
  height: auto;
  display: block;
  /* Drop-shadow gives the card a subtle lift against the frosted sidebar */
  filter: drop-shadow(0 2px 6px rgba(216, 90, 48, 0.18));
}
/* Legacy text logo classes — kept for any code path still referencing them */
.logo-hex { display: none; }
.logo-name { display: none; }
.logo-sub { display: none; }

/* ─── Nav ────────────────────────────────────────────────────────────────── */
.nav { display: flex; flex-direction: column; padding: 12px 10px; flex: 1; gap: 3px; }
.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 4px 12px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all 0.1s;
  text-align: left;
  width: 100%;
}

/* Secondary sidebar links (Manage subscription, Need help?) — lighter than
   nav tabs so the two real pages stay the visual priority. */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius);
  text-align: left;
  transition: all 0.1s;
}
.sidebar-link:hover { background: rgba(255,255,255,0.55); color: var(--text); }
.sidebar-link svg { flex-shrink: 0; opacity: 0.65; }
.nav-item:hover { background: rgba(255,255,255,0.55); color: var(--text); }
.nav-item.active {
  background: linear-gradient(180deg, #2b93ff, #007aff);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0,122,255,0.40), inset 0 1px 0 rgba(255,255,255,0.45);
}
.nav-item.active svg { opacity: 1; }
.nav-item svg { flex-shrink: 0; opacity: 0.7; }
.nav-divider { height: 1px; background: var(--border); margin: 6px 4px; }

/* "BETA" pill on individual nav items (pages still under polish) */
.nav-beta {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 149, 0, 0.18);
  color: #c25e00;
  border: 1px solid rgba(255, 149, 0, 0.35);
  line-height: 1.4;
}
.nav-item.active .nav-beta {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
}

.sidebar-footer { padding: 12px 14px; border-top: 1px solid var(--border); }
.sidebar-logout { width: 100%; justify-content: center; margin-bottom: 10px; }

/* Account summary card — who's logged in + plan status */
.account-block {
  padding: 10px 12px;
  margin-bottom: 12px;
  background: rgba(255,255,255,0.34);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius);
}
.account-email {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-plan { display: flex; align-items: center; gap: 7px; margin-top: 6px; flex-wrap: wrap; }
.plan-pill {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--green-dim);
  color: #1a7f37;
  border: 1px solid rgba(52,199,89,0.35);
}
.account-renew { font-size: 10.5px; color: var(--text-muted); }
.ver-badge { font-size: 11px; color: var(--text-muted); }
.copyright { font-size: 10px; color: var(--text-dim); margin-top: 4px; letter-spacing: 0.01em; }

/* ─── Main content ───────────────────────────────────────────────────────── */
/* Transparent so glass cards frost the body's ambient backdrop, not a flat fill */
#main { flex: 1; overflow-y: auto; background: transparent; }
#page { min-height: 100%; }

/* ─── Page header ────────────────────────────────────────────────────────── */
.page-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--glass-edge);
  background: rgba(255,255,255,0.30);
  backdrop-filter: var(--glass-blur-strong);
  -webkit-backdrop-filter: var(--glass-blur-strong);
  box-shadow: 0 1px 12px rgba(25,35,70,0.06);
  position: sticky;
  top: 0;
  z-index: 10;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.page-sub { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.page-body { padding: 20px 24px; }

/* ─── Stat cards ─────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 15px 16px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
}
.stat-card.blue::before  { background: var(--blue); }
.stat-card.green::before { background: var(--green); }
.stat-card.red::before   { background: var(--red); }
.stat-card.amber::before { background: var(--amber); }
.stat-card.purple::before{ background: var(--purple); }

.stat-label { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; letter-spacing: 0.01em; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-meta  { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.stat-delta { font-size: 11px; margin-top: 2px; font-weight: 600; }
.stat-delta.up   { color: var(--green); }
.stat-delta.down { color: var(--red); }

/* ─── Tables ─────────────────────────────────────────────────────────────── */
.table-wrap { background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.table-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.table-toolbar-title { font-size: 13px; font-weight: 600; color: var(--text); margin-right: auto; }

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead tr { border-bottom: 1px solid var(--border); background: rgba(255,255,255,0.22); }
th {
  padding: 9px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: 0.01em;
}
td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,0.42); }
.empty-row td { text-align: center; color: var(--text-muted); padding: 40px; }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.badge-blue   { background: var(--blue-dim);   color: var(--blue); }
.badge-purple { background: var(--purple-dim); color: var(--purple); }
.badge-green  { background: var(--green-dim);  color: #1a8a37; }
.badge-red    { background: var(--red-dim);    color: var(--red); }
.badge-amber  { background: var(--amber-dim);  color: #c87000; }
.badge-gray   { background: rgba(120,128,150,0.16); color: var(--text-muted); }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.1s;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(180deg, #2b93ff, #007aff);
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 14px rgba(0,122,255,0.35), inset 0 1px 0 rgba(255,255,255,0.45);
}
.btn-primary:hover { background: linear-gradient(180deg, #1a86ff, #0066dd); }
.btn-outline {
  background: var(--card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  color: var(--text); border-color: var(--glass-edge);
  box-shadow: var(--shadow);
}
.btn-outline:hover { background: var(--card-hover); border-color: rgba(255,255,255,0.8); }
.btn-danger  { background: transparent; color: var(--red); border-color: rgba(255,59,48,0.3); }
.btn-danger:hover { background: var(--red-dim); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon {
  padding: 5px 7px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--border-hi);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.1s;
  font-size: 12px;
}
.btn-icon:hover { color: var(--red); background: var(--red-dim); border-color: rgba(255,59,48,0.3); }

/* ─── Inputs & Forms ─────────────────────────────────────────────────────── */
.input, select, textarea {
  color-scheme: light;
  background: rgba(255,255,255,0.48);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
  width: 100%;
  transition: border-color 0.1s, box-shadow 0.1s;
  -webkit-appearance: none;
}
.input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-glow);
}
select { background-image: 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='%236e6e73' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; cursor: pointer; }

.form-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-group  { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 12px; font-weight: 600; color: var(--text-muted); }

/* ─── Filter bar ─────────────────────────────────────────────────────────── */
.filter-row {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 12px 24px 0;
}
.filter-row .input { width: 200px; }
.filter-row select { width: 160px; }

/* ─── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(20,25,45,0.28);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: rgba(255,255,255,0.60);
  backdrop-filter: var(--glass-blur-strong);
  -webkit-backdrop-filter: var(--glass-blur-strong);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius-lg);
  width: 560px; max-width: 95vw; max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-box.wide { width: 760px; }
.modal-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--text); }
.modal-close-btn {
  background: rgba(120,128,150,0.18); border: none; color: var(--text-muted);
  cursor: pointer; font-size: 12px; padding: 4px 8px;
  border-radius: 20px; font-weight: 600;
}
.modal-close-btn:hover { background: var(--red-dim); color: var(--red); }
.modal-body { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding-top: 10px; border-top: 1px solid var(--border); margin-top: 8px;
}

/* ─── Auth overlay (login / signup / subscribe gate) ────────────────────────
   Same glass-card language as .modal-box, sized and centered as a standalone
   full-viewport gate rather than a dismissible dialog. */
.auth-overlay {
  position: fixed; inset: 0;
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 408px;
  background: var(--card);
  backdrop-filter: var(--glass-blur-strong);
  -webkit-backdrop-filter: var(--glass-blur-strong);
  border: 1px solid var(--glass-edge);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  padding: 34px 30px 26px;
}
.auth-brand { display: flex; justify-content: center; margin-bottom: 22px; }
.auth-brand .brand-logo { width: 108px; filter: drop-shadow(0 3px 10px rgba(216, 90, 48, 0.20)); }

.auth-heading { font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; margin-bottom: 4px; }
.auth-copy { font-size: 12.5px; color: var(--text-muted); line-height: 1.55; margin-bottom: 18px; }

.auth-field { margin-bottom: 10px; }
.auth-msg { font-size: 11.5px; min-height: 15px; margin-top: 8px; color: var(--red); }
.auth-msg.success { color: var(--green); }

.auth-btn { width: 100%; justify-content: center; padding: 11px 14px; font-size: 13.5px; margin-top: 4px; }
.auth-switch { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 16px; }
.auth-link { color: var(--blue); font-weight: 600; text-decoration: none; cursor: pointer; }
.auth-link:hover { text-decoration: underline; }

.auth-footer {
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text-muted); line-height: 1.6; text-align: center;
}

/* ─── Toasts ─────────────────────────────────────────────────────────────── */
#toasts { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: rgba(255,255,255,0.58);
  backdrop-filter: var(--glass-blur-strong);
  -webkit-backdrop-filter: var(--glass-blur-strong);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius);
  padding: 11px 16px;
  font-size: 13px; font-weight: 500;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
  animation: toast-in 0.2s ease;
  min-width: 220px;
  box-shadow: var(--shadow-lg);
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--blue); }
@keyframes toast-in { from { opacity:0; transform:translateX(16px); } to { opacity:1; transform:translateX(0); } }

/* ─── Section cards ──────────────────────────────────────────────────────── */
.section-card { background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.section-card-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,0.22);
}
.section-card-title { font-size: 12px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.01em; }

/* ─── Charts ─────────────────────────────────────────────────────────────── */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.chart-card { background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 16px; }
.chart-card-title { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 14px; }
.chart-card canvas { max-height: 240px; }
.chart-card.full { grid-column: 1 / -1; }
.chart-card.full canvas { max-height: 260px; }

/* ─── Tools ──────────────────────────────────────────────────────────────── */
.tools-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tool-card { background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 18px; }
.tool-card-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 14px; letter-spacing: -0.01em; }
.tool-result { margin-top: 12px; background: rgba(255,255,255,0.32); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.tool-result-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border); }
.tool-result-row:last-child { border-bottom: none; }
.tool-result-label { color: var(--text-muted); font-size: 12px; font-weight: 500; }
.tool-result-value { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; font-size: 13px; }
.tool-result-value.green { color: #1a8a37; }
.tool-result-value.red   { color: var(--red); }
.tool-result-value.amber { color: var(--amber); }

/* ─── Title checker ──────────────────────────────────────────────────────── */
.title-input-wrap { position: relative; }
.title-input-wrap textarea { padding-right: 52px; resize: none; height: 70px; }
.char-count { position: absolute; right: 10px; bottom: 10px; font-size: 11px; font-weight: 600; color: var(--text-muted); pointer-events: none; }
.char-count.warn { color: var(--amber); }
.char-count.over { color: var(--red); }

/* ─── Profit colors ──────────────────────────────────────────────────────── */
.profit-pos  { color: #1a8a37; font-weight: 600; font-variant-numeric: tabular-nums; }
.profit-neg  { color: var(--red); font-weight: 600; font-variant-numeric: tabular-nums; }
.profit-zero { color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ─── Column mapper ──────────────────────────────────────────────────────── */
.mapper-required::after { content: ' *'; color: var(--blue); }

/* ─── Empty state ────────────────────────────────────────────────────────── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 24px; color: var(--text-muted); gap: 8px; text-align: center; }
.empty-state-icon  { font-size: 28px; opacity: 0.3; }
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--text-muted); }
.empty-state-sub   { font-size: 12px; }

/* ─── Summary bar ────────────────────────────────────────────────────────── */
.summary-bar {
  display: flex; gap: 20px; padding: 9px 12px;
  background: rgba(255,255,255,0.22); border-bottom: 1px solid var(--border);
  font-size: 12px; flex-wrap: wrap; align-items: center;
}
.summary-bar strong { font-variant-numeric: tabular-nums; }

/* ─── Money ──────────────────────────────────────────────────────────────── */
.money { font-variant-numeric: tabular-nums; }

/* ─── Price Watch signals ────────────────────────────────────────────────── */
.signal-fire   { background:rgba(255,149,0,0.18);  color:#c85000; }
.signal-strong { background:var(--green-dim); color:#1a6e2e; }
.signal-hold   { background:var(--green-dim); color:#1a8a37; }
.signal-rising { background:var(--blue-dim);  color:var(--blue); }
.signal-watch  { background:rgba(120,128,150,0.16); color:var(--text-muted); }
.signal-review { background:var(--red-dim);   color:var(--red); }
.signal-none   { background:rgba(120,128,150,0.14); color:var(--text-dim); }

/* ─── Price Watch spotlight cards ────────────────────────────────────────── */
.pt-spotlight-card {
  background: rgba(255,255,255,0.30);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  transition: all 0.12s;
}
.pt-spotlight-card:hover {
  background: var(--card-hover);
  border-color: rgba(255,255,255,0.85);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

/* ─── Price Watch table change pill ─────────────────────────────────────── */
.chg-up   { color: #1a8a37; font-size: 10px; font-weight: 600; }
.chg-down { color: var(--red); font-size: 10px; font-weight: 600; }

/* ─── Price Watch sortable column headers ────────────────────────────────── */
.pt-sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.12s, background 0.12s;
  position: relative;
}
.pt-sortable:hover { color: var(--blue); background: rgba(0,122,255,0.04); }
.pt-sortable.is-active { color: var(--blue); }
.pt-sort-arrow {
  font-size: 9px;
  margin-left: 4px;
  opacity: 0.9;
  vertical-align: middle;
}

/* ─── Pull Sheet ─────────────────────────────────────────────────────────── */
.ps-summary {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 13px;
}
.pullsheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.pullsheet-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  user-select: none;
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.15s, filter 0.15s;
}
.pullsheet-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
/* Image is the click target for the lightbox. Only the wrap with an actual
   image gets the zoom cursor — broken/missing images stay default. */
.pullsheet-img-wrap.ps-img-zoom { cursor: zoom-in; }

/* "Mark pulled" button at the bottom of each card */
.ps-pulled-btn {
  margin-top: 4px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-hover, rgba(255,255,255,0.06));
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.ps-pulled-btn:hover {
  background: var(--green-dim);
  border-color: var(--green);
  color: #1a8a37;
}
.ps-pulled-btn.is-pulled {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.ps-pulled-btn.is-pulled:hover {
  background: #2aa84a;
  border-color: #2aa84a;
}

/* Lightbox overlay shown when an image is clicked */
.ps-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.82);
  align-items: center;
  justify-content: center;
  padding: 32px;
  cursor: zoom-out;
}
.ps-lightbox.is-open { display: flex; flex-direction: column; gap: 14px; }
.ps-lightbox-img {
  max-width: min(720px, 92vw);
  max-height: 82vh;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  cursor: default;
}
.ps-lightbox-caption {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  max-width: 92vw;
  cursor: default;
}
.ps-lightbox-close {
  position: absolute;
  top: 16px; right: 20px;
  width: 36px; height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  color: #111;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.ps-lightbox-close:hover { background: #fff; }

/* ── Foil indicator ──────────────────────────────────────────────────────── */
/* Distinct holo-style border so foils stand out at a glance, even before
   the foil badge registers visually. Outline rather than thick border to
   avoid shifting layout vs non-foil cards. */
.pullsheet-card.is-foil {
  outline: 2px solid transparent;
  background:
    linear-gradient(var(--card), var(--card)) padding-box,
    linear-gradient(120deg, #ff5fa2, #ffd166, #66e3ff, #c79bff, #ff5fa2) border-box;
  border: 2px solid transparent;
}
.ps-foil-badge {
  position: absolute;
  bottom: 8px; left: 8px;
  z-index: 3;
  background: linear-gradient(120deg, #ff5fa2, #ffd166 35%, #66e3ff 65%, #c79bff);
  color: #1a1330;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 3px 9px;
  border-radius: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35), inset 0 0 0 1px rgba(255,255,255,0.55);
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
  pointer-events: none;
}
.ps-foil-summary {
  background: linear-gradient(120deg, #ff5fa2, #ffd166 35%, #66e3ff 65%, #c79bff);
  color: #1a1330;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 2px 9px;
  border-radius: 20px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5);
}

/* ── Product-line filter chips ───────────────────────────────────────────── */
.ps-line-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.ps-line-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--card-hover, rgba(255,255,255,0.06));
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.ps-line-chip:hover {
  border-color: var(--blue);
  color: var(--blue);
}
.ps-line-chip.is-active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.ps-line-chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 16px;
  padding: 0 5px;
  border-radius: 10px;
  background: rgba(0,0,0,0.12);
  font-size: 10.5px;
  font-weight: 700;
}
.ps-line-chip.is-active .ps-line-chip-count {
  background: rgba(255,255,255,0.25);
}
.ps-link { display: block; text-decoration: none; color: inherit; }

/* ── Pulled state ─────────────────────────────────────────────────────────── */
.pullsheet-card.ps-pulled { opacity: 0.5; filter: grayscale(0.6); }
.pullsheet-card.ps-pulled:hover { opacity: 0.75; }
.pullsheet-card.ps-hidden { display: none; }
.ps-pulled-badge {
  display: none;
  position: absolute;
  top: 42%; left: 50%;
  transform: translate(-50%, -50%) rotate(-8deg);
  background: var(--green);
  color: #fff;
  font-size: 13px; font-weight: 800; letter-spacing: 0.08em;
  padding: 6px 14px;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.28);
  z-index: 3;
  pointer-events: none;
}
.pullsheet-card.ps-pulled .ps-pulled-badge { display: block; }

/* Corner link to product page (doesn't trigger pulled toggle) */
.ps-corner-link {
  position: absolute;
  top: 6px; left: 6px;
  z-index: 4;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; line-height: 1;
  color: var(--blue);
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  opacity: 0; transition: opacity 0.12s;
}
.pullsheet-card:hover .ps-corner-link { opacity: 1; }
.ps-corner-link:hover { background: var(--blue); color: #fff; }

/* "Hide pulled" toggle in the summary bar */
.ps-hide-toggle {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; user-select: none;
}
.ps-hide-toggle input { width: auto; cursor: pointer; accent-color: var(--blue); }
.pullsheet-img-wrap {
  position: relative;
  aspect-ratio: 5/7;
  background: rgba(255,255,255,0.35);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pullsheet-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}
.pullsheet-img-wrap.ps-img-failed::after {
  content: 'broken image';
  font-size: 10px;
  color: var(--text-muted);
}
.ps-loading {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
}
.ps-spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: ps-spin 0.8s linear infinite;
}
@keyframes ps-spin { to { transform: rotate(360deg); } }
.ps-noimg {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  background: rgba(255,255,255,0.3);
}
.ps-search-link {
  margin-top: 8px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
  color: var(--blue);
  background: var(--blue-dim);
  padding: 4px 10px;
  border-radius: 20px;
  text-decoration: none;
}
.ps-search-link:hover { background: var(--blue); color: #fff; }
.pullsheet-qty-badge {
  position: absolute;
  top: 8px; right: 8px;
  background: var(--blue);
  color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  box-shadow: 0 1px 4px rgba(0,122,255,0.4);
}
.pullsheet-card-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pullsheet-card-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Shipping labels (6in × 4in) ────────────────────────────────────────── */
#ship-preview { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.ship-label {
  width: 6in; height: 4in;
  background: #fff;
  color: #000;
  position: relative;
  border: 1px solid var(--border-hi);
  border-radius: 4px;
  box-shadow: var(--shadow);
  font-family: Arial, Helvetica, sans-serif;
  overflow: hidden;
}
.ship-return {
  position: absolute;
  top: 0.32in; left: 0.4in;
  font-size: 10pt; line-height: 1.32;
}
.ship-to {
  position: absolute;
  top: 1.95in; left: 2.15in; right: 0.3in;
  font-size: 13pt; line-height: 1.45;
}
.ship-to-name { font-weight: 700; font-size: 14pt; }

/* ─── Card thumbnails ────────────────────────────────────────────────────── */
.card-thumb {
  width: 30px; height: 42px;
  border-radius: 3px;
  background: rgba(0,0,0,0.05);
  overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  cursor: zoom-in;
  vertical-align: middle;
}
.card-thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.card-thumb.none { cursor: default; }
.card-thumb.none::after { content: '—'; color: var(--text-dim); font-size: 11px; }
.card-thumb.empty { background: transparent; cursor: default; }
/* Larger card-art sizes used on Price Watch spotlight tiles and detail modal */
.card-thumb.pt-hold-thumb   { width: 58px;  height: 81px;  border-radius: 4px; }
.card-thumb.pt-detail-thumb { width: 132px; height: 184px; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.card-thumb.pt-hold-thumb.none::after,
.card-thumb.pt-detail-thumb.none::after { font-size: 14px; }
.thumbs-toggle {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; user-select: none;
}
.thumbs-toggle input { width: auto; cursor: pointer; accent-color: var(--blue); }
.thumb-lightbox {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(10,15,30,0.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
}
.thumb-lightbox img { max-width: 80vw; max-height: 85vh; border-radius: 12px; box-shadow: 0 24px 70px rgba(0,0,0,0.5); }

/* ─── "Show more" row window control ─────────────────────────────────────── */
.table-more {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.5);
  font-size: 12px; color: var(--text-muted);
}
.table-more .btn { margin-left: 0; }

/* ─── Misc ───────────────────────────────────────────────────────────────── */
.two-col   { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

/* ─── Orders (per-order fulfillment) ────────────────────────────────────────── */
.order-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 14px 16px 16px;
  margin-bottom: 16px;
  transition: opacity 0.15s;
}
.order-card.is-packed { opacity: 0.5; }
.order-hdr {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.order-customer { font-size: 15px; font-weight: 700; color: var(--text); }
.order-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.order-addr { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.order-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.order-items { margin-top: 2px; }
.order-card-info { display: block; text-decoration: none; color: inherit; }
a.order-card-info { cursor: pointer; }
a.order-card-info:hover .pullsheet-card-name { color: var(--blue); text-decoration: underline; }

/* ─── Mobile top bar + drawer chrome (desktop: hidden) ──────────────────────── */
#mobile-topbar, #sidebar-backdrop { display: none; }

/* ─── Responsive: phones / narrow screens ───────────────────────────────────── */
@media (max-width: 760px) {
  /* Let the page scroll naturally instead of trapping it in an inner panel. */
  html, body { overflow: auto; height: auto; }
  #app { display: block; height: auto; }
  #main { overflow: visible; padding-top: 52px; }
  #page { min-height: calc(100vh - 52px); }

  /* Fixed glass top bar with the hamburger + wordmark. */
  #mobile-topbar {
    display: flex; align-items: center; gap: 12px;
    position: fixed; top: 0; left: 0; right: 0; height: 52px; z-index: 60;
    padding: 0 14px;
    background: var(--sidebar-bg);
    backdrop-filter: var(--glass-blur-strong);
    -webkit-backdrop-filter: var(--glass-blur-strong);
    border-bottom: 1px solid var(--glass-edge);
  }
  #nav-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border: none; background: transparent;
    color: var(--text); cursor: pointer; border-radius: 8px;
  }
  #nav-toggle:active { background: rgba(0,0,0,0.06); }
  .mobile-brand {
    font-family: var(--font); font-weight: 800; font-size: 16px;
    letter-spacing: 0.06em; color: var(--text);
  }

  /* Sidebar becomes a slide-in drawer over the content. */
  #sidebar {
    position: fixed; top: 0; left: 0; height: 100%; width: 250px; min-width: 250px;
    z-index: 80; transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 0 0 44px rgba(20,25,45,0.28);
  }
  #app.nav-open #sidebar { transform: translateX(0); }

  #sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 70;
    background: rgba(20,25,45,0.35);
    opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
  }
  #app.nav-open #sidebar-backdrop { opacity: 1; pointer-events: auto; }

  /* Content reflow so nothing is cramped or clipped. */
  .page-hdr {
    position: static; flex-wrap: wrap; gap: 10px; padding: 16px 16px 12px;
  }
  .page-hdr > div:last-child { width: 100%; }        /* action buttons wrap to their own row */
  .page-title { font-size: 20px; }
  .page-body { padding: 14px 16px; }
  .filter-row { padding: 12px 16px 0; }
  .filter-row .input, .filter-row select { width: 100%; }

  /* Stack 2/3-column forms into a single column. */
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }

  /* Wide data tables scroll horizontally instead of squashing. */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 560px; }

  /* A touch denser card grid so two fit comfortably on a phone. */
  .pullsheet-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }

  /* Modals / auth card fill the small screen nicely. */
  .modal-box { width: 95vw; }
  .auth-card { padding: 28px 22px 22px; }
}
