* { box-sizing: border-box; }
:root {
  --bg: #f5f6f8; --panel: #fff; --line: #e1e4ea; --text: #1d2330; --muted: #6b7385;
  --brand: #ff5a1f; --brand-weak: #fff1eb; --pick: #2563eb; --hl: #e00000;
}
html, body { margin: 0; height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", sans-serif; color: var(--text); background: var(--bg); font-size: 14px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: #c62828; min-height: 1em; }
a { color: var(--pick); }
kbd { border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; font-size: 11px; background: #fafafa; }

.btn { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 6px 10px; cursor: pointer; font: inherit; color: inherit; white-space: nowrap; }
.btn:hover { background: #f0f2f5; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(0.95); }
.btn.icon { padding: 4px 9px; }
.btn.block { width: 100%; margin-top: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
input, select { font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: #fff; min-width: 0; }
input[type=file] { border: none; padding: 4px 0; width: 100%; }
label { display: block; margin: 6px 0; }
label > select, label > input:not([type=checkbox]):not([type=radio]) { display: block; width: 100%; margin-top: 4px; }
label.check, label.radio { display: flex; align-items: center; gap: 6px; }

.login { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); }
.login-box { background: #fff; padding: 32px; border-radius: 12px; width: 340px; box-shadow: 0 6px 30px rgba(0,0,0,.08); }
.login-box h1 { font-size: 20px; margin: 0 0 16px; }
.login-box button { width: 100%; margin-top: 12px; padding: 10px; }

#app { display: flex; flex-direction: column; height: 100%; }
/* 상단 띠를 아래 화면보다 위에 쌓아 ⋯ 메뉴가 잘리지 않게 한다 */
.top { position: relative; z-index: 60; display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; color: var(--brand); white-space: nowrap; }
.office-tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1; }
.office-tabs button { border: 1px solid transparent; background: none; padding: 6px 12px; border-radius: 6px; cursor: pointer; font: inherit; white-space: nowrap; }
.office-tabs button.on { background: var(--brand-weak); color: var(--brand); font-weight: 700; border-color: #ffd5c4; }
.plan-box, .search, .user { position: relative; display: flex; align-items: center; gap: 4px; }
.search input { width: 220px; }
.menu { position: absolute; top: 100%; left: 0; margin-top: 4px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 30; min-width: 180px; padding: 4px; }
.menu.right { left: auto; right: 0; }
.menu.wide { min-width: 320px; max-height: 60vh; overflow: auto; }
.menu button { display: block; width: 100%; text-align: left; border: none; background: none; padding: 8px 10px; border-radius: 6px; cursor: pointer; font: inherit; }
.menu button:hover { background: #f0f2f5; }
.menu .danger { color: #c62828; }
.result { padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.result:hover { background: #f0f2f5; }
.result .where { font-size: 12px; color: var(--muted); }
.result .here { color: var(--hl); font-weight: 700; }

.body { flex: 1; display: flex; min-height: 0; }
.side { width: 360px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; padding: 10px; border: none; background: none; cursor: pointer; font: inherit; border-bottom: 2px solid transparent; }
.tabs button.on { border-bottom-color: var(--brand); color: var(--brand); font-weight: 700; }
.tab { padding: 12px; overflow: auto; flex: 1; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 10px; }
.seg button { flex: 1; border: none; background: #fff; padding: 8px 4px; cursor: pointer; font: inherit; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--brand); color: #fff; font-weight: 700; }
.seg.small { margin: 0; }
.seg.small button { padding: 5px 10px; font-size: 13px; }
.help { color: var(--muted); font-size: 13px; margin: 4px 0 8px; line-height: 1.5; }
.hint { color: var(--muted); font-size: 13px; }
.box { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin: 10px 0; }
.box summary { cursor: pointer; }
.area { border-top: 1px dashed var(--line); margin-top: 10px; padding-top: 10px; }
.row { display: flex; gap: 6px; align-items: center; margin: 6px 0; }
.row > select, .row > input { flex: 1; }
.actions { display: flex; gap: 6px; margin-top: 12px; }
.actions .btn { flex: 1; }
.msg { margin-top: 10px; padding: 8px 10px; border-radius: 6px; background: #eef5ff; font-size: 13px; line-height: 1.5; white-space: pre-line; }
.msg.error { background: #fdecea; color: #b71c1c; }
.list { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; margin: 6px 0; }
.list .item { padding: 6px 10px; cursor: pointer; display: flex; justify-content: space-between; gap: 6px; border-bottom: 1px solid #f2f3f5; }
.list .item:hover { background: #f7f8fa; }
.list .item.on { background: var(--brand-weak); outline: 2px solid var(--brand); outline-offset: -2px; }
.list .item .sub { color: var(--muted); font-size: 12px; }
#unseatedFilter, #peopleFilter { width: 100%; }
.table-wrap { max-height: 40vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 5px 8px; border-bottom: 1px solid #f0f1f4; text-align: left; }
.table th { position: sticky; top: 0; background: #fafbfc; font-weight: 600; }
.table tr.click { cursor: pointer; }
.table tr.click:hover { background: #f7f8fa; }
.form { display: grid; gap: 6px; margin-top: 8px; }
.org-row { display: flex; gap: 6px; align-items: center; margin: 4px 0; }
.org-row span { flex: 1; font-size: 13px; }
.org-row input { width: 150px; }
.office-row, .user-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid #f2f3f5; }
.office-row .btns, .user-row .btns { display: flex; gap: 4px; }
.office-row .btn, .user-row .btn, .draft .btn { padding: 3px 8px; font-size: 12px; }
.draft { border: 1px solid #ffd5c4; background: #fffaf7; border-radius: 8px; padding: 8px; margin-top: 8px; }
.draft input[type=text] { width: 100%; margin: 4px 0; }
.badge { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 10px; background: #eef0f4; color: var(--muted); }
.badge.admin { background: var(--brand-weak); color: var(--brand); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.map-bar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: #fff; border-bottom: 1px solid var(--line); }
.stats { flex: 1; display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.stats b { color: var(--text); }
.edit-bar { flex: 1; display: flex; align-items: center; gap: 8px; }
.zoom { display: flex; gap: 4px; }
.map-wrap { flex: 1; position: relative; overflow: hidden; background: #fbfbfc; background-image: radial-gradient(#e4e6eb 1px, transparent 1px); background-size: 20px 20px; }
#map { width: 100%; height: 100%; display: block; user-select: none; cursor: grab; }
#map.panning { cursor: grabbing; }
#map.tool-add { cursor: copy; }
.empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px 14px; background: #fff; border-top: 1px solid var(--line); font-size: 12px; max-height: 80px; overflow: auto; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,.15); }

/* 지도 */
.seat rect.body { stroke: #9aa3b2; stroke-width: 1.2; }
.seat.vacant rect.body { fill: #fff; stroke-dasharray: 5 4; }
.seat:hover rect.body { stroke: #333; stroke-width: 2; }
.seat.picked rect.body { stroke: var(--pick); stroke-width: 4; }
.seat.target rect.body { stroke: var(--brand); stroke-width: 3; }
.seat text { pointer-events: none; font-family: inherit; }
.seat .sid { fill: #59606e; }
.seat .nm { font-weight: 700; fill: #111; }
.seat .tm { fill: #3d4452; }
.obj rect { fill: #eceef2; stroke: #cfd4dc; }
.obj text { fill: #6b7385; pointer-events: none; }
.hl-box { fill: none; stroke: var(--hl); stroke-width: 6; animation: hlpulse 1s ease-in-out infinite; pointer-events: none; }
@keyframes hlpulse { 0%, 100% { stroke-opacity: 1; } 50% { stroke-opacity: .35; } }
.sel-rect { fill: rgba(37,99,235,.08); stroke: var(--pick); stroke-dasharray: 6 4; }

.seat-pop { position: fixed; z-index: 1000; display: flex; flex-direction: column; max-height: calc(100vh - 16px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.16); padding: 12px; width: 280px; }
.seat-pop h3 { margin: 0 0 6px; font-size: 15px; }
.seat-pop .who { margin-bottom: 8px; }
.seat-pop input { width: 100%; }
.seat-pop .list { flex: 1 1 auto; min-height: 60px; max-height: 200px; overflow: auto; }
.seat-pop .row { flex: none; }
.seat-pop .row .btn { flex: 1; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1d2330; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 100; max-width: 80vw; white-space: pre-line; }
.toast.error { background: #b71c1c; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid #ccc; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .body { flex-direction: column-reverse; }
  .side { width: 100%; height: 45%; border-right: none; border-top: 1px solid var(--line); }
  .search input { width: 140px; }
  .top { flex-wrap: wrap; }
}

/* 브라우저판: 저장 공간이 막힌 창(미리보기 등) 안내 */
.mem-banner { background: #fff4e5; color: #8a4b00; border-bottom: 1px solid #f3d19e; padding: 8px 16px; font-size: 13px; }
.mem-banner a { margin-left: 8px; color: #c2410c; font-weight: 600; }

/* 섹터(구획) */
.sector-bar { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 8px 0; background: #fafbfc; }
.sector-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.sector-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sector-chip { border: 1px solid var(--c, #868e96); color: var(--c, #495057); background: #fff; border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.sector-chip b { font-weight: 700; }
.sector-chip.on { background: var(--c, #868e96); color: #fff; }
.sector-chip.off { border-style: dashed; color: #868e96; border-color: #adb5bd; }
.sector-bar .btn { margin-top: 6px; width: 100%; }

/* 초기화 버튼 */
.btn.danger { color: #c62828; border-color: #e8b4b4; }
.btn.danger:hover { background: #fdecec; }
.sector-reset { display: flex; gap: 6px; margin-top: 8px; }
.sector-reset select { flex: 1; min-width: 0; }
.sector-reset .btn { width: auto; margin-top: 0; white-space: nowrap; }

/* ───────── 테마: 애플 키노트 ───────── */
:root {
  --bg: #f5f5f7; --panel: #fff; --line: #d2d2d7; --text: #1d1d1f; --muted: #6e6e73;
  --brand: #007aff; --brand-weak: #e8f1ff; --pick: #5856d6; --hl: #ff3b30;
}
html, body { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Apple SD Gothic Neo", "Pretendard", "Helvetica Neue", "Malgun Gothic", sans-serif; letter-spacing: -0.003em; -webkit-font-smoothing: antialiased; }
.btn { border-radius: 8px; border-color: var(--line); background: #fff; transition: background .12s, box-shadow .12s; }
.btn:hover { background: #f5f5f7; }
.btn.primary { background: var(--brand); border-color: var(--brand); }
.btn.primary:hover { background: #0a84ff; filter: none; }
.btn.danger { color: #ff3b30; border-color: #ffd0cd; }
.btn.danger:hover { background: #fff1f0; }
input, select { border-radius: 8px; border-color: var(--line); }
input:focus, select:focus { outline: 2px solid rgba(0,122,255,.35); outline-offset: 0; border-color: var(--brand); }
.top { background: rgba(255,255,255,.82); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid rgba(0,0,0,.08); }
.brand { color: var(--text); font-weight: 700; }
.office-tabs button { border-radius: 999px; }
.office-tabs button.on { background: var(--brand-weak); color: var(--brand); border-color: #cfe2ff; }
.side { background: #fbfbfd; border-right: 1px solid rgba(0,0,0,.08); }
.seg { border-radius: 10px; background: #e9e9ee; border: none; padding: 2px; gap: 2px; }
.seg button { background: transparent; border-radius: 8px; }
.seg button + button { border-left: none; }
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.18); font-weight: 600; }
.tabs button.on { border-bottom-color: var(--brand); color: var(--brand); }
.box, .sector-bar { border-radius: 12px; border-color: rgba(0,0,0,.08); background: #fff; }
.list .item.on { background: var(--brand-weak); outline-color: var(--brand); }
.badge.admin { background: var(--brand-weak); color: var(--brand); }
.map-wrap { background-color: #fbfbfd; background-image: radial-gradient(#e5e5ea 1px, transparent 1px); }
.seat rect.body { fill: var(--fill, #fff); stroke: var(--stroke, #8e8e93); stroke-width: 1.6; }
.seat.vacant rect.body { fill: var(--fill, #fff); stroke-dasharray: 6 4; stroke-opacity: .75; }
.seat:hover rect.body { stroke-width: 3; filter: brightness(.97); }
.seat.picked rect.body { stroke: var(--pick); stroke-width: 5; }
.seat .sid { fill: #6e6e73; }
.seat .nm { fill: #1d1d1f; font-weight: 600; }
.seat .tm { fill: #48484a; }
.seat.vacant .nm { fill: #8e8e93; }
.obj rect { fill: #f2f2f7; stroke: #d1d1d6; }
.obj text { fill: #8e8e93; }
.sector-chip { background: #fff; }
.sector-chip.on { color: #fff; }
.legend { background: rgba(255,255,255,.9); }
.seat-pop { border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.22); border: 1px solid rgba(0,0,0,.08); }
.mem-banner { background: #fff8e5; color: #8a5a00; border-bottom: 1px solid #ffe2a1; }
.mem-banner a { color: #007aff; }
.login-box { border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.12); }
.sel-rect { fill: rgba(88,86,214,.08); stroke: var(--pick); }

/* 공지 버튼·대화상자 */
.notice-btn { background: var(--brand-weak); color: var(--brand); border-color: #cfe2ff; font-weight: 600; }
.notice-btn:hover { background: #dbe9ff; }
.modal { position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,.32); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; }
.modal-card { background: #fff; border-radius: 18px; padding: 24px 26px; width: min(480px, 100%); box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.modal-card h2 { margin: 0 0 8px; font-size: 19px; letter-spacing: -0.02em; }
.modal-card p { margin: 6px 0; line-height: 1.5; }
.modal-url input { width: 100%; margin-top: 6px; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1; }

.menu .menu-link { display: block; padding: 8px 12px; color: inherit; text-decoration: none; font-size: 13px; }
.menu .menu-link:hover { background: #f5f5f7; }

/* 저장 확인 띠(브라우저판): 바꾼 내용이 있을 때만 아래쪽에 작게 뜬다 */
.save-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 90; display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 16px; background: rgba(29,29,31,.92); color: #fff; border-radius: 999px; box-shadow: 0 8px 28px rgba(0,0,0,.28); font-size: 13px; backdrop-filter: blur(12px); }
.save-bar.hidden { display: none; }
.save-bar .btn { padding: 4px 12px; border-radius: 999px; font-size: 12px; }
/* 「취소」 — 공통 .btn 은 흰 바탕인데 띠 글자색이 흰색이라 글자가 안 보였다(2026-11-03 마틴님 "취소가 흰배경에 글씨도 비슷한색이라 안보여"). 어두운 띠 위에서 반투명 흰 바탕 + 흰 글자로 */
.save-bar .btn:not(.primary) { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.55); color: #fff; font-weight: 600; }
.save-bar .btn:not(.primary):hover { background: rgba(255,255,255,.3); }

/* 좌석 끌어 옮기기·맞바꾸기 */
.seat-dragging, .seat-dragging .seat { cursor: grabbing; }
.drag-ghost { position: fixed; z-index: 95; pointer-events: none; padding: 4px 10px; background: rgba(0,122,255,.92); color: #fff; border-radius: 8px; font-size: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.drag-ghost.swap { background: rgba(255,149,0,.95); }
.drag-ghost.swap::after { content: ' ⇄ 맞바꿈'; }
.seat.drop-target rect.body { stroke: #007AFF !important; stroke-width: 4 !important; stroke-dasharray: none !important; }

