:root {
  --bg: #f3f0eb;
  --surface: #ffffff;
  --surface-2: #f7f5f1;
  --text: #1b2230;
  --muted: #6b7280;
  --line: #e7e3dc;
  --accent: #1f3fae;
  --accent-soft: #e8edfb;
  --ok: #16a34a;
  --ok-soft: #e6f6ec;
  --meet: #ea8a0c;
  --meet-soft: #fdf1e1;
  --rest: #8a94a6;
  --rest-soft: #eef0f3;
  --shadow: 0 1px 2px rgba(30, 30, 20, .04), 0 6px 20px rgba(30, 30, 20, .05);
  --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: Pretendard, system-ui, "Malgun Gothic", sans-serif;
  -webkit-font-smoothing: antialiased; font-size: 14px;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 10px 20px; background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(8px);
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2a55d8, #5b8def); color: #fff; font-weight: 800; font-size: 14px;
}
.logo b { display: block; font-size: 15px; letter-spacing: .01em; }
.logo small { color: var(--muted); font-size: 11px; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; }
.tab {
  border: none; background: transparent; padding: 8px 18px; border-radius: 10px;
  display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600;
}
.tab.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent);
  color: #fff; font-size: 11px; display: inline-grid; place-items: center;
}
.badge:empty { display: none; }
.top-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.pill {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 7px 14px; font-size: 13px; display: inline-flex; gap: 6px; align-items: center;
}
.pill.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.clock { font-variant-numeric: tabular-nums; }

main { max-width: 1520px; margin: 0 auto; padding: 20px; }
.view[hidden] { display: none !important; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- monitor ---------- */
.monitor { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.mon-main { display: grid; gap: 16px; }
.hero {
  padding: 24px 28px; border-left: 5px solid var(--accent);
  background: linear-gradient(100deg, #fff 55%, #eef1fd);
}
.hero .kicker { color: var(--accent); font-size: 13px; font-weight: 700; }
.hero h2 { margin: 6px 0 6px; font-size: 22px; }
.hero p { margin: 0; color: var(--muted); }
.hero p b { color: var(--text); }
.hero-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.btn { border: 1px solid var(--line); background: var(--surface); padding: 10px 16px; border-radius: 12px; font-weight: 600; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; padding: 12px 20px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 14px 16px; }
.stat small { color: var(--muted); font-size: 12px; }
.stat b { display: block; font-size: 22px; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.stat b span { font-size: 14px; color: var(--muted); font-weight: 500; }
.stat p { margin: 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.section { padding: 18px 20px 20px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.section-head h3 { margin: 0; font-size: 16px; }
.section-head h3 small { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 4px; }
.section-head .count { color: var(--muted); font-size: 12px; }
.teams { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.team {
  border: 1px solid var(--line); border-top: 4px solid var(--c); border-radius: 16px; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.team-head { display: flex; gap: 10px; align-items: center; }
.floor-badge { background: var(--c); color: #fff; font-weight: 800; border-radius: 8px; padding: 4px 8px; font-size: 13px; }
.team-head b { display: block; font-size: 16px; }
.team-head small { color: var(--muted); font-size: 12px; }
.chip { margin-left: auto; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.chip.work { background: var(--ok-soft); color: var(--ok); }
.chip.meet { background: var(--meet-soft); color: var(--meet); }
.chip.rest { background: var(--rest-soft); color: var(--rest); }
.team .now { margin: 0; font-size: 14px; line-height: 1.5; min-height: 42px; }
.member { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--c); color: #fff;
  display: grid; place-items: center; font-size: 11px; font-weight: 800; flex: none;
}
.avatar.lg { width: 44px; height: 44px; font-size: 13px; }
.member b { font-size: 14px; }
.member span { color: var(--muted); font-size: 12px; }
.prog { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.bar { flex: 1; height: 6px; background: #ece8e1; border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: inherit; transition: width .8s; }
.done-list { margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--muted); display: grid; gap: 4px; }
.done-list li::before { content: "✓ "; color: var(--ok); font-weight: 700; }
.next { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.dday { background: var(--c, var(--accent)); color: #fff; border-radius: 6px; padding: 2px 7px; font-weight: 800; font-size: 11px; }
.team .go { font-size: 13px; font-weight: 600; border: none; background: none; padding: 0; color: var(--accent); text-align: left; }

.side { display: grid; gap: 16px; }
.sched-day { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; margin: 14px 0 6px; }
.sched-day:first-of-type { margin-top: 0; }
.sched-day span { color: var(--muted); font-weight: 500; }
.sched {
  display: flex; gap: 14px; padding: 10px 12px; border: 1px solid var(--line); border-left: 4px solid var(--c);
  border-radius: 12px; background: var(--surface);
}
.sched.today { background: #ecf8f1; }
.sched time { font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; }
.sched time small { display: block; color: var(--muted); font-weight: 500; font-size: 11px; }
.sched b { display: block; font-size: 13px; }
.sched span { color: var(--muted); font-size: 12px; }
.sample-note { color: var(--muted); font-size: 11px; margin: 12px 0 0; }
.people { display: grid; gap: 8px; }
.person-row {
  display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--surface); text-align: left; width: 100%;
}
.person-row .meta { min-width: 0; flex: 1; }
.person-row .meta div { display: flex; align-items: center; gap: 8px; }
.person-row .meta p { margin: 2px 0 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.where { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.where.work { background: var(--ok-soft); color: var(--ok); }
.where.meet { background: var(--meet-soft); color: var(--meet); }
.where.rest { background: var(--rest-soft); color: var(--rest); }

/* ---------- office tower ---------- */
.office { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.tower {
  position: relative; border-radius: 22px; overflow: hidden; height: calc(100vh - 130px); min-height: 620px;
  background: linear-gradient(#0b1430, #1b3263); color: #fff;
}
.tower svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.tower-ui { position: absolute; left: 14px; right: 14px; top: 14px; z-index: 2; display: grid; gap: 8px; pointer-events: none; }
.tower-ui > * { pointer-events: auto; }
.floor-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.fchip {
  border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .92); color: var(--text);
  border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 6px;
}
.fchip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.fchip.on { background: #1b2230; color: #fff; }
.ticker {
  background: rgba(255, 255, 255, .92); color: var(--text); border-radius: 999px; padding: 6px 14px; font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 640px;
}
.ticker b { margin-right: 8px; }
.tower svg[hidden] { display: none; }
.tower.inside { background: radial-gradient(circle at 50% 55%, #141e38, #05080f 70%); }
.tower.inside .floor-card { right: auto; left: 14px; }
.fav { transition: transform 2.2s ease-in-out, opacity .6s; }
.fav[opacity="0"] { opacity: 0; }
.fav .bob { animation: bob 2.4s ease-in-out infinite; }
.floor-label { cursor: pointer; }
.floor-label rect { transition: fill .2s; }
.floor-label:hover rect { fill: #2a3550; }
.floor { transition: opacity .4s; }
.tower.focus .floor:not(.sel) { opacity: .22; }
.av { transition: transform 2.2s ease-in-out; }
.av .ring { transition: stroke .3s; }
.av .bob { animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-1.5px); } }
.win-lit { animation: flick 6s infinite; }
@keyframes flick { 50% { opacity: .55; } }
.floor-card {
  position: absolute; right: 14px; bottom: 14px; z-index: 2; width: 300px; max-width: calc(100% - 28px);
  background: rgba(255, 255, 255, .96); color: var(--text); border-radius: 16px; padding: 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
.floor-card[hidden] { display: none; }
.floor-card .x { position: absolute; right: 10px; top: 10px; border: none; background: var(--surface-2); width: 28px; height: 28px; border-radius: 50%; }
.floor-card h4 { margin: 0 0 10px; display: flex; gap: 8px; align-items: center; }
.floor-card p { margin: 8px 0; font-size: 13px; }
.floor-card .label { font-size: 11px; color: var(--muted); font-weight: 700; margin-top: 12px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); padding: 8px 6px 0; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }

/* chat */
.chat { display: flex; flex-direction: column; height: calc(100vh - 130px); min-height: 620px; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.chat-head b { display: block; font-size: 15px; }
.chat-head small { color: var(--muted); font-size: 12px; }
.chat-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.chat-tabs button { border: none; background: none; padding: 10px; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; }
.chat-tabs button.on { color: var(--text); font-weight: 700; border-color: #f2b400; }
.chat-body { flex: 1; overflow-y: auto; background: #b9cde0; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-body.plain { background: var(--surface); }
.msg { display: flex; gap: 8px; max-width: 88%; align-items: flex-start; }
.msg .avatar { width: 30px; height: 30px; font-size: 10px; }
.msg .who { font-size: 11px; margin-bottom: 3px; color: #2a3445; }
.msg .txt { background: #fff; border-radius: 4px 14px 14px 14px; padding: 8px 11px; font-size: 13px; line-height: 1.45; }
.msg time { font-size: 10px; color: #4b5563; align-self: flex-end; white-space: nowrap; }
.msg .col { display: flex; flex-direction: column; }
.msg .row { display: flex; gap: 6px; align-items: flex-end; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg.me .txt { background: #fee500; border-radius: 14px 4px 14px 14px; }
.msg.sys { align-self: center; max-width: 100%; }
.msg.sys .txt { background: rgba(0, 0, 0, .12); color: #1f2937; font-size: 11px; border-radius: 999px; padding: 4px 12px; }
.chat-foot { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.chat-foot input { flex: 1; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font: inherit; background: var(--surface-2); }
.chat-foot button { border: none; background: #fee500; border-radius: 12px; padding: 0 14px; font-weight: 700; }
.chat-note { color: var(--muted); font-size: 11px; padding: 0 12px 10px; }
.file { display: flex; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; text-align: left; background: var(--surface); width: 100%; }
.file b { display: block; font-size: 13px; }
.file span { color: var(--muted); font-size: 11px; }
.qa { border-radius: 12px; padding: 10px 12px; font-size: 13px; line-height: 1.55; white-space: pre-line; }
.qa.q { background: var(--accent-soft); align-self: flex-end; max-width: 85%; }
.qa.a { background: var(--surface-2); border: 1px solid var(--line); }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; }
.suggest button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 10px; font-size: 12px; }

/* ---------- reports ---------- */
.reports { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 20px; align-items: start; }
.rep-list { display: grid; gap: 8px; }
.rep {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 14px; padding: 12px 14px; text-align: left; width: 100%;
}
.rep.on { border-color: var(--accent); background: var(--accent-soft); }
.rep b { display: block; font-size: 14px; line-height: 1.45; }
.rep span { color: var(--muted); font-size: 12px; }
.rep .new { color: var(--accent); font-weight: 800; font-size: 11px; margin-left: 6px; }
.viewer { padding: 22px 26px; min-height: 360px; }
.viewer .empty { color: var(--muted); margin: 0; }
.viewer h2 { margin: 0 0 6px; font-size: 20px; }
.viewer .meta { color: var(--muted); font-size: 13px; margin-bottom: 20px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.viewer h4 { margin: 20px 0 8px; font-size: 14px; color: var(--accent); }
.viewer ul { margin: 0; padding-left: 20px; line-height: 1.8; }
.viewer .files { display: flex; gap: 8px; flex-wrap: wrap; }
.viewer .files span { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12px; background: var(--surface-2); }

dialog { border: none; border-radius: 18px; padding: 0; width: min(440px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
dialog::backdrop { background: rgba(20, 20, 30, .4); }
.dlg { padding: 20px; }
.dlg .x { float: right; border: none; background: var(--surface-2); width: 30px; height: 30px; border-radius: 50%; }
.dlg h4 { font-size: 12px; color: var(--muted); margin: 16px 0 6px; }
.dlg ul { margin: 0; padding-left: 18px; line-height: 1.7; }

@media (max-width: 1100px) {
  .monitor, .office, .reports { grid-template-columns: 1fr; }
  .tower { height: 70vh; min-height: 520px; }
  .chat { height: 560px; min-height: 0; }
}
@media (max-width: 720px) {
  main { padding: 16px; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .top-right { margin-left: 0; width: 100%; }
  .tabs { width: 100%; }
  .tab { flex: 1; justify-content: center; padding: 8px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .teams { grid-template-columns: 1fr; }
  .hero { padding: 20px; }
  .ticker { display: none; }
  .floor-card { padding: 12px; }
  .floor-card .label, .floor-card .done-list { display: none; }
}
