/* Swarm Carousels design system. Warm, minimal, quiet. */
:root, :root[data-theme=light] {
  --app:#F4F2EE; --surface:#F8F6F2; --card:#FFFFFF; --tile:#F3F1EC; --track:#EEEAE3; --line:#E4E0D8;
  --ink:#1B1A17; --ink-2:#66635D; --ink-3:#8E8A82; --brand:#F2B33D; --select:#2F6BFF;
  --on-ink:#FFFFFF; --ink-hover:#333330;
  --green-bg:#E7F4EC; --green:#1E7A45; --amber-bg:#FFF2D7; --amber:#805600; --red-bg:#FBE5E2; --red:#D8453A;
  --neutral-bg:#EFEDE8; --neutral:#6B6A65;
  --sh-1:0 1px 2px rgba(0,0,0,.04); --sh-2:0 8px 24px rgba(0,0,0,.05);
  --r-card:20px; --r-tile:14px; --r-input:12px; --r-pill:999px;
  --font:"Inter",-apple-system,BlinkMacSystemFont,"SF Pro Text","Helvetica Neue",sans-serif;
  --backdrop:rgba(26,26,26,.28);
  color-scheme: light;
}
:root[data-theme=dark] {
  --app:#151412; --surface:#1B1A18; --card:#23211E; --tile:#2A2824; --track:#302D28; --line:#37332E;
  --ink:#F2F1ED; --ink-2:#A3A19B; --ink-3:#75736D; --on-ink:#1A1A1A; --ink-hover:#DAD9D4;
  --green-bg:#1B2D22; --green:#7CCB9A; --amber-bg:#33291A; --amber:#E0B25E; --red-bg:#3A2320; --red:#E98B7C;
  --neutral-bg:#2A2A27; --neutral:#A3A19B; --backdrop:rgba(0,0,0,.55); --sh-2:0 8px 24px rgba(0,0,0,.3);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]):not([data-theme=dark]) {
    --app:#151412; --surface:#1B1A18; --card:#23211E; --tile:#2A2824; --track:#302D28; --line:#37332E;
    --ink:#F2F1ED; --ink-2:#A3A19B; --ink-3:#75736D; --on-ink:#1A1A1A; --ink-hover:#DAD9D4;
    --green-bg:#1B2D22; --green:#7CCB9A; --amber-bg:#33291A; --amber:#E0B25E; --red-bg:#3A2320; --red:#E98B7C;
    --neutral-bg:#2A2A27; --neutral:#A3A19B; --backdrop:rgba(0,0,0,.55); --sh-2:0 8px 24px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}

*,*::before,*::after { box-sizing:border-box; }
html,body { margin:0; height:100%; }
body { background:var(--app); color:var(--ink); font:400 13px/1.5 var(--font); -webkit-font-smoothing:antialiased; font-variant-numeric:tabular-nums; overflow-x:hidden; }
h1,h2,h3,h4,p { margin:0; }
button,input,select,textarea { font:inherit; color:inherit; }
button { cursor:pointer; }
a { color:inherit; text-decoration:none; }
svg { flex:none; }
:focus-visible { outline:2px solid var(--ink); outline-offset:2px; }
::selection { background:rgba(10,132,255,.2); }

/* type */
.t-page { font-size:22px; font-weight:500; letter-spacing:-.01em; line-height:1.25; }
.t-section { font-size:15px; font-weight:500; }
.t-label { font-size:12px; color:var(--ink-2); }
.t-body { font-size:13px; }
.t-muted { color:var(--ink-2); } .t-faint { color:var(--ink-3); }
.num { font-variant-numeric:tabular-nums; }

/* layout */
.shell { display:flex; gap:0; height:100vh; padding:10px; }
.frame { flex:1; display:flex; min-width:0; background:var(--surface); border-radius:28px; overflow:hidden; }
.sidebar { width:232px; flex:none; padding:20px 12px 16px; display:flex; flex-direction:column; gap:4px; overflow-y:auto; }
.logo { display:flex; align-items:center; gap:10px; padding:2px 10px 18px; font-size:16px; font-weight:600; letter-spacing:-.01em; }
.logo-mark { width:24px; height:24px; border-radius:8px; background:var(--brand); }
.nav-group { margin:16px 10px 6px; font-size:12px; color:var(--ink-3); }
.nav-item { display:flex; align-items:center; gap:10px; height:36px; padding:0 10px; border-radius:var(--r-pill); color:var(--ink-2); background:none; border:0; width:100%; text-align:left; }
.nav-item:hover { color:var(--ink); }
.nav-item.active { background:var(--card); color:var(--ink); box-shadow:var(--sh-1), 0 2px 8px rgba(0,0,0,.04); font-weight:500; }
.nav-item .grow { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.nav-item .caret { transition:transform .15s; } .nav-item.open .caret { transform:rotate(90deg); }
.nav-sub { display:flex; flex-direction:column; gap:2px; margin:2px 0 4px 20px; padding-left:10px; border-left:1px solid var(--line); }
.nav-sub .nav-item { height:32px; }
.rail { width:64px; flex:none; padding:16px 0; display:flex; flex-direction:column; align-items:center; gap:8px; }
.rail .logo-mark { margin-bottom:14px; }
.rail-btn { position:relative; width:40px; height:40px; border-radius:50%; display:grid; place-items:center; background:none; border:0; color:var(--ink-2); }
.rail-btn:hover { background:var(--card); color:var(--ink); }
.rail-btn.active { background:var(--ink); color:var(--on-ink); }
.rail-btn svg { width:18px; height:18px; }
.rail-btn[data-tip]:hover::after { content:attr(data-tip); position:absolute; left:calc(100% + 10px); top:50%; transform:translateY(-50%); background:var(--ink); color:var(--on-ink); font-size:12px; padding:4px 10px; border-radius:var(--r-pill); white-space:nowrap; z-index:50; pointer-events:none; }
.main { flex:1; min-width:0; display:flex; flex-direction:column; }
.topbar { height:52px; flex:none; display:flex; align-items:center; gap:12px; padding:0 24px 0 8px; }
.topbar .title { font-size:15px; font-weight:500; display:flex; align-items:center; gap:8px; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.topbar .crumb { color:var(--ink-2); font-weight:400; } .topbar .crumb:hover { color:var(--ink); }
.topbar .sep { color:var(--ink-3); }
.topbar .right { margin-left:auto; display:flex; align-items:center; gap:8px; }
.cmd-pill { display:flex; align-items:center; gap:8px; height:32px; padding:0 8px 0 12px; border-radius:var(--r-pill); background:var(--card); border:1px solid var(--line); color:var(--ink-3); }
.cmd-pill:hover { color:var(--ink-2); }
.cmd-pill kbd { font:inherit; font-size:11px; background:var(--tile); color:var(--ink-2); border-radius:var(--r-pill); padding:1px 8px; }
.content { flex:1; min-height:0; overflow-y:auto; padding:8px 32px 48px 8px; }
.page { max-width:1180px; margin:0 auto; padding:0 0 0 0; display:flex; flex-direction:column; gap:32px; }
.page-head { display:flex; align-items:flex-end; gap:16px; flex-wrap:wrap; } .page-head .grow { flex:1; }
.section-head { display:flex; align-items:center; gap:10px; margin-bottom:16px; }
.section-title { font-size:15px; font-weight:500; display:flex; align-items:center; gap:8px; }
.section-head .right { margin-left:auto; display:flex; gap:8px; align-items:center; }
.count { display:inline-grid; place-items:center; min-width:20px; height:20px; padding:0 6px; border-radius:6px; background:var(--ink); color:var(--on-ink); font-size:11px; font-weight:500; }
.grid { display:grid; gap:24px; } .grid.cols-2 { grid-template-columns:repeat(2,1fr); } .grid.cols-3 { grid-template-columns:repeat(3,1fr); } .grid.cols-4 { grid-template-columns:repeat(4,1fr); }
.grid.auto { grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); }
.row { display:flex; align-items:center; gap:8px; } .row.wrap { flex-wrap:wrap; } .stack { display:flex; flex-direction:column; gap:12px; } .grow { flex:1; min-width:0; } .spacer { flex:1; }

/* components */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:6px; height:32px; padding:0 14px; border-radius:var(--r-pill); background:var(--card); border:1px solid var(--line); color:var(--ink); font-weight:500; white-space:nowrap; box-shadow:var(--sh-1); }
.btn:hover { background:var(--tile); }
.btn.primary { background:var(--brand); color:#1B1A17; border-color:var(--brand); box-shadow:none; }
.btn.primary:hover { background:#E5A42C; border-color:#E5A42C; }
.btn.ghost { background:none; border-color:transparent; box-shadow:none; color:var(--ink-2); }
.btn.ghost:hover { background:var(--track); color:var(--ink); }
.btn.sm { height:26px; padding:0 10px; font-size:12px; }
.btn.icon { width:40px; padding:0; } .btn.icon.sm { width:40px; height:40px; }
.btn.danger { color:var(--red); }
.btn:disabled,.btn[disabled] { opacity:.45; cursor:not-allowed; pointer-events:none; }
.seg { display:inline-flex; gap:2px; padding:3px; background:var(--track); border-radius:var(--r-pill); max-width:100%; overflow-x:auto; }
.seg button { display:inline-flex; align-items:center; gap:6px; height:28px; padding:0 12px; border:0; border-radius:var(--r-pill); background:none; color:var(--ink-2); font-weight:500; white-space:nowrap; }
.seg button:hover { color:var(--ink); }
.seg button.active { background:var(--card); color:var(--ink); box-shadow:var(--sh-1); }
.seg .n { display:inline-grid; place-items:center; min-width:18px; height:18px; padding:0 5px; border-radius:var(--r-pill); background:var(--line); color:var(--ink-2); font-size:11px; }
.chip { display:inline-flex; align-items:center; height:22px; padding:0 9px; border-radius:var(--r-pill); font-size:12px; font-weight:500; background:var(--neutral-bg); color:var(--neutral); white-space:nowrap; }
.chip.green { background:var(--green-bg); color:var(--green); } .chip.amber { background:var(--amber-bg); color:var(--amber); } .chip.red { background:var(--red-bg); color:var(--red); }
.badge { display:inline-grid; place-items:center; min-width:20px; height:20px; padding:0 6px; border-radius:6px; background:var(--ink); color:var(--on-ink, #fff); font-size:11px; font-weight:500; font-variant-numeric:tabular-nums; vertical-align:middle; }
.card { background:var(--card); border-radius:var(--r-card); padding:20px; box-shadow:var(--sh-1); }
.card.flush { padding:0; overflow:hidden; } .card.link { transition:box-shadow .15s; } .card.link:hover { box-shadow:var(--sh-2); }
.tile { background:var(--tile); border-radius:var(--r-tile); padding:14px; }
.thumb { position:relative; aspect-ratio:3/4; background:var(--tile); border-radius:var(--r-tile); overflow:hidden; }
.thumb canvas,.thumb img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; display:block; }
.swatch { width:28px; height:28px; border-radius:50%; box-shadow:inset 0 0 0 1px rgba(0,0,0,.08); }
.dots { display:flex; } .dots i { width:14px; height:14px; border-radius:50%; margin-right:-4px; box-shadow:0 0 0 2px var(--card); }

.field { display:flex; flex-direction:column; gap:6px; } .field > label,.field > .lbl { font-size:12px; color:var(--ink-2); } .field .hint { font-size:12px; color:var(--ink-3); }
.brand-brief-import [hidden] { display:none; }
.input,.select,.textarea { width:100%; height:36px; padding:0 12px; background:var(--card); border:1px solid var(--line); border-radius:var(--r-input); outline:none; }
.card .input,.card .select,.card .textarea { background-color:var(--tile); border-color:transparent; }
.textarea { height:auto; min-height:88px; padding:10px 12px; resize:vertical; line-height:1.5; }
.input::placeholder,.textarea::placeholder { color:var(--ink-3); }
.input:focus,.select:focus,.textarea:focus { border-color:var(--ink); box-shadow:0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent); background-color:var(--card); }
.select { appearance:none; padding-right:32px; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239C9A94' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 10px center; }
.input.sm,.select.sm { height:28px; font-size:12px; }
.input[type=number] { width:96px; }
.input.search { padding-left:34px; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239C9A94' stroke-width='1.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:11px center; }
.toggle { position:relative; display:inline-block; width:36px; height:22px; flex:none; }
.toggle input { position:absolute; inset:0; width:100%; height:100%; margin:0; opacity:0; cursor:pointer; z-index:1; }
.toggle i { position:absolute; inset:0; background:var(--line); border-radius:var(--r-pill); transition:background .15s; }
.toggle i::after { content:""; position:absolute; top:3px; left:3px; width:16px; height:16px; border-radius:50%; background:#fff; box-shadow:0 1px 2px rgba(0,0,0,.2); transition:transform .15s; }
.toggle input:checked + i { background:var(--ink); } .toggle input:checked + i::after { transform:translateX(14px); }
:root[data-theme=dark] .toggle input:checked + i::after { background:var(--on-ink); }
.toggle input:focus-visible + i { outline:2px solid var(--ink); outline-offset:2px; }
.check { display:inline-flex; align-items:center; gap:8px; }
.check input { appearance:none; width:18px; height:18px; margin:0; border-radius:6px; border:1.5px solid var(--ink-3); background:var(--card); display:grid; place-items:center; }
.check input:checked { background:var(--ink); border-color:var(--ink); }
.check input:checked::after { content:""; width:9px; height:5px; border-left:1.5px solid var(--on-ink); border-bottom:1.5px solid var(--on-ink); transform:translateY(-1px) rotate(-45deg); }

.list { display:flex; flex-direction:column; }
.list-row { display:flex; align-items:center; gap:12px; padding:12px 0; border-top:1px solid var(--line); min-height:52px; }
.list-row:first-child { border-top:0; }
.list-row .meta { color:var(--ink-3); font-size:12px; }
.table { width:100%; border-collapse:collapse; }
.table th { text-align:left; font-weight:400; font-size:12px; color:var(--ink-3); padding:0 12px 10px 0; }
.table td { padding:12px 12px 12px 0; border-top:1px solid var(--line); }
.table td.r,.table th.r { text-align:right; padding-right:0; }

.backdrop { position:fixed; inset:0; z-index:100; background:var(--backdrop); display:grid; place-items:center; padding:16px; }
.sheet { width:min(480px,100%); max-height:calc(100vh - 32px); overflow:auto; background:var(--card); border-radius:var(--r-card); box-shadow:var(--sh-2); padding:24px; display:flex; flex-direction:column; gap:16px; }
.sheet h3 { font-size:15px; font-weight:500; } .sheet .actions { display:flex; justify-content:flex-end; gap:8px; margin-top:4px; }
.toasts { position:fixed; right:20px; bottom:20px; z-index:200; display:flex; flex-direction:column; gap:8px; align-items:flex-end; }
.toast { background:var(--ink); color:var(--on-ink); padding:10px 16px; border-radius:var(--r-pill); box-shadow:var(--sh-2); max-width:min(420px,calc(100vw - 32px)); }
.toast.error { background:var(--red); color:#fff; } .toast.success { background:var(--green); color:#fff; }
:root[data-theme=dark] .toast.error,:root[data-theme=dark] .toast.success { color:#111; }
.cmdk-wrap { align-items:start; padding-top:14vh; }
.cmdk { width:min(560px,100%); background:var(--card); border-radius:var(--r-card); box-shadow:var(--sh-2); overflow:hidden; }
.cmdk input { width:100%; height:52px; padding:0 20px; border:0; border-bottom:1px solid var(--line); background:none; outline:none; font-size:14px; }
.cmdk-list { max-height:360px; overflow:auto; padding:8px; }
.cmdk-group { font-size:12px; color:var(--ink-3); padding:8px 12px 4px; }
.cmdk-item { display:flex; align-items:center; gap:10px; height:38px; padding:0 12px; border-radius:var(--r-input); color:var(--ink-2); }
.cmdk-item .hint { margin-left:auto; font-size:12px; color:var(--ink-3); }
.cmdk-item.sel { background:var(--tile); color:var(--ink); }
.cmdk-empty { padding:24px; text-align:center; color:var(--ink-3); }
.empty { display:flex; flex-direction:column; align-items:center; text-align:center; gap:16px; padding:56px 24px; color:var(--ink-2); }
.empty p { max-width:360px; font-size:14px; }
.skeleton { background:var(--track); border-radius:var(--r-tile); min-height:14px; } .skeleton.line { height:12px; border-radius:6px; }
.spinner { width:16px; height:16px; border-radius:50%; border:2px solid var(--line); border-top-color:var(--ink); animation:sw-spin .8s linear infinite; display:inline-block; flex:none; }
@keyframes sw-spin { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration:2s; } }

/* phone and narrow */
@media (max-width:900px) {
  .sidebar:not(.navmenu) { display:none; }
  .grid.cols-3,.grid.cols-4 { grid-template-columns:repeat(2,1fr); }
}
@media (max-width:640px) {
  .shell { padding:0; } .frame { border-radius:0; }
  .rail { width:52px; } .topbar { padding:0 16px 0 4px; } .content { padding:8px 16px 40px 16px; }
  .grid.cols-2,.grid.cols-3,.grid.cols-4 { grid-template-columns:1fr; } .grid { gap:16px; }
  .cmd-pill span { display:none; } .cmd-pill kbd { display:none; } .cmd-pill { padding:0 10px; }
  .t-page { font-size:20px; }
}
.rail.auto { display:none; }
@media (max-width:900px) { .rail.auto { display:flex; } }
.sidebar.hidden { display:none; }
.seg{align-self:flex-start}
.page-head .grow{flex:1 1 240px}

/* thin, quiet scrollbars: a slim line that fades in while you hover or scroll the area */
::-webkit-scrollbar { width:10px; height:10px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background:transparent; }
::-webkit-scrollbar-thumb { background-color:transparent; border-radius:10px; border:3px solid transparent; background-clip:padding-box; transition:background-color .3s ease, border-width .15s ease; }
*:hover::-webkit-scrollbar-thumb { background-color:rgba(26,26,26,.2); }
::-webkit-scrollbar-thumb:hover { background-color:rgba(26,26,26,.42); border-width:2px; }
:root[data-theme=dark] *:hover::-webkit-scrollbar-thumb { background-color:rgba(242,241,237,.22); }
:root[data-theme=dark] ::-webkit-scrollbar-thumb:hover { background-color:rgba(242,241,237,.45); }
/* numbers can be scrubbed: hover, press and drag left or right */
input[type=number] { -moz-appearance:textfield; appearance:textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance:none; margin:0; }
input[type=number]:not(:focus), label:has(> input[type=number]) { cursor:ew-resize; }
/* hover tips: appear after a short pause, like a desktop app */
.sw-tip { position:fixed; z-index:99999; pointer-events:none; max-width:240px; padding:6px 10px; border-radius:9px; background:#1A1A1A; color:#fff; font:500 12px/1.35 var(--font); box-shadow:0 6px 18px rgba(0,0,0,.25); opacity:0; transform:translateY(3px); transition:opacity .15s ease, transform .15s ease; }
.sw-tip.on { opacity:1; transform:none; }

/* menu button + drop-down menu (replaces the always-open icon rail on work pages) */
.burger { flex:none; width:36px; height:36px; margin:0 2px 0 6px; border-radius:50%; border:0; background:none; color:var(--ink-2); display:grid; place-items:center; }
.burger:hover, .burger[aria-expanded=true] { background:var(--card); color:var(--ink); } .burger svg { width:18px; height:18px; }
.sidebar.navmenu { position:fixed; left:22px; top:64px; z-index:70; width:248px; max-height:calc(100vh - 90px); background:var(--card); border:1px solid var(--line); border-radius:18px; box-shadow:0 16px 40px rgba(0,0,0,.14); padding:14px 10px 12px; animation:menuIn .16s ease; }
.sidebar.navmenu.hidden { display:none; }
@keyframes menuIn { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:none; } }

/* which AI is in use, always visible */
.ai-chip { display:inline-flex; align-items:center; gap:7px; height:30px; padding:0 12px; border-radius:999px; background:var(--card); border:1px solid var(--line); font-size:12.5px; font-weight:500; color:var(--ink); white-space:nowrap; }
.ai-chip:hover { background:var(--tile); }
.ai-chip .ai-dot { width:8px; height:8px; border-radius:50%; background:var(--green); flex:none; }
.ai-chip[data-p=codex] .ai-dot { background:#10A37F; } .ai-chip[data-p=claude] .ai-dot { background:#D97757; }
@media (max-width:760px) { .ai-chip span { display:none; } .ai-chip { padding:0 9px; } }
