/* RoomDesk 样式。只用系统字体，不加载任何外部资源。浅色纸面背景、石板色文字、唯一强调色为靛蓝。 */
:root {
  --paper: #fbfbf9;
  --surface: #ffffff;
  --surface-2: #f6f5f1;
  --ink: #1e293b;
  --ink-2: #475569;
  --ink-3: #64748b;
  --ink-4: #94a3b8;
  --line: #e6e4de;
  --line-2: #efede8;
  --accent: #4f46e5;
  --accent-ink: #3730a3;
  --accent-soft: #eef0fe;
  --accent-line: #c7cbfa;
  --other: #eef1f5;
  --other-line: #cbd5e1;
  --danger: #b42318;
  --danger-soft: #fdf1ef;
  --danger-line: #f3c4bd;
  --ok: #2f6f4f;
  --ok-soft: #eff7f2;
  --ok-line: #c6e3d2;
  --radius: 10px;
  --label-w: 124px;
  --row-h: 46px;
  --shadow: 0 1px 2px rgba(30, 41, 59, 0.04), 0 2px 8px rgba(30, 41, 59, 0.04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  min-width: 320px;
}
button, input, select { font: inherit; color: inherit; }
h1, h2 { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- 顶栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--paper);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-mark rect:first-child { fill: var(--accent); }
.brand-mark rect:last-of-type, .brand-mark path { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; }
.brand-text { display: flex; align-items: baseline; gap: 8px; }
.brand-text strong { font-size: 17px; letter-spacing: 0.2px; }
.brand-text span { color: var(--ink-3); }
.topbar-meta { display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-size: 13px; }
.sample-badge {
  padding: 2px 8px; border: 1px dashed var(--accent-line); border-radius: 999px;
  color: var(--accent-ink); background: var(--accent-soft); font-size: 12px; white-space: nowrap;
}

/* ---------------------------------------------------------------- 布局 */
.layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start;
  max-width: 1440px; margin: 0 auto; padding: 16px 24px;
}
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-head h2 { font-size: 15px; }
.side { display: grid; gap: 16px; min-width: 0; }

/* ---------------------------------------------------------------- 日程板 */
.board { padding: 12px 14px 10px; min-width: 0; }
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.floor-tabs { display: flex; gap: 4px; padding: 3px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 9px; flex-wrap: wrap; }
.floor-tab {
  border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; cursor: pointer; color: var(--ink-2); white-space: nowrap;
}
.floor-tab small { color: var(--ink-4); margin-left: 4px; font-size: 12px; }
.floor-tab:hover { color: var(--ink); }
.floor-tab[aria-selected="true"] { background: var(--surface); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(30, 41, 59, 0.08); font-weight: 600; }
.floor-tab[aria-selected="true"] small { color: var(--accent); }
.day-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.day-nav input[type="date"] { height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.icon-button {
  width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  cursor: pointer; font-size: 18px; line-height: 1; color: var(--ink-2);
}
.icon-button:hover { border-color: var(--ink-4); color: var(--ink); }
.ghost-button {
  height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; color: var(--ink-2); white-space: nowrap;
}
.ghost-button:hover:not(:disabled) { border-color: var(--accent-line); color: var(--accent-ink); }
.ghost-button:disabled { opacity: 0.5; cursor: not-allowed; }

.timeline-scroll { overflow-x: auto; overscroll-behavior-x: contain; }
.timeline { position: relative; min-width: 600px; }
.tl-hours { display: grid; grid-template-columns: var(--label-w) minmax(0, 1fr); height: 24px; }
.tl-hours-track { position: relative; }
.tl-hour { position: absolute; top: 2px; transform: translateX(-50%); font-size: 11px; color: var(--ink-4); }
.tl-hour:first-child { transform: none; }
.tl-hour:last-child { transform: translateX(-100%); }
.tl-floor { padding: 8px 0 4px; font-size: 12px; color: var(--ink-3); border-top: 1px solid var(--line-2); }
.tl-floor-label { display: inline-flex; align-items: baseline; gap: 8px; position: sticky; left: 0; }
.tl-hours + .tl-floor { border-top: 0; }
.tl-floor strong { color: var(--ink-2); font-size: 12px; }
.tl-row { display: grid; grid-template-columns: var(--label-w) minmax(0, 1fr); height: var(--row-h); }
.tl-room { display: flex; flex-direction: column; justify-content: center; padding-right: 10px; min-width: 0; background: var(--surface); }
.tl-room strong { font-size: 13px; font-weight: 600; }
.tl-room span { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-track {
  position: relative; margin: 4px 0; border-radius: 7px; cursor: copy;
  background-color: var(--surface-2);
  background-image: linear-gradient(to right, var(--line) 1px, transparent 1px);
  background-size: calc(100% / var(--hours, 13)) 100%; /* --hours 由 app.js 按 RULES 设置 */
}
.tl-track:hover { background-color: #f1f0eb; }
.tl-block {
  position: absolute; top: 3px; bottom: 3px; min-width: 6px; padding: 2px 7px; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--other-line); border-left-width: 3px; background: var(--other); color: var(--ink);
  font-size: 12px; line-height: 1.25; text-align: left; cursor: pointer; display: flex; flex-direction: column; justify-content: center;
}
.tl-block span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-block small { color: var(--ink-3); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-block.is-mine { border-color: var(--accent-line); border-left-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.tl-block.is-mine small { color: var(--accent); }
.tl-block:hover { box-shadow: 0 1px 4px rgba(30, 41, 59, 0.14); z-index: 2; }
.tl-block.is-narrow { padding: 2px 3px 2px 4px; font-size: 11.5px; }
.tl-block.is-narrow small { display: none; }
.tl-block.is-tiny { padding: 0; }
.tl-block.is-tiny span, .tl-block.is-tiny small { display: none; }
.tl-draft {
  position: absolute; top: 3px; bottom: 3px; border: 1.5px dashed var(--accent); border-radius: 6px; background: rgba(79, 70, 229, 0.06);
  pointer-events: none; z-index: 3;
}
.tl-draft.is-conflict { border-color: var(--danger); background: rgba(180, 35, 24, 0.07); }
.tl-now {
  position: absolute; top: 24px; bottom: 0; width: 0; border-left: 1.5px solid var(--danger); pointer-events: none; z-index: 4;
  left: calc(var(--label-w) + (100% - var(--label-w)) * var(--at));
}
.tl-now::before { content: ""; position: absolute; top: -3px; left: -4.5px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }
.tl-empty { padding: 28px 0; text-align: center; color: var(--ink-3); }

.board-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.hint { margin: 0; font-size: 12px; color: var(--ink-3); }
.legend { display: flex; gap: 14px; margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--ink-3); }
.legend li { display: flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 10px; border-radius: 3px; border: 1px solid var(--other-line); border-left-width: 3px; background: var(--other); }
.swatch-mine { border-color: var(--accent-line); border-left-color: var(--accent); background: var(--accent-soft); }
.swatch-draft { border: 1.5px dashed var(--accent); background: rgba(79, 70, 229, 0.06); }

/* ---------------------------------------------------------------- 表单 */
.booking-form { padding: 14px 16px 16px; display: grid; gap: 10px; }
.booking-form .card-head { margin-bottom: 0; }
.duration { font-size: 12px; color: var(--ink-3); }
.field { display: grid; gap: 4px; min-width: 0; }
.field > span { font-size: 12px; color: var(--ink-2); }
.field input, .field select {
  width: 100%; height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); min-width: 0;
}
.field input:hover, .field select:hover { border-color: var(--ink-4); }
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14); }
.field-row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.check { border-radius: 8px; padding: 8px 10px; font-size: 13px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink-2); min-height: 38px; }
.check p { margin: 0; }
.check p + p, .check ul + p { margin-top: 6px; }
.check ul { margin: 4px 0 0; padding-left: 18px; }
.check.is-ok { border-color: var(--ok-line); background: var(--ok-soft); color: var(--ok); }
.check.is-error { border-color: var(--danger-line); background: var(--danger-soft); color: var(--danger); }
.check.is-conflict { border-color: var(--danger-line); background: var(--danger-soft); color: var(--ink); }
.check.is-conflict strong { color: var(--danger); }
.suggest { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--accent-line); background: var(--surface); color: var(--accent-ink); border-radius: 999px;
  padding: 1px 10px; font-size: 12px; cursor: pointer; white-space: nowrap;
}
.chip:hover { background: var(--accent-soft); }
.primary-button {
  height: 38px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer;
}
.primary-button:hover:not(:disabled) { background: var(--accent-ink); }
.primary-button:disabled { background: #c7c9d9; cursor: not-allowed; }

/* ---------------------------------------------------------------- 我的预约 */
.mine { padding: 14px 16px; }
.count { font-size: 12px; color: var(--ink-3); }
.mine-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mine-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; }
.mine-item:hover { border-color: var(--accent-line); }
.mine-main { min-width: 0; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
.mine-main strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mine-main > span { display: block; font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 400; color: var(--accent-ink); background: var(--accent-soft); vertical-align: 1px; }
.mine-actions { display: flex; gap: 4px; }
.small-button { height: 26px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 12px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.small-button:hover { border-color: var(--accent-line); color: var(--accent-ink); }
.small-button.is-danger:hover { border-color: var(--danger-line); color: var(--danger); }
.mine-empty { color: var(--ink-3); font-size: 13px; padding: 6px 0; }

/* ---------------------------------------------------------------- 页脚、详情、提示 */
.footer { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; padding: 4px 24px 24px; font-size: 12px; color: var(--ink-3); text-align: center; }
.link-button { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; font-size: 12px; }
.detail { border: 1px solid var(--line); border-radius: 12px; padding: 0; width: min(400px, calc(100vw - 32px)); color: var(--ink); background: var(--surface); box-shadow: 0 12px 40px rgba(30, 41, 59, 0.18); }
.detail::backdrop { background: rgba(30, 41, 59, 0.28); }
.detail-body { padding: 16px 18px 18px; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.detail-head h2 { font-size: 16px; padding-top: 4px; overflow-wrap: anywhere; }
.detail-list { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; margin: 14px 0 16px; font-size: 13px; }
.detail-list dt { color: var(--ink-3); }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.detail-actions { display: flex; justify-content: flex-end; gap: 8px; }
.danger-button { height: 32px; padding: 0 12px; border: 1px solid var(--danger-line); border-radius: 8px; background: var(--surface); color: var(--danger); cursor: pointer; }
.danger-button:hover, .danger-button.is-armed { background: var(--danger); border-color: var(--danger); color: #fff; }
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); max-width: calc(100vw - 32px);
  padding: 8px 14px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 13px; box-shadow: 0 6px 20px rgba(30, 41, 59, 0.25); z-index: 20;
}
.noscript { padding: 24px; text-align: center; }

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}
@media (max-width: 760px) {
  :root { --label-w: 96px; --row-h: 44px; }
  .topbar { padding: 10px 16px; }
  .topbar-meta { width: 100%; justify-content: space-between; }
  .layout { padding: 12px 16px; gap: 12px; }
  .side { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .board { padding: 10px 10px 8px; }
  .board-head { flex-direction: column; align-items: stretch; }
  .floor-tabs { justify-content: space-between; }
  .floor-tab { padding: 5px 8px; flex: 1; }
  .floor-tab small { display: none; }
  .day-nav input[type="date"] { flex: 1 1 120px; min-width: 0; }
  .day-nav .ghost-button { flex: 1 1 40%; }
  .timeline { min-width: 820px; }
  .tl-room, .tl-hours > div:first-child { position: sticky; left: 0; z-index: 5; background: var(--surface); }
  .tl-room span { display: none; }
  .legend { gap: 10px; }
  .footer { padding: 4px 16px 20px; }
}
