/* Orchestrator Web UI V0.1 — mobile-first, calm, dense where it matters. */

:root {
  --bg: #0c0d10;
  --bg-elev: #111217;
  --surface: #15161c;
  --surface-2: #1b1c23;
  --surface-3: #22242c;
  --border: #262831;
  --border-strong: #33363f;
  --text: #ecedf1;
  --text-2: #b6b9c3;
  --muted: #858a97;
  --faint: #5b606c;
  --accent: #8b97ff;
  --accent-strong: #6f7dff;
  --accent-soft: rgba(139, 151, 255, 0.12);
  --accent-ink: #0c0d10;
  --ok: #43c08f;
  --ok-soft: rgba(67, 192, 143, 0.12);
  --warn: #e7ae4a;
  --warn-soft: rgba(231, 174, 74, 0.13);
  --danger: #f0676a;
  --danger-soft: rgba(240, 103, 106, 0.12);
  --info: #6cb3ee;
  --info-soft: rgba(108, 179, 238, 0.12);
  --claude: #d8a37a;
  --claude-soft: rgba(216, 163, 122, 0.12);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.28);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --tabbar-h: 62px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f6f8;
    --bg-elev: #fbfbfc;
    --surface: #ffffff;
    --surface-2: #f4f4f7;
    --surface-3: #ececf1;
    --border: #e4e5ea;
    --border-strong: #d4d6dd;
    --text: #15161a;
    --text-2: #3e414a;
    --muted: #6b6f7a;
    --faint: #9a9ea8;
    --accent: #5260e6;
    --accent-strong: #3f4dd6;
    --accent-soft: rgba(82, 96, 230, 0.09);
    --accent-ink: #ffffff;
    --ok: #1f9d6b;
    --ok-soft: rgba(31, 157, 107, 0.1);
    --warn: #b87812;
    --warn-soft: rgba(184, 120, 18, 0.1);
    --danger: #d9474b;
    --danger-soft: rgba(217, 71, 75, 0.09);
    --info: #2f7fc1;
    --info-soft: rgba(47, 127, 193, 0.09);
    --claude: #a8623a;
    --claude-soft: rgba(168, 98, 58, 0.09);
    --shadow: 0 1px 2px rgba(20, 22, 30, 0.04), 0 6px 18px rgba(20, 22, 30, 0.05);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shell ---------- */

.app { min-height: 100dvh; }
.shell { display: flex; min-height: 100dvh; }
.sidebar { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.topbar .title { flex: 1; min-width: 0; }
.topbar h1 { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .subtitle { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border: 0; border-radius: 12px; background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(0.96); }
.icon-btn svg { width: 22px; height: 22px; }
/* back arrow (discussion -> its project's discussion list), shown on every width: icon only, 44px hit area,
   accessible name from aria-label; the negative margins keep the arrow right before the title */
.back-link {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; margin: 0 -8px 0 -12px;
  border-radius: 12px; color: var(--accent); text-decoration: none; cursor: pointer;
}
.back-link svg { width: 24px; height: 24px; }
.back-link:hover { background: var(--surface-2); }
.back-link:active { transform: scale(0.97); }
.back-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.content { flex: 1; width: 100%; max-width: 860px; margin: 0 auto; padding: 8px 16px calc(var(--tabbar-h) + 24px + var(--safe-bottom)); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: color-mix(in srgb, var(--bg-elev) 86%, transparent);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid var(--border);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--faint); font-size: 11px; font-weight: 560; position: relative;
}
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--text); }
.tab.active svg { color: var(--accent); }
.tab .dot {
  position: absolute; top: 8px; left: calc(50% + 8px);
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
  background: var(--warn); color: #15110a; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center;
}

@media (min-width: 900px) {
  .sidebar {
    display: flex; flex-direction: column; gap: 4px; width: 248px; flex: none;
    position: sticky; top: 0; height: 100dvh; padding: 18px 12px;
    border-right: 1px solid var(--border); background: var(--bg-elev);
  }
  .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 650; letter-spacing: -0.01em; }
  .brand img { width: 26px; height: 26px; }
  .brand small { display: block; color: var(--faint); font-weight: 500; font-size: 11.5px; }
  .nav-item {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
    color: var(--text-2); font-weight: 540; font-size: 14px;
  }
  .nav-item svg { width: 18px; height: 18px; color: var(--muted); }
  .nav-item:hover { background: var(--surface-2); color: var(--text); }
  .nav-item.active { background: var(--surface-3); color: var(--text); }
  .nav-item.active svg { color: var(--accent); }
  .nav-item .count { margin-left: auto; font-size: 11.5px; color: var(--warn); font-weight: 650; }
  .nav-section { margin: 18px 10px 6px; font-size: 11.5px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
  .nav-project { padding: 7px 10px; border-radius: 9px; color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav-project:hover, .nav-project.active { color: var(--text); background: var(--surface-2); }
  .sidebar .spacer { flex: 1; }
  .tabbar { display: none; }
  .content { padding: 12px 28px 48px; }
  .topbar { padding: 16px 28px 12px; }
  .topbar .back { display: none; }
}

/* ---------- primitives ---------- */

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.section-title {
  display: flex; align-items: center; gap: 8px; margin: 18px 2px 8px;
  font-size: 12.5px; font-weight: 620; color: var(--muted); letter-spacing: .01em;
}
.section-title .grow { height: 1px; background: var(--border); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card.pad { padding: 14px 16px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; }
.card-head h3 { font-size: 15px; font-weight: 640; letter-spacing: -0.01em; }
.card-body { padding: 12px 16px 16px; }
.card-foot { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 16px 14px; border-top: 1px solid var(--border); }
.card-foot .btn { flex: 1 1 150px; }
@media (min-width: 900px) { .card-foot .btn { flex: 0 0 auto; } }

.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; min-height: 56px;
  border-top: 1px solid var(--border); cursor: pointer; transition: background .15s;
}
.list-item:first-child { border-top: 0; }
.list-item:hover { background: var(--surface-2); }
.list-item:active { background: var(--surface-3); }
.list-item .chev { color: var(--faint); width: 16px; height: 16px; flex: none; }
.list-item h4 { font-size: 15px; font-weight: 580; letter-spacing: -0.01em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 14.5px;
  cursor: pointer; transition: transform .08s, background .15s, opacity .15s, border-color .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-strong); }
.btn.ok { background: var(--ok); border-color: transparent; color: #07140e; }
.btn.danger-ghost { color: var(--danger); background: transparent; border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn svg { width: 17px; height: 17px; }
.btn .spin { width: 16px; height: 16px; }
@media (max-width: 520px) { .topbar .btn-label { display: none; } .topbar .btn.small { padding: 0 10px; } }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 620; background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.claude { background: var(--claude-soft); color: var(--claude); }
.pill.live .dot { animation: pulse 1.4s ease-in-out infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.spin { animation: spin .8s linear infinite; }

.input, .textarea, .select {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s; font-size: 16px;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.label { display: block; margin: 0 0 6px 2px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.hint { margin: 6px 2px 0; font-size: 12.5px; color: var(--muted); }
.field + .field { margin-top: 14px; }

.search { position: relative; }
.search svg { position: absolute; left: 13px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--faint); }
.search .input { padding-left: 38px; }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 36px 20px; color: var(--muted);
}
.empty svg { width: 34px; height: 34px; color: var(--faint); }
.empty h3 { color: var(--text); font-size: 15.5px; font-weight: 620; }
.empty p { max-width: 320px; font-size: 13.5px; }

.skeleton { border-radius: 10px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.error-banner {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  background: var(--danger-soft); color: var(--danger); font-size: 13.5px;
}
.notice {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  background: var(--surface-2); color: var(--text-2); font-size: 13.5px; border: 1px solid var(--border);
}
.notice.warn { background: var(--warn-soft); border-color: transparent; color: var(--text); }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }

.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; overflow-x: auto;
}
.segmented button {
  min-height: 38px; padding: 0 8px; border: 0; border-radius: 9px; background: transparent;
  color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.18); }
.segmented .n { margin-left: 5px; color: var(--faint); font-weight: 650; }
.segmented button.active .n { color: var(--accent); }
@media (max-width: 480px) { .segmented { grid-auto-flow: row; grid-template-columns: 1fr 1fr; } }

/* ---------- discussion ---------- */

.discussion { display: flex; flex-direction: column; gap: 14px; padding-bottom: 8px; }
.msg { display: flex; flex-direction: column; gap: 4px; max-width: 88%; animation: rise .22s ease-out; }
.msg.owner { align-self: flex-end; align-items: flex-end; }
.msg .who { font-size: 12px; font-weight: 620; color: var(--muted); padding: 0 4px; display: flex; gap: 6px; align-items: center; }
.bubble {
  padding: 11px 14px; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere;
  font-size: 15px; line-height: 1.55;
}
.msg.owner .bubble { background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.msg.agent .bubble { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.msg.claude { max-width: 100%; align-self: stretch; }
.msg.claude .bubble { background: var(--claude-soft); border: 1px solid color-mix(in srgb, var(--claude) 30%, transparent); border-radius: 16px; }
.msg.claude .who { color: var(--claude); }
.avatar { width: 18px; height: 18px; border-radius: 6px; display: inline-grid; place-items: center; font-size: 10px; font-weight: 800; }
.avatar.ds { background: var(--info-soft); color: var(--info); }
.avatar.cl { background: var(--claude-soft); color: var(--claude); }

.thinking { display: inline-flex; gap: 4px; padding: 14px 16px; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: pulse 1.2s infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; } .thinking i:nth-child(3) { animation-delay: .3s; }

.kv { display: grid; gap: 12px; }
.kv .k { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.kv .v { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); font-size: 14.5px; }
.points { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.points li { display: flex; gap: 9px; font-size: 14.5px; }
.points li svg { width: 16px; height: 16px; flex: none; margin-top: 3px; color: var(--ok); }
.points.q li svg { color: var(--warn); }

.draft { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.draft .card-head .kicker { font-size: 11.5px; font-weight: 700; color: var(--accent); letter-spacing: .06em; text-transform: uppercase; }
.final { border-color: color-mix(in srgb, var(--ok) 35%, var(--border)); }
.final .kicker { font-size: 11.5px; font-weight: 700; color: var(--ok); letter-spacing: .06em; text-transform: uppercase; }
.risk { font-weight: 650; }
.risk.FAST { color: var(--ok); } .risk.STANDARD { color: var(--info); } .risk.HIGH_RISK { color: var(--danger); }

.cap { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; }
.cap + .cap { margin-top: 6px; }

.run { overflow: hidden; }
.run .kicker { font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.steps { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; margin-top: 12px; }
.step { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.step .bar { height: 4px; border-radius: 4px; background: var(--surface-3); position: relative; overflow: hidden; }
.step.done .bar { background: var(--ok); }
.step.active .bar { background: var(--accent-soft); }
.step.active .bar::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--accent); border-radius: 4px; animation: slide 1.4s ease-in-out infinite; }
.step.skipped .bar { background: var(--surface-3); opacity: .5; }
.step .lbl { font-size: 11.5px; font-weight: 600; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step.done .lbl, .step.active .lbl { color: var(--text-2); }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 14px; }
.fact { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.fact .k { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.fact .v { font-size: 14px; font-weight: 620; margin-top: 2px; overflow-wrap: anywhere; }
.files { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.file { font-family: var(--mono); font-size: 12px; padding: 4px 8px; border-radius: 7px; background: var(--surface-2); color: var(--text-2); }
.decision {
  margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft);
  display: flex; flex-direction: column; gap: 10px;
}
.decision p { font-size: 13.5px; }

.composer-wrap {
  position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-bottom)); z-index: 15;
  padding: 10px 0 12px; margin-top: 6px;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
@media (min-width: 900px) { .composer-wrap { bottom: 0; } }
.composer {
  display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 14px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 22px; box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.composer textarea {
  flex: 1; min-height: 40px; max-height: 180px; padding: 9px 0; border: 0; outline: none; resize: none;
  background: transparent; font-size: 16px; line-height: 1.45;
}
.send-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer; flex: none; transition: transform .08s, opacity .15s; }
.send-btn:active { transform: scale(0.94); }
.send-btn[disabled] { opacity: .35; cursor: not-allowed; }
.send-btn svg { width: 19px; height: 19px; }

.suggestion {
  display: flex; flex-direction: column; gap: 10px; padding: 13px 14px; border-radius: 14px;
  background: var(--claude-soft); border: 1px solid color-mix(in srgb, var(--claude) 28%, transparent);
}
.suggestion .t { font-weight: 640; color: var(--text); font-size: 14px; }

.layout-discussion { display: block; }
@media (min-width: 1240px) {
  .content.wide { max-width: 1240px; }
  .layout-discussion { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
  .side-panel { position: sticky; top: 76px; max-height: calc(100dvh - 96px); overflow-y: auto; }
  .inline-draft { display: none; }
}
@media (max-width: 1239px) { .side-panel { display: none; } }

/* ---------- system ---------- */

.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .grid { grid-template-columns: 1fr 1fr; } .grid .span { grid-column: 1 / -1; } }
.metric { font-size: 26px; font-weight: 680; letter-spacing: -0.02em; }
.meter { height: 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; margin: 10px 0 6px; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table td { padding: 8px 0; border-top: 1px solid var(--border); vertical-align: top; }
.table tr:first-child td { border-top: 0; }
.table td:last-child { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }
.ai-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--border); }
.ai-row:first-child { border-top: 0; padding-top: 2px; }
.ai-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.ai-mark.ds { background: var(--info-soft); color: var(--info); }
.ai-mark.cl { background: var(--claude-soft); color: var(--claude); }
.ai-mark.cx { background: var(--ok-soft); color: var(--ok); }
details.more { margin-top: 10px; }
details.more summary { cursor: pointer; color: var(--accent); font-size: 13.5px; font-weight: 600; list-style: none; padding: 6px 0; }
details.more summary::-webkit-details-marker { display: none; }

/* ---------- sheet, toast, login ---------- */

.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet {
  width: 100%; max-width: 520px; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 22px 22px 0 0; padding: 10px 18px calc(20px + var(--safe-bottom)); animation: up .22s cubic-bezier(.2,.8,.2,1);
}
.sheet .grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 0 auto 14px; }
.sheet h2 { font-size: 18px; font-weight: 660; margin-bottom: 14px; letter-spacing: -0.01em; }
.sheet .actions { display: flex; gap: 8px; margin-top: 18px; }
.sheet .actions .btn { flex: 1; }
@media (min-width: 700px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 20px; padding-bottom: 20px; } .sheet .grabber { display: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

.toasts { position: fixed; z-index: 80; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 16px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100% - 32px)); pointer-events: none; }
@media (min-width: 900px) { .toasts { left: auto; right: 24px; transform: none; bottom: 24px; width: 360px; } }
.toast { padding: 12px 14px; border-radius: 12px; background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-size: 14px; font-weight: 560; animation: rise .2s ease-out; display: flex; gap: 10px; align-items: center; }
.toast.error { border-color: color-mix(in srgb, var(--danger) 50%, var(--border)); }
.toast svg { width: 17px; height: 17px; flex: none; }
.toast.ok svg { color: var(--ok); } .toast.error svg { color: var(--danger); }

.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login .card { width: 100%; max-width: 380px; padding: 26px 22px 22px; }
.login .logo { width: 44px; height: 44px; margin-bottom: 16px; }
.login h1 { font-size: 22px; font-weight: 680; letter-spacing: -0.02em; }
.login p { color: var(--muted); font-size: 14px; margin: 6px 0 20px; }

.fab { position: fixed; right: 18px; bottom: calc(var(--tabbar-h) + 18px + var(--safe-bottom)); z-index: 25; }
@media (min-width: 900px) { .fab { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
