/* Archid hub: Atlas look from Agent OS, tuned for phone first. */
:root {
  color-scheme: dark;
  --bg: #07080C; --bg2: #0C0E14; --card: #12141B; --card2: #171A23; --input: #1B1E28;
  --line: #262A36; --line2: #353B4B;
  --text: #F2F4FA; --muted: #9AA1B5; --dim: #8A91A5;
  --acc: #8CA0FF; --acc-soft: #1F2556; --acc-ink: #B9C5FF; --on-acc: #0A0E26;
  --ok: #4BD08B; --bad: #FF9A9A; --warn: #FFC978;
  --acc-rgb: 140, 160, 255;
  --sans: 'Geist', 'Segoe UI', -apple-system, system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --r: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #EEF0F4; --bg2: #E6E9F0; --card: #FFFFFF; --card2: #F6F7FA; --input: #EDEFF4;
    --line: #E1E4EA; --line2: #CDD2DC;
    --text: #0F1220; --muted: #545A6C; --dim: #5F6678;
    --acc: #3347FF; --acc-soft: #E3E7FF; --acc-ink: #1A2BD1; --on-acc: #FFFFFF;
    --ok: #0E7441; --bad: #B3261E; --warn: #8A5A00;
    --acc-rgb: 51, 71, 255;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--acc); }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 13px; } .mono { font-family: var(--mono); }
.err { color: var(--bad); min-height: 1.2em; margin: 8px 0 0; font-size: 14px; }

/* ---------- buttons + fields */
.btn { border: 1px solid var(--line2); background: var(--card2); border-radius: 14px; padding: 10px 16px; cursor: pointer; font-weight: 600; min-height: 44px; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--acc); color: var(--on-acc); border-color: transparent; }
.btn.ok { background: var(--ok); color: #06180F; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 12px; }
.icon-btn { border: 1px solid var(--line); background: var(--card); border-radius: 12px; min-width: 40px; height: 40px; cursor: pointer; padding: 0 10px; font-weight: 600; }
.field { width: 100%; background: var(--input); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; outline: none; min-height: 46px; font-size: 16px; }
.field:focus { border-color: var(--acc); }
textarea.field { resize: vertical; min-height: 90px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line2); background: var(--card2); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: 14px; font-weight: 600; }
.chip.on { background: var(--acc-soft); border-color: var(--acc); color: var(--acc-ink); }

/* ---------- gate */
.gate { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.gate-card { width: min(380px, 100%); text-align: center; }
.gate-card form { display: grid; gap: 10px; margin-top: 18px; }
.gate h1 { margin: 14px 0 4px; font-size: 34px; letter-spacing: -.02em; }
.logo-orb { width: 84px; height: 84px; margin: 0 auto; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #DDE3FF, var(--acc) 45%, #2A3AB8 100%); box-shadow: 0 0 60px rgba(var(--acc-rgb), .45); }

/* ---------- shell */
.app { display: flex; min-height: 100%; }
main { flex: 1; min-width: 0; padding: calc(10px + var(--safe-t)) 16px calc(92px + var(--safe-b)); max-width: 860px; margin: 0 auto; }
.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .01em; }
.top-right { display: flex; align-items: center; gap: 10px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dim); }
.dot.ok { background: var(--ok); box-shadow: 0 0 10px var(--ok); } .dot.bad { background: var(--bad); }
.rail { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around; background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b)); }
.rail a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; border-radius: 12px; }
.rail a .ic { font-size: 20px; line-height: 1; }
.rail a.on { color: var(--acc); }
@media (min-width: 900px) {
  .rail { position: sticky; top: 0; height: 100vh; width: 92px; flex-direction: column; justify-content: flex-start; gap: 6px; border-top: 0; border-right: 1px solid var(--line); padding: 20px 8px; background: var(--card); }
  .rail a { flex: 0; padding: 12px 0; font-size: 12px; }
  .rail a.on { background: var(--acc-soft); }
  main { padding: 24px 32px 40px; }
}

/* ---------- content */
h2 { font-size: 30px; line-height: 1.15; letter-spacing: -.02em; margin: 10px 0 2px; }
h3 { font: 600 12px var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.sub { color: var(--muted); margin: 0 0 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: 12px 0; }
.card.tight { padding: 10px 14px; }
.coach { border-left: 3px solid var(--warn); background: var(--card2); }
.stale { border: 1px dashed var(--warn); color: var(--warn); border-radius: 14px; padding: 8px 12px; font-size: 14px; margin: 10px 0; }
ul.list { list-style: none; margin: 0; padding: 0; }
ul.list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
ul.list li:last-child { border-bottom: 0; }
ul.list li.done .t { color: var(--dim); text-decoration: line-through; }
.box { flex: 0 0 26px; width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line2); background: transparent; cursor: pointer; display: grid; place-items: center; margin-top: 1px; color: var(--on-acc); font-size: 15px; font-weight: 800; }
.box.on { background: var(--ok); border-color: var(--ok); color: #06180F; }
.bullet { flex: 0 0 26px; text-align: center; color: var(--dim); }
.money { font-family: var(--mono); color: var(--acc-ink); white-space: nowrap; }
.t code, .note code { font-family: var(--mono); font-size: .9em; background: var(--input); padding: 1px 5px; border-radius: 6px; }

/* Talk hero on Home */
.hero { display: flex; align-items: center; gap: 16px; background: linear-gradient(135deg, var(--acc-soft), var(--card)); border: 1px solid var(--line); border-radius: 26px; padding: 18px; margin: 14px 0; cursor: pointer; width: 100%; text-align: left; }
.hero .mini-orb { flex: 0 0 64px; height: 64px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #DDE3FF, var(--acc) 45%, #2A3AB8 100%); box-shadow: 0 0 34px rgba(var(--acc-rgb), .5); animation: breathe 3.2s ease-in-out infinite; }
.hero b { display: block; font-size: 20px; }
@keyframes breathe { 50% { transform: scale(1.06); box-shadow: 0 0 48px rgba(var(--acc-rgb), .7); } }

/* clips */
.tabs { display: flex; gap: 8px; overflow-x: auto; margin: 6px 0 4px; padding-bottom: 4px; }
.clip video { width: 100%; max-height: 62vh; background: #000; border-radius: 14px; display: block; }
.clip .row { display: flex; gap: 8px; margin-top: 10px; }
.clip .row .btn { flex: 1; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--card2); border: 1px solid var(--line2); }
.tag.review { color: var(--warn); } .tag.approved { color: var(--ok); } .tag.posted { color: var(--acc); } .tag.skipped { color: var(--dim); }

/* notes */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; margin: 8px 0; }
.crumbs a { cursor: pointer; }
.file { display: flex; gap: 10px; align-items: center; padding: 11px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.file:last-child { border-bottom: 0; }
.file .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snip { font-size: 13px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.note { overflow-wrap: anywhere; }
.note h1 { font-size: 26px; margin: 4px 0 10px; } .note h2 { font-size: 21px; margin: 18px 0 6px; } .note h3 { font-size: 13px; margin: 16px 0 6px; }
.note p { margin: 6px 0; } .note ul { padding-left: 20px; margin: 6px 0; } .note blockquote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--line2); color: var(--muted); }
.note table { border-collapse: collapse; font-size: 14px; display: block; overflow-x: auto; } .note td, .note th { border: 1px solid var(--line); padding: 4px 8px; }
.note .wl { cursor: pointer; border-bottom: 1px dashed var(--acc); color: var(--acc); }
.note .fm { font-family: var(--mono); font-size: 12px; color: var(--dim); white-space: pre-wrap; background: var(--card2); border-radius: 10px; padding: 8px 10px; }

/* ---------- talk overlay */
.talk { position: fixed; inset: 0; z-index: 50; background: radial-gradient(ellipse at 50% 70%, #10163A 0%, var(--bg) 62%); display: flex; flex-direction: column; padding: calc(12px + var(--safe-t)) 16px calc(12px + var(--safe-b)); }
@media (prefers-color-scheme: light) { .talk { background: radial-gradient(ellipse at 50% 70%, #DCE2FF 0%, var(--bg) 62%); } }
.talk-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.talk-log { flex: 1; overflow-y: auto; padding: 12px 0; display: flex; flex-direction: column; gap: 10px; max-width: 720px; width: 100%; margin: 0 auto; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 18px; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--acc); color: var(--on-acc); border-bottom-right-radius: 6px; }
.msg.ai { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.sys { align-self: center; background: transparent; color: var(--muted); font-size: 13px; padding: 2px; }
.talk-stage { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 0 14px; }
.orb { position: relative; width: 132px; height: 132px; border: 0; background: transparent; cursor: pointer; padding: 0; }
.orb-core { position: absolute; inset: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #E4E9FF, var(--acc) 45%, #2A3AB8 100%); box-shadow: 0 0 50px rgba(var(--acc-rgb), .55); transition: transform .08s linear; }
.orb-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(var(--acc-rgb), .35); }
.talk[data-s=idle] .orb-core { animation: breathe 3.2s ease-in-out infinite; }
.talk[data-s=listening] .orb-ring { animation: ping 1.4s ease-out infinite; border-color: rgba(75, 208, 139, .7); }
.talk[data-s=listening] .orb-core { background: radial-gradient(circle at 35% 30%, #E6FFF1, #4BD08B 45%, #137A45 100%); box-shadow: 0 0 50px rgba(75, 208, 139, .55); }
.talk[data-s=thinking] .orb-ring { border-color: transparent; border-top-color: var(--acc); animation: spin .9s linear infinite; }
.talk[data-s=thinking] .orb-core { transform: scale(.88); opacity: .85; }
.talk[data-s=speaking] .orb-core { animation: talkpulse .5s ease-in-out infinite alternate; }
@keyframes ping { from { transform: scale(1); opacity: 1; } to { transform: scale(1.25); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes talkpulse { to { transform: scale(1.07); } }
.talk-state { font-size: 18px; font-weight: 700; }
.talk-type { display: flex; gap: 8px; max-width: 720px; width: 100%; margin: 0 auto; }
.talk-type .btn { flex: 0 0 auto; }

.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 14px; font-weight: 600; z-index: 60; max-width: 90vw; font-size: 14px; }
@media (min-width: 900px) { .toast { bottom: 30px; } }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line2); border-top-color: var(--acc); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; }
