/* 와인장 공통 스타일 — 화이트 컨셉: 흰 바탕·먹색 글자·포인트 샴페인 골드 + 버건디
   규칙: 색은 토큰만 쓴다(직접 hex 금지). 글꼴은 화면=Pretendard, 손님용 차림장=Noto Serif KR.
   다크 모드는 기본이 아니라 선택([data-theme=dark]). */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");

:root {
  --bg: #ffffff;
  --paper: #faf8f4;        /* 살짝 따뜻한 종이색 (카드 배경·섹션 구분) */
  --ink: #1c1b19;          /* 먹색 */
  --ink-2: #5c5852;
  --ink-3: #8c877e;
  --line: #e8e3da;
  --line-2: #d6cfc2;
  --gold: #c6a35f;         /* 샴페인 골드 */
  --gold-2: #a9884a;
  --gold-soft: #f6f0e2;
  --burg: #6f1d2b;         /* 버건디 */
  --burg-2: #8d2f3f;
  --burg-soft: #f4e8ea;
  --ok: #2f7a4f;  --ok-soft: #e7f2ea;
  --warn: #b7791f; --warn-soft: #fbf1df;
  --err: #b3261e;  --err-soft: #f9e6e4;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(28,27,25,.05), 0 8px 24px rgba(28,27,25,.06);
  --font: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --serif: "Noto Serif KR", "Nanum Myeongjo", "Apple Myungjo", serif;
  --topbar-h: 56px;
}
:root[data-theme="dark"] {
  --bg: #171615; --paper: #1f1d1b; --ink: #f1ece3; --ink-2: #c9c2b6; --ink-3: #8f887c;
  --line: #2d2a26; --line-2: #3a3631; --gold-soft: #2b261c; --burg-soft: #2d1a1e;
  --ok-soft: #1c2b22; --warn-soft: #2d2415; --err-soft: #2d1b1a;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 15px; line-height: 1.5; letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
p { margin: 0; }
.muted { color: var(--ink-3); }
.sub { color: var(--ink-2); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.serif { font-family: var(--serif); }
.gold { color: var(--gold-2); } .burg { color: var(--burg); }
.right { text-align: right; } .center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 32px; }
.mb-2 { margin-bottom: 12px; }
.hide { display: none !important; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── 레이아웃 ───────────────────────────────────────────── */
.wrap { max-width: 1080px; margin: 0 auto; padding: 20px 16px 80px; }
.wrap.narrow { max-width: 560px; }
.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar-h);
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .inner { max-width: 1080px; margin: 0 auto; padding: 0 16px; height: 100%; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--serif); font-weight: 600; font-size: 19px; letter-spacing: 0.02em; white-space: nowrap; flex: none; }   /* 폰 폭에서 탭에 밀려 «와/인/장» 세로로 꺾이지 않게 */
.brand .mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--gold); position: relative; }
.brand .mark::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--burg); }
.brand .gname { font-family: var(--font); font-weight: 500; font-size: 14px; color: var(--ink-2); margin-left: 4px; max-width: 36vw; overflow: hidden; text-overflow: ellipsis; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-left: auto; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 8px 11px; border-radius: 999px; font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.tabs a:hover { background: var(--paper); }
.tabs a.active { color: var(--burg); background: var(--burg-soft); font-weight: 600; }
.tabs a .badge { margin-left: 4px; }
.usermenu { position: relative; }
.usermenu .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--gold-soft); color: var(--gold-2); display: grid; place-items: center; font-weight: 600; font-size: 13px; cursor: pointer; border: 1px solid var(--line); }
.usermenu .menu { position: absolute; right: 0; top: 40px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 180px; padding: 6px; display: none; }
.usermenu.open .menu { display: block; }
.usermenu .menu a, .usermenu .menu button { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: var(--radius-sm); background: none; border: 0; cursor: pointer; font-size: 14px; }
.usermenu .menu a:hover, .usermenu .menu button:hover { background: var(--paper); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--serif); font-weight: 600; font-size: 24px; }
.page-head .desc { color: var(--ink-3); font-size: 13px; margin-top: 2px; }

/* ── 버튼 ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--bg); color: var(--ink); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: var(--paper); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--burg); border-color: var(--burg); color: #fff; }
.btn-primary:hover { background: var(--burg-2); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-2); }
.btn-ghost { border-color: transparent; }
.btn-ghost:hover { background: var(--paper); }
.btn-danger { color: var(--err); border-color: var(--err-soft); background: var(--err-soft); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }

/* ── 입력 ───────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.field .hint { font-size: 12px; color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--bg); outline: none; transition: border-color .12s, box-shadow .12s;
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.input.sm, .select.sm { height: 34px; font-size: 13px; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.search {
  display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 14px; border: 1px solid var(--line-2);
  border-radius: 999px; background: var(--bg); box-shadow: var(--shadow);
}
.search input { flex: 1; border: 0; outline: 0; background: transparent; height: 100%; font-size: 16px; }
.search .icon { color: var(--ink-3); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 14px; }
.form-grid .span2 { grid-column: span 2; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span2 { grid-column: span 1; } }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--burg); }
.switch { position: relative; width: 42px; height: 24px; border-radius: 999px; background: var(--line-2); cursor: pointer; transition: background .15s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch.on { background: var(--burg); } .switch.on::after { left: 21px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 999px; height: 36px; overflow: hidden; }
.stepper button { width: 36px; height: 100%; border: 0; background: var(--bg); cursor: pointer; font-size: 18px; color: var(--ink-2); }
.stepper button:hover { background: var(--paper); }
.stepper .val { min-width: 40px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.range { width: 100%; accent-color: var(--burg); }

/* ── 카드·리스트·표 ─────────────────────────────────────── */
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.paper { background: var(--paper); border-color: transparent; }
.card.flat { box-shadow: none; }
.card + .card { margin-top: 12px; }
.card-title { font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.list { display: flex; flex-direction: column; }
.list > .item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.list > .item:hover { background: var(--paper); }
.list > .item:last-child { border-bottom: 0; }
.thumb { width: 44px; height: 58px; border-radius: 6px; background: var(--paper); border: 1px solid var(--line); object-fit: cover; flex: none; display: grid; place-items: center; color: var(--ink-3); font-size: 11px; }
.thumb.sq { width: 44px; height: 44px; }
.wine-name { font-weight: 600; line-height: 1.3; }
.wine-sub { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.qty { font-variant-numeric: tabular-nums; font-weight: 600; }
.qty.zero { color: var(--err); }
.qty.low { color: var(--warn); }
.price { font-variant-numeric: tabular-nums; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-size: 12px; color: var(--ink-3); font-weight: 500; letter-spacing: .02em; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr:hover td { background: var(--paper); }
.table .editable:focus { outline: 2px solid var(--gold-soft); background: var(--gold-soft); }
.grid { display: grid; gap: 12px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 760px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }
.stat { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.stat .k { font-size: 12px; color: var(--ink-3); }
.stat .v { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; letter-spacing: -0.02em; }
.stat .v small { font-size: 13px; color: var(--ink-3); font-weight: 500; margin-left: 2px; }
.empty { padding: 40px 16px; text-align: center; color: var(--ink-3); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.empty .big { font-size: 28px; margin-bottom: 6px; }
/* 빈 상태 표식(이모지 대신): 골드 원 + 버건디 점 — 차림장 .m-empty .mark 와 같은 모양 */
.empty .mark { display: block; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--gold); position: relative; margin: 0 auto 10px; }
.empty .mark::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--burg); }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.section-title { font-family: var(--serif); font-size: 13px; letter-spacing: .12em; color: var(--gold-2); text-transform: uppercase; margin: 18px 0 8px; }

/* ── 칩·배지 ───────────────────────────────────────────── */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg); font-size: 13px; cursor: pointer; user-select: none; }
.chip:hover { background: var(--paper); }
.chip.on { background: var(--burg-soft); border-color: var(--burg); color: var(--burg); font-weight: 500; }
.chip.gold.on { background: var(--gold-soft); border-color: var(--gold); color: var(--gold-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--paper); color: var(--ink-2); letter-spacing: .01em; }
.badge-burg { background: var(--burg-soft); color: var(--burg); }
.badge-gold { background: var(--gold-soft); color: var(--gold-2); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-err { background: var(--err-soft); color: var(--err); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.red { background: #8b2237; } .dot.white { background: #e9dfa6; border: 1px solid var(--line-2); } .dot.rose { background: #e8a0a8; }
.dot.sparkling { background: #d8c98a; } .dot.orange { background: #d98b3b; } .dot.sweet { background: #c99a2e; } .dot.fortified { background: #6a3b1f; }
.dot.traditional { background: #b9b09a; } .dot.sake { background: #cfd8dc; } .dot.spirit { background: #8a5a2b; } .dot.nonalc { background: #9bc3a2; }

/* ── 모달·토스트·시트 ───────────────────────────────────── */
.modal-bg { position: fixed; inset: 0; background: rgba(28,27,25,.45); z-index: 100; display: flex; align-items: flex-end; justify-content: center; padding: 0; }
@media (min-width: 640px) { .modal-bg { align-items: center; padding: 20px; } }
.modal { background: var(--bg); width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 18px 18px 24px; box-shadow: var(--shadow); }
@media (min-width: 640px) { .modal { border-radius: 14px; } }
.modal.wide { max-width: 960px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h2 { font-size: 17px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow); animation: toast-in .18s ease-out; }
.toast.err { background: var(--err); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fab { position: fixed; right: 18px; bottom: 22px; z-index: 60; height: 52px; padding: 0 20px; border-radius: 999px; background: var(--burg); color: #fff; border: 0; font-size: 15px; font-weight: 600; box-shadow: var(--shadow); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.fab:hover { background: var(--burg-2); }
.sheet-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.sheet-tabs button { background: none; border: 0; padding: 10px 12px; cursor: pointer; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 14px; }
.sheet-tabs button.active { color: var(--burg); border-bottom-color: var(--burg); font-weight: 600; }
.skeleton { background: linear-gradient(90deg, var(--paper), var(--line), var(--paper)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 6px; min-height: 14px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ── 인쇄 공통 ─────────────────────────────────────────── */
@media print {
  .topbar, .fab, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .wrap { padding: 0; max-width: none; }
}

/* 안내 상자 (출납장·시세장·운영 화면 공용) */
.hint-box { font-size: 13px; color: var(--ink-2); background: var(--paper); border-radius: var(--radius); padding: 10px 12px; line-height: 1.5; }

/* ── 소셜 로그인 버튼 (로그인·가입 화면) ─────────────────────
   «색은 토큰만» 규칙의 유일한 예외 — 각 브랜드 가이드가 정한 색(Google #fff/#dadce0 · Apple #000)을 그대로 쓴다. (카카오는 원장 지시로 뺌)
   로고는 인라인 SVG(이모지 아님). 폭 100% · 높이 48 · 둥글기 radius-sm · 글자 15/600. 다크 테마는 Google·Apple 만 반전. */
.social { display: flex; flex-direction: column; gap: 10px; }
.social-or { display: flex; align-items: center; gap: 12px; margin: 18px 0 12px; color: var(--ink-3); font-size: 13px; }
.social-or::before, .social-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sbtn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: 48px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 15px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: filter .12s, transform .05s;
}
.sbtn svg { width: 18px; height: 18px; flex: none; }
.sbtn:hover { filter: brightness(.96); }
.sbtn:active { transform: translateY(1px); }
.sbtn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sbtn:disabled { opacity: .45; cursor: not-allowed; }
.sbtn-google { background: #fff; border-color: #dadce0; color: #1f1f1f; }
.sbtn-apple { background: #000; border-color: #000; color: #fff; }          /* 로고는 currentColor → 흰색 */
:root[data-theme="dark"] .sbtn-google { background: #131314; border-color: #8e918f; color: #e3e3e3; }
:root[data-theme="dark"] .sbtn-apple { background: #fff; border-color: #fff; color: #000; }   /* 로고 검정 */
