/* roomhub — 공통 스타일. 빌드 도구 없음. */
:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1b1f24;
  --muted: #6b7280;
  --line: #dfe3e8;
  --line-soft: #c9d0d8;   /* 30분 점선 — 점선이라 실제론 정시 선보다 옅게 보인다 */
  --accent: #a50034;          /* LG 레드 */
  --accent-soft: #fdecf1;
  --room: #e8eef7;
  --room-line: #9db4d4;
  --desk: #f0f1f3;
  --desk-line: #cbd0d6;
  --free: #ffffff;
  --busy: #a50034;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c; --panel: #1c2026; --ink: #e8eaed; --muted: #98a1ad;
    --line: #2c323b; --line-soft: #454d58; --accent: #ff5c8a; --accent-soft: #3a1a26;
    --room: #232d3d; --room-line: #46586f; --desk: #232830; --desk-line: #39404a;
    --free: #1c2026; --busy: #ff5c8a;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard",
        "Malgun Gothic", "Noto Sans KR", Segoe UI, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 20px 60px; }

header.top {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  padding: 4px 0 16px;
}
header.top h1 { font-size: 20px; margin: 0; letter-spacing: -.01em; }
header.top .sub { color: var(--muted); font-size: 13px; }
header.top .spacer { flex: 1 1 auto; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow);
}

/* ── 버튼 ─────────────────────────────────────────────────────────────── */
.btn {
  appearance: none; text-decoration: none; white-space: nowrap; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink); border-radius: 9px; padding: 7px 13px; font-size: 14px;
  cursor: pointer; font-family: inherit; line-height: 1.3;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── 도면 ─────────────────────────────────────────────────────────────── */
.plan-card { padding: 10px 12px 6px; }
/* max-height 는 창이 낮을 때의 안전장치. 평소엔 .wrap 폭(1180)이 크기를 결정한다 —
   도면만으로 첫 화면을 다 먹으면 아래 예약 목록이 안 보인다. */
svg.plan { width: 100%; height: auto; display: block; touch-action: manipulation; max-height: 56vh; }
svg.plan text { font-family: inherit; fill: var(--ink); }
.wall { stroke: var(--muted); fill: none; stroke-width: 2.5; }
.wall.thin { stroke-width: 1.4; opacity: .65; }
.desk { fill: var(--desk); stroke: var(--desk-line); stroke-width: 1; }
.zone-label { font-size: 15px; font-weight: 600; fill: var(--muted); }
.note { font-size: 13px; fill: var(--muted); }
.facility rect { fill: var(--desk); stroke: var(--desk-line); }
.facility text { font-size: 13px; fill: var(--muted); }
/* 출입구: 4회의실과 E/V 사이에서 오른쪽 → 왼쪽으로 진입 */
svg.plan .entrance .arrow { stroke: var(--muted); fill: none; stroke-width: 2.5; }
svg.plan .entrance .head  { fill: var(--muted); stroke: none; }
svg.plan .entrance text   { font-size: 13px; fill: var(--muted); font-weight: 600; }

g.room { cursor: pointer; }
g.room .box { fill: var(--room); stroke: var(--room-line); stroke-width: 2; rx: 4; transition: fill .12s; }
g.room .name { font-size: 19px; font-weight: 700; text-anchor: middle; }
g.room .cap  { font-size: 13px; fill: var(--muted); text-anchor: middle; }
g.room .stat { font-size: 13px; text-anchor: middle; fill: var(--accent); font-weight: 600; }
g.room:hover .box { fill: var(--accent-soft); stroke: var(--accent); }
g.room:focus { outline: none; }
g.room:focus-visible .box { stroke: var(--accent); stroke-width: 3; }

/* ── 예약 그리드 ──────────────────────────────────────────────────────── */
/* 08:00 으로 자동 스크롤하므로 날짜 이동 툴바도 따라 붙어 있어야 한다 */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
           position: sticky; top: 0; z-index: 4; background: var(--bg); padding: 10px 0 12px; }
.toolbar .date { font-weight: 700; font-size: 17px; min-width: 150px; text-align: center; }
.toolbar input[type=date] {
  font: inherit; padding: 6px 9px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
}

.grid-card { padding: 0; }
.colhead { display: flex; border-bottom: 1px solid var(--line); position: sticky; top: 62px;
           background: var(--panel); z-index: 3; border-radius: 14px 14px 0 0; }
.colhead .gut { flex: 0 0 62px; }
.colhead .ch { flex: 1 1 0; text-align: center; padding: 10px 6px; border-left: 1px solid var(--line); }
.colhead .ch b { display: block; font-size: 15px; }
.colhead .ch span { color: var(--muted); font-size: 12px; }

.gridbody { display: flex; position: relative; padding: 11px 0 14px; }
.gutter { flex: 0 0 62px; position: relative; }
.gutter .hm {
  position: absolute; right: 8px; font-size: 11px; color: var(--muted);
  transform: translateY(-50%); white-space: nowrap;
}
.col { flex: 1 1 0; position: relative; border-left: 1px solid var(--line); user-select: none; }
.slot { position: absolute; left: 0; right: 0; background: var(--free);
        border-bottom: 1px solid var(--line-soft); }
.slot { border-bottom-style: dotted; }                 /* 30분 경계 = 점선 */
.slot.hourline { border-bottom-style: solid; border-bottom-color: var(--line); }
.slot.work { background: color-mix(in srgb, var(--accent) 3%, var(--free)); }
.slot:hover { background: var(--accent-soft); }
.slot.sel { background: var(--accent); opacity: .35; }
.slot.past { background: repeating-linear-gradient(45deg, transparent, transparent 7px,
              color-mix(in srgb, var(--muted) 7%, transparent) 7px,
              color-mix(in srgb, var(--muted) 7%, transparent) 14px); }

.bk {
  position: absolute; left: 3px; right: 3px; border-radius: 7px; overflow: hidden;
  background: var(--accent); color: #fff; padding: 4px 7px; cursor: pointer;
  border: 1px solid rgba(0,0,0,.08); box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.bk b { display: block; font-size: 13px; font-weight: 700; line-height: 1.25;
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk span { font-size: 11px; opacity: .88; }
/* 1슬롯짜리는 두 줄이 안 들어간다 — 한 줄로 눕힌다 */
/* 칸이 낮으면 두 줄이 안 들어간다 — 한 줄로 눕히고, 더 낮으면 더 조인다 */
.bk.short { display: flex; align-items: center; gap: 6px; padding: 2px 7px; }
.bk.short b { font-size: 12px; line-height: 1.3; }
.bk.short span { font-size: 10.5px; }
.bk.tiny { border: none; padding: 0 6px; gap: 5px; }
.bk.tiny b { font-size: 10.5px; line-height: 1.25; }
.bk.tiny span { font-size: 9.5px; }
.bk.short b { flex: 0 1 auto; }
.bk.short span { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk:hover { filter: brightness(1.08); }
.nowline { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid #e8384f; z-index: 2; pointer-events: none; }
.nowline::before { content: ""; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px;
                   border-radius: 50%; background: #e8384f; }

/* ── 모달 ─────────────────────────────────────────────────────────────── */
.backdrop {
  position: fixed; inset: 0; background: rgba(16,24,40,.45);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50;
}
.modal { background: var(--panel); border-radius: 16px; box-shadow: var(--shadow);
         width: 100%; max-width: 420px; padding: 20px; }
.modal h2 { margin: 0 0 4px; font-size: 18px; }
.modal .when { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.modal label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; }
.modal input[type=text], .modal select {
  width: 100%; font: inherit; padding: 9px 11px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.modal .row { display: flex; gap: 10px; }
.modal .row > div { flex: 1 1 0; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.modal .err { color: #d63552; font-size: 13px; margin-top: 12px; min-height: 18px; }
.modal dl { margin: 0; font-size: 14px; }
.modal dt { color: var(--muted); font-size: 12px; margin-top: 10px; }
.modal dd { margin: 2px 0 0; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; padding: 8px 4px 2px; }
.legend i { display: inline-block; width: 13px; height: 13px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
         background: #1b1f24; color: #fff; padding: 10px 16px; border-radius: 10px;
         font-size: 14px; z-index: 60; box-shadow: var(--shadow); }

/* ── 도면 아래 그 날 예약 목록 ─────────────────────────────────────────── */
.daylist { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; }
@media (max-width: 860px) { .daylist { grid-template-columns: repeat(2, 1fr); } }
.daycol { padding: 12px 14px 14px; cursor: pointer; }
.daycol:hover { border-color: var(--accent); }
.daycol h3 { margin: 0 0 8px; font-size: 14px; }
.daycol .empty { margin: 0; color: var(--muted); font-size: 13px; }
.daycol .row { display: flex; gap: 8px; font-size: 13px; padding: 3px 0; border-top: 1px solid var(--line); }
.daycol .row b { flex: 0 0 auto; color: var(--accent); font-variant-numeric: tabular-nums; }
.daycol .row span { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
