/* Phoenix on the phone. Warm ivory and charcoal with a terracotta accent, like the desktop app. */
:root {
  color-scheme: light dark;
  --bg: #f6f2ec; --panel: #fffdf9; --sunken: #efe9e0; --line: #e4dccf; --line-strong: #d3c8b8;
  --text: #211c17; --body: #4a4138; --muted: #81776b; --faint: #a89e91;
  --accent: #c4623a; --accent-ink: #fff; --accent-soft: #f6e4da;
  --ok: #3f7d58; --ok-soft: #e3f0e8; --warn: #b7791f; --warn-soft: #f8ecd2; --bad: #b3402f; --bad-soft: #f8e1dc;
  --shadow: 0 1px 2px rgb(60 40 20 / .06), 0 10px 30px rgb(60 40 20 / .10);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --top: env(safe-area-inset-top, 0px); --bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131210; --panel: #1b1916; --sunken: #232019; --line: #2c2823; --line-strong: #3b362e;
    --text: #f2ece3; --body: #cfc6ba; --muted: #9a9084; --faint: #6f675d;
    --accent: #dc885e; --accent-ink: #1a110c; --accent-soft: #3a261b;
    --ok: #6fbf8b; --ok-soft: #1c2e24; --warn: #e0b04f; --warn-soft: #33290f; --bad: #ee8472; --bad-soft: #3a1f1a;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 14px 40px rgb(0 0 0 / .5);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
body { background: var(--bg); color: var(--body); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.15; color: var(--text); font-weight: 650; letter-spacing: -.02em; }
h2 { font-size: 17px; color: var(--text); font-weight: 600; letter-spacing: -.01em; }
.muted { color: var(--muted); } .small { font-size: 13px; } .mono { font-family: var(--mono); font-size: 13px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---- screens ---- */
#app { position: fixed; inset: 0; display: flex; flex-direction: column; }
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; animation: rise .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen { animation: none; } * { scroll-behavior: auto !important; transition: none !important; } }
.bar { display: flex; align-items: center; gap: 4px; min-height: calc(52px + var(--top)); padding: var(--top) 8px 0; flex: none; }
.bar h2 { flex: 1; min-width: 0; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .sub { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.bar.large { display: block; min-height: 0; padding: calc(var(--top) + 18px) 20px 10px; }
.bar.large .row { display: flex; align-items: flex-end; gap: 12px; } .bar.large h1 { flex: 1; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 22px; color: var(--text); transition: background .15s; }
.icon-btn:active { background: var(--sunken); }
.icon-btn.accent { color: var(--accent); }
.scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 16px 24px; }
.stack { display: grid; gap: 14px; }

/* ---- tab bar ---- */
.tabs { flex: none; display: grid; grid-template-columns: repeat(3, 1fr); padding: 6px 8px calc(6px + var(--bottom)); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: .5px solid var(--line); }
.tab { display: grid; justify-items: center; gap: 2px; padding: 6px 0 4px; color: var(--muted); font-size: 11px; font-weight: 500; border-radius: 12px; }
.tab[aria-current="page"] { color: var(--accent); }
.tab svg { width: 24px; height: 24px; }
.tab .dot { position: absolute; width: 8px; height: 8px; border-radius: 4px; background: var(--accent); transform: translate(11px, 3px); }
.tab-wrap { position: relative; display: grid; }

/* ---- cards and rows ---- */
.card { background: var(--panel); border: .5px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: 0 1px 2px rgb(60 40 20 / .04); }
.list { background: var(--panel); border: .5px solid var(--line); border-radius: 16px; overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 13px 16px; min-height: 64px; transition: background .12s; }
.item + .item { border-top: .5px solid var(--line); }
.item:active { background: var(--sunken); }
.item .main { flex: 1; min-width: 0; }
.item .t { display: block; color: var(--text); font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { display: block; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .when { font-size: 12.5px; color: var(--faint); flex: none; align-self: flex-start; margin-top: 2px; }
.chev { color: var(--faint); flex: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 12px; font-size: 12.5px; font-weight: 500; background: var(--sunken); color: var(--body); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); } .chip.warn { background: var(--warn-soft); color: var(--warn); } .chip.bad { background: var(--bad-soft); color: var(--bad); } .chip.accent { background: var(--accent-soft); color: var(--accent); }
.dot-live { width: 8px; height: 8px; border-radius: 4px; background: var(--faint); flex: none; }
.dot-live.on { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.section-title { margin: 20px 4px 8px; font-size: 13px; font-weight: 600; color: var(--muted); }

/* ---- buttons and fields ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 20px; border-radius: 23px; font-weight: 600; background: var(--sunken); color: var(--text); transition: transform .12s, background .15s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.block { width: 100%; } .btn.small { height: 36px; padding: 0 16px; font-size: 14px; border-radius: 18px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.input { width: 100%; height: 48px; padding: 0 14px; border-radius: 12px; border: .5px solid var(--line-strong); background: var(--panel); outline: none; font-size: 16px; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field { display: grid; gap: 6px; } .field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.error-line { min-height: 20px; color: var(--bad); font-size: 14px; }
.switch { position: relative; width: 52px; height: 32px; border-radius: 16px; background: var(--line-strong); flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 13px; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform .2s cubic-bezier(.3, .9, .3, 1); }
.switch[aria-checked="true"] { background: var(--accent); } .switch[aria-checked="true"]::after { transform: translateX(20px); }
.meter { height: 8px; border-radius: 4px; background: var(--sunken); overflow: hidden; }
.meter i { display: block; height: 100%; width: calc(var(--v, 0) * 100%); border-radius: 4px; background: var(--accent); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.meter.warn i { background: var(--warn); } .meter.bad i { background: var(--bad); }

/* ---- sign in ---- */
.login { flex: 1; display: grid; align-content: center; gap: 22px; padding: 28px; max-width: 420px; width: 100%; margin: 0 auto; }
.login .mark { width: 72px; height: 72px; border-radius: 18px; box-shadow: var(--shadow); }
.login p { color: var(--muted); }

/* ---- chat ---- */
.messages { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 16px 12px; display: flex; flex-direction: column; gap: 18px; }
.msg { max-width: 100%; word-break: break-word; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; max-width: 86%; background: var(--accent-soft); color: var(--text); padding: 10px 14px; border-radius: 20px 20px 6px 20px; white-space: pre-wrap; }
.msg.assistant { color: var(--text); }
/* Answers read like the desktop: calm body text, clear headings, framed code and tables. */
.md { font-size: 16px; line-height: 1.68; color: var(--text); letter-spacing: .005em; }
.md > * + * { margin-top: 12px; }
.md > .md-h { margin-top: 22px; } .md .md-h { margin-bottom: 0; color: var(--text); font-weight: 650; line-height: 1.35; letter-spacing: -.01em; }
.md > .md-h:first-child { margin-top: 0; }
.md h2.md-h { font-size: 20px; } .md h3.md-h { font-size: 18px; } .md h4.md-h, .md h5.md-h, .md h6.md-h { font-size: 16px; }
.md strong { color: var(--text); font-weight: 650; }
.md a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 3px; }
.md ul, .md ol { padding-left: 1.45em; margin-bottom: 0; }
.md li ul, .md li ol { margin-top: 6px; }
.md li { padding-left: .15em; }
.md li + li { margin-top: 6px; }
.md li::marker { color: var(--muted); }
.md ol > li::marker { font-variant-numeric: tabular-nums; }
.md li.md-task { list-style: none; margin-left: -1.3em; }
.md-box { display: inline-block; width: 15px; height: 15px; margin-right: 8px; vertical-align: -2px; border: 1.5px solid var(--line-strong); border-radius: 4px; }
.md-box.on { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 2.5px var(--panel); }
.md blockquote { margin-left: 0; margin-right: 0; margin-bottom: 0; padding: 2px 0 2px 14px; border-left: 3px solid var(--line-strong); color: var(--body); }
.md blockquote > * + * { margin-top: 8px; }
.md hr { border: 0; border-top: 1px solid var(--line); margin-bottom: 8px; }
.md > hr { margin-top: 20px; }
.md code { font-family: var(--mono); font-size: .86em; background: var(--sunken); padding: 1.5px 5px; border-radius: 5px; }
.md-code { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); }
.md-code-bar { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 14px; background: var(--sunken); color: var(--muted); font-size: 12.5px; }
.md-copy { color: var(--muted); font-size: 12.5px; padding: 4px 8px; border-radius: 8px; }
.md-copy:active { background: var(--line); }
.md-code pre { margin: 0; padding: 12px 14px; overflow-x: auto; font: 13px/1.6 var(--mono); color: var(--text); -webkit-overflow-scrolling: touch; }
.md-code pre code { background: none; padding: 0; font-size: inherit; }
.md-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; -webkit-overflow-scrolling: touch; }
.md-table table { border-collapse: collapse; min-width: 100%; font-size: 14.5px; line-height: 1.5; }
.md-table th, .md-table td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); min-width: 72px; }
.md-table th { background: var(--sunken); color: var(--text); font-weight: 600; white-space: nowrap; }
.md-table tr:last-child td { border-bottom: 0; }
.md-table td + td, .md-table th + th { border-left: 1px solid var(--line); }
.md-img { color: var(--muted); }
.msg.assistant .caret::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 4px; border-radius: 4px; background: var(--accent); animation: pulse 1s ease-in-out infinite; vertical-align: middle; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.7); } }
.msg.note { align-self: center; font-size: 13px; color: var(--muted); text-align: center; }
.empty { display: grid; justify-items: center; gap: 10px; padding: 56px 28px; text-align: center; color: var(--muted); }
.empty svg { width: 44px; height: 44px; color: var(--faint); } .empty h2 { color: var(--text); }

.composer { flex: none; padding: 8px 12px calc(10px + var(--bottom)); background: var(--bg); }
.target { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; margin: 0 4px 8px; padding: 5px 12px 5px 10px; border-radius: 16px; background: var(--sunken); color: var(--body); font-size: 13.5px; font-weight: 500; }
.target span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compose-row { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 16px; background: var(--panel); border: .5px solid var(--line-strong); border-radius: 26px; box-shadow: 0 2px 10px rgb(60 40 20 / .06); }
.compose-row:focus-within { border-color: var(--accent); }
.compose-row textarea { flex: 1; min-height: 36px; max-height: 144px; resize: none; border: 0; outline: 0; background: none; padding: 7px 0; line-height: 1.4; font-size: 16px; }
.send { width: 40px; height: 40px; border-radius: 20px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); flex: none; transition: opacity .15s, transform .12s; }
.send:active { transform: scale(.92); } .send[disabled] { opacity: .35; pointer-events: none; }
.send.stop { background: var(--text); color: var(--bg); }

/* ---- a task running on a computer ---- */
.task { display: grid; gap: 10px; padding: 14px 16px; background: var(--panel); border: .5px solid var(--line); border-radius: 16px; }
.task .head { display: flex; align-items: center; gap: 10px; } .task .head b { flex: 1; color: var(--text); font-weight: 600; }
.task .words { white-space: pre-wrap; color: var(--text); word-break: break-word; }
.task .steps { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.task .step { display: flex; gap: 8px; align-items: baseline; } .task .step svg { width: 14px; height: 14px; flex: none; transform: translateY(2px); }
.ask { display: grid; gap: 10px; padding: 14px; border-radius: 14px; background: var(--warn-soft); border: .5px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.ask b { color: var(--text); } .ask pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: 13px/1.5 var(--mono); color: var(--body); }
.ask .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---- sheets and toast ---- */
.scrim { position: fixed; inset: 0; background: rgb(0 0 0 / .38); opacity: 0; transition: opacity .2s; z-index: 20; }
.scrim.open { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 82dvh; display: flex; flex-direction: column; background: var(--panel); border-radius: 22px 22px 0 0; padding: 8px 16px calc(16px + var(--bottom)); box-shadow: var(--shadow); transform: translateY(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
.sheet.open { transform: none; }
.sheet .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 4px auto 10px; flex: none; }
.sheet h2 { margin: 0 0 8px 4px; } .sheet .body { overflow-y: auto; display: grid; gap: 6px; }
.choice { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; text-align: left; width: 100%; }
.choice:active { background: var(--sunken); } .choice .main { flex: 1; min-width: 0; } .choice .t { display: block; color: var(--text); font-weight: 560; } .choice .s { display: block; font-size: 13.5px; color: var(--muted); }
.choice[aria-checked="true"] { background: var(--accent-soft); }
.toasts { position: fixed; left: 16px; right: 16px; top: calc(var(--top) + 10px); z-index: 30; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { padding: 10px 16px; border-radius: 22px; background: var(--text); color: var(--bg); font-size: 14.5px; box-shadow: var(--shadow); animation: rise .2s; max-width: 100%; }
.toast.bad { background: var(--bad); color: #fff; }
.offline { flex: none; padding: 6px 16px; text-align: center; font-size: 13px; background: var(--warn-soft); color: var(--warn); }
.skeleton { height: 64px; border-radius: 16px; background: linear-gradient(90deg, var(--sunken), var(--panel), var(--sunken)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; background: var(--sunken); color: var(--body); font-weight: 600; font-size: 16px; }
.install-hint { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; padding: 12px 8px 12px 14px; background: var(--panel); border: .5px solid var(--line); border-radius: 16px; }
.install-hint img { border-radius: 10px; flex: none; }
.install-hint .main { flex: 1; min-width: 0; }
.install-hint .t, .install-hint .s { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.install-hint .t { color: var(--text); font-weight: 600; font-size: 15px; }
.install-hint .s { color: var(--muted); font-size: 13px; }
.steps { margin: 14px 0 0; padding-left: 1.4em; color: var(--text); line-height: 1.7; }
.steps li + li { margin-top: 6px; }
.steps b { color: var(--text); font-weight: 600; }
.inline-icon { display: inline-flex; align-items: center; gap: 3px; vertical-align: -2px; color: var(--accent); }
.address { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 10px 10px 14px; background: var(--sunken); border-radius: 12px; }
.address code { flex: 1; min-width: 0; overflow-wrap: anywhere; font: 14px/1.4 var(--mono); color: var(--text); }
