/* ============================================================
   Zei JP Admin — Design System
   Dark-first Linear-style operator console
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ---------- Tokens: DARK (default) ---------- */
:root,
[data-theme="dark"] {
  --bg:            oklch(0.165 0.006 270);
  --bg-2:          oklch(0.190 0.006 270);
  --surface:       oklch(0.214 0.007 270);
  --surface-2:     oklch(0.242 0.008 270);
  --surface-hover: oklch(0.268 0.009 270);
  --border:        oklch(0.285 0.009 270);
  --border-2:      oklch(0.350 0.011 270);
  --text:          oklch(0.965 0.003 270);
  --text-2:        oklch(0.735 0.008 270);
  --text-3:        oklch(0.560 0.009 270);
  --text-faint:    oklch(0.440 0.009 270);

  --shadow-1: 0 1px 2px oklch(0 0 0 / 0.30);
  --shadow-2: 0 4px 16px oklch(0 0 0 / 0.36);
  --shadow-3: 0 16px 48px oklch(0 0 0 / 0.46);
  --overlay:  oklch(0.10 0.004 270 / 0.66);

  --placeholder-a: oklch(0.255 0.008 270);
  --placeholder-b: oklch(0.225 0.008 270);

  color-scheme: dark;
}

/* ---------- Tokens: LIGHT ---------- */
[data-theme="light"] {
  --bg:            oklch(0.985 0.002 270);
  --bg-2:          oklch(0.965 0.003 270);
  --surface:       oklch(1 0 0);
  --surface-2:     oklch(0.975 0.003 270);
  --surface-hover: oklch(0.955 0.004 270);
  --border:        oklch(0.905 0.005 270);
  --border-2:      oklch(0.855 0.006 270);
  --text:          oklch(0.205 0.012 270);
  --text-2:        oklch(0.435 0.010 270);
  --text-3:        oklch(0.560 0.009 270);
  --text-faint:    oklch(0.660 0.008 270);

  --shadow-1: 0 1px 2px oklch(0.4 0.02 270 / 0.08);
  --shadow-2: 0 4px 16px oklch(0.4 0.02 270 / 0.10);
  --shadow-3: 0 16px 48px oklch(0.4 0.02 270 / 0.16);
  --overlay:  oklch(0.30 0.01 270 / 0.30);

  --placeholder-a: oklch(0.915 0.005 270);
  --placeholder-b: oklch(0.945 0.004 270);

  color-scheme: light;
}

/* ---------- Accent (overridable via --accent-h/c/l) ---------- */
:root {
  --accent-h: 25;
  --accent-c: 0.205;
  --accent-l: 0.585;
  --accent:        oklch(var(--accent-l) var(--accent-c) var(--accent-h));
  --accent-hover:  oklch(calc(var(--accent-l) + 0.05) var(--accent-c) var(--accent-h));
  --accent-soft:   oklch(var(--accent-l) var(--accent-c) var(--accent-h) / 0.16);
  --accent-text:   oklch(0.99 0.01 var(--accent-h));

  /* semantic status */
  --green:  oklch(0.72 0.15 152);
  --green-soft: oklch(0.72 0.15 152 / 0.16);
  --yellow: oklch(0.80 0.135 85);
  --yellow-soft: oklch(0.80 0.135 85 / 0.16);
  --red:    oklch(0.64 0.21 25);
  --red-soft: oklch(0.64 0.21 25 / 0.16);
  --blue:   oklch(0.66 0.145 250);
  --blue-soft: oklch(0.66 0.145 250 / 0.16);
  --violet: oklch(0.66 0.16 300);
  --violet-soft: oklch(0.66 0.16 300 / 0.16);

  --r-xs: 5px;
  --r-sm: 7px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --density: 1;     /* set by tweak: 0.85 compact, 1 regular, 1.18 comfy */
  --fs: 1;          /* base font scale */
}

/* ---------- Reset / base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: calc(14px * var(--fs));
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-feature-settings: 'tnum' 1; }
.tnum { font-variant-numeric: tabular-nums; }

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
::placeholder { color: var(--text-faint); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- Type helpers ---------- */
.t-display { font-size: calc(30px * var(--fs)); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.t-h1 { font-size: calc(21px * var(--fs)); font-weight: 700; letter-spacing: -0.015em; }
.t-h2 { font-size: calc(16px * var(--fs)); font-weight: 600; letter-spacing: -0.01em; }
.t-body { font-size: calc(14px * var(--fs)); }
.t-sm { font-size: calc(13px * var(--fs)); }
.t-xs { font-size: calc(12px * var(--fs)); }
.t-2xs { font-size: calc(11px * var(--fs)); letter-spacing: 0.02em; }
.t-eyebrow { font-size: calc(11px * var(--fs)); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.dim { color: var(--text-2); }
.dimmer { color: var(--text-3); }
.strong { font-weight: 600; }

/* ---------- App frame ---------- */
#root { height: 100vh; }
.app { display: grid; height: 100vh; background: var(--bg); }
.app.with-sidebar { grid-template-columns: auto 1fr; }

/* ===== Sidebar ===== */
.sidebar {
  display: flex; flex-direction: column;
  width: 232px; min-width: 232px;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  transition: width .18s ease, min-width .18s ease;
  overflow: hidden;
}
.sidebar.collapsed { width: 60px; min-width: 60px; }
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 16px 14px 14px; }
.sb-logo {
  width: 30px; height: 30px; min-width: 30px; border-radius: 8px;
  background: var(--accent); color: var(--accent-text);
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
  box-shadow: var(--shadow-1);
}
.sb-brand-name { font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.sb-brand-sub { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.sb-nav { display: flex; flex-direction: column; gap: 2px; padding: 8px; flex: 1; }
.sb-section-label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); padding: 14px 10px 6px; white-space: nowrap; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 500; font-size: calc(13.5px * var(--fs));
  white-space: nowrap; position: relative; transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--text); }
.nav-item.active::before {
  content: ''; position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; background: var(--accent); border-radius: 0 3px 3px 0;
}
.nav-item .icon { color: currentColor; opacity: .92; }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 19px; padding: 0 6px; border-radius: 99px;
  background: var(--accent); color: var(--accent-text); font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}
.collapsed .sb-brand-name, .collapsed .sb-brand-sub, .collapsed .nav-item span,
.collapsed .sb-section-label, .collapsed .nav-badge, .collapsed .sb-foot-text { display: none; }
.collapsed .nav-item { justify-content: center; padding: 9px; }
.sb-foot { padding: 10px; border-top: 1px solid var(--border); }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-sm); }
.sb-user:hover { background: var(--surface); }

/* ===== Main column ===== */
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow: hidden; }

/* ===== Topbar ===== */
.topbar {
  display: flex; align-items: center; gap: 12px;
  height: 56px; min-height: 56px; padding: 0 18px;
  border-bottom: 1px solid var(--border); background: color-mix(in oklab, var(--bg) 82%, transparent);
  backdrop-filter: blur(8px);
}
.topbar-title { font-weight: 700; font-size: calc(15px * var(--fs)); letter-spacing: -0.01em; }
.topbar-spacer { flex: 1; }
.live-dot { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-3); padding: 5px 10px; border: 1px solid var(--border); border-radius: 99px; }
.live-dot .pulse { width: 7px; height: 7px; border-radius: 99px; background: var(--green); box-shadow: 0 0 0 0 var(--green); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--green) 60%, transparent); } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ===== Hub tab bar (under topbar, above page) ===== */
.hub-tabbar {
  background: color-mix(in oklab, var(--bg) 70%, transparent);
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
  overflow-x: auto;
  overflow-y: hidden;
  flex-shrink: 0;
  scrollbar-width: none;
}
.hub-tabbar::-webkit-scrollbar { display: none; }
.hub-tabbar-inner { display: flex; gap: 2px; min-width: max-content; }
.hub-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 11px 14px;
  background: transparent; border: none;
  color: var(--text-3);
  font-size: calc(13px * var(--fs)); font-weight: 600;
  cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .12s, border-color .12s;
}
.hub-tab:hover { color: var(--text); }
.hub-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ===== Deal Score editor ===== */
.score-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.score-grid > div:last-child { position: sticky; top: 8px; }
.brand-weight-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px 18px; }
.brand-weight-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.preview-card { background: var(--surface); }
.breakdown-tbl th, .breakdown-tbl td { padding-left: 6px; padding-right: 6px; }
.breakdown-tbl th:first-child, .breakdown-tbl td:first-child { padding-left: 12px; }
.breakdown-tbl th:last-child, .breakdown-tbl td:last-child { padding-right: 12px; }
.breakdown-tbl tbody tr:hover { cursor: default; }
.diff-up { color: var(--green); }
.diff-down { color: var(--red); }
.diff-neu { color: var(--text-3); }
@media (max-width: 1100px) {
  .score-grid { grid-template-columns: 1fr; }
  .score-grid > div:last-child { position: static; }
}

/* ===== Page scroll region ===== */
.page { flex: 1; overflow-y: auto; overflow-x: hidden; }
.page-pad { padding: calc(24px * var(--density)) calc(28px * var(--density)); max-width: 1320px; margin: 0 auto; }
.page-pad.wide { max-width: none; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: var(--r-sm);
  font-weight: 600; font-size: calc(13px * var(--fs)); white-space: nowrap;
  border: 1px solid transparent; transition: background .12s, border-color .12s, opacity .12s, color .12s;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-default { background: var(--surface); color: var(--text); border-color: var(--border-2); }
.btn-default:hover:not(:disabled) { background: var(--surface-hover); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface); color: var(--text); }
.btn-danger { background: transparent; color: var(--red); border-color: color-mix(in oklab, var(--red) 40%, transparent); }
.btn-danger:hover:not(:disabled) { background: var(--red-soft); }
.btn-sm { height: 28px; padding: 0 10px; font-size: calc(12.5px * var(--fs)); }
.btn-lg { height: 42px; padding: 0 20px; font-size: calc(14px * var(--fs)); }
.btn-icon { width: 34px; padding: 0; }
.btn-icon.btn-sm { width: 28px; }
.btn-block { width: 100%; }

/* ===== Inputs ===== */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: calc(12.5px * var(--fs)); font-weight: 600; color: var(--text-2); }
.hint { font-size: calc(12px * var(--fs)); color: var(--text-3); }
.input, .textarea, .select {
  width: 100%; background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r-sm); padding: 9px 11px; font-size: calc(13.5px * var(--fs));
  transition: border-color .12s, box-shadow .12s;
}
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.sm, .select.sm { height: 30px; padding: 0 10px; font-size: calc(12.5px * var(--fs)); }
.textarea { resize: vertical; min-height: 88px; line-height: 1.55; }
.input-search { position: relative; }
.input-search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-search .input { padding-left: 32px; }

/* ===== Cards / surfaces ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.card-pad { padding: calc(18px * var(--density)); }
.panel { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r-lg); }

/* ===== Badges & pills ===== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 21px; padding: 0 8px; border-radius: var(--r-xs);
  font-size: calc(11.5px * var(--fs)); font-weight: 600; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.badge-neutral { background: var(--surface-2); color: var(--text-2); }
.badge-brand { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-2); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-yellow { background: var(--yellow-soft); color: var(--yellow); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-violet { background: var(--violet-soft); color: var(--violet); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }

.score { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 38px; height: 24px; padding: 0 7px; border-radius: var(--r-xs); font-weight: 700; font-size: calc(12.5px * var(--fs)); font-variant-numeric: tabular-nums; }
.score-hi { background: var(--green-soft); color: var(--green); }
.score-mid { background: var(--yellow-soft); color: var(--yellow); }
.score-lo { background: var(--red-soft); color: var(--red); }

/* ===== Brand chip / logo ===== */
.brand-logo { width: 24px; height: 24px; min-width: 24px; border-radius: 6px; display: grid; place-items: center; font-weight: 800; font-size: 11px; color: #fff; letter-spacing: -0.02em; }

/* ===== Image placeholders ===== */
.ph {
  position: relative; overflow: hidden; border-radius: var(--r-md);
  background:
    repeating-linear-gradient(45deg, var(--placeholder-a) 0 9px, var(--placeholder-b) 9px 18px);
  border: 1px solid var(--border);
  display: grid; place-items: center;
}
.ph-label { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: var(--text-3); background: color-mix(in oklab, var(--bg) 70%, transparent); padding: 3px 7px; border-radius: 5px; backdrop-filter: blur(2px); text-align: center; max-width: 88%; }
.ph-brandtag { position: absolute; top: 6px; left: 6px; }

/* ===== Tables ===== */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th { text-align: left; font-size: calc(11.5px * var(--fs)); font-weight: 600; color: var(--text-3); padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; background: var(--bg-2); z-index: 2; }
.tbl td { padding: calc(10px * var(--density)) 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: var(--surface); cursor: pointer; }
.tbl tbody tr.selected { background: var(--accent-soft); }
.tbl tbody tr:last-child td { border-bottom: none; }

/* ===== Drawer ===== */
.scrim { position: fixed; inset: 0; background: var(--overlay); z-index: 40; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: min(560px, 94vw); background: var(--bg-2); border-left: 1px solid var(--border); box-shadow: var(--shadow-3); z-index: 41; display: flex; flex-direction: column; animation: slideIn .22s cubic-bezier(.2,.8,.2,1); }
@keyframes slideIn { from { transform: translateX(28px); opacity: .4; } }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px; }
.drawer-foot { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; gap: 10px; }

/* ===== Modal ===== */
.modal-wrap { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal { position: relative; z-index: 51; width: min(540px, 96vw); max-height: 90vh; overflow: hidden; background: var(--bg-2); border: 1px solid var(--border-2); border-radius: var(--r-xl); box-shadow: var(--shadow-3); display: flex; flex-direction: column; animation: pop .2s cubic-bezier(.2,.8,.2,1); }
@keyframes pop { from { transform: scale(.96) translateY(8px); opacity: 0; } }
.modal-head { padding: 18px 20px 4px; }
.modal-body { padding: 14px 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--border); }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); }
.tab { padding: 10px 13px; font-size: calc(13px * var(--fs)); font-weight: 600; color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .12s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: var(--r-sm); gap: 2px; }
.seg button { padding: 5px 11px; border-radius: var(--r-xs); font-size: calc(12.5px * var(--fs)); font-weight: 600; color: var(--text-3); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

/* ===== Toast ===== */
.toast-region { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text); padding: 11px 14px; border-radius: var(--r-md); box-shadow: var(--shadow-2); font-size: calc(13px * var(--fs)); font-weight: 500; animation: toastIn .24s cubic-bezier(.2,.8,.2,1); }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } }
.toast .icon { color: var(--green); }

/* ===== Stat cards ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat { padding: 16px 16px 15px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); transition: border-color .12s, background .12s; }
.stat:hover { border-color: var(--border-2); background: var(--surface-2); cursor: pointer; }
.stat-top { display: flex; align-items: center; gap: 8px; color: var(--text-3); }
.stat-val { font-size: calc(30px * var(--fs)); font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: calc(12px * var(--fs)); color: var(--text-3); margin-top: 4px; }

/* ===== Banner ===== */
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid; font-size: calc(13.5px * var(--fs)); }
.banner-danger { background: var(--red-soft); border-color: color-mix(in oklab, var(--red) 40%, transparent); color: var(--text); }
.banner-warn { background: var(--yellow-soft); border-color: color-mix(in oklab, var(--yellow) 40%, transparent); color: var(--text); }
.banner-info { background: var(--blue-soft); border-color: color-mix(in oklab, var(--blue) 40%, transparent); color: var(--text); }

/* ===== Activity timeline ===== */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 12px; padding: 11px 4px; }
.tl-dot { width: 28px; min-width: 28px; height: 28px; border-radius: 99px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); margin-top: 1px; }
.tl-line { font-size: calc(13px * var(--fs)); }
.tl-time { font-size: calc(11.5px * var(--fs)); color: var(--text-faint); margin-top: 2px; }

/* ===== Checkbox ===== */
.cbx { width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--border-2); background: var(--surface); display: grid; place-items: center; transition: background .12s, border-color .12s; }
.cbx.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

/* ===== Toggle ===== */
.switch { width: 38px; height: 22px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border-2); position: relative; transition: background .15s; }
.switch.on { background: var(--accent); border-color: var(--accent); }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 99px; background: #fff; box-shadow: var(--shadow-1); transition: transform .15s; }
.switch.on .knob { transform: translateX(16px); }

/* ===== Kbd ===== */
.kbd { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border-2); border-bottom-width: 2px; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-2); }

/* ===== Empty state ===== */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 56px 20px; gap: 14px; }
.empty-art { width: 88px; height: 88px; border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-faint); }
.empty h3 { font-size: calc(16px * var(--fs)); font-weight: 700; }
.empty p { color: var(--text-3); max-width: 360px; font-size: calc(13.5px * var(--fs)); }

/* ===== Misc layout ===== */
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gap-sm { gap: 6px; } .gap-lg { gap: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.spin { animation: spin 1s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: var(--r-sm); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.clip-1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ===== Mobile ===== */
.mobile-only { display: none; }
.tabbar { display: none; }
.fab { display: none; }

@media (max-width: 860px) {
  .app.with-sidebar { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .desktop-only { display: none !important; }
  .mobile-only { display: block; }
  .page { padding-bottom: 70px; }
  .page-pad { padding: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .drawer { width: 100vw; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: 60px; z-index: 30;
    background: color-mix(in oklab, var(--bg-2) 92%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text-3); font-size: 10.5px; font-weight: 600; position: relative; }
  .tabbar a.active { color: var(--accent); }
  .fab { display: grid; place-items: center; position: fixed; right: 16px; bottom: 76px; width: 52px; height: 52px; border-radius: 99px; background: var(--accent); color: var(--accent-text); box-shadow: var(--shadow-3); z-index: 31; }
}

/* Device frame helpers (for canvas presentation, optional) */
.scroll-x { overflow-x: auto; }

/* ============ Manual Product Entry — added 2026-05-31 ============ */

/* Just-added highlight on pool cards/rows */
.card--just-added {
  animation: cardGlow 3s ease-out;
  position: relative;
  z-index: 1;
}
@keyframes cardGlow {
  0% {
    box-shadow:
      0 0 0 3px var(--accent),
      0 0 24px 4px color-mix(in oklch, var(--accent) 45%, transparent);
  }
  60% {
    box-shadow:
      0 0 0 2px var(--accent),
      0 0 12px 2px color-mix(in oklch, var(--accent) 25%, transparent);
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

/* Null-score placeholder (manual products) */
.score.score-na {
  background: var(--surface-2);
  color: var(--text-3);
  font-weight: 500;
}

/* Manual-entry modal layout */
.manual-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.manual-form .field--full { grid-column: 1 / -1; }
@media (max-width: 640px) {
  .manual-form { grid-template-columns: 1fr; }
}

/* Image dropzone */
.dropzone {
  border: 2px dashed var(--border-2);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.is-active {
  border-color: var(--accent);
  background: color-mix(in oklch, var(--accent) 6%, transparent);
}
.dropzone-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb__remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
}
.thumb__main-badge {
  position: absolute;
  bottom: 4px; left: 4px;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.thumb--add {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border-2);
  background: transparent;
  cursor: pointer;
  color: var(--text-3);
}
