:root {
  --text: #141414; --muted: #555a55; --line: #e3e5e1; --bg: #fafaf8; --panel: #ffffff; --tint: #f1f4ef;
  --accent: #1f6f43; --accent-ink: #ffffff; --danger: #a12a1f; --warn: #8a5a00; --ok: #1f6f43;
  --radius: 8px; --shadow: 0 1px 3px rgba(0,0,0,0.08); --shadow-hover: 0 4px 12px rgba(0,0,0,0.10);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root { --text: #ecede9; --muted: #a9ada6; --line: #2e322d; --bg: #121411; --panel: #1a1d19; --tint: #1f241e;
    --accent: #5fbf86; --accent-ink: #0d1a12; --danger: #ff8a7d; --warn: #e3b450; --ok: #5fbf86; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1 { font-size: 31px; line-height: 1.15; margin: 0 0 16px; }
h2 { font-size: 25px; line-height: 1.2; margin: 0 0 16px; }
h3 { font-size: 20px; line-height: 1.3; margin: 0 0 8px; }
p { margin: 0 0 16px; max-width: 65ch; }
small, .meta { font-size: 13px; color: var(--muted); }
code, .mono { font-family: var(--mono); font-size: 13px; }

.top { display: flex; align-items: center; gap: 16px; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.top .brand { font-weight: 700; color: var(--text); text-decoration: none; margin-right: 8px; min-height: 44px; display: inline-flex; align-items: center; }
.tap { min-height: 44px; display: inline-flex; align-items: center; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.top nav a { color: var(--text); text-decoration: none; padding: 8px 12px; border-radius: var(--radius); min-height: 44px; display: inline-flex; align-items: center; }
.top nav a[aria-current="page"] { background: var(--tint); font-weight: 600; }
.banner { background: var(--tint); padding: 8px 24px; font-size: 13px; border-bottom: 1px solid var(--line); }
main { max-width: 1120px; margin: 0 auto; padding: 32px 24px 64px; }

.grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card + .card, .card + section, section + section, .grid + .card, .grid + section, .card + .grid, .card + form, form + section { margin-top: 32px; }
.grid > .card { margin-top: 0; }
.spread + form, .spread + .card, .spread + section, .spread + .tabs, h1 + form, p + form { margin-top: 24px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; gap: 16px; align-items: center; flex-wrap: wrap; }
.stat { font-size: 31px; font-weight: 700; line-height: 1.15; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
tr:hover td { background: var(--tint); }
.table-wrap { overflow-x: auto; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 12px 24px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: box-shadow 200ms ease-out, background 200ms ease-out; }
.btn:hover { box-shadow: var(--shadow-hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.small { min-height: 44px; padding: 8px 12px; font-size: 13px; }
.btn.danger { color: var(--danger); }

label { display: block; font-weight: 600; margin-bottom: 4px; }
.field + .field { margin-top: 16px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=tel], input[type=time], input[type=date], input[type=number], input[type=url], select, textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); font: inherit; }
textarea { min-height: 160px; font-family: var(--mono); font-size: 13px; line-height: 1.5; }
textarea.doc { min-height: 480px; }
.error { color: var(--danger); font-size: 13px; margin-top: 4px; }

.pill { display: inline-block; font-size: 13px; padding: 0 8px; border-radius: var(--radius); border: 1px solid var(--line); white-space: nowrap; }
.pill.live, .pill.ok { color: var(--ok); border-color: currentColor; }
.pill.bad { color: var(--danger); border-color: currentColor; }
.pill.warn { color: var(--warn); border-color: currentColor; }

.transcript p { margin: 0 0 8px; }
.transcript .user strong { color: var(--muted); }
.live-call { border-left: 4px solid var(--accent); }
.meter { height: 8px; background: var(--tint); border-radius: var(--radius); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; flex-wrap: wrap; }
.tabs a { padding: 12px 16px; text-decoration: none; color: var(--text); min-height: 44px; display: inline-flex; align-items: center; }
.tabs a[aria-current="page"] { border-bottom: 2px solid var(--accent); font-weight: 600; }
.diff { font-family: var(--mono); font-size: 13px; white-space: pre-wrap; background: var(--tint); padding: 16px; border-radius: var(--radius); }
.diff .add { color: var(--ok); } .diff .del { color: var(--danger); text-decoration: line-through; }
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 480px; overflow-y: auto; padding: 16px; background: var(--tint); border-radius: var(--radius); }
.chat .bubble { padding: 8px 12px; border-radius: var(--radius); background: var(--panel); max-width: 80%; }
.chat .bubble.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.flash { padding: 12px 16px; border-radius: var(--radius); background: var(--tint); margin-bottom: 24px; }

@media (max-width: 640px) {
  main { padding: 24px 16px 64px; }
  .top { padding: 8px 16px; justify-content: space-between; }
  .top nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; }
  h1 { font-size: 25px; }
  .hide-sm { display: none; }
}

.days { display: flex; flex-direction: column; gap: 12px; }
.day { display: grid; grid-template-columns: 120px 1fr 1fr auto; gap: 8px 12px; align-items: end; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.day > strong { align-self: center; }
.day-field { font-weight: 400; font-size: 13px; color: var(--muted); margin: 0; }
.day-closed { font-weight: 400; margin: 0; min-height: 44px; display: inline-flex; align-items: center; gap: 8px; }
.day-error { grid-column: 1 / -1; margin: 0; }
@media (max-width: 640px) {
  .day { grid-template-columns: 1fr 1fr; }
  .day > strong, .day-closed { grid-column: 1 / -1; }
}
