/* derdium Autopilot — design system */
:root {
  --bg: #0A0A0A;
  --bg-2: #0F0F0F;
  --card: #141414;
  --card-2: #1B1B1B;
  --card-3: #232323;
  --line: #242424;
  --line-2: #2E2E2E;
  --text: #F5F4F0;
  --muted: #A3A29C;
  --faint: #6B6A65;
  --accent: #E9A013;
  --accent-2: #F4B63E;
  --accent-soft: rgba(233, 160, 19, .12);
  --accent-ink: #0A0A0A;
  --ok: #6CC79A;
  --ok-soft: rgba(108, 199, 154, .12);
  --bad: #EE7A66;
  --bad-soft: rgba(238, 122, 102, .12);
  --info: #8FB3F5;
  --info-soft: rgba(143, 179, 245, .12);
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 20px 40px -24px rgba(0,0,0,.8);
  --r: 16px;
  --r-sm: 10px;
  --font: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Poppins", var(--font);
  --side: 256px;
  --top: 60px;
  --tab: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F5F4F0;
  --bg-2: #EFEDE7;
  --card: #FFFFFF;
  --card-2: #F7F6F2;
  --card-3: #EFEDE7;
  --line: #E6E3DC;
  --line-2: #D9D5CC;
  --text: #0A0A0A;
  --muted: #5F5E59;
  --faint: #8E8C85;
  --accent: #E9A013;
  --accent-2: #C98400;
  --accent-soft: rgba(233, 160, 19, .14);
  --ok: #24855A;
  --ok-soft: rgba(36, 133, 90, .1);
  --bad: #C2412D;
  --bad-soft: rgba(194, 65, 45, .08);
  --info: #2F5FB8;
  --info-soft: rgba(47, 95, 184, .08);
  --shadow: 0 1px 2px rgba(10,10,10,.04), 0 16px 32px -24px rgba(10,10,10,.25);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font); letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden; min-height: 100dvh;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img, svg, canvas { display: block; max-width: 100%; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- type ---------- */
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; letter-spacing: -.025em; margin: 0; line-height: 1.15; }
h1 { font-size: clamp(26px, 3.4vw, 34px); }
h2 { font-size: 20px; }
h3 { font-size: 16px; letter-spacing: -.015em; }
p { margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }

.logo { font-family: "Poppins", sans-serif; font-weight: 700; letter-spacing: -.035em; font-size: 22px; line-height: 1; white-space: nowrap; }
.logo i { font-style: normal; color: var(--accent); }
.logo small { font-family: var(--font); font-weight: 500; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); margin-left: 8px; vertical-align: 3px; }

/* ---------- layout ---------- */
.shell { min-height: 100dvh; }
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side); padding: 22px 14px;
  border-right: 1px solid var(--line); background: var(--bg); display: none; flex-direction: column; gap: 4px; z-index: 30;
}
.side .logo { padding: 4px 12px 22px; }
.nav-a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--muted);
  font-weight: 500; font-size: 14.5px; transition: background .15s, color .15s;
}
.nav-a svg { width: 18px; height: 18px; flex: none; }
.nav-a:hover { background: var(--card); color: var(--text); }
.nav-a.on { background: var(--card-2); color: var(--text); }
.nav-a.on svg { color: var(--accent); }
.nav-a .badge { margin-left: auto; }
.nav-sep { height: 1px; background: var(--line); margin: 12px 8px; }
.side-foot { margin-top: auto; padding: 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }

.topbar {
  position: sticky; top: 0; z-index: 25; height: var(--top); display: flex; align-items: center; gap: 12px;
  padding: 0 16px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .t-title { font-family: var(--display); font-weight: 600; font-size: 17px; letter-spacing: -.02em; }
.topbar .spacer { flex: 1; }

.main { padding: 8px 16px calc(var(--tab) + var(--safe-b) + 28px); max-width: 1180px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 10px 0 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 6px; max-width: 620px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(var(--tab) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent); border-top: 1px solid var(--line);
  backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; color: var(--faint); position: relative; padding: 8px 0; }
.tab svg { width: 22px; height: 22px; }
.tab.on { color: var(--text); }
.tab.on svg { color: var(--accent); }
.tab .dot { position: absolute; top: 4px; left: calc(50% + 8px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
.tab-create { display: grid; place-items: center; }
.tab-create span { width: 50px; height: 50px; border-radius: 16px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 10px 24px -10px rgba(233,160,19,.7); transition: transform .15s; }
.tab-create span:active { transform: scale(.94); }
.tab-create svg { width: 24px; height: 24px; }

@media (min-width: 1024px) {
  .side { display: flex; }
  .tabbar { display: none; }
  .topbar { display: none; }
  .wrap { margin-left: var(--side); }
  .main { padding: 36px 40px 64px; }
  .page-head { margin: 0 0 28px; }
}

/* ---------- surfaces ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card.pad { padding: 20px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-b { padding: 18px 20px; }
.card-f { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 1fr; }
.g3 { grid-template-columns: 1fr; }
@media (min-width: 760px) { .g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.hr { height: 1px; background: var(--line); margin: 16px 0; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty svg { width: 28px; height: 28px; margin: 0 auto 12px; color: var(--faint); }
.empty h3 { color: var(--text); margin-bottom: 6px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 11px;
  font-weight: 600; font-size: 14px; white-space: nowrap; border: 1px solid var(--line-2); background: var(--card-2); color: var(--text);
  transition: background .15s, border-color .15s, transform .1s, opacity .15s; user-select: none; -webkit-user-select: none;
}
.btn:hover { background: var(--card-3); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
:root[data-theme="light"] .btn.primary:hover { background: #F2AE2A; border-color: #F2AE2A; }
.btn.inverse { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--card-2); color: var(--text); }
.btn.danger { color: var(--bad); }
.btn.ok { color: var(--ok); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.lg { height: 50px; padding: 0 22px; font-size: 15px; border-radius: 13px; }
.btn.icon { width: 40px; padding: 0; }
.btn.icon.sm { width: 32px; }
.btn.block { width: 100%; }
.btn[disabled], .btn.loading { opacity: .55; pointer-events: none; }
.btn.loading::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--text); }
.field .hint { font-size: 12.5px; color: var(--faint); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line-2);
  color: var(--text); font-size: 16px; transition: border-color .15s, background .15s; -webkit-appearance: none; appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); background: var(--card); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='m2 4 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }
@media (min-width: 1024px) { .input, .select, .textarea { font-size: 15px; } }
.form { display: flex; flex-direction: column; gap: 18px; }
.form-row { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-row.two { grid-template-columns: 1fr 1fr; } }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--card); color: var(--muted); font-weight: 500; font-size: 14px; transition: all .15s;
}
.chip svg { width: 15px; height: 15px; }
.chip:hover { color: var(--text); border-color: var(--faint); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip.sm { height: 30px; padding: 0 11px; font-size: 12.5px; }

.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; z-index: 1; margin: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--card-3); border: 1px solid var(--line-2); transition: .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--faint); transition: .2s; }
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); background: var(--accent-ink); }

.range { width: 100%; accent-color: var(--accent); }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { height: 32px; padding: 0 13px; border-radius: 9px; font-size: 13.5px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.seg button.on { background: var(--card-3); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
:root[data-theme="light"] .seg button.on { background: var(--card); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; background: var(--card-3); color: var(--muted); white-space: nowrap; }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.count { background: var(--accent); color: var(--accent-ink); border-radius: 99px; min-width: 20px; justify-content: center; }
.pip { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.pip.ok { background: var(--ok); } .pip.bad { background: var(--bad); } .pip.accent { background: var(--accent); }
.pip.live { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }

.ch { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text); }
.ch .ch-i { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: var(--card-3); color: var(--text); font-size: 10px; font-weight: 700; letter-spacing: -.02em; }

/* ---------- Today ---------- */
.hello { font-family: var(--display); font-weight: 600; letter-spacing: -.03em; font-size: clamp(28px, 5vw, 40px); line-height: 1.08; }
.hello em { font-style: normal; color: var(--faint); }
.kpis { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr); gap: 1px; overflow-x: auto; scroll-snap-type: x mandatory; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); scrollbar-width: none; }
.kpis::-webkit-scrollbar { display: none; }
.kpi { background: var(--card); padding: 16px 18px; scroll-snap-align: start; min-width: 0; }
.kpi .v { font-family: var(--display); font-size: 26px; font-weight: 600; letter-spacing: -.03em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12.5px; color: var(--muted); }
.kpi:first-child { border-radius: var(--r) 0 0 var(--r); }
.kpi:last-child { border-radius: 0 var(--r) var(--r) 0; }

.callout { display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-radius: var(--r); background: var(--accent); color: var(--accent-ink); }
.callout h3 { font-size: 16px; }
.callout p { opacity: .78; font-size: 13.5px; }
.callout .btn { background: var(--accent-ink); color: #fff; border-color: var(--accent-ink); }
.callout .ic { width: 40px; height: 40px; border-radius: 12px; background: rgba(0,0,0,.1); display: grid; place-items: center; flex: none; }

.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.check:first-child { border-top: 0; padding-top: 0; }
.check .box { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--line-2); display: grid; place-items: center; flex: none; margin-top: 1px; }
.check.done .box { background: var(--ok); border-color: var(--ok); color: var(--bg); }
.check.done .box svg { width: 13px; height: 13px; }
.check.done .t { color: var(--faint); text-decoration: line-through; text-decoration-color: var(--line-2); }
.progress { height: 4px; border-radius: 4px; background: var(--card-3); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .4s; }

.timeline { display: flex; flex-direction: column; }
.tl { display: grid; grid-template-columns: 56px 1fr; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); align-items: start; }
.tl:first-child { border-top: 0; padding-top: 0; }
.tl .time { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13.5px; padding-top: 1px; }
.tl .what { min-width: 0; }
.tl .what p { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.brief { white-space: pre-wrap; font-size: 14.5px; line-height: 1.65; }
.brief b { display: block; font-size: 11px; letter-spacing: .12em; color: var(--faint); margin-top: 14px; margin-bottom: 2px; font-weight: 600; }
.brief b:first-child { margin-top: 0; }

.log { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.log:first-child { border-top: 0; padding-top: 0; }
.log .pip { margin-top: 7px; }

/* ---------- posts ---------- */
.posts { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .posts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1400px) { .posts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.post { display: flex; flex-direction: column; overflow: hidden; }
.post-top { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; }
.post-body { padding: 12px 16px 14px; white-space: pre-wrap; word-wrap: break-word; font-size: 14.5px; line-height: 1.6; flex: 1; }
.post-body.clamp { max-height: 270px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 75%, transparent); mask-image: linear-gradient(#000 75%, transparent); }
.post-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 0 16px 12px; font-size: 12.5px; color: var(--faint); }
.post-vis { margin: 0 16px 14px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--bg-2); aspect-ratio: 4 / 5; max-height: 300px; display: grid; place-items: center; }
.post-vis canvas { width: 100%; height: 100%; object-fit: contain; }
.post-actions { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--card); margin-top: auto; }
.post-actions .btn { height: 42px; }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.cal-day { min-height: 200px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cal-day.today { border-color: var(--accent); }
.cal-day .d { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--faint); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.cal-day .d b { font-family: var(--display); font-size: 18px; color: var(--text); letter-spacing: -.02em; }
.slot { border-radius: 10px; padding: 8px 9px; background: var(--card-2); border: 1px solid var(--line); font-size: 12.5px; text-align: left; width: 100%; transition: border-color .15s; min-width: 0; }
.slot:hover { border-color: var(--faint); }
.slot .s-t { display: flex; justify-content: space-between; gap: 6px; color: var(--faint); font-size: 11.5px; font-weight: 600; margin-bottom: 3px; }
.slot .s-x { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--text); }
.slot.published { opacity: .6; }
.slot.due { border-color: var(--accent); }
.slot.failed { border-color: var(--bad); }
.agenda-day { margin-bottom: 18px; }
.agenda-day h4 { font-family: var(--font); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin: 0 0 8px; font-weight: 600; }
.agenda-day.today h4 { color: var(--accent); }
.agenda-day .slot { padding: 12px 14px; font-size: 14px; margin-bottom: 8px; }

/* ---------- ideas ---------- */
.ideas { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .ideas { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.idea { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.idea h3 { font-family: var(--font); font-weight: 600; font-size: 15.5px; letter-spacing: -.01em; line-height: 1.35; }
.idea p { color: var(--muted); font-size: 14px; }
.score { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.score i { display: block; width: 36px; height: 4px; border-radius: 4px; background: var(--card-3); position: relative; overflow: hidden; }
.score i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--accent); border-radius: 4px; }

/* ---------- agents ---------- */
.flow { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .flow { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1300px) { .flow { grid-template-columns: repeat(4, 1fr); } }
.flow-col h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 14px; }
.flow-col h3 .n { width: 24px; height: 24px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 12px; font-family: var(--font); }
.agent { padding: 16px; display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.agent h4 { font-family: var(--font); font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.agent p { font-size: 13.5px; color: var(--muted); }
.agent .last { font-size: 12.5px; color: var(--faint); display: flex; gap: 8px; align-items: flex-start; }
.agent .last .pip { margin-top: 6px; }
.agent.off { opacity: .55; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.t th { text-align: left; font-weight: 600; color: var(--faint); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t td.r, .t th.r { text-align: right; font-variant-numeric: tabular-nums; }
.t tr.click { cursor: pointer; }
.t tr.click:hover td { background: var(--card-2); }
.t .ttl { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 700px) {
  table.t.cards thead { display: none; }
  table.t.cards, .t.cards tbody, .t.cards tr, .t.cards td { display: block; width: 100%; }
  .t.cards tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .t.cards td { border: 0; padding: 2px 0; text-align: left !important; }
  .t.cards td[data-l]::before { content: attr(data-l) " "; color: var(--faint); font-size: 12px; }
  .t.cards td.inline { display: inline-block; width: auto; margin-right: 14px; }
  .t .ttl { max-width: 100%; white-space: normal; font-weight: 600; }
}

.chart { width: 100%; height: 180px; }
.chart .bar { fill: var(--accent); }
.chart .bar.dim { fill: var(--card-3); }
.chart text { fill: var(--faint); font-size: 10px; font-family: var(--font); }
.chart line { stroke: var(--line); }
.hbar { display: grid; grid-template-columns: 96px 1fr 60px; gap: 12px; align-items: center; font-size: 13.5px; padding: 6px 0; }
.hbar .track { height: 8px; background: var(--card-3); border-radius: 8px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--accent); border-radius: 8px; }

/* ---------- sheet / modal ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 80; opacity: 0; transition: opacity .2s; backdrop-filter: blur(2px); }
.scrim.in { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; max-height: 92dvh; display: flex; flex-direction: column;
  background: var(--card); border-top: 1px solid var(--line-2); border-radius: 22px 22px 0 0; transform: translateY(100%);
  transition: transform .28s cubic-bezier(.2,.8,.2,1); padding-bottom: var(--safe-b);
}
.sheet.in { transform: none; }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line-2); margin: 10px auto 2px; flex: none; }
.sheet-h { display: flex; align-items: center; gap: 12px; padding: 12px 20px 14px; border-bottom: 1px solid var(--line); flex: none; }
.sheet-h h2 { font-size: 18px; flex: 1; min-width: 0; }
.sheet-b { padding: 18px 20px 22px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; flex: 1; }
.sheet-f { padding: 12px 20px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex: none; flex-wrap: wrap; }
.sheet-f .btn { flex: 1; min-width: 120px; }
@media (min-width: 760px) {
  .sheet { left: 50%; top: 50%; bottom: auto; right: auto; width: min(680px, calc(100vw - 48px)); max-height: 86vh; border-radius: 20px; border: 1px solid var(--line-2);
    transform: translate(-50%, -46%) scale(.98); opacity: 0; transition: transform .22s, opacity .22s; padding-bottom: 0; }
  .sheet.wide { width: min(980px, calc(100vw - 48px)); }
  .sheet.in { transform: translate(-50%, -50%); opacity: 1; }
  .sheet .grab { display: none; }
  .sheet-f .btn { flex: 0 0 auto; }
  .sheet-f .push { margin-left: auto; }
}

.toast-wrap { position: fixed; z-index: 120; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab) + var(--safe-b) + 14px); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 420px; }
@media (min-width: 1024px) { .toast-wrap { bottom: 28px; left: calc(50% + var(--side) / 2); } }
.toast { pointer-events: auto; padding: 12px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 500; font-size: 14px; box-shadow: 0 16px 40px -12px rgba(0,0,0,.5); display: flex; gap: 10px; align-items: center; animation: tin .25s ease; max-width: 100%; }
.toast.bad { background: var(--bad); color: #fff; }
.toast svg { width: 16px; height: 16px; flex: none; }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }

/* ---------- setup / auth ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .auth { grid-template-columns: minmax(420px, 1fr) minmax(0, 1.05fr); } }
.auth-art { display: none; position: relative; overflow: hidden; background: #0A0A0A; color: #F5F4F0; padding: 48px; border-right: 1px solid #1E1E1E; }
@media (min-width: 1024px) { .auth-art { display: flex; flex-direction: column; } }
.auth-art .logo { font-size: 30px; color: #F5F4F0; }
.auth-art .big { font-family: "Poppins"; font-weight: 600; font-size: clamp(34px, 3.4vw, 52px); letter-spacing: -.04em; line-height: 1.04; margin-top: auto; max-width: 560px; }
.auth-art .big i { font-style: normal; color: var(--accent); }
.auth-art ol { list-style: none; padding: 0; margin: 36px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: #1E1E1E; border: 1px solid #1E1E1E; border-radius: 14px; overflow: hidden; }
.auth-art li { background: #0F0F0F; padding: 14px; font-size: 13px; color: #A3A29C; }
.auth-art li b { display: block; color: #F5F4F0; font-weight: 600; margin-bottom: 4px; font-size: 13.5px; }
.auth-art li span { color: var(--accent); font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 600; }
.auth-main { display: flex; flex-direction: column; padding: 20px 16px calc(24px + var(--safe-b)); }
@media (min-width: 640px) { .auth-main { padding: 40px; } }
.auth-inner { width: 100%; max-width: 520px; margin: auto; padding: 24px 0; }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
@media (min-width: 1024px) { .auth-top .logo { visibility: hidden; } }
.steps { display: flex; gap: 6px; margin: 30px 0 28px; }
.steps i { flex: 1; height: 3px; border-radius: 3px; background: var(--card-3); transition: background .3s; }
.steps i.on { background: var(--accent); }
.step-n { font-size: 12.5px; color: var(--faint); font-weight: 600; letter-spacing: .04em; margin-bottom: 8px; }
.auth h1 { font-size: clamp(28px, 6vw, 36px); letter-spacing: -.035em; }
.auth .lede { color: var(--muted); margin: 10px 0 28px; font-size: 15.5px; }
.auth-actions { display: flex; gap: 10px; margin-top: 30px; }
.auth-actions .btn.primary { flex: 1; }
.tone-row { display: grid; grid-template-columns: 76px 1fr 76px; gap: 12px; align-items: center; font-size: 13px; color: var(--muted); }
.tone-row span:last-child { text-align: right; }
.pick { display: grid; gap: 10px; grid-template-columns: 1fr; }
.pick-o { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--card); text-align: left; transition: border-color .15s, background .15s; width: 100%; }
.pick-o.on { border-color: var(--accent); background: var(--accent-soft); }
.pick-o .rad { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-2); flex: none; margin-top: 2px; display: grid; place-items: center; }
.pick-o.on .rad { border-color: var(--accent); }
.pick-o.on .rad::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.pick-o b { display: block; font-weight: 600; margin-bottom: 2px; }
.pick-o span { color: var(--muted); font-size: 13.5px; }

/* ---------- settings ---------- */
.set-layout { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .set-layout { grid-template-columns: 220px minmax(0, 1fr); align-items: start; } .set-nav { position: sticky; top: 36px; } }
.set-nav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.set-nav::-webkit-scrollbar { display: none; }
@media (min-width: 900px) { .set-nav { flex-direction: column; margin: 0; padding: 0; gap: 2px; } }
.set-nav a { padding: 8px 12px; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: 14px; white-space: nowrap; border: 1px solid var(--line); }
@media (min-width: 900px) { .set-nav a { border: 0; } }
.set-nav a.on { background: var(--card-2); color: var(--text); border-color: var(--line-2); }
.set-nav a:hover { color: var(--text); }
.code { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; word-break: break-all; }
.code span { flex: 1; min-width: 0; }
pre.code { display: block; white-space: pre-wrap; margin: 0; }
.steps-list { counter-reset: s; list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.steps-list li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; gap: 12px; font-size: 14px; }
.steps-list li::before { content: counter(s); width: 26px; height: 26px; border-radius: 8px; background: var(--card-3); display: grid; place-items: center; font-weight: 700; font-size: 12.5px; }
.status-line { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); font-size: 14px; }

/* ---------- misc ---------- */
.skel { background: linear-gradient(90deg, var(--card) 0%, var(--card-2) 50%, var(--card) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r); border: 1px solid var(--line); }
@keyframes sk { to { background-position: -200% 0; } }
.fade-in { animation: fi .25s ease; }
@keyframes fi { from { opacity: 0; transform: translateY(4px); } }
.more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.more-a { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--card-2); }
.more-a svg { width: 22px; height: 22px; color: var(--accent); }
.more-a b { font-weight: 600; }
.more-a span { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.vis-styles { display: flex; gap: 8px; }
.vis-styles button { width: 34px; height: 34px; border-radius: 10px; border: 2px solid var(--line-2); }
.vis-styles button.on { border-color: var(--accent); }
.counter { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--bad); font-weight: 600; }
.hide-m { display: none; }
@media (min-width: 760px) { .hide-m { display: initial; } .hide-d { display: none !important; } }
.reply-card { padding: 16px 18px; }
.reply-card .q { color: var(--muted); font-size: 14px; border-left: 2px solid var(--line-2); padding-left: 12px; margin-bottom: 12px; }
.reply-card .a { font-size: 14.5px; white-space: pre-wrap; }
.offline { position: fixed; top: 0; left: 0; right: 0; z-index: 200; background: var(--bad); color: #fff; text-align: center; font-size: 13px; padding: 6px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
