:root {
  --bg: #f3f2f0;
  --surface: #ffffff;
  --surface-2: #f7f6f4;
  --ink: #151413;
  --ink-2: #4a4743;
  --muted: #8c8781;
  --line: #e8e6e2;
  --coral: #ef6236;
  --coral-ink: #c4441c;
  --coral-soft: #fce5db;
  --green: #239460;
  --green-soft: #dff3e8;
  --amber: #b77d00;
  --amber-bar: #f2c14e;
  --amber-soft: #fbf0d2;
  --red: #d2373c;
  --red-soft: #fbe3e3;
  --scrim: rgba(21, 20, 19, .38);
  /* System fonts only: no third-party font requests (they would carry employees' IPs abroad). */
  --f-ui: -apple-system, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --f-num: -apple-system, "SF Pro Display", "Segoe UI", Roboto, system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-ui); font-size: 14px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
.num { font-family: var(--f-num); font-variant-numeric: tabular-nums; }

.app { min-height: 100vh; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 10px max(16px, env(safe-area-inset-right, 0px)) 6px max(16px, env(safe-area-inset-left, 0px)); }
.top .back { border: 0; background: none; color: var(--coral-ink); padding: 4px 0; font-weight: 500; }
.view { flex: 1; padding: 8px max(16px, env(safe-area-inset-right, 0px)) 96px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 16px; max-width: 640px; width: 100%; margin: 0 auto; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); }
.tabbar button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding: 4px 0; }
.tabbar button.on { color: var(--ink); }

.ico { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico.s { width: 16px; height: 16px; }
.ph h1 { margin: 0; font-weight: 300; font-size: 28px; line-height: 1.12; letter-spacing: -.01em; }
.ph p { margin: 2px 0 0; color: var(--muted); }
.card { background: var(--surface); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.later { border: 1.5px dashed var(--amber-bar); }
.sec { display: flex; flex-direction: column; gap: 10px; }
.sec-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sec-h h3 { margin: 0; font-size: 15px; font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.chip.coral { background: var(--coral-soft); color: var(--coral-ink); }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.red { background: var(--red-soft); color: var(--red); }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; flex-shrink: 0; }
.chips::-webkit-scrollbar { display: none; }
.fchip { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 12px; font-size: 13px; color: var(--ink-2); }
.fchip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.seg { display: flex; background: var(--surface); border-radius: 999px; padding: 4px; gap: 2px; overflow-x: auto; }
.seg button { flex: 1; border: 0; background: none; padding: 8px 10px; border-radius: 999px; font-weight: 500; font-size: 13px; color: var(--muted); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.btn { border: 0; border-radius: 14px; background: var(--coral); color: #fff; font-weight: 600; padding: 13px 16px; font-size: 15px; }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); font-weight: 500; }
.btn.small { padding: 8px 12px; font-size: 13px; border-radius: 999px; }
.btn:disabled { opacity: .5; }
.fab { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 7; box-shadow: 0 10px 30px -12px rgba(0,0,0,.4); }

.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 0 12px; height: 46px; }
.search:focus-within { border-color: var(--coral); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 15px; outline: none; }
.search .ico { color: var(--muted); width: 19px; height: 19px; }
.hint { font-size: 12.5px; color: var(--muted); }
.list { background: var(--surface); border-radius: 20px; padding: 4px 14px; }
.row { display: flex; gap: 12px; align-items: center; padding: 11px 0; border: 0; border-top: 1px solid var(--line); width: 100%; background: none; text-align: left; }
.row:first-child { border-top: 0; }
.row .body { flex: 1; min-width: 0; }
.row .body b { display: block; font-weight: 500; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .body span { font-size: 12.5px; color: var(--muted); }
.row .right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.row .right .num { font-weight: 500; }
.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13.5px; flex: none; background: var(--surface-2); color: var(--ink-2); }
.av.lg { width: 58px; height: 58px; font-size: 18px; background: var(--coral-soft); color: var(--coral-ink); }

.hero { display: flex; gap: 14px; align-items: center; }
.hero h1 { margin: 0; font-size: 21px; font-weight: 600; line-height: 1.2; }
.hero p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.acts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.act { border: 0; background: var(--surface); border-radius: 16px; padding: 11px 0 9px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 500; text-decoration: none; color: var(--ink); }
.act .ico { color: var(--coral); }
.ctabs { display: flex; gap: 2px; overflow-x: auto; margin: 0 -16px; padding: 0 16px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.ctabs button { flex: none; border: 0; background: none; padding: 10px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.ctabs button.on { color: var(--ink); border-color: var(--coral); }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tiles.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile { background: var(--surface-2); border-radius: 12px; padding: 9px 10px; min-width: 0; }
.tile span { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile b { font-family: var(--f-num); font-weight: 500; font-size: 18px; white-space: nowrap; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.kv > div:first-child { border-top: 0; padding-top: 0; }
.kv > div > span:first-child { color: var(--muted); }
.kv > div > span:last-child { text-align: right; font-weight: 500; overflow-wrap: anywhere; }
small.note { color: var(--muted); font-size: 12px; }

.rc { background: var(--surface); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 8px; border: 0; text-align: left; width: 100%; }
.rc .top-line { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.rc .sum { display: flex; flex-direction: column; align-items: flex-end; }
.rc .sum b { font-family: var(--f-num); font-size: 16px; font-weight: 600; }
.rc .sum s { color: var(--muted); font-size: 12px; }
.rc .sub { font-size: 12.5px; color: var(--muted); }
.rc.ret .sum b { color: var(--red); }
.lines { display: flex; flex-direction: column; gap: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
.lines .code { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) auto 34px; gap: 8px; align-items: end; font-size: 13px; }
.line .art { display: block; font-family: ui-monospace, Menlo, monospace; font-size: 10.5px; color: var(--muted); overflow-wrap: anywhere; }
.line b { font-weight: 600; font-size: 12.5px; }
.line .muted { color: var(--muted); }

.note-item { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-top: 1px solid var(--line); }
.note-item:first-child { border-top: 0; padding-top: 0; }
.note-item .who { font-size: 12.5px; color: var(--muted); }
.note-item .who b { color: var(--ink); }
.note-item p { margin: 0; white-space: pre-wrap; }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; min-width: 0; resize: none; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 10px 12px; min-height: 44px; }

.task { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border-radius: 16px; padding: 12px 14px; }
.cb { flex: none; width: 24px; height: 24px; border-radius: 8px; border: 1.8px solid var(--line); background: none; display: grid; place-items: center; padding: 0; }
.cb svg { width: 14px; height: 14px; stroke: #fff; fill: none; stroke-width: 2.6; opacity: 0; }
.cb.on { background: var(--green); border-color: var(--green); }
.cb.on svg { opacity: 1; }
.task .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.task .ttl { font-weight: 500; }
.task.done .ttl { color: var(--muted); text-decoration: line-through; }
.task .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.glabel { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 500; }
.glabel.red { color: var(--red); }
.alert { background: var(--amber-soft); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.alert b { font-size: 14px; }

.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 20; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; background: var(--bg); border-radius: 24px 24px 0 0; max-height: 92vh; overflow-y: auto; padding: 12px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 14px; max-width: 640px; margin: 0 auto; }
.sheet h2 { margin: 0; font-size: 19px; font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 500; }
.field input, .field select, .field textarea { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; font-size: 15px; }
.field textarea { resize: none; min-height: 64px; }
.err { color: var(--red); font-size: 12.5px; }
.help { color: var(--muted); font-size: 12.5px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.match { border-radius: 12px; padding: 10px 12px; font-size: 13px; background: var(--green-soft); }
.match.warn { background: var(--amber-soft); }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); z-index: 40; background: var(--ink); color: var(--bg); border-radius: 14px; padding: 11px 14px; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: none; max-width: 600px; margin: 0 auto; }
.toast.show { opacity: 1; transform: none; }
.gate { display: flex; flex-direction: column; gap: 18px; padding-top: 18vh; }
.orb { width: 60px; height: 60px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ff9a73, var(--coral) 55%, #b9401b); display: grid; place-items: center; }
.orb i { width: 16px; height: 16px; border-radius: 50%; background: #fff; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
