/* Matt's Studio 空堂預約 — 務實風格 */
:root {
  color-scheme: light;
  --bg: #f6f6f4;
  --surface: #ffffff;
  --ink: #1b1f1c;
  --ink-2: #4b534e;
  --ink-3: #6d756f;
  --line: #dcdedb;
  --accent: #146c43;
  --accent-ink: #ffffff;
  --free-bg: #e8f4ec;
  --free-line: #b9dcc6;
  --free-ink: #0f5a37;
  --booked-bg: #f0f0ee;
  --group-bg: #fdf1e6;
  --group-ink: #9a4a12;
  --error: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121513;
    --surface: #1b201d;
    --ink: #eceeec;
    --ink-2: #bcc3be;
    --ink-3: #939b95;
    --line: #2f3733;
    --accent: #2f9d68;
    --free-bg: #15301f;
    --free-line: #2a5a3d;
    --free-ink: #8fd9ad;
    --booked-bg: #232925;
    --group-bg: #33261a;
    --group-ink: #f0b27e;
    --error: #ff8a80;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang HK", "Noto Sans TC", "Microsoft JhengHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}
button, select, input { font: inherit; color: inherit; }
button, select, input:not([type="checkbox"]) { min-height: 2.75rem; }
a { color: var(--accent); }
.num { font-variant-numeric: tabular-nums; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip {
  position: absolute; left: 8px; top: -60px; z-index: 50;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  padding: 8px 12px; border-radius: 6px;
}
.skip:focus { top: 8px; }

/* Header */
.top { background: var(--surface); border-bottom: 1px solid var(--line); padding: 20px 0 16px; }
.top h1 { margin: 0 0 4px; font-size: 1.5rem; line-height: 1.3; }
.lead { margin: 0 0 12px; color: var(--ink-2); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0; font-size: 0.95rem; }
.meta div { display: flex; gap: 6px; }
.meta dt { color: var(--ink-3); }
.meta dd { margin: 0; font-weight: 600; }

/* Sections */
main { padding-bottom: 24px; }
section { margin-top: 24px; }
h2 { margin: 0 0 6px; font-size: 1.2rem; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sec-sub { color: var(--ink-3); font-size: 0.92rem; }
.note { margin: 4px 0 12px; color: var(--ink-2); font-size: 0.95rem; }
.empty, .error { padding: 12px; border: 1px dashed var(--line); border-radius: 8px; background: var(--surface); margin: 8px 0; }
.error { border-color: var(--error); color: var(--error); }

/* Empty slot list */
.slots { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.slot {
  background: var(--surface); border: 1px solid var(--free-line); border-left: 4px solid var(--accent);
  border-radius: 8px; padding: 12px 14px;
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
}
.slot-date { margin: 0; font-weight: 600; }
.slot-time { margin: 0; font-size: 1.45rem; font-weight: 700; line-height: 1.25; grid-column: 1; }
.slot-meta { margin: 0; color: var(--ink-2); font-size: 0.95rem; grid-column: 1; }
.slot .btn { grid-column: 2; grid-row: 1 / span 3; }
.today-mark { font-size: 0.8rem; border: 1px solid var(--accent); color: var(--accent); border-radius: 4px; padding: 0 5px; margin-left: 6px; font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.75rem; padding: 8px 18px; border-radius: 8px; border: 1px solid transparent;
  font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn-solid { background: var(--accent); color: var(--accent-ink); }
.btn-wa { background: var(--accent); color: var(--accent-ink); width: 100%; margin-top: 14px; }
.btn-wa[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

/* Timetable tools */
.tools { display: grid; gap: 8px; margin: 8px 0 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 4px 14px; cursor: pointer; min-height: 2.4rem;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.search input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: var(--surface); }

/* Days */
.days { display: grid; gap: 12px; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.day-date { margin: 0; font-size: 1.05rem; }
.day-count { color: var(--ink-3); font-size: 0.9rem; }
.agenda { list-style: none; margin: 0; padding: 0; }
.entry {
  display: grid; grid-template-columns: 7.2em auto 1fr auto; gap: 4px 10px; align-items: center;
  padding: 9px 14px; border-top: 1px solid var(--line);
}
.entry:first-child { border-top: 0; }
.entry.is-free { background: var(--free-bg); }
.entry-time { margin: 0; font-weight: 600; white-space: nowrap; }
.entry-dur { color: var(--ink-3); font-weight: 400; font-size: 0.85rem; display: block; }
.entry-venue { color: var(--ink-2); }
.tag { display: inline-block; font-size: 0.85rem; padding: 1px 8px; border-radius: 4px; white-space: nowrap; }
.tag-free { background: var(--surface); color: var(--free-ink); border: 1px solid var(--free-line); font-weight: 600; }
.tag-booked { background: var(--booked-bg); color: var(--ink-2); border: 1px solid var(--line); }
.tag-group { background: var(--group-bg); color: var(--group-ink); border: 1px solid var(--group-ink); }
.tag-hint { color: var(--ink-3); font-size: 0.85rem; margin-left: 4px; }
.mini-book {
  border: 1px solid var(--accent); background: var(--surface); color: var(--accent);
  border-radius: 6px; padding: 2px 12px; font-weight: 600; cursor: pointer; min-height: 2.4rem;
}
@media (max-width: 560px) {
  .entry { grid-template-columns: 6.8em 1fr auto; }
  .entry-venue { grid-column: 2 / -1; }
  .entry .mini-book { grid-column: 3; grid-row: 1; justify-self: end; }
}

/* Footer */
footer { border-top: 1px solid var(--line); padding: 16px 0 28px; color: var(--ink-2); font-size: 0.92rem; }
footer p { margin: 0 0 4px; }

/* Booking sheet */
.overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
  display: none; align-items: flex-end; justify-content: center; z-index: 40;
}
.overlay.open { display: flex; }
.sheet {
  background: var(--surface); width: 100%; max-width: 520px; max-height: 92vh; overflow: auto;
  border-radius: 14px 14px 0 0; padding: 16px 18px 22px;
}
@media (min-width: 640px) {
  .overlay { align-items: center; }
  .sheet { border-radius: 12px; }
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet h3 { margin: 0; font-size: 1.25rem; }
.btn-close { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; width: 2.75rem; font-size: 1.4rem; cursor: pointer; }
.sheet-lead { color: var(--ink-2); font-size: 0.95rem; margin: 8px 0 12px; }
.sheet label { display: block; font-weight: 600; margin: 12px 0 4px; }
.sheet input, .sheet select {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--bg);
}
.sheet select:disabled { opacity: 0.7; }
.lock-note { color: var(--ink-3); font-weight: 400; font-size: 0.9rem; }
.venue-line { margin: 12px 0 0; color: var(--ink-2); }
.fineprint { color: var(--ink-3); font-size: 0.88rem; margin: 10px 0 0; }
