:root {
  color-scheme: light dark;
  --bg: var(--tg-theme-bg-color, #f3f5f3);
  --surface: var(--tg-theme-secondary-bg-color, #ffffff);
  --surface-2: var(--tg-theme-section-bg-color, #e9ece9);
  --line: color-mix(in srgb, var(--tg-theme-text-color, #152019) 14%, transparent);
  --text: var(--tg-theme-text-color, #152019);
  --muted: var(--tg-theme-hint-color, #68736c);
  --accent: var(--tg-theme-button-color, #168447);
  --amber: #e9c36a;
  --red: #c84235;
  --safe-top: max(env(safe-area-inset-top), 0px);
  --safe-bottom: max(env(safe-area-inset-bottom), 0px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text); }
button, a { font: inherit; }
button { color: inherit; }
.prototype-note { min-height: calc(32px + var(--safe-top)); padding: calc(8px + var(--safe-top)) 16px 8px; display: flex; justify-content: center; gap: 9px; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--text); font-size: 10px; letter-spacing: .05em; }
.prototype-note span { font-weight: 800; }
.prototype-note b { font-weight: 520; opacity: .72; }
.app-shell { width: min(100%, 470px); min-height: calc(100dvh - 32px); margin: 0 auto; padding: 0 18px calc(94px + var(--safe-bottom)); position: relative; overflow-x: clip; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.identity { display: flex; align-items: center; gap: 11px; }
.mark { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #3b443e; background: var(--surface); font-weight: 760; letter-spacing: -.06em; }
.identity div { display: grid; gap: 2px; }
.identity b { font-size: 14px; letter-spacing: -.01em; }
.identity small { color: var(--muted); font-size: 10px; }
.analysis-trigger { min-height: 44px; border: 0; background: transparent; color: var(--accent); font-size: 12px; font-weight: 700; cursor: pointer; }
.view { animation: enter .28s cubic-bezier(.2,.8,.2,1); }
.view-intro { padding: 34px 2px 26px; }
.view-intro.compact { padding-bottom: 22px; }
.eyebrow { display: block; margin-bottom: 12px; color: var(--accent); font: 750 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .14em; }
h1, h2, p { margin-top: 0; }
.view-intro h1 { margin-bottom: 8px; max-width: 390px; font-size: clamp(31px, 9vw, 42px); line-height: .98; letter-spacing: -.045em; font-weight: 680; }
.view-intro p { margin-bottom: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.decision { padding: 20px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--red) 35%, var(--line)); box-shadow: 0 18px 60px rgba(0,0,0,.08); }
.decision-meta, .exception header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; font: 700 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; }
.decision-meta span, .critical header span { color: var(--red); }
.decision-meta time, .exception time { color: var(--muted); letter-spacing: 0; }
.decision h2 { margin-bottom: 9px; font-size: 22px; line-height: 1.1; letter-spacing: -.025em; }
.decision p { margin-bottom: 18px; color: #b8c0ba; font-size: 13px; line-height: 1.55; }
.decision-actions { display: grid; gap: 8px; }
.decision-actions button, .decision-actions a, .project-detail > a, .project-detail > button, .exception button, .sheet-done { min-height: 46px; display: flex; align-items: center; justify-content: center; border: 1px solid transparent; background: var(--accent); color: var(--tg-theme-button-text-color, #ffffff); text-decoration: none; font-size: 12px; font-weight: 750; cursor: pointer; }
.decision-actions a { background: transparent; border-color: var(--line); color: var(--text); }
#briefing { display: flex; flex-direction: column; }
#briefing .view-intro { order: 1; }
#briefing .decision { order: 2; }
#briefing .since { order: 3; }
#briefing .motion { order: 4; }
.decision-actions a span, .project-detail a span { margin-left: 6px; color: var(--accent); }
.section-block { padding-top: 30px; }
.section-heading { min-height: 36px; display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid var(--line); }
.section-heading h2 { font-size: 15px; letter-spacing: -.01em; }
.section-heading span { color: var(--muted); font-size: 10px; }
.work-row { width: 100%; min-height: 72px; display: grid; grid-template-columns: 9px 1fr auto; gap: 12px; align-items: center; padding: 0 2px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.status { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(121,232,165,.08); }
.status.review { background: var(--amber); box-shadow: 0 0 0 4px rgba(233,195,106,.08); }
.status.risk { background: var(--red); box-shadow: 0 0 0 4px rgba(240,123,110,.08); }
.work-row > span:nth-child(2) { display: grid; gap: 5px; min-width: 0; }
.work-row b { font-size: 13px; }
.work-row small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.work-row em { color: var(--muted); font: normal 650 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li { min-height: 64px; display: grid; grid-template-columns: 48px 1fr; gap: 10px; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.timeline time { padding-top: 2px; color: var(--muted); font: 600 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.timeline p { margin: 0; display: grid; gap: 5px; }
.timeline b { font-size: 12px; }
.timeline span { color: var(--muted); font-size: 10px; line-height: 1.45; }
code { color: #c4cbc6; font: 600 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.project-list { display: grid; gap: 12px; }
.project-detail { padding: 18px; border: 1px solid var(--line); background: var(--surface); }
.project-detail header { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: start; }
.project-index { color: var(--muted); font: 600 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.project-detail h2 { margin-bottom: 3px; font-size: 17px; letter-spacing: -.02em; }
.project-detail header p { margin-bottom: 0; color: var(--muted); font-size: 10px; }
.project-detail header strong { color: var(--accent); font: 650 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.progress { height: 2px; margin: 18px 0; background: #292e2b; }
.progress i { display: block; width: var(--progress); height: 100%; background: var(--accent); }
.project-detail dl { margin: 0 0 16px; }
.project-detail dl div { min-height: 44px; display: grid; grid-template-columns: 68px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.project-detail dt { color: var(--muted); font-size: 9px; }
.project-detail dd { margin: 0; font-size: 11px; line-height: 1.35; }
.project-detail > a, .project-detail > button { width: 100%; min-height: 44px; background: transparent; border-color: var(--line); color: var(--text); }
.fleet-summary { display: grid; grid-template-columns: repeat(3,1fr); margin-bottom: 18px; border-block: 1px solid var(--line); }
.fleet-summary div { padding: 16px 10px; border-right: 1px solid var(--line); }
.fleet-summary div:last-child { border-right: 0; }
.fleet-summary span { display: block; color: var(--muted); font: 700 8px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.fleet-summary strong { display: block; margin-top: 8px; font-size: 24px; }
.exception-list { display: grid; gap: 10px; }
.exception { padding: 18px; border: 1px solid var(--line); background: var(--surface); }
.exception.critical { border-left: 2px solid var(--red); }
.exception.warning { border-left: 2px solid var(--amber); }
.warning header span { color: var(--amber); }
.exception h2 { margin-bottom: 6px; font-size: 16px; }
.exception p { margin-bottom: 14px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.exception button { min-height: 44px; padding: 0 12px; background: transparent; border-color: var(--line); color: var(--text); }
.working-agents { border-bottom: 1px solid var(--line); }
.working-agents summary { min-height: 58px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; font-size: 12px; }
.working-agents summary b { color: var(--muted); font-size: 9px; }
.working-agents ul { margin: 0 0 12px; padding: 0; list-style: none; }
.working-agents li { min-height: 44px; display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; border-top: 1px solid var(--line); font-size: 10px; }
.working-agents li em { color: var(--muted); font-style: normal; }
.working-agents li b { color: var(--accent); font-size: 9px; }
.working-agents.muted li b { color: var(--muted); }
.tabbar { position: fixed; z-index: 20; right: 0; bottom: 0; left: 0; width: min(100%, 470px); height: calc(72px + var(--safe-bottom)); margin: 0 auto; padding: 6px 12px var(--safe-bottom); display: grid; grid-template-columns: repeat(3,1fr); background: color-mix(in srgb, var(--surface) 88%, transparent); border-top: 1px solid var(--line); backdrop-filter: blur(24px) saturate(130%); }
.tabbar button { min-height: 56px; display: grid; place-items: center; align-content: center; gap: 6px; border: 0; background: transparent; color: var(--muted); font-size: 9px; cursor: pointer; }
.tabbar i { width: 16px; height: 3px; background: currentColor; opacity: .38; }
.tabbar button.active { color: var(--text); }
.tabbar button.active i { background: var(--accent); opacity: 1; }
.tabbar strong { display: inline-grid; min-width: 15px; height: 15px; margin-left: 2px; place-items: center; border-radius: 999px; background: var(--red); color: white; font-size: 8px; }
.sheet-scrim { position: fixed; z-index: 50; inset: 0; display: grid; align-items: end; background: rgba(0,0,0,.62); }
.analysis-sheet { width: min(100%, 600px); max-height: min(88dvh, 820px); margin: 0 auto; overflow-y: auto; padding: 22px 20px calc(24px + var(--safe-bottom)); background: var(--surface); border: 1px solid var(--line); border-bottom: 0; box-shadow: 0 -24px 90px rgba(0,0,0,.3); animation: sheet-in .32s cubic-bezier(.2,.8,.2,1); }
.analysis-sheet > header { display: grid; grid-template-columns: 1fr 44px; gap: 10px; align-items: start; margin-bottom: 22px; }
.analysis-sheet h2 { max-width: 420px; margin: 0; font-size: 25px; line-height: 1.05; letter-spacing: -.035em; }
.analysis-sheet header button { width: 44px; height: 44px; border: 1px solid var(--line); background: transparent; font-size: 25px; cursor: pointer; }
.comparison-head, .comparison-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.comparison-head { padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--muted); font: 700 8px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .1em; }
.comparison-row { padding: 14px 0; border-bottom: 1px solid var(--line); }
.comparison-row p { margin: 0; display: grid; gap: 6px; }
.comparison-row b { font-size: 12px; }
.comparison-row p:last-child b { color: var(--accent); }
.comparison-row small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.preserve, .lose { margin-top: 16px; padding: 15px; background: var(--surface-2); border-left: 2px solid var(--accent); }
.lose { border-left-color: var(--muted); }
.preserve span, .lose span { color: var(--accent); font: 750 8px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; }
.lose span { color: var(--muted); }
.preserve p, .lose p { margin: 8px 0 0; color: #bdc5bf; font-size: 10px; line-height: 1.5; }
.sheet-done { width: 100%; margin-top: 18px; }
.toast { position: fixed; z-index: 80; right: 18px; bottom: calc(88px + var(--safe-bottom)); left: 18px; max-width: 420px; min-height: 48px; margin: auto; padding: 14px 16px; background: var(--text); color: var(--bg); box-shadow: 0 12px 50px rgba(0,0,0,.2); font-size: 11px; font-weight: 650; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:active, a:active { transform: translateY(1px); }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(24px); } }
@media (min-width: 860px) {
  body { background: color-mix(in srgb, var(--bg) 92%, var(--text)); }
  .app-shell { margin-top: 34px; margin-bottom: 34px; min-height: 820px; border: 1px solid #292e2b; background: var(--bg); box-shadow: 0 36px 120px rgba(0,0,0,.55); }
  .prototype-note { min-height: 32px; padding-top: 8px; }
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--tg-theme-bg-color, #090b0a);
    --surface: var(--tg-theme-secondary-bg-color, #111412);
    --surface-2: var(--tg-theme-section-bg-color, #171b18);
    --text: var(--tg-theme-text-color, #f2f5f2);
    --muted: var(--tg-theme-hint-color, #929b95);
    --accent: var(--tg-theme-button-color, #79e8a5);
    --red: #f07b6e;
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .tabbar { background: #111411; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --line: #69716c; --muted: #c0c6c2; }
}
