/* 붐팝플렌즈 운영 페이지. 밝은 테마: 흰 바탕 + 어두운 남색 옆 메뉴. 포인트는 게임의 나무·주황·크림. */
:root,
[data-theme="light"] {
  --bg: #f5f6f9;
  --panel: #ffffff;
  --panel-2: #fafbfc;
  --line: #e3e6ec;
  --text: #1d2433;
  --muted: #6b7385;
  --side: #1b2540;
  --side-2: #243052;
  --side-text: #c9d0e3;
  --side-active: #ffffff;
  --accent: #e8892b;
  --accent-ink: #ffffff;
  --accent-soft: #fdf0e1;
  --wood: #6b3d16;
  --cream: #fff6e4;
  --ok: #2f9e5b;
  --ok-soft: #e4f5ea;
  --bad: #d64545;
  --bad-soft: #fbe7e7;
  --warn: #c98612;
  --warn-soft: #fcf2dc;
  --shadow: 0 1px 2px rgba(20, 30, 60, 0.06), 0 4px 16px rgba(20, 30, 60, 0.05);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #10141d;
  --panel: #181e2a;
  --panel-2: #1d2432;
  --line: #2a3242;
  --text: #e6e9f0;
  --muted: #8b93a7;
  --side: #0b0f18;
  --side-2: #161c2a;
  --side-text: #a9b1c6;
  --side-active: #ffffff;
  --accent: #f0994a;
  --accent-ink: #1a1106;
  --accent-soft: #3a2a18;
  --wood: #d9a36b;
  --cream: #2a2218;
  --ok: #4cc27c;
  --ok-soft: #173424;
  --bad: #ef6b6b;
  --bad-soft: #3a1c1f;
  --warn: #e3ae45;
  --warn-soft: #3a2f16;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.5 "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; }
.muted { color: var(--muted); }
.error { color: var(--bad); min-height: 1.2em; margin: 8px 0 0; font-size: 13px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── 버튼·입력 */
.btn {
  appearance: none; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--panel-2); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.icon-btn { border: 1px solid var(--line); background: var(--panel); color: var(--text); width: 34px; height: 34px; border-radius: 8px; cursor: pointer; font-size: 16px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; min-width: 0;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { width: 100%; min-height: 90px; resize: vertical; }
label.field { display: grid; gap: 4px; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
label.field > input, label.field > select, label.field > textarea { color: var(--text); }
.check { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; }

/* ── 로그인 */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px;
  background: linear-gradient(160deg, var(--side) 0%, var(--side-2) 60%, var(--wood) 140%); }
.login-card { width: min(380px, 100%); background: var(--panel); border-radius: 16px; padding: 32px 28px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-card h1 { font-size: 20px; margin: 12px 0 6px; }
.brand-mark { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 12px;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 24px; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.brand-mark.sm { width: 28px; height: 28px; font-size: 15px; border-radius: 8px; }
.gsi { display: flex; justify-content: center; margin: 20px 0 6px; min-height: 44px; }
.dev-form { display: grid; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); text-align: left; }
.dev-label { font-size: 12px; color: var(--warn); font-weight: 700; }

/* ── 틀 */
.app { display: flex; min-height: 100%; }
.side { width: 232px; flex: none; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; font-weight: 700; }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px; }
.nav-group { font-size: 11px; letter-spacing: .04em; color: #7c86a3; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--side-text); text-decoration: none; }
.nav a:hover { background: var(--side-2); color: #fff; }
.nav a.on { background: var(--side-2); color: var(--side-active); box-shadow: inset 3px 0 0 var(--accent); }
.nav a.off { opacity: .45; pointer-events: none; }
.nav .ico { width: 18px; text-align: center; }
.nav .tag { margin-left: auto; font-size: 10px; padding: 1px 6px; border-radius: 6px; background: #2e3a5c; color: #aab4d4; }
.nav .count { margin-left: auto; font-size: 11px; padding: 0 7px; border-radius: 9px; background: var(--accent); color: #fff; }
.side-foot { padding: 12px 18px; font-size: 12px; color: #7c86a3; border-top: 1px solid rgba(255,255,255,.06); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top h2 { font-size: 17px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.me { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.me img { width: 26px; height: 26px; border-radius: 50%; }
.menu-btn { display: none; }
.view { padding: 22px 24px 40px; max-width: 1280px; width: 100%; }

/* ── 카드·표 */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; }
.card h3 { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card h3 .right { margin-left: auto; display: flex; gap: 6px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12px; color: var(--muted); }
.stat.accent { border-top: 3px solid var(--accent); }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-weight: 600; color: var(--muted); background: var(--panel-2); position: sticky; top: 0; white-space: nowrap; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--panel-2); }
.empty { text-align: center; color: var(--muted); padding: 28px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; font-size: 13px; }

.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.profile-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.profile-head h3 { margin: 0; font-size: 20px; }
.wallet { display: flex; gap: 20px; flex-wrap: wrap; }
.wallet b { font-size: 20px; }
.items { display: flex; flex-wrap: wrap; gap: 6px; }
.items .badge { font-weight: 500; }
.plus { color: var(--ok); } .minus { color: var(--bad); }
.back { display: inline-block; margin-bottom: 12px; font-size: 13px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.tabs button { border: 0; background: none; color: var(--muted); padding: 8px 12px; font: inherit; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a { color: var(--muted); padding: 8px 12px; border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.notice-body { white-space: pre-wrap; color: var(--muted); font-size: 12.5px; max-width: 520px; }

/* ── 창 */
.modal { border: 0; border-radius: 14px; padding: 0; width: min(520px, calc(100% - 32px)); background: var(--panel); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.modal::backdrop { background: rgba(10, 14, 25, .5); }
.modal form { padding: 20px 22px; max-height: 85vh; overflow-y: auto; }
.modal h3 { font-size: 16px; margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.reward-row { display: grid; grid-template-columns: 110px 1fr 90px 32px; gap: 6px; margin-bottom: 6px; }
.hint { font-size: 12px; color: var(--muted); margin: -4px 0 10px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--side); color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; transition: .2s; pointer-events: none; z-index: 50; font-size: 13px; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.bad { background: var(--bad); }

/* ── 좁은 화면 */
@media (max-width: 900px) {
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .side { position: fixed; left: 0; top: 0; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .menu-btn { display: inline-block; }
  .top { padding: 10px 16px; }
  .me span { display: none; }
  .view { padding: 16px; }
  .kv { grid-template-columns: 96px 1fr; }
  .reward-row { grid-template-columns: 90px 1fr 70px 32px; }
}

/* ── 2·3차 */
#otpCode { font-size: 22px; letter-spacing: 6px; text-align: center; width: 100%; }
.qr { display: grid; place-items: center; padding: 10px; background: #fff; border-radius: 10px; width: fit-content; margin: 0 auto 10px; }
.qr svg, .qr img { display: block; width: 180px; height: 180px; }
.secret { font-family: ui-monospace, Consolas, monospace; background: var(--panel-2); border: 1px dashed var(--line); padding: 8px; border-radius: 8px; word-break: break-all; text-align: center; margin-bottom: 10px; }
.chart { width: 100%; height: 140px; display: block; }
.chart .bar { fill: var(--accent); }
.chart .bar.alt { fill: #5b7bd5; }
.chart text { fill: var(--muted); font-size: 10px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.chart-card h4 { font-size: 13px; margin: 0 0 6px; color: var(--muted); font-weight: 600; }
.chart-card .total { font-size: 18px; font-weight: 700; color: var(--text); margin-left: 6px; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--bad); }
.status-dot.ok { background: var(--ok); }
.split { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 16px; align-items: start; }
.list-item { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.list-item:hover { background: var(--panel-2); }
.list-item.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.list-item .t { font-weight: 600; }
.list-item .s { font-size: 12px; color: var(--muted); }
.ticket-body { white-space: pre-wrap; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 8px 0 12px; }
.ai-box { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; }
.weight-input { width: 80px; }
.banner { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 600; }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
a.stat { display: block; color: inherit; text-decoration: none; }
a.stat:hover { border-color: var(--accent); }
.btn.ghost.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: -4px 0 10px; align-items: center; }

/* AI 비서(채팅 봇) */
.agent { display: flex; flex-direction: column; height: calc(100vh - 140px); min-height: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.ag-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.ag-head .btn { margin-left: auto; flex: none; }
.ag-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.ag-empty { margin: auto; text-align: center; }
.ag-empty .chips { justify-content: center; margin-top: 10px; gap: 6px; }
.ag-msg { display: flex; }
.ag-msg.me { justify-content: flex-end; }
.ag-bubble { max-width: min(760px, 88%); padding: 9px 13px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); word-break: break-word; }
.ag-bubble p { margin: 0 0 6px; }
.ag-bubble p:last-child { margin-bottom: 0; }
.ag-bubble .table-wrap { margin: 6px 0; }
.ag-bubble table th, .ag-bubble table td { padding: 4px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.ag-msg.me .ag-bubble { background: var(--accent-soft); border-color: transparent; }
.ag-bubble.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.ag-li { margin: 2px 0; }
.ag-card { max-width: min(560px, 92%); border: 1px solid var(--accent); border-radius: 12px; padding: 10px 13px; background: var(--cream); }
.ag-card.closed { border-color: var(--line); background: var(--panel-2); }
.ag-card-t { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.ag-card-s { font-weight: 600; margin-bottom: 6px; }
.ag-card pre { margin: 4px 0 0; max-height: 220px; overflow: auto; white-space: pre-wrap; }
.ag-card-b { display: flex; gap: 6px; margin-top: 8px; }
.ag-st { display: inline-block; margin-top: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.ag-st.ok { color: var(--ok); }
.ag-st.bad { color: var(--bad); }
.ag-file { display: inline-block; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--ok-soft); color: var(--text); text-decoration: none; font-weight: 600; }
.ag-input { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.ag-input textarea { flex: 1; resize: none; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); }
.ag-input .btn { flex: none; align-self: flex-end; }
@media (max-width: 760px) { .agent { height: calc(100vh - 110px); } .ag-head { flex-wrap: wrap; } }

/* 스토어 등록정보 */
.lst-tabs button .badge { margin-left: 4px; }
.lst-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.lst-cnt { font-variant-numeric: tabular-nums; margin-left: 6px; }
.lst-cnt.over { color: var(--bad); font-weight: 700; }
.lst-imgsec { margin-bottom: 16px; }
.lst-imghead { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; font-size: 13px; }
.lst-file { cursor: pointer; }
.lst-copy { font-size: 12.5px; padding: 4px 6px; }
.lst-none { font-size: 12.5px; margin: 0; }
.lst-imgs { display: flex; flex-wrap: wrap; gap: 8px; }
.lst-img { position: relative; border: 2px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel-2); }
.lst-img img { height: 150px; display: block; }
.lst-imgs.sm .lst-img img { height: 90px; }
.lst-img.del img { opacity: .3; }
.lst-img.del { border-color: var(--bad); }
.lst-img.new { border-color: var(--ok); }
.lst-x { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 12px; }
.lst-tag { position: absolute; left: 4px; bottom: 4px; font-size: 10.5px; background: var(--ok); color: #fff; padding: 1px 6px; border-radius: 6px; }
.lst-bar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; box-shadow: var(--shadow); }
.lst-bar .right { margin-left: auto; }
.danger-text { color: var(--bad) !important; }
.modal.wide { width: min(900px, calc(100% - 32px)); }
.lst-dblock { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.lst-dfield { margin-top: 8px; font-size: 13px; }
.diff { font-family: ui-monospace, Consolas, monospace; font-size: 12px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin-top: 4px; white-space: pre-wrap; word-break: break-word; }
.diff > div { padding: 1px 8px; }
.diff-add { background: var(--ok-soft); }
.diff-del { background: var(--bad-soft); text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }
.diff-skip { color: var(--muted); background: var(--panel-2); font-style: italic; }
@media (max-width: 900px) { .lst-grid { grid-template-columns: 1fr; } }

/* ── SquarePort 허브 ── */
.env-badge { margin-left: 6px; vertical-align: middle; }
.env-badge.test { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.env-badge.prod { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.proj { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; color: var(--text); }
.proj:hover { text-decoration: none; border-color: var(--accent); }
.proj .ic { font-size: 28px; }
.proj .nm { font-size: 16px; font-weight: 700; margin-top: 8px; }
.proj .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.keybox { font-family: ui-monospace, Consolas, monospace; font-size: 13px; word-break: break-all; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; user-select: all; }
.sp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--side-2); font-size: 13px; }
.sp-bar a { color: #c9d1e8; }
.sp-bar select { flex: 1 1 100%; min-width: 0; padding: 4px 6px; font-size: 13px; }
