:root {
  color-scheme: light;
  font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #152238;
  --muted: #68778e;
  --line: #e3e9f0;
  --paper: #ffffff;
  --canvas: #f3f6fa;
  --nav: #0c1424;
  --nav2: #142238;
  --teal: #0fa68f;
  --teal-soft: #e6f8f4;
  --blue: #3175d8;
  --blue-soft: #eaf2ff;
  --amber: #b76d09;
  --amber-soft: #fff5df;
  --red: #c65058;
  --red-soft: #fff0f0;
  --shadow: 0 8px 32px rgba(20, 42, 70, 0.055);
}
:root[data-preview-theme="2"] { --canvas: #f4f4f0; --nav: #202b33; --nav2: #34424a; --teal: #437f75; --teal-soft: #e9f2ec; }
:root[data-preview-theme="3"] { --canvas: #eef2fa; --nav: #090d24; --nav2: #1a2350; --teal: #20bba4; --teal-soft: #e4f9f6; --blue: #6e61d9; --blue-soft: #f0edff; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-size: 14px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #9bdad0; outline-offset: 2px; }
button:disabled { opacity: .5; cursor: not-allowed; }
a { color: inherit; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 258px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 26px 16px 18px; background: var(--nav); color: #dce7f4; z-index: 10; }
.brand { display: flex; align-items: center; gap: 12px; margin: 0 11px 30px; }
.brand-mark { height: 37px; width: 37px; border-radius: 12px; background: linear-gradient(135deg, #24d9b9, #1674be); color: #06272c; display: grid; place-items: center; font-size: 21px; font-weight: 900; box-shadow: 0 7px 18px #0d857b55; }
.brand b { display: block; color: #fff; letter-spacing: .025em; font-size: 17px; }
.brand small { color: #9aaac0; font-size: 10px; font-weight: 700; letter-spacing: .13em; }
.mode-box { padding: 5px; background: #1b2a40; border: 1px solid #2b3c55; display: grid; grid-template-columns: 1fr 1fr; border-radius: 12px; margin: 0 8px 28px; }
.mode-box button { background: transparent; border: 0; border-radius: 8px; color: #aebdd0; padding: 10px 5px; font-weight: 700; white-space: nowrap; }
.mode-box button.active { color: #092a2f; background: #72e3cf; box-shadow: 0 2px 8px #06132199; }
.nav-caption { color: #788da9; font-size: 10px; letter-spacing: .15em; font-weight: 800; padding: 0 19px; margin: 0 0 9px; }
.nav-list { display: grid; gap: 3px; }
.nav-item { width: 100%; text-align: left; display: flex; gap: 12px; align-items: center; padding: 12px 15px; background: transparent; color: #acbbcf; border: 1px solid transparent; border-radius: 10px; font-weight: 650; }
.nav-item:hover { background: #1b2a40; color: #fff; }
.nav-item.active { background: #20394a; border-color: #2b665f; color: #82ebd5; }
.nav-icon { width: 19px; text-align: center; font-size: 17px; font-weight: 400; }
.side-footer { margin-top: auto; padding: 16px 12px 4px; border-top: 1px solid #25344b; }
.side-footer .mono { color: #8aa3b5; display: block; margin-bottom: 8px; }
.side-footer p { font-size: 11px; line-height: 1.5; margin: 0; color: #8192a9; }
.workspace { min-width: 0; }
.topbar { height: 70px; display: flex; justify-content: space-between; align-items: center; padding: 0 32px; background: #fff; border-bottom: 1px solid var(--line); }
.crumb { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; font-weight: 650; }
.crumb strong { color: var(--ink); }
.top-actions { display: flex; gap: 9px; align-items: center; }
.top-actions .avatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: #dceae7; color: #187e73; font-weight: 900; margin-left: 5px; }
.content { max-width: 1480px; margin: auto; padding: 28px 32px 56px; }
.page-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-heading h1 { margin: 3px 0 7px; font-size: clamp(24px, 3vw, 31px); letter-spacing: -.045em; }
.page-heading p { color: var(--muted); margin: 0; line-height: 1.6; }
.eyebrow { font-size: 11px; color: var(--teal); font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.heading-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.notice { display: flex; align-items: start; gap: 11px; padding: 12px 15px; background: #fff9e9; color: #765719; border: 1px solid #f3e2b4; border-radius: 11px; line-height: 1.5; margin: 0 0 20px; }
.notice strong { color: #76500c; }
.notice svg { flex: none; margin-top: 1px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); min-width: 0; }
.card.pad { padding: 21px; }
.card.pad-lg { padding: 25px; }
.card + .card { margin-top: 0; }
.section { margin-top: 22px; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 14px; }
.section-title h2 { margin: 0; font-size: 18px; letter-spacing: -.035em; }
.section-title p { color: var(--muted); margin: 4px 0 0; font-size: 12px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card { padding: 20px; }
.stat-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; font-weight: 750; }
.stat-icon { display: grid; place-items: center; width: 30px; height: 30px; background: #eef4f9; border-radius: 9px; color: #47678d; font-size: 17px; }
.stat-card b { display: block; font-size: 28px; margin: 11px 0 5px; letter-spacing: -.04em; }
.stat-card small { color: var(--muted); line-height: 1.4; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .85fr); gap: 16px; }
.stack { display: grid; gap: 15px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.space-between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.strong { font-weight: 800; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border: 1px solid transparent; border-radius: 7px; font-size: 11px; font-weight: 800; white-space: nowrap; line-height: 1.1; }
.badge.teal { background: var(--teal-soft); color: #12816f; border-color: #c7eee5; }
.badge.blue { background: var(--blue-soft); color: #3769ae; border-color: #dbe9ff; }
.badge.amber { background: var(--amber-soft); color: var(--amber); border-color: #f9e9bb; }
.badge.red { background: var(--red-soft); color: var(--red); border-color: #ffd9dc; }
.badge.gray { background: #edf1f5; color: #65758c; border-color: #e1e7ed; }
.badge.dark { background: #1e3046; color: #d8e7ef; border-color: #2b3d53; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 9px; border: 1px solid #d9e2eb; background: #fff; color: #263950; padding: 9px 13px; font-size: 12px; font-weight: 800; white-space: nowrap; transition: .15s ease; }
.btn:hover { border-color: #98b3c9; background: #f8fbfd; transform: translateY(-1px); }
.btn.primary { border-color: #108f7c; background: #109c87; color: #fff; }
.btn.primary:hover { background: #0b8877; }
.btn.dark { background: #1b3048; color: #fff; border-color: #1b3048; }
.btn.danger { color: var(--red); border-color: #f1c9cb; }
.btn.sm { padding: 6px 9px; font-size: 11px; border-radius: 7px; }
.text-btn { background: none; border: 0; color: #0c8c7b; padding: 3px 0; font-size: 12px; font-weight: 850; }
.text-btn:hover { text-decoration: underline; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 9px; flex-wrap: wrap; margin-bottom: 15px; }
.toolbar-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.input, .select { background: #fff; color: var(--ink); border: 1px solid #d8e1eb; border-radius: 9px; padding: 9px 10px; min-height: 36px; min-width: 0; }
.input::placeholder { color: #9aa8ba; }
.search { width: min(265px, 100%); }
.select { padding-right: 28px; }
.segmented { display: inline-flex; gap: 3px; padding: 3px; border-radius: 9px; background: #eaf0f4; }
.segmented button { border: 0; background: transparent; color: #64768b; border-radius: 7px; padding: 7px 10px; font-size: 11px; font-weight: 850; }
.segmented button.active { color: var(--ink); background: #fff; box-shadow: 0 1px 5px #20324918; }
.table-wrap { overflow-x: auto; }
.data-table { border-collapse: collapse; width: 100%; min-width: 660px; }
.data-table th { color: #8190a3; font-size: 11px; font-weight: 850; text-align: left; padding: 12px 12px; border-bottom: 1px solid var(--line); background: #f9fbfd; white-space: nowrap; }
.data-table td { border-bottom: 1px solid #edf1f4; padding: 13px 12px; font-size: 12px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr[data-action] { cursor: pointer; }
.data-table tbody tr[data-action]:hover { background: #f7fcfb; }
.table-footer { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 13px; margin-top: 3px; color: var(--muted); font-size: 12px; }
.empty { padding: 35px 12px; text-align: center; color: var(--muted); }
.flow { display: flex; gap: 7px; align-items: stretch; flex-wrap: wrap; }
.flow-step { flex: 1 1 115px; padding: 12px; background: #f7fafc; border: 1px solid #e6edf2; border-radius: 11px; min-width: 110px; }
.flow-step.active { background: #e8f9f5; border-color: #bceade; }
.flow-step b { display: block; margin: 4px 0 5px; font-size: 13px; }
.flow-step small { color: var(--muted); display: block; line-height: 1.4; }
.flow-step .num { color: #0e9985; font-size: 11px; font-weight: 900; }
.rounds { display: flex; gap: 5px; flex-wrap: wrap; margin: 15px 0; }
.round { height: 28px; min-width: 28px; padding: 0 7px; display: grid; place-items: center; border-radius: 8px; font-size: 12px; font-weight: 900; }
.round.P { background: #dceeff; color: #1c6ab4; }
.round.B { background: #ffe2e4; color: #bd434c; }
.round.T { background: #e5f8e8; color: #278752; }
.round.sep { background: transparent; color: #a2adba; padding: 0 2px; min-width: 11px; }
.status-line { display: flex; align-items: center; gap: 9px; padding: 11px 0; border-bottom: 1px solid #edf1f4; }
.status-line:last-child { border-bottom: 0; }
.status-line > div { flex: 1; min-width: 0; }
.status-line b { display: block; font-size: 12px; }
.status-line small { color: var(--muted); display: block; margin-top: 3px; }
.bar { height: 6px; background: #edf1f4; border-radius: 9px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: #18ac96; }
.chip-row { display: flex; gap: 7px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 7px 10px; background: #f3f7fa; color: #40556f; border-radius: 8px; font-size: 11px; font-weight: 750; }
.callout { padding: 13px 15px; border-radius: 10px; background: #f0f6fc; border: 1px solid #dce8f4; color: #49627e; font-size: 12px; line-height: 1.6; }
.callout.amber { background: #fff8e9; border-color: #f1dfb4; color: #806023; }
.callout.red { background: #fff1f2; border-color: #f3d8dc; color: #a23b4e; }
.callout.teal { background: #edfaf7; border-color: #c5e9e1; color: #217469; }

.strategy-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.strategy-card { text-align: left; padding: 18px; min-height: 165px; border: 1px solid var(--line); background: #fff; border-radius: 13px; transition: .15s ease; }
.strategy-card:hover, .select-card:hover { border-color: #7ecfc1; box-shadow: 0 8px 20px #0a897518; transform: translateY(-2px); }
.strategy-card h3 { font-size: 18px; margin: 12px 0 8px; }
.strategy-card p { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 0; }
.strategy-card .row { justify-content: space-between; }
.select-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.select-card { text-align: left; padding: 13px; background: #fff; border: 1px solid var(--line); border-radius: 11px; transition: .15s ease; }
.select-card.selected { background: #edf9f5; border-color: #5ac7b2; box-shadow: inset 0 0 0 1px #5ac7b2; }
.select-card b { display: block; font-size: 12px; margin-bottom: 6px; }
.select-card small { display: block; color: var(--muted); font-size: 11px; line-height: 1.35; }
.select-card .check { color: #0e9884; font-weight: 900; float: right; }
.settings-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .75fr); gap: 16px; align-items: start; }
.settings-section + .settings-section { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.settings-section h3 { margin: 0 0 5px; font-size: 15px; }
.settings-section > p { margin: 0 0 14px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field-grid label { display: grid; gap: 6px; color: #41546b; font-size: 12px; font-weight: 800; }
.toggle-line { padding: 11px 0; border-top: 1px solid #eef2f5; display: flex; gap: 13px; align-items: center; justify-content: space-between; }
.toggle-line:first-child { border-top: 0; }
.toggle-line b { display: block; font-size: 12px; }
.toggle-line small { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; line-height: 1.45; }
.switch { width: 39px; height: 22px; flex: none; border: 0; border-radius: 20px; background: #c8d1dd; padding: 3px; transition: .2s ease; }
.switch:after { content: ""; display: block; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #32415455; transition: .2s ease; }
.switch.on { background: #0fa68f; }
.switch.on:after { transform: translateX(17px); }
.rooms-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; max-height: 290px; overflow: auto; padding: 3px; }
.room-check { display: flex; align-items: center; gap: 7px; padding: 7px 8px; border-radius: 7px; font-size: 11px; color: #394d62; }
.room-check:hover { background: #f4f9f8; }
.room-check input { accent-color: var(--teal); }
.ladder-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.ladder-grid label { font-size: 10px; color: var(--muted); display: grid; gap: 4px; }
.ladder-grid input { width: 100%; font-size: 11px; padding: 8px 5px; }
.sticky-card { position: sticky; top: 16px; }
.settings-summary { display: grid; gap: 11px; }
.settings-summary .line { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid #edf1f4; padding-bottom: 10px; font-size: 12px; }
.settings-summary .line:last-child { border-bottom: 0; padding-bottom: 0; }

.calendar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.calendar-head strong { font-size: 17px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-weekday { text-align: center; color: #91a0b0; font-size: 10px; font-weight: 800; padding: 8px 0; }
.cal-day { min-height: 80px; text-align: left; background: #fff; border: 1px solid #e8edf2; border-radius: 9px; padding: 9px; color: #40566d; }
.cal-day:hover { border-color: #63c8b4; background: #f8fffd; }
.cal-day.selected { border-color: #21ae99; background: #ebfaf6; }
.cal-day.blank { background: transparent; border-color: transparent; cursor: default; }
.cal-day b { display: block; font-size: 12px; }
.cal-day small { display: block; color: var(--muted); font-size: 10px; line-height: 1.35; margin-top: 8px; }
.cal-day.has-data small { color: #078c78; font-weight: 800; }
.mini-bars { height: 125px; display: flex; align-items: flex-end; gap: 8px; border-bottom: 1px solid var(--line); padding: 0 5px 5px; }
.mini-bars > span { flex: 1; min-width: 10px; border-radius: 5px 5px 0 0; background: #60cbbb; }
.mini-bars > span.negative { background: #e9a4aa; }
.key-value { display: grid; grid-template-columns: 115px minmax(0, 1fr); gap: 10px 12px; font-size: 12px; }
.key-value dt { color: var(--muted); }
.key-value dd { margin: 0; font-weight: 750; overflow-wrap: anywhere; }
.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li { position: relative; padding: 0 0 20px 24px; border-left: 1px solid #d7e3ec; margin-left: 6px; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 2px; }
.timeline li:before { content: ""; position: absolute; left: -5px; top: 2px; width: 9px; height: 9px; border-radius: 50%; background: #2cae9a; box-shadow: 0 0 0 3px #e2f7f2; }
.timeline b { display: block; font-size: 12px; }
.timeline small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.timeline .time { color: #0c9884; font-size: 10px; font-weight: 900; margin-right: 5px; }
.telegram-tabs { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.telegram-tabs button { background: #f0f4f7; color: #52677d; border: 1px solid transparent; border-radius: 9px; padding: 9px 13px; font-size: 12px; font-weight: 800; }
.telegram-tabs button.active { color: #0a796a; background: #e6f8f4; border-color: #bceade; }
.telegram-preview { min-height: 205px; background: #0e1927; border: 1px solid #1b2c3f; border-radius: 15px; padding: 20px; display: flex; align-items: flex-start; }
.tg-bubble { max-width: 330px; background: #1b2e40; color: #f5fafc; padding: 12px 15px; border-radius: 14px 14px 14px 4px; box-shadow: 0 4px 18px #06101c4d; }
.tg-bubble pre { margin: 0; font: 12px/1.5 "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif; white-space: pre-wrap; overflow-wrap: anywhere; }
.tg-bubble small { display: block; margin-top: 9px; color: #9cb1c4; font-size: 10px; }
.tg-textarea { display: block; width: 100%; min-height: 170px; resize: vertical; margin-top: 7px; line-height: 1.5; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 50; background: #07142288; display: flex; justify-content: flex-end; }
.drawer { width: min(520px, 100vw); height: 100%; overflow-y: auto; background: #fff; box-shadow: -10px 0 40px #08182933; animation: slide-in .2s ease; }
@keyframes slide-in { from { transform: translateX(20px); opacity: .5; } to { transform: translateX(0); opacity: 1; } }
.drawer-header { padding: 22px 25px; border-bottom: 1px solid var(--line); display: flex; align-items: start; justify-content: space-between; gap: 15px; }
.drawer-header h2 { margin: 4px 0 0; font-size: 22px; }
.drawer-body { padding: 23px 25px 35px; }
.drawer-section { margin: 0 0 24px; }
.drawer-section h3 { margin: 0 0 12px; font-size: 14px; }
.drawer-section p { font-size: 12px; line-height: 1.7; color: #50637b; }
.toast { position: fixed; bottom: 22px; right: 22px; z-index: 90; max-width: 340px; padding: 12px 16px; background: #1b3346; color: #fff; box-shadow: 0 8px 24px #152f3e44; border-radius: 10px; font-size: 12px; line-height: 1.5; }

@media (max-width: 1160px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strategy-grid, .select-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-layout { grid-template-columns: 1fr; }
  .sticky-card { position: static; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 70px minmax(0, 1fr); }
  .sidebar { padding-left: 7px; padding-right: 7px; }
  .brand { margin: 0 auto 22px; }
  .brand b, .brand small, .mode-box, .nav-caption, .nav-label, .side-footer { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .nav-icon { font-size: 20px; }
  .sidebar:after { content: "회원 / 관리자 전환은 넓은 화면에서 표시"; display: none; }
  .topbar { padding: 0 20px; }
  .content { padding: 24px 20px 40px; }
  .split { grid-template-columns: 1fr; }
  .top-actions .user-label { display: none; }
  .mobile-modes { display: flex !important; gap: 5px; }
}
@media (max-width: 640px) {
  .shell { display: block; }
  .sidebar { position: sticky; height: auto; top: 0; padding: 8px 10px; flex-direction: row; align-items: center; overflow-x: auto; }
  .brand { margin: 0 12px 0 0; flex: none; }
  .brand-mark { height: 30px; width: 30px; font-size: 17px; }
  .nav-list { display: flex; gap: 3px; flex: none; }
  .nav-item { width: auto; min-width: 40px; flex: none; padding: 8px; }
  .nav-icon { font-size: 18px; }
  .topbar { height: 55px; padding: 0 13px; }
  .content { padding: 17px 12px 35px; }
  .page-heading { display: block; }
  .heading-actions { margin-top: 12px; justify-content: flex-start; }
  .stat-grid, .grid-2, .grid-3, .strategy-grid, .select-grid { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: 1fr; }
  .rooms-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ladder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calendar-grid { gap: 2px; }
  .cal-day { min-height: 58px; padding: 6px 3px; }
  .cal-day small { font-size: 9px; margin-top: 4px; }
}
