/* Appointment board: calm, dense, one accent colour. Spacing is a 4/8 px scale. */
:root {
  --bg: #f6f7f9; --panel: #fff; --ink: #1c2330; --muted: #5d6677; --line: #dde1e8; --accent: #2a5bd7; --accent-ink: #fff;
  --pending: #f3b43f; --pending-ink: #3d2a00; --confirmed: #4f86e8; --confirmed-ink: #fff; --done: #aab1bd; --done-ink: #1c2330;
  --danger: #b3261e; --now: #d93025; --row: 40px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b; --panel: #1b2029; --ink: #e6e9ef; --muted: #9aa3b2; --line: #2e3542; --accent: #7aa2ff; --accent-ink: #0b1020;
    --pending: #c98f1f; --pending-ink: #fff; --confirmed: #3b66c4; --confirmed-ink: #fff; --done: #4a5262; --done-ink: #e6e9ef;
    --danger: #ff8a80; --now: #ff6b60;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
h1 { font-size: 16px; margin: 0; }
h2 { font-size: 15px; margin: 24px 0 8px; }
h3 { font-size: 14px; margin: 16px 0 8px; }
.muted { color: var(--muted); }
.pad { padding: 16px; }

button, input, select, textarea { font: inherit; color: inherit; }
button { min-height: 40px; padding: 0 16px; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.danger { color: var(--danger); border-color: var(--danger); }
button.small { min-height: 32px; padding: 0 8px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { min-height: 40px; padding: 4px 8px; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; width: 100%; }
textarea { min-height: 72px; resize: vertical; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
label.f { display: block; margin: 8px 0 0; font-size: 12px; color: var(--muted); }
label.f > input, label.f > select, label.f > textarea { margin-top: 4px; color: var(--ink); font-size: 14px; }
label.check { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; }
label.check input { width: 18px; min-height: 18px; }

.bar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.title { display: flex; align-items: center; gap: 8px; }
.badge { padding: 2px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 12px; }
.dates { display: flex; gap: 4px; align-items: center; }
.dates button { min-width: 40px; }
.dates input { width: auto; }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.who { color: var(--muted); }

main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.card { max-width: 420px; margin: 48px auto; padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.card a.btn { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; background: var(--accent); color: var(--accent-ink); border-radius: 6px; text-decoration: none; }

/* the board: the time gutter and the headers stay put while the rest scrolls */
.scroll { flex: 1; min-height: 0; overflow: auto; background: var(--panel); }
.grid { display: grid; min-width: min-content; }
.gutter { position: sticky; left: 0; z-index: 3; background: var(--panel); border-right: 1px solid var(--line); }
.hd { position: sticky; top: 0; z-index: 2; height: 40px; display: flex; align-items: center; justify-content: center; padding: 0 8px; background: var(--panel); border-bottom: 1px solid var(--line); font-weight: 600; white-space: nowrap; }
.gutter .hd { z-index: 4; left: 0; }
.t { height: var(--row); font-size: 11px; color: var(--muted); padding: 2px 8px 0 0; text-align: right; border-top: 1px solid var(--line); }
.col { position: relative; border-left: 1px solid var(--line); min-width: 132px; }
.cell { display: block; width: 100%; height: var(--row); min-height: 0; padding: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; }
.cell.hour { border-top-color: var(--muted); }
.cell:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.blk { position: absolute; left: 4px; right: 4px; z-index: 1; min-height: 0; padding: 2px 8px; border: 0; border-radius: 6px; text-align: left; overflow: hidden; font-size: 12px; line-height: 1.3; box-shadow: 0 0 0 1px var(--panel); }
.blk b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blk span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .9; }
.blk.pending { background: var(--pending); color: var(--pending-ink); }
.blk.confirmed { background: var(--confirmed); color: var(--confirmed-ink); }
.blk.completed, .blk.no_show { background: var(--done); color: var(--done-ink); }
.blk.cancelled, .blk.rejected { background: transparent; color: var(--muted); border: 1px dashed var(--muted); box-shadow: none; text-decoration: line-through; }
.now { position: absolute; left: 0; right: 0; height: 2px; background: var(--now); z-index: 2; pointer-events: none; }
.closed { padding: 8px 16px; color: var(--muted); }

dialog { width: min(480px, calc(100vw - 16px)); max-height: calc(100vh - 16px); overflow: auto; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog h2 { margin: 0 0 8px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chips button { min-height: 32px; padding: 0 8px; border-radius: 999px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.err { margin-top: 8px; color: var(--danger); }
.alts { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 8px 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }

/* setup */
.setup { padding: 16px; max-width: 860px; width: 100%; margin: 0 auto; overflow: auto; }
.types { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.type { text-align: left; height: auto; padding: 8px 16px; line-height: 1.5; }
.type.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.type small { display: block; color: var(--muted); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td input { min-height: 32px; }
.secret { display: flex; gap: 8px; margin-top: 8px; }
.secret code { flex: 1; padding: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; overflow-wrap: anywhere; }

.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 20; padding: 8px 16px; border-radius: 6px; background: var(--ink); color: var(--bg); }

@media (max-width: 640px) {
  .bar { padding: 8px; }
  .col { min-width: 112px; }
  .setup { padding: 8px; }
}
