/* The phone app. Made to feel at home on an iPhone: system font, large titles, grouped lists,
   a frosted tab bar, and nothing that scrolls sideways. Dark, in the soft blue and mint of the portfolio. */
:root {
  --bg: #0b0d13;
  --surface: #151924;
  --surface-2: #1d2231;
  --line: rgba(255, 255, 255, 0.08);
  --text: #eef0f6;
  --dim: #8f96aa;
  --faint: #5f6678;
  --accent: #8fa6ff;
  --accent-ink: #0b0f1f;
  --mint: #6fdcbc;
  --warn: #f2c078;
  --bad: #ff8f8f;
  --radius: 16px;
  --tabs: 84px;
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; border-radius: 8px; }

.view { min-height: 100dvh; padding: calc(var(--top) + 10px) 16px calc(var(--tabs) + var(--bottom) + 24px); max-width: 640px; margin: 0 auto; outline: none; }
.view.enter { animation: enter 0.22s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* headers */
.eyebrow { color: var(--dim); font-size: 13px; font-weight: 600; margin: 8px 0 2px; }
.title { font-size: 34px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 6px; }
.lede { color: var(--dim); font-size: 15px; margin: 0 0 18px; }
.back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; color: var(--accent); background: none; border: 0; padding: 0 4px 0 0; font-size: 17px; cursor: pointer; }
.back svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
h2.section { font-size: 20px; font-weight: 700; margin: 28px 0 10px; letter-spacing: -0.01em; }

/* status card */
.status { position: relative; background: linear-gradient(160deg, #1a2036, #141826 60%); border: 1px solid var(--line); border-radius: 20px; padding: 16px; overflow: hidden; }
.status .line { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.status p { margin: 6px 0 0; color: var(--dim); font-size: 15px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.live { background: var(--mint); box-shadow: 0 0 0 0 rgba(111, 220, 188, 0.6); animation: pulse 1.6s infinite; }
.dot.paused { background: var(--warn); }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(111, 220, 188, 0); } 100% { box-shadow: 0 0 0 0 rgba(111, 220, 188, 0); } }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-height: 84px; display: flex; flex-direction: column; justify-content: space-between; text-align: left; color: inherit; cursor: pointer; }
.stat b { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--dim); font-size: 13px; }
.stat.hot b { color: var(--warn); }
.stat.good b { color: var(--mint); }
.minor { display: flex; gap: 16px; color: var(--dim); font-size: 14px; margin: 10px 2px 0; }

.actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.btn { min-height: 48px; padding: 0 20px; border-radius: 999px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.wide { width: 100%; }
.btn.ghost { background: var(--surface-2); color: var(--text); }
.btn.danger { background: rgba(255, 143, 143, 0.14); color: var(--bad); }
.btn.mint { background: var(--mint); color: #062a20; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* notices */
.notice { border-radius: var(--radius); padding: 12px 14px; margin-top: 12px; font-size: 15px; background: var(--surface); border: 1px solid var(--line); }
.notice b { display: block; margin-bottom: 2px; }
.notice.bad { border-color: rgba(255, 143, 143, 0.35); background: rgba(255, 143, 143, 0.07); }
.notice.warn { border-color: rgba(242, 192, 120, 0.35); background: rgba(242, 192, 120, 0.07); }
.notice.good { border-color: rgba(111, 220, 188, 0.35); background: rgba(111, 220, 188, 0.07); }
.notice a { font-weight: 600; }

/* grouped lists */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 64px; color: inherit; position: relative; width: 100%; background: none; border: 0; text-align: left; cursor: pointer; }
.row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: 66px; border-top: 1px solid var(--line); }
.row:active { background: var(--surface-2); }
.row .main { flex: 1; min-width: 0; }
.row .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { color: var(--dim); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .r { color: var(--warn); font-size: 14px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row .chev { width: 8px; height: 14px; stroke: var(--faint); fill: none; stroke-width: 2; flex: none; }
.row .tag { font-size: 13px; color: var(--dim); flex: none; font-variant-numeric: tabular-nums; }
.day { color: var(--dim); font-size: 13px; font-weight: 600; margin: 18px 4px 6px; }

/* company monogram: drawn, not an icon font */
.mono { width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 17px; color: #0b0d13; }
.mono.big { width: 64px; height: 64px; border-radius: 18px; font-size: 28px; }

/* job detail */
.head { display: flex; gap: 14px; align-items: center; margin: 6px 0 4px; }
.head .t { font-size: 24px; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
.head .s { color: var(--dim); font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.chip { font-size: 13px; padding: 6px 10px; border-radius: 999px; background: var(--surface-2); color: var(--dim); }
.chip.good { color: var(--mint); background: rgba(111, 220, 188, 0.1); }
.chip.warn { color: var(--warn); background: rgba(242, 192, 120, 0.1); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-top: 12px; }
.card h3 { margin: 0 0 6px; font-size: 15px; color: var(--dim); font-weight: 600; }
.card p { margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 6px 0; font-size: 15px; }
.timeline time { color: var(--faint); font-size: 13px; flex: none; width: 92px; font-variant-numeric: tabular-nums; }
.docs { margin-bottom: 4px; }
.docs .doc { width: 40px; height: 40px; flex: none; fill: rgba(143, 166, 255, 0.12); stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; }
.given { margin: 0; display: grid; grid-template-columns: 1fr; gap: 2px; }
.given dt { color: var(--dim); font-size: 13px; margin-top: 10px; }
.given dt:first-child { margin-top: 0; }
.given dd { margin: 0; font-size: 16px; overflow-wrap: anywhere; white-space: pre-wrap; }
details.card summary { cursor: pointer; color: var(--dim); font-weight: 600; font-size: 15px; }
details.card[open] summary { margin-bottom: 8px; }

/* forms */
.field { display: block; padding: 10px 14px; position: relative; }
.field + .field::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; border-top: 1px solid var(--line); }
.field > span { display: block; color: var(--dim); font-size: 13px; margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; background: transparent; border: 0; padding: 4px 0; font-size: 17px; outline: none; min-height: 32px; }
.field select { appearance: none; -webkit-appearance: none; color: var(--text); }
.field select option { background: var(--surface); }
.field textarea { resize: vertical; min-height: 72px; }
.field.switch { display: flex; align-items: center; gap: 12px; }
.field.switch > span:not(.toggle) { flex: 1; margin: 0; color: var(--text); font-size: 15px; }
.toggle { position: relative; width: 51px; height: 31px; flex: none; }
.toggle input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.toggle i { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-2); transition: background 0.2s; }
.toggle i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; transition: transform 0.2s; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); }
.toggle input:checked + i { background: var(--mint); }
.toggle input:checked + i::after { transform: translateX(20px); }
.toggle input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.groupname { color: var(--dim); font-size: 13px; margin: 22px 4px 6px; }
.hint { color: var(--faint); font-size: 13px; margin: 6px 4px 0; }

/* empty, loading, error */
.empty { text-align: center; padding: 48px 20px; color: var(--dim); }
.empty svg { width: 72px; height: 72px; stroke: var(--mint); fill: none; stroke-width: 1.6; margin-bottom: 12px; stroke-linecap: round; stroke-linejoin: round; }
.empty b { display: block; color: var(--text); font-size: 20px; margin-bottom: 4px; }
.skel { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* chat */
.chat { display: flex; flex-direction: column; gap: 8px; padding-bottom: 80px; }
.bubble { max-width: 82%; padding: 10px 14px; border-radius: 20px; font-size: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.bubble.ai { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 6px; }
.bubble.typing { color: var(--dim); }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.suggest button { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; font-size: 14px; cursor: pointer; color: var(--text); }
.composer { position: fixed; left: 0; right: 0; bottom: calc(var(--tabs) + var(--bottom)); padding: 8px 12px; background: rgba(11, 13, 19, 0.86); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-top: 1px solid var(--line); display: flex; gap: 8px; z-index: 5; }
.composer input { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; outline: none; }
.composer .btn { min-height: 44px; padding: 0 16px; }

/* take over: the page fills the screen; nothing but Done and a quiet menu */
.live { margin: 0 -16px; padding-bottom: 96px; }
.livebar { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(var(--top) + 2px) 12px 4px; background: rgba(11, 13, 19, 0.9); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.livetitle { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; text-align: center; }
.more { min-width: 44px; min-height: 44px; border: 0; background: none; color: var(--accent); font-size: 24px; line-height: 1; cursor: pointer; }
.menu { position: absolute; right: 12px; top: calc(var(--top) + 52px); z-index: 6; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); }
.menu button { display: block; width: 100%; text-align: left; padding: 14px 18px; background: none; border: 0; color: var(--text); font-size: 16px; cursor: pointer; }
.menu button + button { border-top: 1px solid var(--line); }
.menu .bad { color: var(--bad); }
.livenote { margin: 0; padding: 4px 16px 8px; color: var(--dim); font-size: 13px; line-height: 1.35; text-align: center; }
.human { margin: 0 12px 10px; padding: 14px 16px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.human p { margin: 0 0 12px; font-size: 14px; line-height: 1.45; color: var(--text); }
.stage { position: relative; overflow: hidden; background: #fff; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.stage canvas { will-change: transform; }
/* Where the finger tapped, shown at once while the page catches up. */
.tap-dot { position: absolute; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%; background: rgba(20, 40, 160, .28); pointer-events: none; animation: tapdot .45s ease-out forwards; }
@keyframes tapdot { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tap-dot { animation: none; opacity: .35; } }
.stage canvas { display: block; width: 100%; height: auto; }
.stage:not(.ready) { min-height: 70vh; background: #fff linear-gradient(90deg, #fff 0%, #eef0f4 50%, #fff 100%) 0 0 / 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .stage:not(.ready) { animation: none; } }
.sendbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; padding: 12px 16px calc(var(--bottom) + 12px); background: rgba(11, 13, 19, 0.9); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
.sendbar[hidden] { display: none; }
.keys-in { position: fixed; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; font-size: 16px; border: 0; padding: 0; }

/* tab bar */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: space-around; padding: 6px 4px calc(var(--bottom) + 6px); background: rgba(14, 17, 25, 0.82); backdrop-filter: saturate(160%) blur(22px); -webkit-backdrop-filter: saturate(160%) blur(22px); border-top: 1px solid var(--line); }
.tabs a { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; color: var(--faint); font-size: 10.5px; font-weight: 600; min-height: 50px; }
.tabs a svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--accent); }
.badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #ff5d5d; color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700; }
body.full .tabs { display: none; }
body.full .view { padding-bottom: calc(var(--bottom) + 24px); }

.offline { position: sticky; top: 0; z-index: 20; padding: calc(var(--top) + 8px) 16px 8px; background: #3a2b14; color: var(--warn); font-size: 14px; text-align: center; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabs) + var(--bottom) + 16px); transform: translateX(-50%); z-index: 30; background: #f2f4fa; color: #0b0d13; padding: 10px 16px; border-radius: 999px; font-size: 15px; font-weight: 600; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4); max-width: calc(100% - 32px); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.acct small { display: block; color: var(--dim); font-size: 13px; margin-top: 2px; }
.acct details { margin-top: 6px; font-size: 14px; }
.acct summary { color: var(--accent); cursor: pointer; }
.acct code { display: inline-block; margin-top: 4px; font: 15px ui-monospace, Menlo, monospace; user-select: all; -webkit-user-select: all; word-break: break-all; }
