:root {
  --ink: #1f2328; --muted: #6b7280; --line: #e3e5e8; --bg: #f6f7f9; --card: #fff;
  --head: #3a3a3a; --busy: #a3a3a3; --sat: #4aa8ff; --sun: #ff6b6b;
  --accent: #2f7d5b; --accent-soft: #dff3e8; --danger: #c0392b;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif; color: var(--ink); background: var(--bg); line-height: 1.5; }
#app { max-width: 1100px; margin: 0 auto; padding: 16px 12px 110px; }
h1 { font-size: 1.35rem; margin: 8px 0 12px; }
h2 { font-size: 1.1rem; margin: 22px 0 8px; }
.intro { white-space: pre-wrap; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.muted { color: var(--muted); font-size: .9rem; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; margin: 6px 0 12px; align-items: center; }
.legend i { display: inline-block; width: 14px; height: 14px; border: 1px solid var(--line); vertical-align: -2px; margin-right: 4px; border-radius: 3px; }

/* 시간표 */
.week { overflow-x: auto; margin-bottom: 18px; border-radius: 8px; border: 1px solid #222; background: #fff; -webkit-overflow-scrolling: touch; }
table.grid { border-collapse: collapse; width: 100%; min-width: 520px; table-layout: fixed; }
.grid th, .grid td { border: 1px dotted #bbb; padding: 0; text-align: center; font-size: .8rem; height: 34px; }
.grid thead th { background: var(--head); color: #fff; font-weight: 700; height: 26px; border: 1px solid #222; }
.grid th.sat { color: var(--sat); } .grid th.sun { color: var(--sun); }
.grid th.hour { position: sticky; left: 0; z-index: 1; width: 92px; background: #fff; color: var(--ink); font-weight: 400; text-align: left; padding-left: 8px; border: 1px dotted #bbb; }
.grid thead th.corner { background: var(--head); left: 0; z-index: 2; }
.cell { width: 100%; height: 100%; min-height: 34px; border: 0; background: transparent; font: inherit; cursor: pointer; padding: 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell:hover:not(:disabled) { background: #eef6f1; }
.cell:disabled { cursor: default; }
.cell.busy { background: var(--busy); }
.cell.off { background: #f0f0f0; }
.cell.sel { background: var(--accent); color: #fff; font-weight: 700; }
.cell.block { background: #555; color: #fff; font-size: .7rem; }
.cell.recur { background: repeating-linear-gradient(45deg, #777, #777 5px, #999 5px, #999 10px); color: #fff; font-size: .7rem; }
.cell.book { color: #fff; font-size: .72rem; font-weight: 700; cursor: pointer; }
.cell.adm-sel { outline: 3px solid #f59e0b; outline-offset: -3px; }

/* 하단 바 */
.bar { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 10px 14px; display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; box-shadow: 0 -4px 16px rgba(0,0,0,.06); z-index: 5; }
.bar .txt { flex: 1 1 220px; max-width: 640px; font-size: .92rem; }

button.btn, .btn { font: inherit; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 14px; cursor: pointer; color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn.danger { color: var(--danger); border-color: #e5b4ae; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.small { padding: 4px 10px; font-size: .85rem; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

dialog { border: 0; border-radius: 14px; padding: 20px; width: min(440px, 92vw); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog h3 { margin: 0 0 10px; }
label { display: block; font-size: .88rem; margin: 10px 0 4px; font-weight: 600; }
input, select, textarea { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid #ccd0d5; border-radius: 8px; background: #fff; }
textarea { min-height: 90px; resize: vertical; }
.row { display: flex; gap: 8px; } .row > * { flex: 1; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.err { color: var(--danger); font-size: .88rem; margin-top: 8px; min-height: 1.2em; }
.ok-box { background: var(--accent-soft); border-radius: 10px; padding: 12px; margin: 8px 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.tabs { display: flex; gap: 6px; margin: 10px 0 14px; flex-wrap: wrap; }
.tab { padding: 7px 14px; border-radius: 20px; border: 1px solid var(--line); background: #fff; cursor: pointer; font: inherit; }
.tab.on { background: var(--ink); color: #fff; border-color: var(--ink); }
table.list { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; font-size: .9rem; }
.list th, .list td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.list th { background: #fafafa; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; color: #fff; font-size: .78rem; }
.toast { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); background: #222; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 20; font-size: .9rem; }
.grid th.hour { white-space: nowrap; }
@media (max-width: 600px) {
  .grid th.hour { width: 68px; font-size: .72rem; padding-left: 4px; }
  table.grid { min-width: 480px; }
}
.cell.cal { background: #5b7a99; color: #fff; font-size: .7rem; cursor: pointer; }
details.card summary { cursor: pointer; }
