:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #16181d;
  --muted: #5d6470;
  --line: #e2e5ea;
  --accent: #2456d6;
  --accent-text: #ffffff;
  --accent-soft: #e8eefc;
  --bubble: #2456d6;
  --bubble-text: #ffffff;
  --error: #b42318;
  --error-soft: #fdecea;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg: #0f1115;
    --card: #181b21;
    --text: #eceef2;
    --muted: #9aa1ad;
    --line: #2a2f38;
    --accent: #6e93ff;
    --accent-text: #0f1115;
    --accent-soft: #1f2a45;
    --bubble: #3563e9;
    --bubble-text: #ffffff;
    --error: #ff8a80;
    --error-soft: #3a1d1b;
  }
}
:root[data-theme=dark] {
    --bg: #0f1115;
    --card: #181b21;
    --text: #eceef2;
    --muted: #9aa1ad;
    --line: #2a2f38;
    --accent: #6e93ff;
    --accent-text: #0f1115;
    --accent-soft: #1f2a45;
    --bubble: #3563e9;
    --bubble-text: #ffffff;
    --error: #ff8a80;
    --error-soft: #3a1d1b;
    color-scheme: dark;
}
:root[data-theme=light] { color-scheme: light; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.wrap { max-width: 760px; margin: 0 auto; padding: 32px 18px 48px; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 0.8rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 10px; }
p { margin: 0 0 8px; }
.small { font-size: 0.875rem; }
.muted { color: var(--muted); }
.top { margin-bottom: 20px; }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.byline { margin: 4px 0 10px; font-weight: 550; }
.lede { color: var(--muted); max-width: 60ch; }
.badge {
  font-size: 0.75rem; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap;
}
.badge[hidden] { display: none; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px;
}
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.label { font-weight: 600; }
textarea {
  width: 100%; resize: vertical; min-height: 220px; padding: 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
  font: 0.85rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.actions { display: flex; gap: 10px; margin: 14px 0 10px; flex-wrap: wrap; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
.primary, .secondary { border-radius: 10px; padding: 10px 18px; font-weight: 600; }
.primary { background: var(--accent); color: var(--accent-text); border: 1px solid var(--accent); }
.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; font-size: 0.875rem; }
.link-btn[hidden] { display: none; }
.error { color: var(--error); background: var(--error-soft); border-radius: 10px; padding: 10px 12px; margin-top: 6px; }
.error[hidden] { display: none; }
.status { color: var(--muted); font-size: 0.9rem; margin: 4px 2px 12px; min-height: 1.4em; }
.fields { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; }
.fields dt { font-weight: 600; }
.fields dd { margin: 0; }
@media (max-width: 520px) {
  .fields { grid-template-columns: 1fr; gap: 2px; }
  .fields dd { margin-bottom: 8px; }
}
.chip {
  display: inline-block; font-weight: 650; font-size: 0.9rem; padding: 4px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.chip[hidden] { display: none; }
.bubble {
  background: var(--bubble); color: var(--bubble-text); border-radius: 18px 18px 4px 18px;
  padding: 12px 16px; max-width: 520px; margin-left: auto; white-space: pre-wrap; word-wrap: break-word;
}
.list { margin: 0; padding-left: 20px; }
.list li { margin-bottom: 4px; }
.schedule { list-style: none; margin: 0; padding: 0; }
.schedule li { display: grid; grid-template-columns: 7.5rem 1fr; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.schedule li:first-child { border-top: 0; }
.schedule .when { font-weight: 650; }
.schedule .rel { display: block; font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.schedule .what { display: block; }
.schedule .phase { display: block; font-size: 0.8rem; color: var(--muted); }
[data-placeholder]:empty::before { content: attr(data-placeholder); color: var(--muted); font-style: italic; }
.bubble[data-placeholder]:empty { background: var(--accent-soft); }
.thinking summary { cursor: pointer; font-weight: 600; }
.thinking #thinking { white-space: pre-wrap; color: var(--muted); margin-top: 10px; }
.thinking[hidden] { display: none; }
.plan[hidden] { display: none; }
.foot { margin-top: 28px; }
.foot h2 { margin-bottom: 6px; }
