/* =========================================================
   Company Card — "Receipt Ledger" design system
   종이 질감 배경 + 잉크색 사이드 레일 + 시그널 오렌지 포인트
   숫자는 모노스페이스, 요약은 영수증, 일별 추이는 바코드
   ========================================================= */

:root {
  --bg: #f2efe8;
  --surface: #fffdf8;
  --surface-2: #f8f5ee;
  --surface-3: #ece7dc;
  --ink: #17181c;
  --ink-2: #4b4e57;
  --ink-3: #85878d;
  --line: #e4dfd3;
  --line-strong: #cdc6b6;
  --accent: #ff5a1f;
  --accent-ink: #ffffff;
  --accent-soft: #ffe7dc;
  --good: #11845b;
  --good-soft: #dcf1e7;
  --bad: #cf3a31;
  --bad-soft: #fbe4e1;
  --warn: #9a6400;
  --warn-soft: #fbefd3;
  --rail: #fbf9f4;
  --rail-ink: #2a2b30;
  --rail-text: #4b4e57;
  --rail-strong: #17181c;
  --rail-dim: #9a968d;
  --rail-hover: rgba(23, 24, 28, .05);
  --rail-active: #ffece3;
  --rail-line: #e4dfd3;
  --shadow: 0 1px 0 rgba(23, 24, 28, .04), 0 10px 28px -16px rgba(23, 24, 28, .25);
  --shadow-lg: 0 30px 80px -20px rgba(15, 16, 18, .45);
  --radius: 16px;
  --radius-sm: 10px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", system-ui, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0f1012;
  --surface: #17181b;
  --surface-2: #1c1d21;
  --surface-3: #26282d;
  --ink: #eeece6;
  --ink-2: #b7b4ac;
  --ink-3: #7d7b76;
  --line: #2a2c31;
  --line-strong: #3a3d44;
  --accent: #ff6a35;
  --accent-soft: #3b1f14;
  --good: #3cc58d;
  --good-soft: #10291f;
  --bad: #ff6b61;
  --bad-soft: #351513;
  --warn: #e7b04a;
  --warn-soft: #33270f;
  --rail: #0a0b0d;
  --rail-ink: #ece9e2;
  --rail-text: rgba(236, 233, 226, .78);
  --rail-strong: #ffffff;
  --rail-dim: #8e8b84;
  --rail-hover: rgba(255, 255, 255, .05);
  --rail-active: rgba(255, 255, 255, .09);
  --rail-line: rgba(255, 255, 255, .08);
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 30px -18px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #0f1012; --surface: #17181b; --surface-2: #1c1d21; --surface-3: #26282d;
    --ink: #eeece6; --ink-2: #b7b4ac; --ink-3: #7d7b76; --line: #2a2c31; --line-strong: #3a3d44;
    --accent-soft: #3b1f14; color-scheme: dark;
    --rail: #0a0b0d; --rail-ink: #ece9e2; --rail-text: rgba(236, 233, 226, .78); --rail-strong: #ffffff;
    --rail-dim: #8e8b84; --rail-hover: rgba(255, 255, 255, .05); --rail-active: rgba(255, 255, 255, .09);
    --rail-line: rgba(255, 255, 255, .08);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
svg.lucide { width: 18px; height: 18px; stroke-width: 1.9; flex: none; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.ink-2 { color: var(--ink-2); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }

.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--rail); color: var(--rail-ink);
  border-right: 1px solid var(--rail-line);
  padding: 22px 14px 16px;
  overflow-y: auto;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; }
.brand-mark {
  position: relative; width: 38px; height: 26px; border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), #ff9a3d);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15);
}
.brand-mark::after {
  content: ""; position: absolute; left: 6px; top: 8px; width: 10px; height: 8px; border-radius: 2px;
  background: linear-gradient(135deg, #f6dd96, #c8992f);
}
.brand-name { font-weight: 800; letter-spacing: -.01em; font-size: 16px; line-height: 1.1; }
.brand-sub { font-family: var(--mono); font-size: 10.5px; color: var(--rail-dim); letter-spacing: .08em; }

.nav-group { margin-bottom: 18px; }
.nav-title {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--rail-dim); padding: 0 12px 8px;
}
.nav a {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--rail-text); font-size: 14.5px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--rail-hover); color: var(--rail-strong); }
.nav a.is-active { background: var(--rail-active); color: var(--rail-strong); font-weight: 650; }
.nav a.is-active::before {
  content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav a.is-active svg { color: var(--accent); }
.nav .kbd { margin-left: auto; }

.rail-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--rail-line); display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 750; font-size: 12.5px; letter-spacing: -.04em;
}
.av-0 { background: #ff5a1f; }
.av-1 { background: #e5484d; }
.av-2 { background: #d6409f; }
.av-3 { background: #8e4ec6; }
.av-4 { background: #3e63dd; }
.av-5 { background: #0090ff; }
.av-6 { background: #12a594; }
.av-7 { background: #30a46c; }
.av-8 { background: #c2820a; }
.av-9 { background: #6b6f7a; }
.who { min-width: 0; flex: 1; }
.who-name { font-weight: 650; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-role { font-family: var(--mono); font-size: 11px; color: var(--rail-dim); }
.rail-foot button {
  background: none; border: 0; color: var(--rail-dim); padding: 8px; border-radius: 8px; cursor: pointer;
}
.rail-foot button:hover { background: var(--rail-hover); color: var(--rail-strong); }

.stage { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  height: 62px; padding: 0 36px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .menu-btn { display: none; }
.jump {
  display: flex; align-items: center; gap: 10px;
  width: min(380px, 100%); height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  color: var(--ink-3); cursor: pointer; text-align: left;
}
.jump:hover { border-color: var(--line-strong); }
.jump span { flex: 1; font-size: 14px; }
.kbd {
  font-family: var(--mono); font-size: 11px; padding: 2px 6px; border-radius: 6px;
  border: 1px solid var(--line-strong); color: var(--ink-3); background: var(--surface-2);
}
.nav .kbd { border-color: var(--rail-line); background: transparent; color: var(--rail-dim); }
.topbar-spacer { flex: 1; }
.today { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); }

.page { width: 100%; max-width: 1320px; padding: 30px 36px 72px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.eyebrow {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); font-weight: 600; margin-bottom: 6px;
}
.page-title { font-size: clamp(26px, 2.6vw, 34px); font-weight: 800; letter-spacing: -.025em; line-height: 1.15; }
.page-desc { color: var(--ink-2); margin-top: 6px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Building blocks ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 15px; font-weight: 750; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.panel-body { padding: 20px; }
.panel-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }

.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.split { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); align-items: start; }
.split-form { grid-template-columns: minmax(0, 1fr) minmax(280px, 400px); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.mt { margin-top: 18px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 650; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: transform .08s, background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn svg.lucide { width: 16px; height: 16px; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-primary:hover { border-color: var(--ink); box-shadow: 0 6px 16px -8px rgba(0, 0, 0, .5); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { border-color: var(--accent); box-shadow: 0 8px 20px -8px var(--accent); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-danger { color: var(--bad); }
.btn-danger:hover { border-color: var(--bad); background: var(--bad-soft); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.icon-btn { width: 38px; padding: 0; }
.btn-sm.icon-btn { width: 30px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ---------- Forms ---------- */
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 110px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.mono { letter-spacing: .04em; }
.select {
  appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2385878d' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.form { display: grid; gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field > label, .field > .label { display: block; font-size: 13px; font-weight: 650; margin-bottom: 7px; color: var(--ink-2); }
.field .req { color: var(--accent); }
.hint { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.form-actions { display: flex; gap: 8px; align-items: center; padding-top: 4px; }
.form-actions .grow { flex: 1; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.switch {
  appearance: none; width: 42px; height: 24px; border-radius: 999px; flex: none;
  background: var(--line-strong); position: relative; cursor: pointer; transition: background .2s; margin: 0;
}
.switch::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s;
}
.switch:checked { background: var(--accent); }
.switch:checked::before { transform: translateX(18px); }

.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-3); gap: 2px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  padding: 7px 14px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.seg input:checked + label { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.seg a { padding: 7px 14px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.seg a.is-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.seg .count { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }

/* ---------- Notices / chips ---------- */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 16px; margin-bottom: 18px; border-radius: 12px;
  border: 1px solid; font-size: 14px;
}
.notice svg.lucide { margin-top: 2px; }
.notice-ok { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 30%, transparent); color: var(--good); }
.notice-err { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); color: var(--bad); }
.notice-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); }
.notice ul { margin: 6px 0 0; padding-left: 18px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 3px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--surface-3); color: var(--ink-2); white-space: nowrap;
}
.chip svg.lucide { width: 13px; height: 13px; }
.chip-accent { background: var(--accent-soft); color: var(--accent); }
.chip-good { background: var(--good-soft); color: var(--good); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-ink { background: var(--ink); color: var(--bg); }
.chip-outline { background: transparent; border: 1px solid var(--line-strong); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

.filter-chip { cursor: pointer; border: 1px solid var(--line-strong); background: var(--surface); height: 32px; padding: 0 12px; font-size: 13px; }
.filter-chip:hover { border-color: var(--ink-3); }
.filter-chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.filter-chip .sub { font-weight: 500; opacity: .7; }

/* ---------- Month navigator ---------- */
.monthnav {
  display: inline-flex; align-items: center; height: 40px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); overflow: hidden;
}
.monthnav a { display: grid; place-items: center; width: 40px; height: 100%; color: var(--ink-2); }
.monthnav a:hover { background: var(--surface-3); color: var(--ink); }
.monthnav .label { font-family: var(--mono); font-weight: 600; font-size: 14.5px; padding: 0 10px; min-width: 104px; text-align: center; }
.monthnav-wrap { display: flex; align-items: center; gap: 8px; }

/* ---------- Filter bar ---------- */
.filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 12px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.filters .input, .filters .select { width: auto; min-width: 150px; height: 36px; }
.filters .grow { flex: 1; min-width: 180px; }
.filters .btn { height: 36px; }
.toggle-chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong); cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink-2); user-select: none; }
.toggle-chip input { accent-color: var(--accent); margin: 0; }
.toggle-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* ---------- Receipt (요약 카드) ---------- */
.receipt {
  position: relative; background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 22px 24px 26px; margin-bottom: 12px;
  filter: drop-shadow(0 10px 16px rgba(23, 24, 28, .08)) drop-shadow(0 0 0.5px var(--line-strong));
}
.receipt::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -11px; height: 12px;
  background: radial-gradient(circle at 9px 12px, transparent 6.5px, var(--surface) 7px) repeat-x;
  background-size: 18px 12px;
}
.receipt-title { display: flex; align-items: center; justify-content: space-between; font-family: var(--mono); font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.receipt-total { font-family: var(--mono); font-size: clamp(28px, 3vw, 38px); font-weight: 650; letter-spacing: -.03em; margin: 10px 0 2px; line-height: 1.1; }
.receipt-total small { font-size: .45em; font-weight: 500; color: var(--ink-3); margin-left: 4px; letter-spacing: 0; }
.receipt hr { border: 0; border-top: 1.5px dashed var(--line-strong); margin: 14px 0; }
.r-line { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; padding: 2px 0; }
.r-line span:first-child { color: var(--ink-2); }
.r-line span:last-child { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.receipt-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
.receipt-strip > div { padding: 2px 18px; border-left: 1.5px dashed var(--line-strong); }
.receipt-strip > div:first-child { border-left: 0; padding-left: 0; }
.receipt-strip .k { font-size: 12.5px; color: var(--ink-3); }
.receipt-strip .v { font-family: var(--mono); font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.receipt-strip .v.big { font-size: 26px; color: var(--accent); }

/* ---------- Barcode (일별 막대) ---------- */
.barcode { display: grid; grid-template-columns: repeat(var(--n, 31), minmax(0, 1fr)); gap: 3px; align-items: end; height: 132px; }
.barcode .bar {
  position: relative; height: calc(var(--h, 0) * 1%); min-height: 2px;
  background: var(--ink); border-radius: 2px 2px 0 0; transition: background .15s;
}
.barcode .bar.zero { background: var(--line-strong); height: 2px; }
.barcode .bar.weekend { opacity: .45; }
.barcode .bar.today { background: var(--accent); opacity: 1; }
.barcode .bar:hover { background: var(--accent); opacity: 1; }
.barcode .bar:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); font-family: var(--mono); font-size: 11.5px;
  padding: 4px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 5;
}
.barcode-axis { display: grid; grid-template-columns: repeat(var(--n, 31), minmax(0, 1fr)); gap: 3px; margin-top: 6px; font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
.barcode-axis span { text-align: center; visibility: hidden; }
.barcode-axis span.show { visibility: visible; }

/* ---------- KPI ---------- */
.kpi { padding: 18px 20px; }
.kpi .label { font-size: 13px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-family: var(--mono); font-size: 26px; font-weight: 650; letter-spacing: -.03em; margin-top: 6px; line-height: 1.15; }
.kpi .sub { font-size: 13px; color: var(--ink-2); margin-top: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.delta { font-family: var(--mono); font-weight: 600; font-size: 12.5px; padding: 2px 7px; border-radius: 6px; }
.delta.up { background: var(--bad-soft); color: var(--bad); }
.delta.down { background: var(--good-soft); color: var(--good); }
.delta.flat { background: var(--surface-3); color: var(--ink-2); }

.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; width: calc(var(--p, 0) * 1%); background: var(--good); border-radius: 99px; }

/* ---------- Ranking ---------- */
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.rank li:last-child { border-bottom: 0; }
.rank .no { font-family: var(--mono); font-size: 12px; color: var(--ink-3); font-weight: 600; }
.rank .name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank .name small { font-weight: 500; color: var(--ink-3); margin-left: 6px; }
.rank .amt { font-family: var(--mono); font-size: 13.5px; font-weight: 600; text-align: right; }
.rank .amt small { display: block; font-weight: 500; color: var(--ink-3); font-size: 11.5px; }
.meter { height: 5px; border-radius: 99px; background: var(--surface-3); margin-top: 6px; overflow: hidden; }
.meter > i { display: block; height: 100%; width: calc(var(--p, 0) * 1%); background: var(--ink-2); border-radius: 99px; }
.rank li:first-child .meter > i { background: var(--accent); }
.empty { padding: 28px 12px; text-align: center; color: var(--ink-3); font-size: 14px; }
.empty svg.lucide { width: 28px; height: 28px; display: block; margin: 0 auto 8px; opacity: .6; }

/* ---------- Trend (월별) ---------- */
.trend { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; align-items: end; height: 210px; }
.trend .col { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; height: 100%; gap: 6px; min-width: 0; }
.trend .v { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); text-align: center; }
.trend .b { height: calc(var(--h, 0) * 1%); min-height: 3px; background: var(--surface-3); border-radius: 8px 8px 3px 3px; border: 1px solid var(--line-strong); }
.trend .col.is-current .b { background: var(--accent); border-color: var(--accent); }
.trend .col.is-current .v { color: var(--accent); font-weight: 650; }
.trend .m { font-family: var(--mono); font-size: 12px; text-align: center; color: var(--ink-2); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; font-size: 12px; font-weight: 650; color: var(--ink-3); letter-spacing: .02em;
  padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; white-space: nowrap; }
.table th.num { text-align: right; }
.table .nowrap { white-space: nowrap; }
.table .strong { font-weight: 650; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions form { display: inline; }
.table .sub { display: block; font-size: 12.5px; color: var(--ink-3); }
.table.compact td { padding: 8px 12px; }
.table.dense { font-size: 13px; }
.table.dense td { padding: 7px 12px; white-space: nowrap; }
.table th.mapped { color: var(--accent); }
.table th .role { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: .08em; }
.table tr.is-invalid td { background: var(--bad-soft); }
.table tr.is-unclassified td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.cell-select { height: 32px; font-size: 13px; padding: 0 30px 0 10px; min-width: 150px; background-position: right 10px center; }
.cell-input { height: 32px; font-size: 13px; min-width: 160px; }
.save-state { width: 22px; display: inline-grid; place-items: center; color: var(--ink-3); }
.save-state.ok { color: var(--good); }
.save-state.err { color: var(--bad); }
.save-state.busy svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.merchant { font-weight: 600; }
.card-tag { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }

.pager { display: flex; gap: 4px; justify-content: center; align-items: center; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 34px; height: 34px; padding: 0 10px; border-radius: 9px;
  display: inline-grid; place-items: center; font-family: var(--mono); font-size: 13px; color: var(--ink-2);
}
.pager a:hover { background: var(--surface-3); }
.pager .is-on { background: var(--ink); color: var(--bg); }

/* ---------- Credit card tiles ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(282px, 1fr)); gap: 20px; }
.ccard {
  --c1: #1d1f24; --c2: #44474f;
  position: relative; aspect-ratio: 1.586; border-radius: 18px; padding: 18px 20px;
  display: flex; flex-direction: column; justify-content: space-between;
  color: #fff; overflow: hidden; isolation: isolate;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: 0 18px 34px -18px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(255, 255, 255, .08);
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s;
}
.ccard::before {
  content: ""; position: absolute; z-index: -1; width: 240px; height: 240px; right: -90px; top: -110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .18), transparent 65%);
}
.ccard::after {
  content: ""; position: absolute; z-index: -1; inset: 0;
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, .035) 0 2px, transparent 2px 9px);
}
a.ccard:hover { transform: translateY(-4px) rotate(-.6deg); box-shadow: 0 26px 40px -18px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(255, 255, 255, .12); }
.tone-0 { --c1: #1b1c20; --c2: #464a53; }
.tone-1 { --c1: #ff5a1f; --c2: #b8360b; }
.tone-2 { --c1: #0d5a43; --c2: #16946f; }
.tone-3 { --c1: #1c2655; --c2: #3c55a8; }
.tone-4 { --c1: #4b1e50; --c2: #9a3f88; }
.tone-5 { --c1: #7c5d24; --c2: #c9a25a; }
.ccard-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ccard-issuer { font-weight: 800; font-size: 15px; letter-spacing: -.01em; }
.ccard-company { font-size: 11.5px; opacity: .75; margin-top: 2px; }
.ccard-chip { width: 40px; height: 30px; border-radius: 7px; background: linear-gradient(135deg, #f5dc95, #c3922e); position: relative; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.ccard-chip::before { content: ""; position: absolute; inset: 9px 0; border-top: 1px solid rgba(0, 0, 0, .25); border-bottom: 1px solid rgba(0, 0, 0, .25); }
.ccard-number { font-family: var(--mono); font-size: 17px; letter-spacing: .14em; text-shadow: 0 1px 1px rgba(0, 0, 0, .25); white-space: nowrap; }
.ccard-bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.ccard-label { font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; opacity: .65; text-transform: uppercase; }
.ccard-owner { font-weight: 700; font-size: 14.5px; }
.ccard-exp { font-family: var(--mono); font-size: 13px; text-align: right; }
.ccard-limit { font-family: var(--mono); font-size: 11.5px; opacity: .8; text-align: right; }
.ccard.is-off { filter: grayscale(1) brightness(.9); opacity: .78; }
.ccard-stamp {
  position: absolute; right: 72px; top: 20px; transform: rotate(-10deg);
  font-family: var(--mono); font-weight: 800; font-size: 13px; letter-spacing: .18em;
  padding: 4px 10px; border: 2px solid rgba(255, 255, 255, .85); border-radius: 6px; color: #fff;
}
.ccard-add {
  aspect-ratio: 1.586; border-radius: 18px; border: 2px dashed var(--line-strong);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--ink-3); font-weight: 650; transition: border-color .15s, color .15s, background .15s;
}
.ccard-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.ccard-add svg.lucide { width: 26px; height: 26px; }

.card-preview-wrap { position: sticky; top: 90px; }
.card-preview-wrap .ccard { max-width: 380px; }

/* ---------- Upload ---------- */
.drop {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 48px 24px; text-align: center; border-radius: 20px;
  border: 2px dashed var(--line-strong); background: var(--surface);
  transition: border-color .15s, background .15s; cursor: pointer;
}
.drop:hover, .drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--ink); color: var(--bg); }
.drop-icon svg.lucide { width: 26px; height: 26px; }
.drop-title { font-size: 18px; font-weight: 750; }
.steps { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--ink-3); }
.steps .step { display: inline-flex; align-items: center; gap: 6px; }
.steps .step b { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-family: var(--mono); font-size: 11.5px; background: var(--surface-3); color: var(--ink-2); }
.steps .step.is-on { color: var(--ink); font-weight: 650; }
.steps .step.is-on b { background: var(--accent); color: #fff; }
.steps .sep { width: 24px; height: 1px; background: var(--line-strong); }
.mapping { display: flex; flex-wrap: wrap; gap: 8px; }
.scroll-y { max-height: 520px; overflow: auto; }

.upload-list { list-style: none; margin: 0; padding: 0; }
.upload-list a { display: block; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.upload-list a:hover { background: var(--surface-2); }
.upload-list a.is-on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.upload-list .fn { font-weight: 650; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-list .meta { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }

/* ---------- Dashboard ---------- */
.hello { font-size: clamp(26px, 3vw, 36px); font-weight: 800; letter-spacing: -.03em; line-height: 1.2; }
.hello em { font-style: normal; color: var(--accent); }
.cta {
  display: flex; flex-direction: column; justify-content: space-between; gap: 14px; height: 100%;
  padding: 20px 22px; border-radius: var(--radius); background: var(--ink); color: var(--bg);
  position: relative; overflow: hidden;
}
.cta::after { content: ""; position: absolute; right: -40px; bottom: -60px; width: 180px; height: 180px; border-radius: 50%; border: 28px solid rgba(255, 90, 31, .35); }
.cta .big { font-family: var(--mono); font-size: 44px; font-weight: 700; letter-spacing: -.04em; line-height: 1; }
.cta .big small { font-size: 16px; font-weight: 500; opacity: .7; margin-left: 4px; }
.cta .btn { align-self: flex-start; background: var(--accent); border-color: var(--accent); color: #fff; position: relative; z-index: 1; }
.cta.done::after { border-color: rgba(60, 197, 141, .35); }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.quick a {
  display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 650; font-size: 14px;
  transition: border-color .15s, transform .15s;
}
.quick a:hover { border-color: var(--ink-3); transform: translateY(-1px); }
.quick .qi { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); }
.tx-list { list-style: none; margin: 0; padding: 0; }
.tx-list li { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 20px; border-bottom: 1px solid var(--line); }
.tx-list li:last-child { border-bottom: 0; }
.tx-date { font-family: var(--mono); text-align: center; line-height: 1.1; }
.tx-date b { display: block; font-size: 17px; }
.tx-date span { font-size: 10.5px; color: var(--ink-3); }
.tx-main { min-width: 0; }
.tx-main .merchant { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.tx-amt { font-family: var(--mono); font-weight: 650; text-align: right; }

/* ---------- Palette ---------- */
.palette-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(15, 16, 18, .42); backdrop-filter: blur(3px); display: none; }
.palette-backdrop.is-open { display: block; animation: fade .12s ease-out; }
.palette {
  width: min(580px, calc(100% - 32px)); margin: 12vh auto 0; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg);
  animation: pop .16s cubic-bezier(.2, .9, .3, 1.2);
}
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.palette-input input { flex: 1; height: 58px; border: 0; outline: 0; background: transparent; font-size: 17px; }
.palette-list { list-style: none; margin: 0; padding: 8px; max-height: 360px; overflow-y: auto; }
.palette-list li a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; font-weight: 550; }
.palette-list li a .grp { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.palette-list li.is-sel a { background: var(--accent-soft); color: var(--accent); }
.palette-foot { display: flex; gap: 14px; padding: 10px 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- Toast ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 15px; border-radius: 12px; font-size: 14px; font-weight: 550;
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg);
  animation: pop .18s ease-out;
}
.toast.err { background: var(--bad); color: #fff; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art {
  position: relative; overflow: hidden; background: #17181c; color: #ece9e2;
  padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
}
.login-art::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(600px 400px at 85% 15%, rgba(255, 90, 31, .28), transparent 70%),
              radial-gradient(500px 400px at 10% 100%, rgba(255, 154, 61, .12), transparent 70%);
}
.login-art > * { position: relative; }
.login-headline { font-size: clamp(32px, 4vw, 52px); font-weight: 800; letter-spacing: -.035em; line-height: 1.12; max-width: 520px; }
.login-headline em { font-style: normal; color: #ff7a45; }
.login-sub { color: #9a978f; margin-top: 14px; max-width: 420px; }
.fan { position: relative; height: 300px; margin: 30px 0; }
.fan .ccard { position: absolute; width: 300px; left: 50%; top: -30px; transform-origin: 50% 120%; }
.fan .ccard:nth-child(1) { transform: translateX(-50%) rotate(-20deg) translateX(-140px); }
.fan .ccard:nth-child(2) { transform: translateX(-50%) rotate(-9deg) translateX(-60px); }
.fan .ccard:nth-child(3) { transform: translateX(-50%) rotate(2deg) translateX(18px); }
.fan .ccard:nth-child(4) { transform: translateX(-50%) rotate(13deg) translateX(92px); }
.login-art:hover .fan .ccard:nth-child(1) { transform: translateX(-50%) rotate(-24deg) translateX(-175px); }
.login-art:hover .fan .ccard:nth-child(2) { transform: translateX(-50%) rotate(-11deg) translateX(-75px); }
.login-art:hover .fan .ccard:nth-child(3) { transform: translateX(-50%) rotate(4deg) translateX(30px); }
.login-art:hover .fan .ccard:nth-child(4) { transform: translateX(-50%) rotate(17deg) translateX(125px); }
.login-foot { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: #77746d; font-family: var(--mono); }
.login-foot a:hover { color: #fff; }
.login-main { display: flex; align-items: center; justify-content: center; padding: 48px 24px; background: var(--bg); }
.login-box { width: 100%; max-width: 380px; }
.login-box h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.login-box .page-desc { margin-bottom: 26px; }
.login-box .btn { width: 100%; height: 46px; font-size: 15px; }
.login-box .input { height: 46px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }

/* ---------- Error ---------- */
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; text-align: center; }
.error-code { font-family: var(--mono); font-size: 96px; font-weight: 800; letter-spacing: -.05em; line-height: 1; color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .receipt-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; }
  .receipt-strip > div:nth-child(3) { border-left: 0; padding-left: 0; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; left: 0; top: 0; width: 272px; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .rail { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 35; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .today { display: none; }
  .page { padding: 22px 16px 56px; }
  .cols-2, .cols-3, .split, .split-form { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-art { padding: 28px 20px; }
  .fan { height: 200px; }
  .fan .ccard { width: 230px; }
  .card-preview-wrap { position: static; }
}
@media (max-width: 560px) {
  .cols-4 { grid-template-columns: minmax(0, 1fr); }
  .receipt-strip { grid-template-columns: minmax(0, 1fr); }
  .receipt-strip > div { border-left: 0; padding-left: 0; }
  .jump span { display: none; }
  .jump { width: auto; }
  .filters .input, .filters .select { min-width: 0; width: 100%; }
  .filters .grow { min-width: 0; }
  .trend { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
