/* ---------- Design tokens ---------- */
:root {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --border: #e4e7ef;
  --text: #151a2d;
  --text-2: #4b5470;
  --text-3: #7a829c;
  --brand: #5b4bdb;
  --brand-2: #7c6cf0;
  --brand-soft: #eeebff;
  --brand-ink: #ffffff;
  --ok: #128f5a;
  --ok-soft: #e3f6ec;
  --warn: #b26a00;
  --warn-soft: #fff1d6;
  --bad: #c93636;
  --bad-soft: #fde8e8;
  --info: #2563c9;
  --info-soft: #e5eefc;
  --shadow-sm: 0 1px 2px rgba(21, 26, 45, .06);
  --shadow-md: 0 6px 24px rgba(21, 26, 45, .08);
  --shadow-lg: 0 20px 60px rgba(21, 26, 45, .22);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar: 248px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1220;
  --surface: #171b2e;
  --surface-2: #1c2138;
  --border: #2a3050;
  --text: #eef0fa;
  --text-2: #b4bad4;
  --text-3: #868daa;
  --brand: #8b7dff;
  --brand-2: #a79bff;
  --brand-soft: #25224a;
  --brand-ink: #0f1220;
  --ok: #3fd391;
  --ok-soft: #12332a;
  --warn: #f2b255;
  --warn-soft: #3a2c12;
  --bad: #ff7b7b;
  --bad-soft: #3d1b1f;
  --info: #7fb0ff;
  --info-soft: #172a4a;
  --shadow-sm: none;
  --shadow-md: 0 6px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 8px; }
svg { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 14px; transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: color-mix(in srgb, var(--border) 60%, var(--text-3)); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 40%, transparent); }
:root[data-theme="dark"] .btn.primary { color: #0f1220; }
.btn.primary:hover:not(:disabled) { background: linear-gradient(135deg, var(--brand), var(--brand-2)); filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn.danger-ghost { background: transparent; border-color: transparent; color: var(--bad); }
.btn.danger-ghost:hover:not(:disabled) { background: var(--bad-soft); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; }
.icon-btn { width: 36px; height: 36px; padding: 0; border-radius: 10px; display: inline-grid; place-items: center; border: 1px solid transparent; background: transparent; color: var(--text-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100%; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 20px 14px; background: var(--surface); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 40%, transparent); }
.brand-mark svg { width: 22px; height: 22px; }
.brand-name { font-weight: 750; letter-spacing: -.01em; line-height: 1.15; }
.brand-sub { font-size: 12px; color: var(--text-3); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav button {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-2); font-weight: 600; text-align: left;
}
.nav button:hover { background: var(--surface-2); color: var(--text); }
.nav button[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
.side-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.me { display: flex; align-items: center; gap: 10px; padding: 0 6px; min-width: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: var(--brand); background: var(--brand-soft); flex: none; }
.me-name { font-weight: 650; font-size: 14px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-role { font-size: 12px; color: var(--text-3); }
.side-actions { display: flex; gap: 6px; }
.side-actions .btn { flex: 1; }

.content { min-width: 0; padding: 28px clamp(16px, 3.2vw, 44px) 80px; max-width: 1280px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-title { font-size: 26px; font-weight: 780; letter-spacing: -.02em; line-height: 1.2; }
.page-sub { color: var(--text-2); margin-top: 4px; }

/* ---------- Cards, stats ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { padding: 16px 18px; display: flex; align-items: center; gap: 14px; }
.stat-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.stat-ico.t-all { background: var(--info-soft); color: var(--info); }
.stat-ico.t-done { background: var(--ok-soft); color: var(--ok); }
.stat-ico.t-busy { background: var(--brand-soft); color: var(--brand); }
.stat-ico.t-bad { background: var(--bad-soft); color: var(--bad); }
.stat-num { font-size: 26px; font-weight: 780; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 13px; color: var(--text-3); margin-top: 4px; }

/* ---------- Upload ---------- */
.upload { padding: 22px; margin-bottom: 26px; }
.drop {
  border: 2px dashed color-mix(in srgb, var(--brand) 35%, var(--border)); border-radius: var(--radius);
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand-soft) 55%, transparent), transparent);
  padding: 44px 20px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s, transform .15s;
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop.over { transform: scale(1.005); }
.drop-ico { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 14px; display: grid; place-items: center; color: var(--brand); background: var(--surface); box-shadow: var(--shadow-md); }
.drop-ico svg { width: 30px; height: 30px; }
.drop-title { font-size: 18px; font-weight: 700; }
.drop-title u { text-decoration-color: var(--brand); color: var(--brand); text-underline-offset: 3px; }
.drop-hint { color: var(--text-3); font-size: 13px; margin-top: 4px; }
.options { display: flex; flex-wrap: wrap; gap: 18px 32px; margin-top: 20px; align-items: flex-start; }
.opt { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.opt-label { font-size: 13px; font-weight: 650; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-weight: 600; font-size: 13.5px; color: var(--text-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.opt-note { font-size: 12.5px; color: var(--text-3); max-width: 340px; }
.tip { position: relative; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3); font-size: 11px; font-weight: 700; cursor: help; }

/* ---------- Results ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-title { font-size: 18px; font-weight: 720; }
.section-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.empty { padding: 48px 20px; text-align: center; color: var(--text-3); }
.empty svg { width: 44px; height: 44px; margin: 0 auto 10px; color: var(--text-3); opacity: .7; }
.empty b { display: block; color: var(--text-2); font-size: 16px; margin-bottom: 4px; }

.item { overflow: hidden; display: flex; flex-direction: column; animation: rise .3s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.stage { position: relative; aspect-ratio: 3 / 4; background: var(--surface-2); overflow: hidden; user-select: none; touch-action: pan-y; }
.stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; -webkit-user-drag: none; }
.stage.compare { cursor: ew-resize; touch-action: none; }
.stage .after { clip-path: inset(0 0 0 var(--pos, 35%)); }
.divider { position: absolute; top: 0; bottom: 0; left: var(--pos, 35%); width: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); transform: translateX(-1px); pointer-events: none; }
.divider::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b4bdb' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M9 6l-6 6 6 6M15 6l6 6-6 6'/></svg>") center / 20px no-repeat;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
.tag { position: absolute; top: 10px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; background: rgba(15, 18, 32, .72); color: #fff; backdrop-filter: blur(6px); pointer-events: none; }
.tag.l { left: 10px; } .tag.r { right: 10px; }
.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; text-align: center; padding: 16px; background: rgba(15, 18, 32, .55); color: #fff; backdrop-filter: blur(2px); font-weight: 600; }
.overlay.err { background: rgba(120, 20, 28, .72); }
.overlay small { font-weight: 500; opacity: .9; max-width: 220px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .3); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.bar { width: 70%; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .28); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: inherit; background: #fff; transition: width .2s; }
.item-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fname { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.meta { font-size: 12.5px; color: var(--text-3); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; flex: none; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.queued { background: var(--info-soft); color: var(--info); }
.chip.running, .chip.uploading { background: var(--brand-soft); color: var(--brand); }
.chip.running::before, .chip.uploading::before { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.chip.done { background: var(--ok-soft); color: var(--ok); }
.chip.error { background: var(--bad-soft); color: var(--bad); }
.item-actions { display: flex; gap: 8px; }
.item-actions .btn { flex: 1; }
.expiry { font-size: 12px; color: var(--text-3); }
.expiry.soon { color: var(--warn); font-weight: 600; }

/* ---------- Help view ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.step { padding: 20px; }
.step-n { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-weight: 750; color: var(--brand); background: var(--brand-soft); margin-bottom: 12px; }
.step h3 { font-size: 16px; margin-bottom: 4px; }
.step p { color: var(--text-2); font-size: 14px; }
.faq { padding: 6px 20px; }
.faq details { border-bottom: 1px solid var(--border); padding: 14px 0; }
.faq details:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; font-weight: 650; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::after { content: "+"; font-size: 20px; line-height: 1; color: var(--text-3); }
.faq details[open] summary::after { content: "–"; }
.faq p { color: var(--text-2); margin-top: 8px; font-size: 14.5px; }
.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); margin-top: 20px; font-size: 14px; }
.notice svg { color: var(--warn); margin-top: 2px; }

/* ---------- Lightbox ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(8, 10, 20, .72); backdrop-filter: blur(4px); animation: fade .15s ease both; }
@keyframes fade { from { opacity: 0; } }
.dialog { width: min(980px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.dialog-head h3 { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog-stage { position: relative; background: #0b0d18; display: grid; place-items: center; min-height: 0; flex: 1; overflow: hidden; }
.dialog-stage .stage { aspect-ratio: var(--ar, 3 / 4); height: min(70vh, 760px); width: auto; max-width: 100%; margin: 0 auto; background: #0b0d18; }
.dialog-stage .stage img { transition: transform .25s ease; }
.dialog-stage .stage.zoom img { transform: scale(3); transform-origin: 100% 100%; }
.stage .hint { display: none; position: absolute; left: 10px; bottom: 10px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 650; background: rgba(15, 18, 32, .78); color: #fff; pointer-events: none; }
.stage.zoom .hint { display: block; }
.stage.zoom .divider, .stage.zoom .tag { display: none; }
.stage.zoom { cursor: zoom-out; }
.dialog-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; flex-wrap: wrap; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-weight: 600; font-size: 14px; max-width: 360px; animation: rise .25s ease both; }
.toast.err { background: var(--bad); color: #fff; }

/* ---------- Auth page ---------- */
.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-art { position: relative; padding: 56px; color: #fff; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; background: radial-gradient(900px 500px at 10% 0%, #8b7dff 0%, transparent 60%), radial-gradient(700px 500px at 100% 100%, #3b2db0 0%, transparent 60%), #2a1f86; }
.auth-art .brand { padding: 0; }
.auth-art .brand-mark { background: rgba(255, 255, 255, .18); box-shadow: none; backdrop-filter: blur(6px); }
.auth-art .brand-sub { color: rgba(255, 255, 255, .75); }
.auth-art h2 { font-size: clamp(28px, 3.2vw, 42px); line-height: 1.12; letter-spacing: -.025em; font-weight: 800; margin-bottom: 16px; max-width: 460px; }
.auth-art p { color: rgba(255, 255, 255, .82); max-width: 440px; font-size: 16px; }
.feats { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.feats li { display: flex; align-items: center; gap: 12px; color: rgba(255, 255, 255, .92); font-weight: 560; }
.feats svg { width: 22px; height: 22px; padding: 4px; border-radius: 8px; background: rgba(255, 255, 255, .18); }
.auth-foot { font-size: 13px; color: rgba(255, 255, 255, .6); }
.auth-form-wrap { display: grid; place-items: center; padding: 32px 20px; background: var(--bg); }
.auth-card { width: min(400px, 100%); padding: 32px; }
.auth-card h1 { font-size: 24px; font-weight: 780; letter-spacing: -.02em; }
.auth-card .sub { color: var(--text-2); margin: 6px 0 22px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 650; color: var(--text-2); }
.input { height: 44px; width: 100%; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 20%, transparent); }
.pw { position: relative; }
.pw .input { padding-right: 46px; }
.pw .icon-btn { position: absolute; right: 4px; top: 4px; }
.form-err { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bad-soft); color: var(--bad); font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.auth-card .btn.primary { width: 100%; height: 46px; font-size: 15px; }
.auth-theme { position: fixed; top: 14px; right: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 14px; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { padding: 0; }
  .nav { flex-direction: row; margin-left: auto; }
  .nav button { padding: 8px 12px; }
  .nav button span { display: none; }
  .side-foot { margin: 0; border: 0; padding: 0; flex-direction: row; align-items: center; }
  .me-role, .side-actions .label { display: none; }
  .side-actions .btn { flex: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}
@media (max-width: 520px) {
  .stat { padding: 12px; gap: 10px; } .stat-num { font-size: 22px; } .stat-ico { width: 36px; height: 36px; }
  .drop { padding: 30px 14px; } .upload { padding: 14px; }
  .page-title { font-size: 22px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .item-actions .btn span { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- v2: team feedback ---------- */
.page-head { align-items: flex-start; }
.info-box { display: flex; align-items: center; gap: 12px; padding: 12px 16px; font-size: 13px; color: var(--text-2); line-height: 1.5; box-shadow: none; }
.info-box svg { color: var(--brand); }
.options { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 20px 28px; align-items: start; }
.opt.grow { min-width: 0; }
.choices { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.choice {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  transition: border-color .15s, background .15s, box-shadow .15s, transform .08s;
}
.choice:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); box-shadow: var(--shadow-sm); }
.choice:active { transform: translateY(1px); }
.choice[aria-checked="true"] { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent); }
.radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); flex: none; display: grid; place-items: center; background: var(--surface); }
.choice[aria-checked="true"] .radio { border-color: var(--brand); }
.choice[aria-checked="true"] .radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.choice-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.choice-text b { font-size: 14px; line-height: 1.25; }
.choice[aria-checked="true"] .choice-text b { color: var(--brand); }
.choice-text small { font-size: 12.5px; color: var(--text-2); line-height: 1.4; }
.demo { width: 84px; height: 56px; flex: none; border-radius: 8px; border: 1px solid var(--border); }
.opt-note { margin-top: 14px; font-size: 12.5px; color: var(--text-3); }
.section-head { margin-top: 4px; }
.count { color: var(--text-3); font-weight: 600; margin-left: 4px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.tabs button { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: 13.5px; color: var(--text-2); transition: background .15s, border-color .15s, color .15s; }
.tabs button:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); color: var(--text); }
.tabs button span { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-3); }
.tabs button[aria-selected="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
:root[data-theme="dark"] .tabs button[aria-selected="true"] { color: #0f1220; }
.tabs button[aria-selected="true"] span { background: rgba(255, 255, 255, .22); color: inherit; }
.selall { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.selall input { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.selall input:disabled { cursor: not-allowed; }

.item { transition: box-shadow .18s, transform .18s, border-color .18s; }
.item:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.item.selected { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 35%, transparent), var(--shadow-sm); }
.stage-wrap { position: relative; }
.pick { position: absolute; top: 10px; left: 10px; z-index: 3; width: 28px; height: 28px; cursor: pointer; }
.pick input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.pick .box { width: 100%; height: 100%; border-radius: 8px; display: grid; place-items: center; background: rgba(255, 255, 255, .92); border: 1.5px solid rgba(15, 18, 32, .25); color: transparent; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); transition: background .12s, color .12s, border-color .12s; }
.pick .box svg { width: 18px; height: 18px; stroke-width: 2.6; }
.pick:hover .box { border-color: var(--brand); }
.pick input:checked + .box { background: var(--brand); border-color: var(--brand); color: #fff; }
.pick input:focus-visible + .box { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
.stage-wrap .tag.l { left: 46px; }
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.meta-grid span:last-child { grid-column: 1 / -1; }
.err-note { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); font-size: 12.5px; font-weight: 600; line-height: 1.4; }
.err-note svg { width: 16px; height: 16px; margin-top: 1px; }
.chip.running { background: var(--brand-soft); color: var(--brand); }
.btn { transition: background .15s, border-color .15s, transform .08s, box-shadow .15s, filter .15s; }

@media (max-width: 1000px) { .options { grid-template-columns: 1fr; } }
@media (max-width: 520px) {
  .demo { display: none; }
  .info-box { display: none; }
  .tabs button { padding: 0 11px; }
  .section-actions .btn span { font-size: 13px; }
}

/* card action row: never clip the remove button */
.grid { grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); }
.item-actions { gap: 6px; }
.item-actions .btn { min-width: 0; padding: 0 10px; flex: 1 1 0; }
.item-actions .btn.ghost { flex: 0 0 34px; width: 34px; padding: 0; }
.item-actions .btn.ghost span { display: none; }
.item-actions .btn.ghost:only-child { flex: 1; width: auto; padding: 0 10px; }
.item-actions .btn.ghost:only-child span { display: inline; }

/* ---------- Google sign-in ---------- */
.g-btn { display: flex; justify-content: center; min-height: 44px; }
.linkish { display: block; margin: 18px auto 0; border: 0; background: none; color: var(--brand); font-weight: 600; font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; }
.linkish:hover { filter: brightness(1.15); }
