
:root {
  color-scheme: light dark;
  --page: var(--tg-theme-bg-color, #f5f7fa);
  --surface: var(--tg-theme-section-bg-color, #fff);
  --ink: var(--tg-theme-text-color, #172333);
  --muted: #4e6072;
  --line: #cbd4de;
  --accent: var(--tg-theme-link-color, #115b97);
  --positive: #0e674d;
  --warning: #825600;
  --danger: #a0263b;
  font-family: Inter, system-ui, sans-serif;
}
:root[data-theme='dark'] {
  --page: var(--tg-theme-bg-color, #111923);
  --surface: var(--tg-theme-section-bg-color, #192633);
  --ink: var(--tg-theme-text-color, #eaf1f8);
  --muted: #b4c2ce;
  --line: #4a5a69;
  --accent: var(--tg-theme-link-color, #82c9ff);
  --positive: #8bdabb;
  --warning: #ffd284;
  --danger: #ffa9b5;
}
@supports (color: color-mix(in srgb, black, white)) {
  :root, :root[data-theme='dark'] {
    --muted: color-mix(in srgb, var(--ink) 70%, var(--surface));
    --line: color-mix(in srgb, var(--ink) 18%, var(--surface));
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--ink); }
.console {
  width: min(100%, 700px); margin: 0 auto;
  padding: max(18px, var(--tg-content-safe-area-inset-top, env(safe-area-inset-top)))
    max(14px, var(--tg-content-safe-area-inset-right, env(safe-area-inset-right)))
    max(24px, var(--tg-content-safe-area-inset-bottom, env(safe-area-inset-bottom)))
    max(14px, var(--tg-content-safe-area-inset-left, env(safe-area-inset-left)));
}
.heading, .service-heading, .record-heading {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.heading { margin-block-end: 16px; }
h1, h2, p, dl, dd { margin: 0; }
h1 { font-size: clamp(1.25rem, 5.2vw, 1.85rem); letter-spacing: -.035em; }
h2 { font-size: 1rem; }
button, a { -webkit-tap-highlight-color: transparent; }
button {
  min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: 650 .875rem Inter, system-ui, sans-serif;
  cursor: pointer;
}
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.notice {
  margin-block-end: 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); padding: 12px; font-size: .875rem; line-height: 1.4;
}
.notice[data-tone='warning'] { border-inline-start: 3px solid var(--warning); }
.notice[data-tone='danger'] { border-inline-start: 3px solid var(--danger); }
.service { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.service-times { margin-top: 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.service-times dt, .service-note, .context { color: var(--muted); font-size: .8rem; line-height: 1.4; }
.service-times dd { margin-top: 3px; font-size: .875rem; font-variant-numeric: tabular-nums; }
.service-note { margin-top: 9px; }
.service-reason { margin-top: 5px; color: var(--warning); font-size: .8rem; line-height: 1.4; }
.phase {
  flex: none; border-radius: 100px; border: 1px solid currentColor; padding: 4px 8px;
  color: var(--muted); font-size: .75rem; font-weight: 650;
}
[data-tone='positive'].phase { color: var(--positive); }
[data-tone='warning'].phase { color: var(--warning); }
[data-tone='danger'].phase { color: var(--danger); }
.totals, .delivery-totals { display: grid; gap: 7px; }
.totals { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 10px 0 18px; }
.totals div, .delivery-totals div {
  display: flex; flex-direction: column-reverse; gap: 3px; min-width: 0;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 10px;
}
.totals dt, .delivery-totals dt { color: var(--muted); font-size: .75rem; }
.delivery-totals dt { overflow-wrap: anywhere; }
.totals dd, .delivery-totals dd { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.delivery-totals { grid-template-columns: repeat(auto-fit, minmax(85px, 1fr)); margin: 8px 0; }
.views { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin-bottom: 15px; }
.views button { padding-inline: 4px; }
.views button[aria-pressed='true'] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.context { margin-top: 5px; }
.records { padding: 0; margin: 9px 0 0; list-style: none; display: grid; gap: 7px; }
.record {
  display: grid; gap: 5px; padding: 11px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px;
}
.record-heading { align-items: flex-start; }
.record-title { font-size: .875rem; min-width: 0; overflow-wrap: anywhere; }
.record-detail, .empty { color: var(--muted); font-size: .8rem; line-height: 1.4; overflow-wrap: anywhere; }
.record-mint { font: .75rem ui-monospace, monospace; overflow-wrap: anywhere; color: var(--muted); }
.quote-status { display: grid; gap: 2px; margin-block: 2px; padding: 3px 0 3px 9px; border-inline-start: 2px solid var(--line); }
.quote-status[data-tone='warning'] { border-color: var(--warning); }
.quote-status[data-tone='positive'] { border-color: var(--positive); }
.quote-status[data-tone='warning'] .quote-title { color: var(--warning); }
.quote-title { font-size: .8rem; line-height: 1.4; }
.record-links { display: flex; flex-wrap: wrap; gap: 2px 14px; }
.record-links a {
  color: var(--accent); font-size: .8rem; min-height: 32px;
  display: inline-flex; align-items: center; text-underline-offset: 2px;
}
.empty { padding: 12px 0; }
@media (min-width: 34em) { .totals { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
