:root {
  font-family: system-ui, sans-serif;
  color-scheme: light;
  color: #1d3030;
  background: #eaf0ed;
  --surface: #fff;
  --ink: #1d3030;
  --muted: #49615b;
  --line: #cbdad4;
  --soft: #edf5f1;
  --accent: #07624e;
  --hover: #064e40;
  --warning: #774206;
  --warning-surface: #fdf2df;
  --error: #8c2424;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; padding: 32px 16px; font-size: 15px; line-height: 1.45; }
::selection { color: #052b21; background: #bce3d2; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, p, dl, dd { margin: 0; }
h1, h2 { line-height: 1.2; letter-spacing: -.025em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.02rem; }
h3, h4 { margin: 0; font-size: .96rem; }

.panel {
  max-width: 550px;
  margin-inline: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: clip;
}
.panel-header, .panel-section, .panel-footer { padding: 16px 22px; }
.panel-header, .section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.panel-header { color: #f5fffa; background: #123e34; }
.tracking-mode { color: #cfebe1; font-size: .85rem; margin-top: 4px; }
.panel-section, .panel-footer { border-top: 1px solid var(--line); }
.status-tag {
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--muted);
  font-size: .82rem;
  font-weight: 600;
}
.lunch-summary {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 12px;
  margin-top: 8px;
}
.balance { font-size: 2.05rem; line-height: 1.2; font-weight: 700; letter-spacing: -.035em; }
.balance small { font-size: .94rem; letter-spacing: 0; }
.balance[data-over] { color: var(--warning); }
.muted { color: var(--muted); font-size: .86rem; }
.balance, .reply-stats dd, time, .muted { font-variant-numeric: tabular-nums; }
progress { display: block; width: 100%; height: 7px; border: 0; margin: 9px 0 12px; border-radius: 6px; overflow: hidden; }
progress::-webkit-progress-bar { background: var(--soft); }
progress::-webkit-progress-value { background: var(--accent); }
.lunch:has(.balance[data-over]) progress::-webkit-progress-value { background: var(--warning); }

button, input { font: inherit; }
button, .actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
button:enabled:hover, .actions a:hover { background: var(--soft); }
button:disabled { opacity: .58; cursor: default; }
button.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
button.primary:enabled:hover { background: var(--hover); }
button.header-button { background: transparent; color: #f5fffa; border-color: #85b9a8; }
button.header-button:enabled:hover { background: #23584a; }
button.header-button:focus-visible { outline-color: #f5fffa; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
details { margin-top: 8px; }
summary {
  width: fit-content;
  padding: 4px 0;
  color: var(--accent);
  font-size: .86rem;
  font-weight: 600;
  cursor: pointer;
}
.inline-form { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-top: 4px; }
.inline-form label { display: grid; gap: 3px; color: var(--muted); font-size: .83rem; }
.inline-form input {
  display: block;
  min-height: 36px;
  width: 100%;
  max-width: 140px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
}
.reply-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 10px 0; }
.reply-stats div + div { padding-left: 14px; border-left: 1px solid var(--line); }
.reply-stats dt { color: var(--muted); font-size: .84rem; }
.reply-stats dd { font-size: 1.45rem; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.check-control { display: flex; align-items: center; gap: 6px; min-height: 36px; font-weight: 600; cursor: pointer; }
.check-control input { inline-size: 1rem; block-size: 1rem; margin: 0; accent-color: var(--accent); }
.queue .actions { margin-top: 8px; }
.message:not(:empty) { padding: 6px 9px; margin: 6px 0; border-radius: 6px; font-size: .86rem; font-weight: 600; }
.warning { color: var(--warning); background: var(--warning-surface); }
.error { color: var(--error); background: #fceeee; }
.error:not(:empty) { margin: 8px 12px; }
.panel-footer { background: var(--soft); }
.panel-footer details p { font-size: .86rem; margin-bottom: 6px; }
.floating-notice { padding: 16px; }
.floating-notice button { margin-top: 8px; }

.tool-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 6px 10px;
  background: var(--soft);
}
.tool-nav button { background: transparent; border-color: transparent; padding-inline: 8px; font-size: .85rem; }
.tool-nav button[aria-pressed="true"] { border-color: var(--line); background: var(--surface); color: var(--accent); }
.tool-view > h2 { margin-bottom: 5px; }
.tool-view { overflow-wrap: anywhere; }
.tool-form { display: grid; gap: 8px; margin: 10px 0; }
.tool-form :is(label, legend) { display: grid; gap: 4px; color: var(--muted); font-size: .86rem; font-weight: 600; }
.tool-form :is(input:not([type="checkbox"]), select, textarea) {
  width: 100%;
  min-height: 36px;
  padding: 6px 8px;
  font: inherit;
  font-size: .93rem;
  font-weight: 400;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
}
.tool-form textarea { resize: vertical; }
.tool-form > button { justify-self: start; }
.tool-form .check-control { display: flex; }
.tool-form fieldset { min-width: 0; margin: 0; padding: 8px; border: 1px solid var(--line); border-radius: 7px; }
.choice-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.choice-row button { justify-self: start; }
.record-list { list-style: none; padding: 0; margin: 9px 0; display: grid; gap: 6px; }
.record { padding: 8px 0; border-bottom: 1px solid var(--line); }
.record > :is(button, .actions), .route > :is(button, .actions) { margin-top: 6px; }
.record-preview, .text-preview { white-space: pre-wrap; overflow-wrap: anywhere; }
.text-preview {
  max-height: 240px;
  overflow: auto;
  margin: 8px 0;
  padding: 8px;
  background: var(--soft);
  border-radius: 6px;
  font: inherit;
}
.route { padding: 10px; margin: 8px 0; border: 1px solid var(--line); border-radius: 8px; }
.route > :is(h4, p) { margin-top: 6px; }
.decision-text { font-weight: 650; }
.tool-view a:not(.actions a) { color: var(--accent); text-underline-offset: 3px; }
.tool-notice { color: var(--accent); background: var(--soft); }
.tool-notice:not(:empty) { margin: 8px 12px; }
kbd { font: inherit; font-weight: 650; }

@media (max-width: 440px), (display-mode: picture-in-picture) {
  body { padding: 0; }
  .panel { border: 0; border-radius: 0; }
  .panel-header, .panel-section, .panel-footer { padding: 10px 14px; }
}

@media (pointer: coarse) {
  button, .actions a, .check-control, summary { min-height: 44px; }
}
