/* 바카 — 재고 원장 화면.
   약속: 틀(메뉴·테두리)은 무채색, 색은 데이터(입고·출고·상태·수량)에만 쓴다.
   밝은 레일 + 옅은 색조 프레임 위에 흰 시트. 다크 모드는 같은 이름의 토큰만 바꾼다. */
:root {
  color-scheme: light dark;
  --frame: #eceef1;        /* 바깥 틀 */
  --sheet: #ffffff;        /* 시트(카드) */
  --sheet-2: #f5f6f8;      /* 시트 안의 옅은 면 */
  --ink: #0f1317;
  --ink-2: #38414a;
  --ink-3: #566069;
  --rule: #dde1e6;
  --rule-2: #eaedf0;
  --blue: #2848c8;   --blue-bg: #e8edfc;
  --red: #c4351f;    --red-bg: #fbe9e5;
  --green: #1b7a52;  --green-bg: #e0f2e9;
  --amber: #8a5a0a;  --amber-bg: #f8ecd2;
  --gray: #5f6872;   --gray-bg: #eaedf0;
  --on-accent: #ffffff;
  --btn-bg: var(--ink); --btn-fg: var(--sheet);
  --scrim: rgba(12, 16, 20, .5);
  --r: 8px; --r-lg: 12px;
  --rail-w: 232px;
  --font: "Noto Sans KR", "Pretendard", "Malgun Gothic", system-ui, sans-serif;
  --mono: "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;   /* 숫자·품번도 같은 글꼴(자릿수만 맞춤) */
  --code: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --frame: #0f1215; --sheet: #171b1f; --sheet-2: #1d2227;
    --ink: #e9ecef; --ink-2: #aab2bb; --ink-3: #8b949e;
    --rule: #2b3238; --rule-2: #222830;
    --blue: #8aa4ff;  --blue-bg: #1e2a55;
    --red: #ff8f78;   --red-bg: #3b1e19;
    --green: #62d6a2; --green-bg: #16352b;
    --amber: #e8b95a; --amber-bg: #38290f;
    --gray: #a2abb4;  --gray-bg: #242a30;
    --on-accent: #0a1330; --scrim: rgba(0, 0, 0, .65);
  }
}
:root[data-theme="dark"] {
  --frame: #0f1215; --sheet: #171b1f; --sheet-2: #1d2227;
  --ink: #e9ecef; --ink-2: #aab2bb; --ink-3: #8b949e;
  --rule: #2b3238; --rule-2: #222830;
  --blue: #8aa4ff;  --blue-bg: #1e2a55;
  --red: #ff8f78;   --red-bg: #3b1e19;
  --green: #62d6a2; --green-bg: #16352b;
  --amber: #e8b95a; --amber-bg: #38290f;
  --gray: #a2abb4;  --gray-bg: #242a30;
  --on-accent: #0a1330; --scrim: rgba(0, 0, 0, .65);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--frame); color: var(--ink); font: 400 15px/1.65 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--ink); color: var(--sheet); padding: 8px 14px; border-radius: var(--r); }
.skip:focus { top: 12px; }

/* ── 틀 ── */
.app { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; }
.stage { min-width: 0; display: flex; flex-direction: column; }
main:focus { outline: none; }
main { padding: 8px 40px 72px; max-width: 1280px; width: 100%; outline: none; flex: 1; }

.rail { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 12px 12px; background: var(--sheet); border-right: 1px solid var(--rule); display: flex; flex-direction: column; gap: 4px; scrollbar-width: thin; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-logo { width: 32px; height: 32px; border-radius: 9px; background: var(--blue); display: grid; place-items: center; flex: none; }
.brand-logo svg { width: 18px; height: 18px; fill: none; stroke: var(--on-accent); stroke-width: 2.4; stroke-linecap: round; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-mark { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.brand-sub { font-size: 11px; color: var(--ink-3); }
.rail nav { display: flex; flex-direction: column; flex: 1; }
.rail .grp { margin: 16px 10px 4px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.rail nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r); color: var(--ink-2); font-weight: 500; }
.rail nav a:hover { background: var(--sheet-2); color: var(--ink); text-decoration: none; }
.rail nav a.on { background: var(--frame); color: var(--ink); font-weight: 600; }
.rail nav a.on .ic { color: var(--blue); }
.rail-foot { border-top: 1px solid var(--rule); margin-top: 8px; padding-top: 10px; }
.who { display: block; padding: 4px 8px; font-size: 12px; color: var(--ink-2); }
.who label { display: block; font-size: 11px; color: var(--ink-3); }
.who .inp { margin-top: 4px; }
.mode { padding: 0 8px 2px; font-size: 11px; color: var(--ink-3); }
.who .me { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.who .me .role { font-size: 11px; padding: 0 8px; border-radius: 99px; background: var(--gray-bg); color: var(--ink-2); }
.who .me-links { margin-top: 4px; font-size: 12px; }
.rail.locked nav, .rail.locked .who { visibility: hidden; }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 12px 40px; background: var(--frame); }
.cmd-btn { display: flex; align-items: center; gap: 10px; width: min(340px, 100%); min-height: 38px; padding: 0 10px 0 12px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); color: var(--ink-3); cursor: pointer; text-align: left; }
.cmd-btn:hover { border-color: var(--ink-3); color: var(--ink-2); }
.cmd-label { flex: 1; font-size: 13px; }
kbd { font: 500 11px var(--mono); padding: 1px 6px; border: 1px solid var(--rule); border-radius: 5px; background: var(--sheet-2); color: var(--ink-3); }
.icon-btn { margin-left: auto; width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }

/* 페이지 머리 */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 8px 0 22px; }
.page-head h1 { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.25; }
.page-head .sub { color: var(--ink-3); font-size: 13px; max-width: 62ch; }
.kicker { display: none; }   /* 영문 소제목은 정보가 없어 숨긴다 */

/* ── 시트 ── */
.sheet { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 20px 22px; margin-bottom: 18px; }
.sheet > h2 { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.sheet-note { margin: -6px 0 14px; color: var(--ink-2); font-size: 13px; }
.cols { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.cols.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols > .sheet { margin-bottom: 0; }

/* ── 폼 ── */
.inp, select.inp, textarea.inp { width: 100%; padding: 8px 12px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); min-height: 38px; }
.inp:hover { border-color: var(--ink-3); }
.inp:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--blue-bg); }
.inp::placeholder { color: var(--ink-3); }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > label, .lbl { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > .field { margin-bottom: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; min-height: 38px; border: 1px solid var(--btn-bg); background: var(--btn-bg); color: var(--btn-fg); border-radius: var(--r); cursor: pointer; font-weight: 500; transition: background-color .12s, transform .06s; }
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.ghost:hover { background: var(--sheet-2); border-color: var(--ink-3); filter: none; }
.btn.blue { background: var(--blue); border-color: var(--blue); color: var(--on-accent); }
.btn.red { background: var(--red); border-color: var(--red); color: var(--on-accent); }
.btn.small { min-height: 30px; padding: 3px 11px; font-size: 12px; }
.tabs { display: flex; gap: 2px; margin-bottom: 16px; border-bottom: 1px solid var(--rule); overflow-x: auto; overflow-y: hidden; }
.tabs button { padding: 9px 16px; border: 0; background: none; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--blue); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; background: var(--sheet); }
.seg button { border: 0; background: none; padding: 7px 14px; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: var(--ink); color: var(--sheet); }

/* ── 종류 표시(도장→작은 라벨) / 상태 ── */
.stamp { display: inline-block; padding: 1px 9px; border-radius: 6px; font: 600 12px/1.6 var(--font); white-space: nowrap; background: var(--gray-bg); color: var(--ink-2); }
.stamp.in { color: var(--blue); background: var(--blue-bg); }
.stamp.out { color: var(--red); background: var(--red-bg); }
.stamp.mv { color: var(--green); background: var(--green-bg); }
.stamp.adj { color: var(--amber); background: var(--amber-bg); }
.stamp.fix { color: var(--gray); text-decoration: line-through; }
.tag { display: inline-block; padding: 0 9px; border-radius: 99px; font-size: 12px; line-height: 1.7; background: var(--gray-bg); color: var(--ink-2); white-space: nowrap; }
.tag.ok { background: var(--green-bg); color: var(--green); }
.tag.warn { background: var(--amber-bg); color: var(--amber); }
.tag.err { background: var(--red-bg); color: var(--red); }
.tag.blue { background: var(--blue-bg); color: var(--blue); }

/* ── 표 ── */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 700; font-size: 13px; color: var(--ink-3); padding: 9px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; background: var(--sheet-2); }
th:first-child { border-top-left-radius: 8px; } th:last-child { border-top-right-radius: 8px; }
td { padding: 10px 12px; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--sheet-2); }
.scroll { overflow-x: auto; }

/* 수불부 — 입고(+) 출고(−) 잔량 */
.ledger { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-lg); position: relative; overflow-x: auto; }
.ledger td.bal { font-weight: 600; background: var(--sheet-2); }
.ledger td.pos { color: var(--blue); }
.ledger td.neg { color: var(--red); }
.ledger td.date { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.ledger tr.corr td { color: var(--ink-3); }

/* ── 재고 카드와 사이즈 칩 ── */
.cards { display: grid; gap: 12px; }
.card { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 14px 18px 16px; }
.sheet .card { background: var(--sheet-2); border-color: var(--rule-2); }
.card-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.card-head .brand-name { font-size: 12px; color: var(--ink-3); }
.card-head .style { font: 600 14px var(--mono); }
.card-head .nm { color: var(--ink-2); flex: 1; min-width: 200px; }
.card-head .tot { font: 600 17px var(--mono); }
.sizes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.size { --lvl: var(--rule); min-width: 52px; padding: 4px 9px 5px; border: 1px solid var(--rule); border-radius: 7px; text-align: center; background: var(--sheet); color: var(--ink); cursor: default; box-shadow: inset 0 -3px 0 var(--lvl); }
.size .s { display: block; font-size: 12px; color: var(--ink-3); }
.size .q { display: block; font: 700 16px var(--mono); font-variant-numeric: tabular-nums; }
.size .bc { display: block; margin-top: 2px; padding-top: 3px; border-top: 1px solid var(--rule-2); font: 500 11px var(--mono); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; color: var(--ink-2); user-select: all; }
.size.has-bc { min-width: 92px; }
.size.has { --lvl: var(--blue); }
.size.neg { --lvl: var(--red); }
.size.neg .q { color: var(--red); }
.size.zero .q { color: var(--ink-3); font-weight: 400; }
button.size { font: inherit; cursor: pointer; }
button.size:hover { border-color: var(--ink-3); }
button.size.sel { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
button.size.sel .s { color: var(--rule); }
.wh-line { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.wh-pill { font-size: 12px; padding: 2px 10px; border-radius: 99px; background: var(--gray-bg); color: var(--ink-2); }
.wh-pill.neg { background: var(--red-bg); color: var(--red); }
.neg-text { color: var(--red); font-weight: 600; }

.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px 10px; }
.filters .field { margin: 0; min-width: 0; }
.filters select { width: 100%; }
.filters select.on { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); font-weight: 600; }
.pager { justify-content: center; align-items: center; margin-top: 14px; }
@media (max-width: 560px) { .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ── 수동 매핑 ── */
.map-panel { display: grid; gap: 12px; padding: 6px 0 10px; }
.map-list { display: grid; gap: 6px; max-height: 260px; overflow: auto; }
.map-item { display: grid; gap: 2px; text-align: left; padding: 8px 12px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); color: var(--ink); cursor: pointer; font: inherit; }
.map-item:hover { border-color: var(--ink-3); }
.map-item.sel { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }

/* ── 점검표 ── */
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule-2); }
.checks li:last-child { border-bottom: 0; }
.checks .mk { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; }
.checks .mk.ok { background: var(--green-bg); color: var(--green); }
.checks .mk.warn { background: var(--amber-bg); color: var(--amber); }
.checks .mk.err { background: var(--red-bg); color: var(--red); }
.checks .t { flex: 1; }

/* KPI 줄: 칸 사이는 가는 구분선 하나 */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-lg); overflow: hidden; margin: 0 0 18px; }
.facts > div { display: flex; flex-direction: column; gap: 2px; padding: 16px 20px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin: 0 -1px -1px 0; }
.facts .k { font-size: 12px; color: var(--ink-3); }
.facts .v { font: 700 26px/1.2 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

.bars .bar { display: grid; grid-template-columns: minmax(80px, 150px) minmax(0, 1fr) 64px; gap: 12px; align-items: center; margin: 9px 0; }
.bar .track { height: 8px; background: var(--rule-2); border-radius: 99px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--blue); border-radius: 99px; }
.bar .fill.red { background: var(--red); }

/* ── 홈: 오늘 할 일 · 추이 ── */
.todo { display: grid; gap: 8px; margin: 0 0 18px; }
.todo-item { display: flex; align-items: center; gap: 14px; padding: 13px 16px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-lg); color: var(--ink); }
.todo-item:hover { text-decoration: none; border-color: var(--ink-3); }
.todo-item .dot { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.todo-item .dot.warn { background: var(--amber-bg); color: var(--amber); }
.todo-item .dot.err { background: var(--red-bg); color: var(--red); }
.todo-item .dot.info { background: var(--blue-bg); color: var(--blue); }
.todo-item .tx { flex: 1; min-width: 0; }
.todo-item .tx b { display: block; font-weight: 600; }
.todo-item .tx span { color: var(--ink-3); font-size: 13px; }
.todo-item .go { color: var(--ink-3); }
.todo-ok { display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: var(--green-bg); color: var(--green); border-radius: var(--r-lg); font-weight: 500; margin-bottom: 18px; }
.trend-legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); margin: -4px 0 8px; }
.trend-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.trend { width: 100%; height: auto; display: block; }
.trend text { font: 11px var(--mono); fill: var(--ink-3); }
.trend .gl { stroke: var(--rule-2); stroke-width: 1; }
.trend .b-in { fill: var(--blue); }
.trend .b-out { fill: var(--red); }

/* ── 올리기 영역 · 알림 ── */
.drop { border: 1.5px dashed var(--rule); border-radius: var(--r-lg); padding: 28px 22px; text-align: center; color: var(--ink-2); background: var(--sheet-2); cursor: pointer; transition: border-color .12s, background-color .12s; }
.drop.over, .drop:hover { border-color: var(--blue); background: var(--blue-bg); }
.drop b { color: var(--ink); }
.banner { padding: 11px 16px; border-radius: var(--r); background: var(--amber-bg); color: var(--amber); margin-bottom: 14px; font-size: 13px; }
.banner.blue { background: var(--blue-bg); color: var(--blue); }
.banner.green { background: var(--green-bg); color: var(--green); }
.banner.red { background: var(--red-bg); color: var(--red); }
.banner a { text-decoration: underline; color: inherit; }

/* 품목 선택기 */
.picker .pk-res { margin-top: 8px; display: grid; gap: 8px; }
.pk-item { padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet-2); }
.pk-item .h { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.pk-sel { margin-top: 10px; }
.pk-sel .chosen { padding: 12px 14px; background: var(--ink); color: var(--sheet); border-radius: var(--r); }
.pk-sel .chosen .style { font: 600 14px var(--mono); }
.pk-sel .chosen .bal { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; opacity: .8; }
.pk-sel .chosen .bal b { font: 600 13px var(--mono); }

/* 스캔 */
.scanbox { display: grid; gap: 12px; }
.scan-input { font: 600 22px var(--mono); padding: 16px 18px; border: 2px solid var(--ink); border-radius: var(--r-lg); width: 100%; background: var(--sheet); }
.scan-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-bg); }
.flash { padding: 13px 16px; border-radius: var(--r); margin-top: 4px; }
.flash.ok { background: var(--green-bg); color: var(--green); }
.flash.err { background: var(--red-bg); color: var(--red); }

#toast { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 60; }
#toast div { padding: 11px 16px; border-radius: var(--r); background: var(--ink); color: var(--sheet); box-shadow: 0 8px 24px rgba(0, 0, 0, .22); max-width: 380px; animation: up .18s ease-out; }
#toast div.err { background: var(--red); color: var(--on-accent); }
@keyframes up { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 비어 있음 · 불러오는 중 */
.empty { padding: 32px 20px; text-align: center; color: var(--ink-3); border: 1px dashed var(--rule); border-radius: var(--r-lg); background: var(--sheet); }
.skel { display: grid; gap: 14px; }
.skel i { display: block; border-radius: var(--r-lg); background: linear-gradient(90deg, var(--rule-2) 25%, var(--sheet-2) 50%, var(--rule-2) 75%); background-size: 200% 100%; animation: sh 1.3s infinite linear; }
.skel .h1 { height: 30px; width: 220px; margin-bottom: 10px; }
.skel .kp { height: 76px; }
.skel .bl { height: 160px; }
@keyframes sh { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; }
.kv dt { color: var(--ink-3); font-size: 12px; }
.kv dd { margin: 0; }
.login { max-width: 380px; margin: 12vh auto; padding: 28px; }
.login h1 { font-size: 24px; margin-bottom: 4px; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; font-weight: 700; }
.login-brand .brand-logo { width: 34px; height: 34px; }
.login .btn { width: 100%; }
.login-alt { display: grid; gap: 8px; margin-top: 16px; text-align: center; }
.login [hidden] { display: none; }
.rail nav a .pend { margin-left: auto; }
pre.code { font-family: var(--code); background: var(--sheet-2); padding: 12px; border-radius: var(--r); overflow: auto; }
[hidden] { display: none !important; }

/* ── 이동 팔레트(Ctrl K) ── */
dialog#cmdk { border: 1px solid var(--rule); border-radius: 14px; padding: 0; width: min(560px, 92vw); background: var(--sheet); color: var(--ink); margin: 12vh auto auto; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); }
dialog#cmdk::backdrop { background: var(--scrim); }
.cmd-form { margin: 0; }
.cmd-in { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--rule); color: var(--ink-3); }
.cmd-in input::-webkit-search-cancel-button { display: none; }
.cmd-in input { flex: 1; border: 0; background: none; min-height: 52px; font-size: 15px; outline: none; color: var(--ink); }
.cmd-esc { border: 1px solid var(--rule); background: var(--sheet-2); color: var(--ink-3); font: 500 11px var(--mono); padding: 2px 7px; border-radius: 5px; cursor: pointer; }
#cmdk-list { list-style: none; margin: 0; padding: 8px; max-height: min(52vh, 420px); overflow-y: auto; }
#cmdk-list li a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r); color: var(--ink); }
#cmdk-list li a:hover { text-decoration: none; }
#cmdk-list li a .g { margin-left: auto; font-size: 11px; color: var(--ink-3); }
#cmdk-list li a[aria-selected="true"] { background: var(--blue-bg); color: var(--blue); }
#cmdk-list .none { padding: 18px; text-align: center; color: var(--ink-3); }

/* ── 폰: 하단 탭바 ── */
.tabbar { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .top { padding: 10px 14px; }
  .cmd-btn kbd { display: none; }
  main { padding: 4px 14px 96px; }
  .page-head h1 { font-size: 22px; }
  .page-head { margin-bottom: 16px; }
  .sheet { padding: 16px 16px; }
  .cols, .cols.c3 { grid-template-columns: 1fr; }
  table { display: block; max-width: 100%; overflow-x: auto; }
  .facts > div { padding: 13px 16px; }
  .facts .v { font-size: 22px; }
  .bars .bar { grid-template-columns: minmax(70px, 110px) minmax(0, 1fr) 56px; gap: 8px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--sheet); border-top: 1px solid var(--rule); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; border: 0; background: none; color: var(--ink-3); font-size: 11px; font-weight: 500; cursor: pointer; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a.on { color: var(--blue); }
  .tabbar [hidden] { display: none !important; }
  #toast { right: 12px; left: 12px; bottom: 72px; }
  #toast div { max-width: none; }
  dialog#cmdk { margin-top: 6vh; }
  .scan-input { font-size: 20px; }
}
body:has(.rail.locked) .top, body:has(.rail.locked) .tabbar { display: none; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
