/* 웨비픽 관리자 — 앱 디자인 언어(주황 #C8632E · 중립 배경 #F4F3EF · Noto Sans KR) + 다크 사이드바. */
:root {
  --brand: #C8632E;
  --brand-dark: #8F4A26;
  --brand-soft: #F0D9C8;
  --bg: #F4F3EF;
  --surface: #FFFFFF;
  --ink: #2A2420;
  --ink-2: #5A5048;
  --muted: #8A8077;
  --muted-2: #9A8F83;
  --line: #E7E3DC;
  --input-line: #E0DAD1;
  --side-bg: #241F1B;
  --side-ink: #C9BFB4;
  --side-label: #8A7E70;
  --side-line: #322B25;
  --side-dot: #6B5D50;
  --ok: #5A9E4B;
  --danger: #D9534F;
  --danger-soft: #FBEDEC;
  --warn: #E0A030;
  --radius: 16px;
  --shadow: 0 1px 4px rgba(42, 36, 32, .05);
  --font: 'Noto Sans KR', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }
.icon { flex-shrink: 0; }

.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* ── 버튼 ─────────────────────────────────────────────────────────────── */
.btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; background: var(--brand); color: #fff; font-size: 14px; font-weight: 800; padding: 11px 18px; border-radius: 12px; cursor: pointer; }
.btn-primary:hover { background: #B5562A; }
.btn-primary[disabled] { opacity: .6; cursor: progress; }
.btn-block { width: 100%; padding: 14px; font-size: 15px; }
.btn-ghost { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: transparent; color: var(--ink-2); font-size: 12.5px; font-weight: 700; padding: 7px 11px; border-radius: 9px; cursor: pointer; }
.btn-ghost:hover { background: var(--bg); }

/* ── 앱 셸 ────────────────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 244px; flex-shrink: 0; background: var(--side-bg); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 9px; padding: 20px 20px 18px; border-bottom: 1px solid #3A322B; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--brand); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-mark-lg { width: 38px; height: 38px; border-radius: 11px; }
.brand-name { display: block; font-size: 15px; font-weight: 900; color: #fff; }
.brand-sub { display: block; font-size: 10.5px; color: var(--muted-2); }
.nav { flex: 1; overflow-y: auto; padding: 8px 10px 20px; }
.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-thumb { background: #4A423A; border-radius: 2px; }
.nav-group + .nav-group { margin-top: 4px; border-top: 1px solid var(--side-line); }
.nav-group-label { display: flex; align-items: center; gap: 7px; padding: 14px 10px 7px; color: var(--side-label); font-size: 10.5px; font-weight: 800; letter-spacing: .8px; }
.nav-group + .nav-group .nav-group-label { padding-top: 16px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 14px 9px 22px; border-radius: 8px; color: var(--side-ink); font-size: 13px; font-weight: 600; margin-bottom: 1px; }
.nav-link:hover { background: #2F2924; color: #fff; }
.nav-link.is-active { background: var(--brand); color: #fff; font-weight: 700; }
.nav-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--side-dot); flex-shrink: 0; }
.nav-link.is-active .nav-dot { background: #fff; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 66px; flex-shrink: 0; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 28px; position: sticky; top: 0; z-index: 10; }
.page-title { margin: 0; font-size: 19px; font-weight: 900; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account { display: flex; align-items: center; gap: 10px; padding-left: 14px; border-left: 1px solid var(--line); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #EFE8E0; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; color: #8A6E55; }
.account-text { display: flex; flex-direction: column; }
.account-name { font-size: 12.5px; font-weight: 700; }
.account-sub { font-size: 10.5px; color: var(--muted-2); }
.logout-form { margin: 0; }
.nav-toggle { display: none; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: transparent; cursor: pointer; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.nav-toggle span { display: block; width: 16px; height: 2px; background: var(--ink-2); border-radius: 1px; }
.content { flex: 1; padding: 26px 28px; }

/* ── 카드·대시보드 ────────────────────────────────────────────────────── */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.stat { padding: 20px; }
.stat-alert { border: 1.5px solid #F4D4D0; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 900; margin-top: 8px; }
.stat-alert .stat-value { color: var(--danger); }
.stat-unit { font-size: 14px; color: var(--muted); }
.stat-note { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.panel { padding: 22px; margin-top: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head h2 { margin: 0; font-size: 14.5px; font-weight: 800; }
.panel-sub { font-size: 11.5px; color: var(--muted); }
.empty { color: var(--muted); margin: 18px 0 2px; }
.activity { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.activity li { display: flex; gap: 11px; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-top: 6px; flex-shrink: 0; }
.activity-dot.is-system { background: var(--ok); }
.activity-title { display: block; font-size: 12.5px; font-weight: 600; }
.activity-meta { display: block; font-size: 11px; color: var(--muted-2); }

.placeholder { max-width: 560px; margin: 40px auto; padding: 36px 32px; text-align: center; }
.placeholder h2 { margin: 12px 0 6px; font-size: 18px; font-weight: 900; }
.placeholder p { margin: 0 0 18px; color: var(--muted); }
.placeholder-icon { display: inline-flex; width: 56px; height: 56px; border-radius: 16px; background: var(--brand-soft); color: var(--brand-dark); align-items: center; justify-content: center; }
.error-code { margin: 10px 0 0 !important; font-size: 13px; font-weight: 800; color: var(--brand) !important; }
.error-detail { text-align: left; background: var(--bg); padding: 12px; border-radius: 10px; overflow-x: auto; font-size: 12px; }
.request-id { font-size: 12px; }
.request-id code { background: var(--bg); padding: 2px 6px; border-radius: 6px; }
body.bare .error-page { margin-top: 12vh; }

/* ── 로그인 ───────────────────────────────────────────────────────────── */
body.bare { background: var(--side-bg); }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 22px; padding: 40px 36px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.login-brand { display: flex; align-items: center; gap: 10px; justify-content: center; }
.login-brand-name { font-size: 22px; font-weight: 900; color: var(--brand-dark); }
.login-sub { text-align: center; font-size: 14px; font-weight: 700; color: var(--muted); margin: 8px 0 0; }
.login-form { margin-top: 24px; display: flex; flex-direction: column; gap: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 7px; }
.field input { width: 100%; border: 1.5px solid var(--input-line); border-radius: 11px; padding: 13px 14px; font-size: 14px; font-family: inherit; color: var(--ink); background: #fff; }
.field input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(200, 99, 46, .15); }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 46px; }
.password-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: none; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--muted-2); border-radius: 8px; }
.password-toggle:hover { color: var(--ink-2); }
.password-toggle span { display: inline-flex; }
.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }
.form-error { display: flex; align-items: flex-start; gap: 7px; background: var(--danger-soft); color: #A33A36; font-size: 12.5px; font-weight: 600; padding: 10px 12px; border-radius: 10px; }
.form-error .icon { margin-top: 2px; }
.banner { margin-top: 18px; font-size: 12.5px; font-weight: 600; padding: 10px 12px; border-radius: 10px; }
.banner-info { background: #FBF1E8; color: var(--brand-dark); }
.banner-success { background: #EEF6EC; color: #3E7A32; }
.login-hint { display: flex; align-items: center; gap: 7px; margin-top: 20px; font-size: 11.5px; color: var(--muted-2); background: #F7F5F1; border-radius: 10px; padding: 11px 13px; }

/* ── 토스트 (오른쪽 위 · 성공 4초 · 실패 9초+닫기) ──────────────────────── */
.toast-root { position: fixed; top: 16px; right: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; max-width: calc(100vw - 32px); }
/* 앱 화면에서는 상단 바(66px) 아래로 — 위에 두면 로그아웃 등 상단 버튼을 덮는다(실브라우저 확인). */
body.app .toast-root { top: 78px; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; min-width: 240px; max-width: 380px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; padding: 12px 14px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); animation: toast-in .18s ease-out; }
.toast-success { border-left: 4px solid var(--ok); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-msg { flex: 1; }
.toast-close { border: none; background: transparent; color: #fff; opacity: .7; cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; }
.toast-close:hover { opacity: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* ── 콘솔 공통(US-009) ───────────────────────────────────────────────── */
.lead { margin: 0 0 16px; color: var(--ink-2); font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.neg { color: var(--danger); font-weight: 700; }
.link { color: var(--brand-dark); text-decoration: underline; text-underline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
.toolbar .lead { flex: 1; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 16px; }
.input { border: 1.5px solid var(--input-line); border-radius: 10px; padding: 8px 11px; font-size: 13px; font-family: inherit; color: var(--ink); background: #fff; min-width: 0; }
.input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(200, 99, 46, .15); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input[readonly] { background: var(--bg); }
.grow { flex: 1; }
.narrow { max-width: 220px; }
textarea.input { width: 100%; resize: vertical; }
.field .input { width: 100%; }
.field { margin-bottom: 14px; border: none; padding: 0; }
.field legend { font-size: 12.5px; font-weight: 700; margin-bottom: 7px; padding: 0; }
.field .check { margin: 4px 14px 4px 0; display: inline-flex; }
.help { margin: 5px 0 0; font-size: 11.5px; color: var(--muted); font-weight: 400; }
.check .help { margin: 0 0 0 4px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1; }
.btn-ghost.danger { color: var(--danger); border-color: #F1C9C6; }
.inline-form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
/* 표 칸에 flex 를 걸면 칸이 표에서 빠져 줄 경계가 어긋난다(실브라우저 확인) — 칸은 table-cell 그대로, 버튼만 줄지어 놓는다. */
td.actions { display: table-cell; min-width: 150px; }
td.actions > * { display: inline-flex; vertical-align: middle; margin: 2px 6px 2px 0; }
a.card.stat { display: block; }
a.card.stat:hover { box-shadow: 0 4px 14px rgba(42, 36, 32, .1); }
.small-value { font-size: 18px; }
.banner-danger { background: var(--danger-soft); color: #A33A36; margin: 0 0 16px; }
main .banner { margin: 0 0 16px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; background: #EFEAE3; color: var(--ink-2); }
.badge-ok { background: #E6F2E3; color: #3E7A32; }
.badge-warn { background: #FBF0DA; color: #8A5E10; }
.badge-danger { background: var(--danger-soft); color: #A33A36; }
.badge-brand { background: var(--brand-soft); color: var(--brand-dark); }
.badge-muted { background: #EFEAE3; color: var(--muted); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--bg); padding: 1px 5px; border-radius: 5px; }
pre.code { background: var(--bg); padding: 12px; border-radius: 10px; overflow-x: auto; font-size: 12px; margin: 0 0 12px; }
pre.code.wrap { white-space: pre-wrap; word-break: break-word; }
.table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 12.5px; }
.table th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.table td.empty { text-align: center; color: var(--muted); padding: 22px; }
.panel > .table:first-child { margin-top: 0; }
.panel { overflow-x: auto; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
.tab { padding: 9px 14px; font-size: 13px; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.is-active { color: var(--brand-dark); border-bottom-color: var(--brand); }
.toolbar .tabs { margin: 0; border: none; }
.pager { display: flex; align-items: center; gap: 10px; justify-content: center; margin-top: 14px; }
.pager-no { font-size: 12px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; margin: 0 0 14px; font-size: 13px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; word-break: break-word; }
.sub { font-size: 13px; font-weight: 800; margin: 18px 0 8px; }
.plain { list-style: none; padding: 0; margin: 0; font-size: 12.5px; display: flex; flex-direction: column; gap: 6px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.two-col > .panel { margin-top: 18px; }
.flow { margin: 12px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.provider-grid .panel { margin-top: 0; }
.panel-gap { margin-top: 26px; }
.faq-list { margin: 0 0 12px; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.faq-list .actions { display: inline-flex; margin-left: 8px; }
.signal-row { margin: 12px 0 0; font-size: 13px; }
.setting-list { display: flex; flex-direction: column; gap: 14px; }
.setting { padding: 18px 20px; }
.setting-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.setting-head h2 { margin: 0; font-size: 14px; font-weight: 800; }
.setting-key { font-size: 11px; color: var(--muted); }
.setting-help { margin: 6px 0 10px; font-size: 12px; color: var(--ink-2); }
.setting-state { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; margin-bottom: 10px; }
.setting-state .value { font-size: 12.5px; }
.setting-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
.setting-actions .inline-form.grow { flex-wrap: wrap; }
.setting-actions .inline-form.grow .input { flex: 1; min-width: 220px; }
.setting-actions .form-error { flex-basis: 100%; margin: 6px 0 0; }
/* 관리자 화면의 비밀번호·비밀값 칸(Ui::password_input) — 로그인 화면과 같은 눈 토글, 작은 입력칸에 맞춘 크기 */
.password-wrap .input { width: 100%; padding-right: 40px; }
.password-wrap .input + .password-toggle { width: 30px; height: 30px; right: 4px; }
.setting-actions .inline-form.grow .password-wrap { flex: 1; min-width: 220px; }
.policy-form { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 22px; margin: 14px 0 6px; }
.policy-form .field { margin-bottom: 6px; }
.policy-form > .check { margin-top: 26px; }
.policy-form > .btn-primary { margin-top: 18px; }
.policy-form .form-error { flex-basis: 100%; }

/* ── 모달(<dialog>) ───────────────────────────────────────────────────── */
.modal { border: none; padding: 0; background: transparent; max-width: calc(100vw - 32px); }
.modal::backdrop { background: rgba(36, 31, 27, .45); }
.modal-card { width: 520px; max-width: 100%; max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--surface); border-radius: 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, .25); margin: 0; }
.modal-sm { width: 400px; }
.modal-lg { width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 900; }
.modal-x { border: none; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-body .form-error { margin: 4px 0 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }

/* ── 주간 막대(CSP 로 인라인 style 을 못 쓴다 — 높이는 5% 단위 클래스) ─────── */
.bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; height: 200px; margin-top: 16px; align-items: end; }
.bar-col { display: flex; flex-direction: column; align-items: center; height: 100%; gap: 4px; }
.bar-stack { flex: 1; width: 60%; display: flex; flex-direction: column; justify-content: flex-end; }
.bar { display: block; width: 100%; }
.bar-shop { background: var(--brand); border-radius: 0 0 4px 4px; }
.bar-offer { background: #F5C45E; border-radius: 4px 4px 0 0; }
.bar-label { font-size: 11px; color: var(--muted); }
.bar-value { font-size: 10.5px; color: var(--ink-2); font-weight: 700; }
.legend { margin: 10px 0 0; font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; }
.dot-shop { background: var(--brand); }
.dot-offer { background: #F5C45E; margin-left: 10px; }
.h-0 { height: 0%; }
.h-5 { height: 5%; }
.h-10 { height: 10%; }
.h-15 { height: 15%; }
.h-20 { height: 20%; }
.h-25 { height: 25%; }
.h-30 { height: 30%; }
.h-35 { height: 35%; }
.h-40 { height: 40%; }
.h-45 { height: 45%; }
.h-50 { height: 50%; }
.h-55 { height: 55%; }
.h-60 { height: 60%; }
.h-65 { height: 65%; }
.h-70 { height: 70%; }
.h-75 { height: 75%; }
.h-80 { height: 80%; }
.h-85 { height: 85%; }
.h-90 { height: 90%; }
.h-95 { height: 95%; }
.h-100 { height: 100%; }

/* ── 좁은 화면 ────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col, .field-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.is-open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
  .nav-toggle { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px; }
  .account-text, .btn-ghost span { display: none; }
}
@media (max-width: 520px) {
  .stat-grid { grid-template-columns: minmax(0, 1fr); }
  .login-card { padding: 32px 22px; }
}
