:root {
  --bg: #f3f5f2;
  --bg-deep: #e6ebe6;
  --surface: #ffffff;
  --ink: #1c2420;
  --muted: #5c6a64;
  --line: #dde4de;
  --accent: #0c5c4f;
  --accent-2: #147866;
  --accent-soft: #e3f3ee;
  --busy: #b42318;
  --busy-soft: #fdecea;
  --warn: #8a5a10;
  --warn-soft: #f7efd8;
  --ok: #0c5c4f;
  --shadow: 0 1px 2px rgba(28, 36, 32, 0.04), 0 8px 20px rgba(28, 36, 32, 0.05);
  --radius: 14px;
  --font: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --tap: 44px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121816;
    --bg-deep: #0c100e;
    --surface: #1b2320;
    --ink: #eef3ee;
    --muted: #97a59e;
    --line: #2c3833;
    --accent: #4ec9ae;
    --accent-2: #3aa88f;
    --accent-soft: #1a3330;
    --busy: #ff8a72;
    --busy-soft: #3a221c;
    --warn: #e6c07b;
    --warn-soft: #3a3018;
    --ok: #4ec9ae;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 10px 24px rgba(0, 0, 0, 0.28);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(900px 380px at 8% -8%, #d7ece6 0%, transparent 58%),
    var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100dvh;
  font-size: 15px;
}
img { max-width: 100%; display: block; }
button, a, input, select, textarea { font: inherit; }
button, .btn { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.02em; line-height: 1.25; }

.wrap {
  width: min(680px, 100%);
  margin: 0 auto;
  padding: 12px 16px calc(32px + env(safe-area-inset-bottom));
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(6px + env(safe-area-inset-top)) 0 14px;
}
.brand {
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  min-width: 0;
}
.brand b {
  color: var(--ink);
  letter-spacing: -0.03em;
  font-size: 20px;
  display: block;
  margin-top: 1px;
  font-weight: 700;
}
.top-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
  max-width: 58%;
}
.nav-link {
  color: var(--ink);
  min-height: var(--tap);
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.nav-link:active { background: var(--bg-deep); }

.local-bar {
  padding: 14px 14px 12px;
  margin-bottom: 6px;
}
.local-date {
  font-size: 15px;
  font-weight: 650;
}
.local-place {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}
.local-weather { margin-top: 10px; }
.wx-now { font-size: 13px; color: var(--ink); margin-bottom: 8px; }
.wx-days {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.wx-day {
  background: var(--bg);
  border-radius: 10px;
  padding: 8px 6px 7px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.wx-day b { color: var(--ink); font-size: 13px; font-weight: 650; }

.plate {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero {
  padding: 16px 16px 14px;
  margin-bottom: 12px;
}
.kicker { font-size: 12px; color: var(--muted); }
.hero h1 { font-size: 24px; margin: 4px 0 6px; }
.meta { color: var(--muted); font-size: 13px; }
.status-word {
  display: inline-flex;
  align-items: center;
  margin-top: 10px;
  padding: 5px 10px;
  border-radius: 999px;
  font-weight: 650;
  font-size: 13px;
}
.status-word.free { background: var(--accent-soft); color: var(--ok); }
.status-word.busy { background: var(--busy-soft); color: var(--busy); }
.status-word.warn { background: var(--warn-soft); color: var(--warn); }
.status-word.off { background: var(--bg-deep); color: var(--muted); }

.grid { display: grid; gap: 10px; }
.room-card {
  display: grid;
  grid-template-columns: 6px 1fr;
  overflow: hidden;
  min-height: 76px;
  color: inherit;
  transition: transform 160ms ease, border-color 160ms ease;
}
.swatch { background: var(--accent-soft); }
.swatch[data-tone="餐饮"] { background: #e8c4a8; }
.swatch[data-tone="会议"] { background: #9fc4bb; }
.swatch[data-tone="路演"] { background: #b9a8d4; }
.swatch[data-tone="培训"] { background: #b5c99a; }
.swatch[data-tone="展览"] { background: #d4b89a; }
.swatch[data-tone="直播"] { background: #9db4d4; }
.swatch[data-tone="洽谈"] { background: #9fc4bb; }
.room-card .body { padding: 12px 14px 12px 12px; }
.room-card h2 { font-size: 16px; }
.room-card .kicker { font-size: 12px; margin-bottom: 2px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
  border-radius: 999px;
  padding: 3px 8px;
}

.section { margin: 18px 0 8px; }
.section h2 { font-size: 15px; }
.section p.hint { color: var(--muted); font-size: 12px; margin: 4px 0 10px; line-height: 1.5; }

.tri {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.cell {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 4px;
  text-align: center;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}
.cell:active { transform: scale(0.98); }
.cell .n { font-weight: 650; font-size: 14px; }
.cell .t { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cell .s { font-size: 11px; font-weight: 650; }
.cell.ok { border-color: #b7d9cf; background: var(--accent-soft); }
.cell.busy { background: var(--busy-soft); border-color: #f0c8bc; }
.cell.gone { opacity: 0.55; }
.cell.pick { outline: 2px solid var(--accent); outline-offset: -1px; background: var(--accent-soft); }
.cell[disabled] { pointer-events: none; }

.cal { display: grid; gap: 6px; }
.day {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 6px;
  align-items: stretch;
}
.day-lab {
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-size: 12px;
  padding-left: 2px;
}
.day-lab b { font-size: 13px; }
.day-lab span { color: var(--muted); font-size: 11px; }
.day .tri .cell { min-height: 52px; padding: 6px 2px; }
.time-pick {
  display: flex;
  align-items: center;
  gap: 6px;
}
.time-pick select {
  flex: 1;
  min-height: var(--tap);
  font-size: 16px;
}
.time-pick span { color: var(--muted); font-weight: 650; }

.contact {
  padding: 14px;
  display: grid;
  gap: 6px;
  margin-bottom: 4px;
}
.room-head { display: grid; gap: 12px; }
.when-grid, .form-grid { display: grid; gap: 4px 14px; }
.when-col label:first-child { margin-top: 0; }
.phone-btn, .btn {
  min-height: var(--tap);
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
}
.btn-primary {
  background: var(--accent);
  color: #f7fffb;
  border-color: var(--accent);
  font-weight: 650;
  width: 100%;
}
.btn-primary:disabled { opacity: 0.4; }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--busy); color: #fff; border-color: var(--busy); width: 100%; }
.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.btn-row .btn { width: 100%; }
.cancel-list { display: grid; gap: 8px; margin: 12px 0; }
.cancel-slot {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  margin: 0;
}
.cancel-slot input { width: 18px; min-height: 18px; margin-top: 2px; }
.cancel-slot .meta { font-size: 12px; }
.cancel-slot.is-locked { opacity: 0.55; cursor: default; }
.btn:focus-visible, .cell:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sheet {
  margin-top: 14px;
  padding: 16px 14px;
}
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
label:first-child { margin-top: 0; }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select,
textarea {
  width: 100%;
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  padding: 10px 12px;
  font-size: 16px;
  appearance: none;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input[type="checkbox"] {
  appearance: auto;
  -webkit-appearance: checkbox;
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  margin: 0;
}
.check input { width: 18px; min-height: 18px; }
.err { color: var(--busy); font-size: 13px; margin: 8px 0 0; min-height: 1.2em; }
.okmsg { color: var(--ok); font-size: 13px; margin: 8px 0 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(12px);
  background: var(--ink);
  color: var(--surface);
  padding: 12px 16px;
  border-radius: 12px;
  max-width: min(92vw, 420px);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 20;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--busy); color: #fff; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 26, 23, 0.46);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 15;
  padding: 12px;
}
.modal.show { display: flex; }
.modal .box {
  width: min(520px, 100%);
  background: var(--surface);
  border-radius: 16px 16px 12px 12px;
  padding: 20px 16px 16px;
  margin-bottom: env(safe-area-inset-bottom);
}

.admin-login {
  max-width: 360px;
  margin: 10vh auto 0;
  padding: 22px 18px;
}
.table-wrap { overflow: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 550; font-size: 12px; }
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.tabs .btn { width: auto; flex: 0 0 auto; }
.tabs button[aria-selected="true"] { background: var(--accent); color: #f7fffb; border-color: var(--accent); }

@media (hover: hover) and (pointer: fine) {
  .room-card:hover {
    border-color: #b7d4cc;
    transform: translateY(-1px);
  }
  .nav-link:hover { border-color: var(--accent); color: var(--accent); }
  .cell.ok:hover { border-color: var(--accent); }
}

@media (min-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding: 28px 24px 56px; }
  .brand { font-size: 13px; }
  .brand b { font-size: 24px; }
  .nav-link { min-height: 40px; font-size: 14px; padding: 0 14px; }
  .hero { padding: 20px; }
  .hero h1 { font-size: 26px; }
  .room-card h2 { font-size: 17px; }
  .room-card .body { padding: 14px 14px 12px 12px; }
  .rooms { grid-template-columns: 1fr 1fr; gap: 12px; }
  .day { grid-template-columns: 56px 1fr; }
  .cell { min-height: 64px; }
  .local-bar { padding: 16px 18px; }
  .local-date { font-size: 17px; }
  .wx-days { gap: 8px; }
  .when-grid { grid-template-columns: 1fr 1fr; }
  .sheet { padding: 20px; }
  .modal { align-items: center; }
  .modal .box { border-radius: 16px; max-width: 420px; }
  .contact { padding: 16px 18px; }
}

@media (prefers-color-scheme: dark) {
  body {
    background:
      radial-gradient(900px 380px at 8% -8%, #1a3330 0%, transparent 55%),
      var(--bg);
  }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
