/* XGene Console — phone first, XGene design system tokens (DESIGN.md). */
:root {
  --navy: #0f2a4a; --navy-2: #17466f; --ink: #182333; --muted: #4a5568; --line: #dde2e8;
  --blue: #115df6; --deep-blue: #0a2d84; --teal: #0b8d96; --teal-text: #08747c;
  --coral: #f47a3c; --coral-hover: #dc5c22; --on-coral: #091f38; --coral-text: #a23d0d;
  --lime-text: #456b00; --danger: #b42318;
  --bg: #f8f5fc; --card: #ffffff; --sky: #eef5ff; --aqua: #eaf8f7; --peach: #fff0e8; --lime-tint: #f3fbe5;
  --r-sm: .55rem; --r-btn: .7rem; --r-md: 1rem; --r-lg: 1.75rem;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --tabs-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8eef6; --muted: #a9b6c7; --line: #2a3a50; --bg: #0b1626; --card: #12223a; --sky: #13284a;
    --aqua: #0f2e33; --peach: #3a2418; --lime-tint: #1d2c10; --teal-text: #5fd0d7; --coral-text: #ffb48a;
    --lime-text: #b5e86a; --danger: #ff8a80; --deep-blue: #9db9ff; --navy: #06101d;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); font-size: 1rem; line-height: 1.55; color: var(--ink); background: var(--bg);
  -webkit-text-size-adjust: 100%; min-height: 100dvh;
}
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--card); padding: .5rem 1rem; z-index: 99; }
.skip:focus { left: 1rem; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
.label { font-size: .77rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 1.5rem 0 .6rem; }
.fine { font-size: .82rem; color: var(--muted); }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 760; letter-spacing: -.02em; }

/* buttons */
.btn {
  font: inherit; font-weight: 700; border-radius: var(--r-btn); border: 1px solid transparent; cursor: pointer;
  min-height: 48px; padding: .7rem 1.1rem; width: 100%;
}
.btn.primary { background: var(--coral); color: var(--on-coral); }
.btn.primary:hover { background: var(--coral-hover); }
.btn.primary:disabled { opacity: .6; cursor: progress; }
.btn.ghost { background: transparent; color: var(--deep-blue); border-color: var(--line); margin-top: .6rem; }
.btn.small { width: auto; min-height: 40px; padding: .4rem .8rem; margin: 0; font-size: .9rem; }

/* sign-in */
.signin { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(120% 80% at 50% 0%, var(--navy-2), var(--navy)); }
.signin-card { width: 100%; max-width: 400px; background: var(--card); border-radius: var(--r-lg); padding: 28px 22px;
  box-shadow: 0 24px 60px rgba(4, 14, 30, .35); }
.signin-card .brand { margin-bottom: 1.2rem; font-size: 1.1rem; }
.signin h1 { font-size: 1.6rem; letter-spacing: -.025em; margin: 0 0 1rem; }
.signin label { display: block; font-weight: 700; font-size: .92rem; margin: .9rem 0 .35rem; }
.signin input { width: 100%; font: inherit; font-size: 1.05rem; padding: .75rem .85rem; min-height: 50px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); color: var(--ink); }
.signin #code { letter-spacing: .3em; font-size: 1.3rem; text-align: center; }
.signin .btn { margin-top: 1.1rem; }
.signin .btn.ghost { margin-top: .6rem; }
.hint { color: var(--muted); font-size: .92rem; margin: 0 0 .2rem; }
.err { color: var(--danger); font-weight: 600; min-height: 1.4em; margin: .6rem 0 0; font-size: .92rem; }
.signin .fine { margin: 1.2rem 0 0; text-align: center; }

/* app shell */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: .75rem; padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top)); background: var(--navy); color: #fff; }
.top .brand { color: #fff; }
.top-status { flex: 1; display: flex; align-items: center; gap: .45rem; font-size: .86rem; min-width: 0; }
.top-status span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .btn.ghost { color: #fff; border-color: rgba(255, 255, 255, .35); }
main { max-width: 720px; margin: 0 auto; padding: 8px 16px calc(var(--tabs-h) + 24px + env(safe-area-inset-bottom)); outline: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: #8894a5; }
.dot.ok { background: #2fbf71; } .dot.warn { background: var(--coral); } .dot.bad { background: #e5484d; }

/* home */
.verdict { margin-top: 16px; border-radius: var(--r-md); padding: 18px; background: var(--sky); border: 1px solid var(--line); }
.verdict .label { margin: 0 0 .3rem; }
.verdict-text { font-size: 1.35rem; font-weight: 760; letter-spacing: -.02em; margin: 0; }
.verdict-sub { margin: .3rem 0 0; color: var(--muted); font-size: .95rem; }
.verdict.ok { background: var(--aqua); } .verdict.warn { background: var(--peach); } .verdict.bad { background: var(--peach); border-color: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; font-weight: 700; font-size: .95rem; min-height: 44px; padding: .5rem .95rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--deep-blue); cursor: pointer; }
.chip:active { transform: scale(.98); }
.cards { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .cards { grid-template-columns: 1fr 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; }
.card h3 { margin: 0 0 .35rem; font-size: 1rem; display: flex; align-items: center; gap: .5rem; }
.card p { margin: .15rem 0; font-size: .92rem; color: var(--muted); }
.card .tag { margin-left: auto; font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  padding: .15rem .5rem; border-radius: 999px; background: var(--lime-tint); color: var(--lime-text); }
.card .tag.standby { background: var(--sky); color: var(--deep-blue); }
.svc { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); }
.svc li { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; border-top: 1px solid var(--line); font-size: .94rem; }
.svc li:first-child { border-top: 0; }
.svc li b { min-width: 7.5rem; font-weight: 700; }
.svc li span.v { color: var(--muted); overflow-wrap: anywhere; }

/* ask */
#view-ask { display: flex; flex-direction: column; }
.chat { display: flex; flex-direction: column; gap: 10px; padding: 16px 0 120px; }
.msg { max-width: 88%; padding: .7rem .9rem; border-radius: 1rem; font-size: .97rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg p { margin: 0; white-space: normal; }
.msg.me { align-self: flex-end; background: var(--deep-blue); color: #fff; border-bottom-right-radius: .3rem; }
@media (prefers-color-scheme: dark) { .msg.me { background: #2a4fae; } }
.msg.bot { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: .3rem; }
.msg.err { border-color: var(--danger); }
.msg .meta { display: block; margin-top: .35rem; font-size: .75rem; color: var(--muted); }
.msg.typing { color: var(--muted); font-style: italic; }
.composer { position: fixed; left: 0; right: 0; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); z-index: 9;
  display: flex; gap: 8px; padding: 10px 16px; background: var(--bg); border-top: 1px solid var(--line); max-width: 720px; margin: 0 auto; }
.composer textarea { flex: 1; font: inherit; font-size: 1rem; resize: none; min-height: 48px; max-height: 140px; padding: .7rem .85rem;
  border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--card); color: var(--ink); }
.composer .btn { width: auto; }

/* activity */
.audit { list-style: none; margin: 0 0 1rem; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); }
.audit li { padding: .65rem 1rem; border-top: 1px solid var(--line); font-size: .92rem; }
.audit li:first-child { border-top: 0; }
.audit time { display: block; font-size: .78rem; color: var(--muted); }
.audit .bad { color: var(--danger); font-weight: 700; }

/* tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--card); border-top: 1px solid var(--line); }
.tab { font: inherit; font-size: .78rem; font-weight: 700; background: none; border: 0; color: var(--muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.tab[aria-current="page"] { color: var(--deep-blue); }
.noscript { padding: 2rem; text-align: center; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
