/* =========================================================
   향 공방 관리 — 반응형 스타일 (모바일 우선)
   모바일 < 768px: 하단 탭 + 서랍 메뉴, 표는 카드형
   태블릿 768~1023px: 서랍 메뉴 + 하단 탭, 표는 가로 스크롤
   PC ≥ 1024px: 좌측 고정 사이드바
   ========================================================= */
:root {
  --bg: #f6f1ea;
  --surface: #fffdf9;
  --surface-2: #faf6f0;
  --ink: #2d2621;
  --muted: #6b6058;              /* 배경 위 5.4:1 */
  --line: #e6ddd2;               /* 카드 구분선(장식) */
  --line-strong: #9a8d81;        /* 입력칸 테두리: 흰 배경 대비 3.2:1 (WCAG 1.4.11) */
  --accent: #5f6f52;
  --accent-strong: #4b5a40;
  --accent-soft: #e8ecdf;
  --warm: #b7794c;
  --warm-soft: #f6e9dd;
  --warm-ink: #8a5530;           /* 연한 갈색 배경 위 글자 5.1:1 */
  --danger: #a33a2f;
  --danger-soft: #f8e3df;
  --warning-ink: #8a5a12;
  --warning-soft: #fbeed6;
  --success-ink: #36603a;
  --success-soft: #e3efdf;
  --radius: 12px;
  --radius-small: 8px;
  --shadow: 0 1px 2px rgba(45, 38, 33, .05), 0 4px 16px rgba(45, 38, 33, .04);
  --sidebar-width: 232px;
  --bottom-tabs-height: 64px;
  --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
[hidden] { display: none !important; }
.icon { width: 18px; height: 18px; flex: none; }

/* ---------- 레이아웃 ---------- */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: min(84vw, 280px);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  transform: translateX(-100%);
  transition: transform .2s ease;
  padding: 18px 12px calc(12px + env(safe-area-inset-bottom));
}
.sidebar-open .sidebar { transform: none; box-shadow: 8px 0 32px rgba(0, 0, 0, .12); }
.sidebar-backdrop { display: none; }
.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(45, 38, 33, .32); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; }
.brand-center { justify-content: center; padding-bottom: 20px; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 18px;
}
.brand-name { font-size: 16px; letter-spacing: -.01em; }
.side-nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.side-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 10px; color: var(--muted); font-weight: 500;
}
.side-link:hover { background: var(--surface-2); color: var(--ink); }
.side-link.is-active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }
.sidebar-footer { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.user-chip { font-size: 13px; color: var(--muted); }

.main-column { min-width: 0; padding-bottom: calc(var(--bottom-tabs-height) + env(safe-area-inset-bottom) + 16px); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  min-height: 56px; padding: 8px 16px;
  background: rgba(246, 241, 234, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.page-title { font-size: 18px; font-weight: 700; flex: 1; }
.content { padding: 16px; max-width: 1400px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }

.bottom-tabs {
  position: fixed; inset: auto 0 0 0; z-index: 25;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--bottom-tabs-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
}
.bottom-tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font: inherit; font-size: 11px; color: var(--muted); background: none; border: 0; cursor: pointer;
}
.bottom-tab .icon { width: 22px; height: 22px; }
.bottom-tab.is-active { color: var(--accent-strong); font-weight: 700; }

.only-mobile { display: inline-flex; }

@media (min-width: 1024px) {
  .sidebar { transform: none; width: var(--sidebar-width); }
  .sidebar-backdrop, .sidebar-open .sidebar-backdrop { display: none; }
  .main-column { margin-left: var(--sidebar-width); padding-bottom: 32px; }
  .bottom-tabs { display: none; }
  .only-mobile { display: none !important; }
  .topbar { padding: 12px 28px; }
  .content { padding: 24px 28px; gap: 20px; }
  .page-title { font-size: 20px; }
}

/* ---------- 공통 요소 ---------- */
.card, .panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.card-title { font-size: 16px; margin-bottom: 12px; }
.small-title { font-size: 14px; margin-top: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.code {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12px;
  padding: 1px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
  white-space: nowrap;
}
.negative { color: var(--danger); }
.positive { color: var(--success-ink); }
.page-intro { margin: 0; font-size: 13.5px; }
.text-link { color: var(--accent-strong); font-weight: 600; }
.text-link:hover { text-decoration: underline; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.split { display: grid; gap: 16px; }
@media (min-width: 900px) { .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }

.badge {
  display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
  white-space: nowrap;
}
.badge-warning { background: var(--warning-soft); border-color: #f0d9ac; color: var(--warning-ink); }

/* 버튼 */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 16px; border-radius: 10px;
  font: inherit; font-weight: 600; font-size: 14px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); cursor: pointer;
  white-space: nowrap; transition: background .15s, border-color .15s;
}
.button:hover { background: var(--surface-2); border-color: #d6cabc; }
.button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .tab:focus-visible {
  outline: 3px solid rgba(95, 111, 82, .35); outline-offset: 1px;
}
.button-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.button-danger { color: var(--danger); border-color: #ecc5bf; }
.button-danger:hover { background: var(--danger-soft); }
.button-ghost { background: transparent; }
.button-small { min-height: 36px; padding: 0 12px; font-size: 13px; }
@media (pointer: coarse) { .button-small { min-height: 40px; } }
.button-block { width: 100%; }
.icon-button {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 10px; border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer;
}
.icon-button:hover { background: var(--surface-2); color: var(--ink); }
.link-button { display: inline-flex; align-items: center; gap: 8px; padding: 6px 0; border: 0; background: none; font: inherit; color: var(--muted); cursor: pointer; }
.link-button:hover { color: var(--ink); }

/* 폼 */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.grow { flex: 1 1 200px; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.field-label small { font-weight: 400; }
input[type="text"], input[type="search"], input[type="number"], input[type="password"], input[type="tel"],
input[type="date"], input[type="datetime-local"], input[type="file"], select, textarea {
  width: 100%; min-height: 42px; padding: 8px 12px;
  font: inherit; font-size: 16px; /* iOS 확대 방지 */
  color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: 10px;
}
input::placeholder, textarea::placeholder { color: #8a7f77; }
input[type="file"] { padding: 7px 10px; font-size: 14px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.uppercase { text-transform: uppercase; }
.field-row { display: grid; gap: 12px; }
@media (min-width: 560px) {
  .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
fieldset + fieldset { border-top: 1px solid var(--line); padding-top: 16px; }
legend { font-weight: 700; padding: 0; margin-bottom: 4px; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-card { max-width: 860px; display: flex; flex-direction: column; gap: 16px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; }
.form-actions > form { display: contents; }

/* 필터 바 */
.filter-bar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px;
  padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.filter-bar .field { flex: 1 1 140px; }
.filter-bar .category-cascade { flex: 1 1 100%; }
.push-right { margin-left: auto; }
@media (min-width: 1024px) { .filter-bar .category-cascade { flex: 2 1 520px; } }

.category-cascade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 768px) { .category-cascade { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cascade-level.is-disabled { opacity: .45; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 768px) { .quick-actions { display: flex; flex-wrap: wrap; } }

/* 알림 */
.flash {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-small); border: 1px solid transparent; font-weight: 500;
}
.flash-success { background: var(--success-soft); color: var(--success-ink); border-color: #cfe2c9; }
.flash-error { background: var(--danger-soft); color: var(--danger); border-color: #ecc5bf; }
.flash-warning { background: var(--warning-soft); color: var(--warning-ink); border-color: #f0d9ac; }
.flash-close { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; opacity: .7; }
.error-list { margin: 8px 0 0; padding-left: 18px; font-weight: 400; max-height: 240px; overflow: auto; }

/* 통계 카드 */
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 900px) { .stat-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); } }
.stat-card {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.stat-card-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.stat-card-accent .stat-label, .stat-card-accent .stat-sub { color: #fff; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 20px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--muted); }
@media (min-width: 1024px) { .stat-value { font-size: 22px; } }

.panel-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .panel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .panel-wide { grid-column: 1 / -1; } }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.panel-header h2 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row.is-inactive { opacity: .55; }
.actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.empty-inline { color: var(--muted); font-size: 13.5px; padding: 8px 0; margin: 0; list-style: none; }
.empty-state { text-align: center; padding: 40px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty-title { font-weight: 700; margin: 0 0 6px; }
.error-detail { text-align: left; white-space: pre-wrap; font-size: 12px; background: var(--surface-2); padding: 10px; border-radius: 8px; }

/* 표 */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card .table-wrap, .panel .table-wrap { border: 0; border-radius: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table thead th { font-size: 12.5px; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
.table tfoot th { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr.is-inactive td { opacity: .5; }
.table tr.is-low td:first-child { box-shadow: inset 3px 0 0 var(--warm); }
.bar { height: 4px; border-radius: 4px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--warm); border-radius: 4px; }

/* 모바일: 표 → 카드 */
@media (max-width: 639px) {
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td, .table-cards tfoot { display: block; width: 100%; }
  .table-cards tfoot tr { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 10px 12px; }
  .table-cards tfoot th { padding: 0; border: 0; background: none; }
  .table-cards tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .table-cards tbody tr:last-child { border-bottom: 0; }
  .table-cards td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0; text-align: right; }
  .table-cards td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; text-align: left; flex: none; }
  .table-cards td:first-child { display: block; text-align: left; font-size: 15px; padding-bottom: 6px; }
  .table-cards td:first-child::before { display: none; }
  .table-cards td.actions { justify-content: flex-end; padding-top: 8px; }
  .table-cards td.actions::before { display: none; }
  .table-cards .num { text-align: right; }
}

/* 하위 메뉴 · 탭 */
.subnav { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.subnav-link { padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.subnav-link.is-active { color: var(--accent-strong); border-bottom-color: var(--accent); }
.tab-list { display: flex; gap: 4px; margin: -4px 0 14px; overflow-x: auto; padding: 4px; background: var(--surface-2); border-radius: 10px; }
.tab {
  flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 14px; border: 0; border-radius: 8px;
  font: inherit; font-weight: 600; font-size: 14px; color: var(--muted); background: none; cursor: pointer;
}
.tab.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.tab-panel { display: flex; flex-direction: column; gap: 12px; }
.segmented { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment span {
  display: grid; place-items: center; min-height: 44px; border-radius: 10px; border: 1px solid var(--line);
  font-weight: 600; cursor: pointer; background: #fff;
}
.segment input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.segment input:focus-visible + span { outline: 3px solid rgba(95, 111, 82, .35); }

/* 경로(브레드크럼) */
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 14px; }
.crumbs a { padding: 4px 8px; border-radius: 8px; font-weight: 600; color: var(--accent-strong); }
.crumbs a:hover { background: var(--accent-soft); }
.crumbs .icon { width: 14px; height: 14px; color: var(--muted); }

/* ---------- 4단계 분류(밀러 컬럼) ---------- */
.miller {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr);
  gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px;
}
.miller-col {
  scroll-snap-align: start; display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.miller-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.miller-head h2 { font-size: 15px; }
.level-pill { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--warm-soft); color: var(--warm-ink); }
.miller-list { list-style: none; margin: 0; padding: 6px; display: flex; flex-direction: column; gap: 2px; flex: 1; max-height: 60vh; overflow-y: auto; }
.miller-list .empty-inline { padding: 12px 8px; }
.miller-item { border-radius: 10px; }
.miller-item.is-selected { background: var(--accent-soft); }
.miller-item.is-inactive .miller-name { color: var(--muted); text-decoration: line-through; }
.miller-link { display: flex; align-items: center; gap: 8px; padding: 10px; min-height: 44px; border-radius: 10px; }
.miller-link:hover { background: var(--surface-2); }
.miller-item.is-selected .miller-link:hover { background: transparent; }
.miller-name { font-weight: 600; }
.miller-meta { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.miller-link .icon { width: 16px; height: 16px; color: var(--muted); }
.item-tools { padding: 0 10px 10px; }
.item-tools summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent-strong); padding: 2px 0 6px; }
.item-tools[open] summary { margin-bottom: 6px; }
.inline-form { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 8px; }
.tool-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.copy-form .field-label .icon { width: 14px; height: 14px; }
.miller-add { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.miller-add .field-label .icon { width: 14px; height: 14px; }

/* 모바일: 현재 단계 열만 보여주는 드릴다운 */
@media (max-width: 767px) {
  .miller { display: block; }
  .miller-col { display: none; }
  .miller-col.is-current { display: flex; }
  .miller-list { max-height: none; }
}

/* ---------- 상품 선택 상자 · 줄 입력 ---------- */
.product-picker { position: relative; min-width: 0; }
.picker-search.has-value { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.picker-results {
  position: absolute; z-index: 15; left: 0; right: 0; top: calc(100% + 4px);
  margin: 0; padding: 4px; list-style: none; max-height: 300px; overflow-y: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(45, 38, 33, .14);
}
.picker-option { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.picker-option[aria-selected="true"], .picker-option:hover { background: var(--accent-soft); }
.picker-option-title { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.picker-option-path { font-size: 12px; color: var(--muted); }
.picker-empty { padding: 10px; color: var(--muted); font-size: 13px; }

.line-items { display: flex; flex-direction: column; gap: 8px; }
.line-head { display: none; }
.line-item {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: end;
  padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
}
.line-item .product-picker { grid-column: 1 / -1; }
.line-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.line-total { margin-right: auto; font-size: 15px; }
@media (min-width: 768px) {
  .line-head, .line-item { display: grid; grid-template-columns: minmax(0, 3fr) 110px 150px 40px; gap: 8px; align-items: center; }
  .line-head { font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 0 10px; }
  .line-item { padding: 0; border: 0; background: none; }
  .line-item .product-picker { grid-column: auto; }
}
.sale-summary { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 10px; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.sale-summary > div { display: flex; justify-content: space-between; }
.sale-total { font-size: 18px; padding-top: 6px; border-top: 1px solid var(--line); margin-top: 4px; }
.action-card .stock-form { max-width: 760px; }

/* ---------- 로그인/설치 ---------- */
.bare-body { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.bare-card {
  width: min(100%, 460px); background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); padding: 28px 22px; display: flex; flex-direction: column; gap: 14px;
}
.bare-card p { margin: 0; }

@media print {
  .sidebar, .bottom-tabs, .topbar .icon-button, .filter-bar, .toolbar-actions, .actions, .subnav { display: none !important; }
  .main-column { margin: 0; }
  body { background: #fff; }
}

/* ---------- 고객관리 ---------- */
.badge-grade { background: var(--warm-soft); border-color: #ecd3bd; color: var(--warm-ink); }
.badge-success { background: var(--success-soft); border-color: #cfe2c9; color: var(--success-ink); }
.customer-head h2 { font-size: 20px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.customer-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.memo { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.num-block { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.danger-zone { border-color: #ecc5bf; }
.consent { align-items: flex-start; min-height: 0; padding: 6px 0; line-height: 1.5; }
.consent input { margin-top: 2px; }
.customer-picker { padding: 12px; border-radius: 10px; background: var(--surface-2); }
.customer-chip { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); }
.row-editor > summary { list-style: none; }
.row-editor > summary::-webkit-details-marker { display: none; }
.row-editor[open] { flex-basis: 100%; }
.row-editor[open] > form { margin-top: 8px; }
.list-row:has(.row-editor[open]) { flex-wrap: wrap; }
.link-button.small { font-size: 12px; padding: 0; color: var(--accent-strong); font-weight: 600; }

/* ---------- UX 개선 (2026-11-26 디자인 비평 반영) ---------- */
/* 전역 '판매 등록' 버튼 */
.topbar-cta { min-height: 38px; padding: 0 14px; }
@media (max-width: 479px) { .topbar-cta .cta-label-long { display: none; } }

/* 저장 중 상태(중복 제출 방지) */
button[aria-busy="true"] { opacity: .7; cursor: progress; }

/* 결제 바: 모바일에서 화면 아래(하단 탭 위)에 고정되어 합계와 저장 버튼이 항상 보인다 */
.checkout-bar {
  position: sticky; bottom: calc(var(--bottom-tabs-height) + env(safe-area-inset-bottom) + 8px); z-index: 12;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-radius: 12px; background: var(--ink); color: #fff;
  box-shadow: 0 8px 24px rgba(45, 38, 33, .22);
}
.checkout-bar .checkout-label { font-size: 12.5px; opacity: .85; display: block; }
.checkout-bar .checkout-amount { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.checkout-bar .button-primary { min-height: 46px; padding: 0 22px; background: var(--accent); border-color: #8fa07f; }
.checkout-bar .button-ghost { color: #fff; border-color: rgba(255, 255, 255, .35); }
@media (min-width: 1024px) { .checkout-bar { bottom: 16px; } }

/* 접었다 펴는 부가 입력 */
.more-options > summary { cursor: pointer; font-weight: 600; color: var(--accent-strong); padding: 6px 0; min-height: 36px; display: flex; align-items: center; }
.more-options[open] > summary { margin-bottom: 8px; }

/* 판매 화면 고객 빠른 등록 */
.quick-register { margin-top: 4px; }
.quick-register-form { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.inline-error { color: var(--danger); font-size: 13px; font-weight: 600; margin: 0; }

/* 재고 작업 패널: 모바일에서는 접어 두고 재고표를 먼저 보여준다 */
.stock-actions > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; font-weight: 700; }
.stock-actions > summary::-webkit-details-marker { display: none; }
.stock-actions > summary .summary-hint { font-weight: 500; font-size: 13px; color: var(--muted); }
.stock-actions[open] > summary { margin-bottom: 12px; }
.stock-actions > summary .icon { transition: transform .15s; }
.stock-actions[open] > summary .icon { transform: rotate(90deg); }

/* 재고 이력 구분 배지: 들어옴/나감 구분 */
.badge-in { background: var(--success-soft); border-color: #cfe2c9; color: var(--success-ink); }
.badge-out { background: var(--surface-2); color: var(--ink); }
.badge-cancel { background: var(--warning-soft); border-color: #f0d9ac; color: var(--warning-ink); }
