:root {
  --bg: #eef0f4;
  --orb-1: #c7d2fe;
  --orb-2: #fde2c8;
  --orb-3: #bae6fd;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.75);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  --blur: blur(22px) saturate(170%);
  --surface: rgba(255, 255, 255, 0.6);
  --surface-2: rgba(255, 255, 255, 0.4);
  --border: rgba(15, 23, 42, 0.07);
  --border-strong: rgba(15, 23, 42, 0.12);
  --text: #111827;
  --text-2: #4b5563;
  --text-3: #8b93a1;
  --primary: #2f5bd3;
  --primary-hover: #2549b0;
  --primary-soft: rgba(47, 91, 211, 0.1);
  --ink: #111827;
  --on-ink: #ffffff;
  --pos: #15803d;
  --pos-soft: rgba(22, 163, 74, 0.1);
  --neg: #dc2626;
  --shadow: 0 8px 32px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-w: 248px;
  --field: rgba(15, 23, 42, 0.045);
  --field-hover: rgba(15, 23, 42, 0.07);
  --gold: #9a7b34;
  --hairline: rgba(15, 23, 42, 0.08);
  --switch-on: #111827;
  --topbar: rgba(255, 255, 255, 0.86);
  --modal-bg: rgba(255, 255, 255, 0.94);
  --modal-backdrop: rgba(15, 23, 42, 0.14);
  --modal-blur: blur(5px);
  --modal-shadow: 0 30px 80px rgba(15, 23, 42, 0.16), 0 2px 8px rgba(15, 23, 42, 0.06);
  color-scheme: light;
}

html.dark-mode {
  --bg: #0a0d14;
  --orb-1: #1e2a5a;
  --orb-2: #3a2a1c;
  --orb-3: #0f3a4a;
  --glass: rgba(24, 29, 42, 0.5);
  --glass-strong: rgba(24, 29, 42, 0.72);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --surface: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --text: #eceff5;
  --text-2: #a9b1c0;
  --text-3: #6b7485;
  --primary: #6e95ff;
  --primary-hover: #8eadff;
  --primary-soft: rgba(110, 149, 255, 0.14);
  --ink: #eceff5;
  --on-ink: #0a0d14;
  --pos: #4ade80;
  --pos-soft: rgba(74, 222, 128, 0.1);
  --neg: #f87171;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --field: rgba(255, 255, 255, 0.05);
  --field-hover: rgba(255, 255, 255, 0.08);
  --gold: #d6bb78;
  --hairline: rgba(255, 255, 255, 0.08);
  --switch-on: #6e95ff;
  --topbar: rgba(14, 18, 28, 0.86);
  --modal-bg: rgba(24, 29, 42, 0.72);
  --modal-backdrop: rgba(5, 8, 14, 0.4);
  --modal-blur: blur(5px);
  --modal-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Pretendard', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
a { color: inherit; text-decoration: none; }
body::before, body::after, .app::before {
  content: ""; position: fixed; z-index: -1; border-radius: 50%;
  filter: blur(90px); opacity: 0.7; pointer-events: none;
}
body::before { width: 520px; height: 520px; top: -140px; left: 120px; background: var(--orb-1); }
body::after { width: 460px; height: 460px; bottom: -160px; right: -80px; background: var(--orb-2); }
.app::before { width: 380px; height: 380px; top: 40%; left: 45%; background: var(--orb-3); opacity: 0.5; }
.muted { color: var(--text-3); }
.pos { color: var(--pos) !important; }
.neg { color: var(--neg) !important; }

.icon {
  width: 18px; height: 18px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.content { padding: 24px 28px 48px; max-width: 1400px; width: 100%; }
.page-section { display: none; }
.page-section.active { display: block; animation: fadeIn 0.2s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: var(--glass); color: var(--text-2);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-right: 1px solid var(--glass-border);
  display: flex; flex-direction: column; padding: 20px 14px;
  z-index: 50; overflow-y: auto;
  transition: transform 0.25s ease;
}
.sidebar-brand { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 4px 8px 22px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--ink);
  color: var(--on-ink); font-weight: 800; font-size: 18px;
  display: grid; place-items: center;
}
.brand-name { color: var(--text); font-weight: 800; font-size: 16px; letter-spacing: 0.08em; }
.nav-label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); padding: 16px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; margin-bottom: 2px;
  background: none; border: 0; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 14px; font-weight: 500;
  cursor: pointer; text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--glass-strong); color: var(--text); font-weight: 600; box-shadow: var(--glass-highlight); }
.nav-item.active .icon { color: var(--primary); }

.sidebar-backdrop { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 28px; min-height: 68px;
  background: var(--topbar);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--glass-border);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadcrumb { font-size: 12px; color: var(--text-3); }
.breadcrumb span { color: var(--text-2); }
.topbar h1 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.topbar-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-2); cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.menu-btn { display: none; }
.icon-sun { display: none; }
html.dark-mode .icon-sun { display: block; }
html.dark-mode .icon-moon { display: none; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 20px; border-radius: var(--radius); background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--glass-border); box-shadow: var(--glass-highlight), var(--shadow); }
.kpi { padding: 20px 24px; min-width: 0; }
.kpi + .kpi { border-left: 1px solid var(--hairline); }
.kpi-label { font-size: 11px; color: var(--text-3); font-weight: 600; letter-spacing: 0.08em; margin-bottom: 10px; }
.kpi-value { font-size: 24px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-accent .kpi-label { color: var(--primary); }
.kpi-accent .kpi-value { color: var(--text); }

.panel { background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--glass-border); border-radius: var(--radius); box-shadow: var(--glass-highlight), var(--shadow); min-width: 0; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px 4px; flex-wrap: wrap; }
.panel-title { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.panel-body { padding: 16px 24px 24px; }
.panel-footer { padding: 18px 24px 24px; border-top: 1px solid var(--hairline); }
.panel-footer .form-group { margin-bottom: 10px; }

.calc-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; margin-bottom: 20px; }
.side-stack { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 88px; }
.toolbar { display: flex; align-items: center; gap: 6px; }

.form-section { padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--hairline); }
.form-section:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.form-section-head { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; margin-bottom: 14px; }
.form-section-head small { font-weight: 500; color: var(--text-3); font-size: 12px; }
.step { font-size: 12px; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }

.field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; min-width: 0; }
.field-grid .form-group { margin-bottom: 0; }
.form-group label { font-size: 12px; font-weight: 500; color: var(--text-3); }
input[type="number"], input[type="text"], input[type="password"], select {
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--field); border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 14px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:hover, select:hover { background: var(--field-hover); }
input:focus, select:focus { background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input::placeholder { color: var(--text-3); }

.info-box { margin-top: 18px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); font-size: 13px; }
.info-box div { display: flex; flex-direction: column; gap: 2px; padding-right: 12px; }
.info-box div + div { padding-left: 16px; border-left: 1px solid var(--hairline); }
.info-box span { font-size: 11.5px; color: var(--text-3); }
.info-box strong { color: var(--text); font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.info-box .hl strong { color: var(--primary); }

.sales-group-box { margin-bottom: 10px; }
.sales-group-row { display: flex; align-items: flex-end; gap: 10px; }
.sales-group-row .form-group { flex: 1; margin-bottom: 0; }
.discount-check-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.discount-check-col label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.discount-check-col input { width: 18px; height: 18px; margin: 10px 0; accent-color: var(--primary); cursor: pointer; }
.btn-remove-group {
  width: 38px; height: 38px; flex-shrink: 0;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-3); font-size: 18px; cursor: pointer;
}
.btn-remove-group:hover { color: var(--neg); background: var(--field); }

.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; margin: 4px 0; font-size: 13.5px; font-weight: 500; }
.toggle-row > label:first-child { cursor: pointer; }
.toggle-wrapper { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows 0.3s ease, opacity 0.3s ease; }
.toggle-wrapper.show { grid-template-rows: 1fr; opacity: 1; }
.toggle-inner { overflow: hidden; }

.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; cursor: pointer; background: var(--border-strong); border-radius: 22px; transition: 0.2s; }
.slider::before { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: 0.2s; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.switch input:checked + .slider { background: var(--switch-on); }
.switch input:checked + .slider::before { transform: translateX(16px); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn .icon { width: 16px; height: 16px; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; height: 44px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
html.dark-mode .btn-primary, html.dark-mode .btn-ebay { color: var(--on-ink); }
.btn-dark { background: var(--ink); color: var(--on-ink); }
.btn-dark:hover { opacity: 0.9; }
.btn-outline { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-outline:hover { background: var(--field); color: var(--text); }
.btn-add { height: auto; padding: 6px 2px; background: transparent; border: 0; color: var(--primary); font-size: 13px; font-weight: 600; }
.btn-add:hover { text-decoration: underline; text-underline-offset: 3px; }
.btn-link { background: none; border: 0; padding: 4px 8px; font-size: 13px; font-weight: 600; cursor: pointer; border-radius: 6px; }
.btn-link.edit { color: var(--primary); }
.btn-link.del { color: var(--neg); }
.btn-link:hover { background: var(--field); }

.result-total { display: flex; flex-direction: column; gap: 2px; padding: 4px 0 20px; margin-bottom: 18px; border-bottom: 1px solid var(--hairline); }
.result-total span { font-size: 11px; color: var(--text-3); font-weight: 600; letter-spacing: 0.08em; }
.result-total strong { font-size: 34px; font-weight: 700; color: var(--text); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.sub-title { font-size: 11px; font-weight: 600; color: var(--text-3); letter-spacing: 0.08em; margin: 6px 0 6px; }
.group-margins-list { font-size: 13px; margin-bottom: 14px; }
.group-row { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; }
.group-row:last-child { border-bottom: 0; }
.group-row small { color: var(--neg); }
.group-row strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.result-list { margin: 0 0 14px; }
.result-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13.5px; }
.result-list > div:last-child { border-bottom: 0; }
.result-list dt { color: var(--text-2); }
.result-list dt small { color: var(--text-3); }
.result-list dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.result-list .strong { margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--hairline); }
.result-list .strong dt { color: var(--text); font-weight: 600; }

.split-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.split-row { display: flex; align-items: center; gap: 8px; }
.split-row input[type="text"] { width: 88px; flex-shrink: 0; }
.split-row input[type="number"] { width: 70px; flex-shrink: 0; }
.split-row .pct { color: var(--text-3); }
.split-row .amt { flex: 1; text-align: right; font-weight: 700; color: var(--pos); font-variant-numeric: tabular-nums; white-space: nowrap; }
.split-summary { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--text-2); flex-wrap: wrap; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; color: var(--text-3); padding: 14px 24px 10px; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
.data-table td { padding: 14px 24px; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: var(--field); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .title-cell { font-weight: 600; white-space: normal; min-width: 160px; }
.data-table .title-cell small { display: block; font-weight: 500; color: var(--neg); font-size: 12px; }
.data-table .date-cell { color: var(--text-3); font-size: 12.5px; }
.data-table .empty { text-align: center; color: var(--text-3); padding: 40px 20px; }
.badge { display: inline-block; white-space: nowrap; padding: 1px 7px; border-radius: 5px; font-size: 11.5px; font-weight: 600; background: var(--pos-soft); color: var(--pos); }
.badge.warn { background: rgba(217, 119, 6, 0.12); color: #d97706; }
.badge.minus { background: rgba(220, 38, 38, 0.1); color: var(--neg); }

.search-bar-sm { margin-bottom: 0; width: 240px; max-width: 100%; }
.search-bar-sm input { height: 32px; }
.inv-table td { vertical-align: middle; }
.inv-thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; display: block; border: 1px solid var(--border); }
.inv-thumb-empty { display: grid; place-items: center; background: var(--surface-2); color: var(--text-3); }
.inv-thumb-empty .icon { width: 18px; height: 18px; }
.inv-table tr.is-sold td:not(.cell-sold):not(:last-child) { opacity: 0.55; }
.sold-cell { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sold-info { display: flex; align-items: center; gap: 6px; }
.sold-sum { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.sale-line { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 10px; }
.sale-line .form-group { flex: 1; margin-bottom: 0; }

.sale-modal { max-width: 440px; padding-top: 28px; }
.sale-modal input[type="number"] { height: 42px; }
.sale-product { display: flex; align-items: center; gap: 12px; padding: 0 0 16px; margin-bottom: 16px; border-bottom: 1px solid var(--hairline); }
.sale-product-thumb { width: 48px; height: 48px; flex-shrink: 0; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: var(--surface-2); color: var(--text-3); }
.sale-product-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sale-product-info { min-width: 0; }
.sale-product-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sale-product-meta { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.sale-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--hairline); font-size: 12px; color: var(--text-3); letter-spacing: 0.04em; }
.sale-total strong { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.sale-sub { display: flex; justify-content: space-between; align-items: baseline; padding-top: 6px; font-size: 12px; color: var(--text-3); }
.sale-sub strong { font-size: 14px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.sale-modal .login-msg { margin-top: 8px; }
.sale-modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sale-modal-actions .btn { height: 44px; }
.btn-success { background: #1f8a4c; color: #fff; }
.btn-success:hover { background: #197340; }
html.dark-mode .btn-success { background: #22c55e; color: #052e14; }
html.dark-mode .btn-success:hover { background: #4ade80; }
.badge.draft { background: var(--primary-soft); color: var(--primary); }
.source-tag { margin-right: 6px; vertical-align: 1px; font-size: 11px; }
.badge.cat-tag { margin-right: 6px; vertical-align: 1px; font-size: 11px; background: var(--field); color: var(--text-2); }
.cat-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 24px 4px; }
.cat-tab { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: transparent; color: var(--text-2); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.cat-tab:hover { background: var(--field); color: var(--text); }
.cat-tab.active { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.cat-tab span { font-variant-numeric: tabular-nums; font-weight: 500; opacity: 0.65; }
.cat-tab.cat-manage { border-style: dashed; color: var(--text-3); }
.cat-tab.cat-manage:hover { color: var(--primary); border-color: var(--primary); background: transparent; }
.label-row { display: flex; align-items: center; justify-content: space-between; }
.label-row .btn-link { padding: 0 4px; font-size: 12px; }
.category-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; max-height: 300px; overflow-y: auto; }
.category-row { display: flex; align-items: center; gap: 8px; }
.category-row input { flex: 1; min-width: 0; }
.category-row .count { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.category-empty { font-size: 13px; text-align: center; padding: 12px 0; }
.category-hint { margin-top: 14px; font-size: 12px; line-height: 1.6; color: var(--text-3); }
.category-hint .btn-link { padding: 0 2px; font-size: 12px; }
.record-cat-name { margin: -8px 0 12px; text-align: center; font-size: 13px; font-weight: 600; color: var(--text-2); }
.check-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--field); cursor: pointer; font-size: 14px; }
.check-row:hover { background: var(--field-hover); }
.check-row input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.cat-edit { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table tr.excluded td:not(.cell-switch):not(.cell-actions):not(.cell-cat) { opacity: 0.45; }

.inv-modal { max-width: 420px; padding-top: 28px; }
.inv-modal-title { font-size: 17px; font-weight: 700; text-align: center; margin-bottom: 18px; }
.inv-modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inv-modal input[type="text"], .inv-modal input[type="number"] { height: 42px; }
.inv-modal-section { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; padding-top: 12px; border-top: 1px solid var(--hairline); font-size: 13px; font-weight: 700; }
.inv-modal-section small { font-weight: 500; font-size: 11.5px; color: var(--text-3); }
.inv-cost-note { min-height: 18px; margin: -4px 0 10px; font-size: 12px; line-height: 1.5; color: var(--primary); font-variant-numeric: tabular-nums; }
.inv-cost-note:empty { margin: 0; min-height: 0; }
.photo-upload { position: relative; display: grid; place-items: center; width: 132px; height: 132px; margin: 0 auto 6px; border-radius: 16px; border: 1px solid transparent; background: var(--field); cursor: pointer; overflow: hidden; transition: border-color 0.15s; }
.photo-upload:hover { background: var(--field-hover); }
.photo-upload img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.photo-upload.has-photo { border-style: solid; }
.photo-upload.has-photo img { display: block; }
.photo-upload.has-photo .photo-placeholder { display: none; }
.photo-placeholder { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-3); }
.photo-placeholder .icon { width: 26px; height: 26px; }
.photo-remove { display: none; margin: 0 auto 10px; }
.btn-login { height: 38px; }

.won-icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.modal-backdrop.login-backdrop { background: var(--modal-backdrop); backdrop-filter: var(--modal-blur); -webkit-backdrop-filter: var(--modal-blur); }
.login-modal { position: relative; width: 100%; max-width: 380px; padding: 36px 28px 28px; border-radius: 20px; background: var(--modal-bg); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--glass-border); box-shadow: var(--glass-highlight), var(--modal-shadow); animation: loginIn 0.25s ease-out; }
@keyframes loginIn { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
.login-mark { width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 14px; }
.login-mark .won-icon { width: 26px; height: 26px; }
.login-title { text-align: center; font-size: 18px; font-weight: 800; letter-spacing: 0.08em; }
.login-sub { text-align: center; margin: 4px 0 24px; color: var(--text-3); font-size: 13px; }
.login-modal input[type="text"], .login-modal input[type="password"] { height: 44px; }
.login-remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); margin: 4px 0 12px; cursor: pointer; }
.login-remember input { accent-color: var(--primary); }
.login-msg { min-height: 18px; margin: 0 0 10px; font-size: 13px; color: var(--neg); }

.user-area { display: flex; align-items: center; gap: 8px; }
.user-chip { max-width: 140px; padding: 0 4px 0 2px; display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--pos); flex-shrink: 0; }
.admin-badge { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border: 1px solid var(--gold); border-radius: 6px; background: transparent; color: var(--gold); font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; cursor: pointer; white-space: nowrap; }
.admin-badge .icon { width: 14px; height: 14px; }
.admin-badge:hover { background: color-mix(in srgb, var(--gold) 10%, transparent); }
.admin-badge.static { cursor: default; }
.login-switch { margin-top: 14px; text-align: center; font-size: 13px; color: var(--text-3); }
.login-msg.ok { color: var(--pos); }
.signup-modal { max-width: 420px; padding-top: 28px; }
.signup-modal input[type="text"], .signup-modal input[type="password"] { height: 42px; }
.pw-rules { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.pw-rules li { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; color: var(--text-3); transition: color 0.15s; }
.pw-rules li::before { content: "·"; width: 10px; text-align: center; font-weight: 700; }
.pw-rules li.ok { color: var(--pos); }
.pw-rules li.ok::before { content: "✓"; }
.field-hint { margin: 2px 0 0; min-height: 16px; font-size: 12px; }
.field-hint.ok { color: var(--pos); }
.field-hint.bad { color: var(--neg); }
.admin-modal { max-width: 760px; padding-top: 28px; }
.admin-modal-head { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 12px; }
.admin-modal-head .inv-modal-title { margin-bottom: 0; }
.admin-modal-body { text-align: left; }
.admin-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.admin-section-head h3 { font-size: 15px; font-weight: 700; }
.admin-stats { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.code-issue { display: flex; gap: 8px; }
.code-issue input { flex: 1; }
.code-issue .btn { height: 40px; flex-shrink: 0; }
.code-table-wrap { margin: 4px -28px 0; max-height: 46vh; overflow-y: auto; }
.code-table th:first-child, .code-table td:first-child { padding-left: 28px; }
.code-table th:last-child, .code-table td:last-child { padding-right: 28px; }
.code-text { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 13px; letter-spacing: 0.04em; }
.code-memo { display: block; color: var(--text-3) !important; font-weight: 500; margin-top: 2px; }
.code-user { font-weight: 600; }
.code-table tr.is-used .code-text { color: var(--text-3); }

.btn-save-cloud { background: var(--primary); color: #fff; }
.btn-save-cloud:hover { background: var(--primary-hover); }
html.dark-mode .btn-save-cloud { color: var(--on-ink); }
.cloud-status { font-size: 12px; font-weight: 500; color: var(--text-3); white-space: nowrap; margin-right: 4px; }

.kpi-grid.kpi-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-grid.kpi-grid-3 .kpi + .kpi { border-left: 1px solid var(--hairline); border-top: 0; }
.cal-header { padding-bottom: 12px; }
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-title { min-width: 120px; text-align: center; font-size: 17px; font-variant-numeric: tabular-nums; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-weekday { padding: 8px 12px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; color: var(--text-3); border-bottom: 1px solid var(--hairline); }
.cal-weekday.sun, .cal-day.sun .cal-date { color: var(--neg); }
.cal-weekday.sat, .cal-day.sat .cal-date { color: var(--primary); }
.cal-days { border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }
.cal-day { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-height: 108px; padding: 8px; border: 0; border-right: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); background: transparent; text-align: left; cursor: pointer; color: var(--text); transition: background 0.15s; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day:hover { background: var(--field); }
.cal-day.other { opacity: 0.4; }
.cal-date { font-size: 13px; font-weight: 600; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font-variant-numeric: tabular-nums; }
.cal-day.today .cal-date { background: var(--ink); color: var(--on-ink) !important; }
.cal-chips { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-chip { display: block; padding: 2px 6px; border-radius: 4px; font-size: 11.5px; font-weight: 500; background: var(--primary-soft); color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-more { font-size: 11px; color: var(--text-3); padding-left: 4px; }
.cal-dots { display: none; gap: 3px; justify-content: center; }
.cal-dots .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); }
.day-modal { max-width: 880px; padding: 24px 28px 28px; display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.day-modal-head { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 16px; padding-right: 24px; padding-left: 24px; }
.day-modal-head .inv-modal-title { margin-bottom: 0; min-width: 220px; }
.day-modal-body { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 28px; min-height: 0; flex: 1; }
.day-col-list { overflow-y: auto; min-height: 240px; max-height: calc(100vh - 170px); padding-right: 6px; }
.day-section { margin-bottom: 18px; }
.day-section-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--hairline); padding-bottom: 6px; }
.day-section-head .sub-title { margin: 0; }
.day-count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.day-list { list-style: none; margin: 0; padding: 0; }
.day-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--hairline); }
.day-list li:last-child { border-bottom: 0; }
.day-item-main { display: flex; flex-direction: column; min-width: 0; }
.day-item-main strong { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.day-item-main span { font-size: 12.5px; color: var(--text-3); overflow-wrap: anywhere; }
.day-empty { color: var(--text-3); font-size: 13px; }
.day-add { align-self: start; padding: 18px; border-radius: var(--radius-sm); background: var(--field); }
.day-add .form-group input { background: var(--surface); }
input[type="date"] { width: 100%; height: 40px; padding: 0 12px; background: var(--field); border: 1px solid transparent; border-radius: var(--radius-sm); font-size: 14px; outline: none; }

.login-msg.info { color: var(--text-2); }

.single-connect { margin-bottom: 20px; }
.single-connect-body { display: flex; align-items: center; gap: 28px; padding: 24px; }
.single-connect-body.compact { padding: 16px 24px; }
.single-connect-text { display: flex; flex-direction: column; gap: 8px; min-width: 0; align-items: flex-start; }
.single-connect-text .panel-title { font-size: 17px; }
.single-connect-text p { margin: 0; font-size: 13px; }
.single-steps { margin: 4px 0 8px; padding-left: 18px; color: var(--text-2); font-size: 13.5px; line-height: 1.8; }
.single-qr { width: 200px; height: 200px; flex-shrink: 0; padding: 10px; border-radius: 14px; background: #fff; display: grid; place-items: center; }
.single-qr svg { width: 100%; height: 100%; }
.single-qr.small { width: 96px; height: 96px; padding: 6px; border-radius: 10px; }
body:not(.is-mobile) .mobile-only { display: none !important; }
body.is-mobile .pc-only { display: none !important; }
.single-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.single-actions .btn { min-width: 120px; height: 42px; }
.ms-top strong { display: flex; align-items: center; gap: 8px; }
.ms-done { border: 0; border-radius: 10px; padding: 8px 14px; background: rgba(255,255,255,0.14); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; }
.single-url { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px !important; overflow-wrap: anywhere; }
.single-status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--text-3); letter-spacing: 0.02em; }
.single-status.on { color: var(--pos); }
.single-status .pulse { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.single-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.single-summary { position: sticky; top: 88px; }
.single-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.single-empty { grid-column: 1 / -1; text-align: center; padding: 48px 16px; color: var(--text-3); font-size: 13.5px; }
.single-card { display: flex; flex-direction: column; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--glass-border); overflow: hidden; transition: opacity 0.15s; }
.single-card.unsold .single-photo img { filter: grayscale(1); opacity: 0.45; }
.single-card.unsold .single-fields input[type="number"] { text-decoration: line-through; color: var(--text-3); }
.single-photo { position: relative; aspect-ratio: 63 / 88; background: var(--field); display: grid; place-items: center; font-size: 12px; }
.single-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.single-no { position: absolute; left: 8px; top: 8px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; background: rgba(0,0,0,0.6); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.single-remove { position: absolute; right: 6px; top: 6px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: rgba(0,0,0,0.55); color: #fff; font-size: 16px; cursor: pointer; }
.single-fields { display: flex; flex-direction: column; gap: 6px; padding: 10px; }
.single-fields input[type="text"], .single-fields input[type="number"] { height: 36px; font-size: 13px; }
.single-unsold { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.single-unsold input { accent-color: var(--neg); width: 16px; height: 16px; }

body.ms-open { overflow: hidden; }
.mobile-single { position: fixed; inset: 0; z-index: 900; display: flex; flex-direction: column; background: #07090d; color: #fff; padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px); }
.ms-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; font-size: 14px; }
.ms-count { font-size: 13px; color: rgba(255,255,255,0.7); font-variant-numeric: tabular-nums; }
.ms-login { margin: auto 24px; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.ms-login .btn-dark { background: #fff; color: #07090d; }
.ms-camera { position: relative; flex: 1; min-height: 0; margin: 0 12px; border-radius: 16px; overflow: hidden; background: #000; }
.ms-camera video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ms-camera-msg { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; font-size: 14px; line-height: 1.6; color: rgba(255,255,255,0.8); }
.ms-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.ms-flash.on { animation: flash 0.25s ease-out; }
@keyframes flash { from { opacity: 0.7; } to { opacity: 0; } }
.ms-strip { display: flex; gap: 8px; overflow-x: auto; padding: 12px; min-height: 92px; align-items: center; }
.ms-strip-empty { font-size: 12.5px; color: rgba(255,255,255,0.5); margin: 0 auto; }
.ms-thumb { position: relative; flex-shrink: 0; width: 52px; height: 72px; border-radius: 6px; overflow: hidden; }
.ms-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ms-thumb button { position: absolute; right: 2px; top: 2px; width: 20px; height: 20px; border: 0; border-radius: 50%; background: rgba(0,0,0,0.65); color: #fff; font-size: 13px; line-height: 1; }
.ms-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 4px 24px 12px; }
.ms-shutter { width: 74px; height: 74px; border-radius: 50%; border: 4px solid rgba(255,255,255,0.9); background: #fff; box-shadow: inset 0 0 0 3px #07090d; cursor: pointer; }
.ms-shutter:active { transform: scale(0.94); }
.ms-side-btn { justify-self: start; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 10px; border: 0; border-radius: 12px; background: rgba(255,255,255,0.1); color: #fff; font-size: 12px; font-weight: 600; cursor: pointer; }
.ms-upload { justify-self: end; background: #2f5bd3; min-width: 72px; }
.ms-upload:disabled { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.4); }
.ms-msg { margin: 0; min-height: 20px; padding: 0 18px 10px; text-align: center; font-size: 13px; color: rgba(255,255,255,0.85); }
.ms-close { position: absolute; right: 14px; top: 64px; border: 0; border-radius: 8px; padding: 6px 10px; background: rgba(255,255,255,0.15); color: #fff; font-size: 12px; }

.pw-field { position: relative; }
.pw-field input { padding-right: 44px; }
.pw-toggle { position: absolute; top: 0; right: 0; width: 44px; height: 100%; display: grid; place-items: center; border: 0; background: transparent; color: var(--text-3); cursor: pointer; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.pw-toggle:hover { color: var(--text); }
.pw-toggle .icon { width: 18px; height: 18px; }
.pw-toggle .icon-eye-off { display: none; }
.pw-toggle.showing .icon-eye { display: none; }
.pw-toggle.showing .icon-eye-off { display: block; }

.search-bar { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border: 1px solid transparent; border-radius: var(--radius-sm); background: var(--field); margin-bottom: 20px; }
.search-bar:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search-bar .icon { color: var(--text-3); }
.search-bar input { flex: 1; min-width: 0; border: 0 !important; box-shadow: none !important; padding: 0; background: transparent !important; }

.set-grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; align-items: start; }
.set-item { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.set-item:hover { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.set-logo-wrapper { height: 60px; width: 100%; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.set-logo { max-width: 100%; max-height: 100%; object-fit: contain; }
.set-name { font-size: 13px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.set-count { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.set-expanded-area, .result-header { grid-column: 1 / -1; }
.set-expanded-area { background: var(--surface-2); border: 1px solid var(--primary); border-radius: var(--radius); padding: 20px; margin: 4px 0 8px; animation: fadeIn 0.2s ease-out; }
.result-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.result-actions { display: flex; gap: 6px; }
.expanded-title { font-size: 15px; font-weight: 700; margin: 0; }
.btn-close-expanded { height: 32px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-close-expanded:hover { color: var(--text); background: var(--bg); }

.loading-box, .state-box { grid-column: 1 / -1; text-align: center; padding: 48px 20px; color: var(--text-3); }
.state-box.error { color: var(--neg); }
.spinner { width: 28px; height: 28px; margin: 0 auto 12px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: rotate 0.8s linear infinite; }
@keyframes rotate { to { transform: rotate(360deg); } }

.pokemon-card-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.pokemon-card-item { display: flex; flex-direction: column; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; transition: border-color 0.15s, transform 0.15s; }
.pokemon-card-item:hover { border-color: var(--primary); transform: translateY(-2px); }
.pokemon-card-img-wrapper { aspect-ratio: 63 / 88; border-radius: 6px; overflow: hidden; background: var(--surface-2); margin-bottom: 8px; }
.pokemon-card-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pokemon-card-name { font-size: 13px; font-weight: 600; margin: 0 0 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pokemon-card-number { font-size: 12px; color: var(--text-3); }

.modal-backdrop { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(2, 6, 23, 0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 1000; }
.card-detail-content { position: relative; width: 100%; max-width: 420px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--modal-bg); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--glass-border); box-shadow: var(--glass-highlight), var(--shadow); border-radius: 16px; padding: 28px 24px 24px; display: flex; flex-direction: column; align-items: center; animation: fadeIn 0.2s ease-out; }
.btn-modal-close { position: absolute; top: 10px; right: 12px; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--text-3); font-size: 22px; cursor: pointer; z-index: 2; }
.btn-modal-close:hover { background: var(--surface-2); color: var(--text); }
.card-3d-wrapper { width: 100%; max-width: 260px; aspect-ratio: 63 / 88; perspective: 1000px; margin-bottom: 20px; }
.card-detail-img { width: 100%; height: 100%; object-fit: contain; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.25); transition: transform 0.1s ease-out; }
.card-detail-info { width: 100%; text-align: center; }
.card-detail-info h3 { font-size: 18px; font-weight: 700; margin-bottom: 2px; }
.card-detail-info p { margin: 0 0 16px; font-size: 13px; }
.price-box { padding: 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.price-text { font-size: 16px; font-weight: 700; color: var(--pos); margin-bottom: 10px; }
.price-text small { font-size: 12px; font-weight: 500; color: var(--text-3); }
.price-text.none { color: var(--text-3); }
.btn-ebay { width: 100%; height: 40px; border: 0; border-radius: var(--radius-sm); background: var(--primary); color: #fff; font-weight: 600; cursor: pointer; }
.btn-ebay:hover { background: var(--primary-hover); }

@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi + .kpi { border-left: 0; }
  .kpi:nth-child(even) { border-left: 1px solid var(--hairline); }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--hairline); }
}
@media (max-width: 1024px) {
  .calc-layout { grid-template-columns: minmax(0, 1fr); }
  .single-layout { grid-template-columns: minmax(0, 1fr); }
  .single-summary { position: static; }
  .side-stack { position: static; }
}
@media (max-width: 860px) {
  .main { margin-left: 0; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; background: var(--glass-strong); box-shadow: 0 0 40px rgba(0,0,0,0.25); }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(2, 6, 23, 0.5); z-index: 45; }
  .menu-btn { display: grid; }
  .topbar { padding: 12px 16px; min-height: 60px; }
  .content { padding: 16px 16px 40px; }
  .field-grid { grid-template-columns: minmax(0, 1fr); }
  .toolbar { width: 100%; }
  .toolbar .search-bar-sm { flex: 1; width: auto; }
  .search-bar-sm { width: 100%; }
  .breadcrumb { display: none; }
}
@media (max-width: 560px) {
  .kpi { padding: 14px 16px; }
  .kpi-value { font-size: 18px; }
  .info-box div + div { padding-left: 0; border-left: 0; }
  .info-box div { padding: 6px 0; }
  .result-total strong { font-size: 28px; }
  .panel-body { padding: 14px 16px 18px; }
  .panel-header { padding: 16px 16px 2px; }
  .cat-tabs { padding: 10px 16px 2px; }
  .panel-footer { padding: 16px; }
  .info-box { grid-template-columns: minmax(0, 1fr); }
  .sales-group-row { gap: 8px; }
  .set-grid-container, .pokemon-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .set-expanded-area { padding: 14px; }
  .data-table th, .data-table td { padding: 10px 12px; }
}

@media (max-width: 640px) {
  .topbar { gap: 10px; }
  .topbar h1 { font-size: 17px; }
  .btn-login { width: 38px; padding: 0; }
  .btn-login-text { display: none; }
  .kpi-grid-3 .kpi-value { font-size: 15px; }
  .cal-day { min-height: 64px; padding: 6px 4px; align-items: center; }
  .cal-chips { display: none; }
  .cal-dots { display: flex; }
  .cal-weekday { padding: 8px 0; text-align: center; }
  .cal-title { min-width: 96px; font-size: 15px; }
  .cal-header .btn-primary { width: 100%; }
  .user-chip { max-width: 90px; padding: 0 10px; }
  .admin-badge span { display: none; }
  .admin-badge { width: 34px; padding: 0; justify-content: center; }
  .admin-badge.static span { display: inline; }
  .admin-badge.static { width: auto; padding: 0 12px; }
  .toolbar { flex-wrap: wrap; }
  .toolbar .btn { flex: 1; }
  .panel-header .toolbar .search-bar-sm { flex-basis: 100%; }

  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tbody tr { position: relative; padding: 14px 16px; border-bottom: 1px solid var(--border); }
  .data-table tbody tr:last-child { border-bottom: 0; }
  .data-table tbody tr:hover td { background: transparent; }
  .data-table td { padding: 3px 0; border: 0; white-space: normal; text-align: right; }
  .data-table td[data-label] { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .data-table td[data-label]::before { content: attr(data-label); color: var(--text-3); font-size: 12.5px; font-weight: 500; text-align: left; flex-shrink: 0; }
  .data-table .title-cell { text-align: left; font-size: 15px; padding-bottom: 6px; min-width: 0; }
  .data-table .cell-actions { text-align: left; padding-top: 8px; margin-left: -8px; }
  .data-table .cell-cat .cat-edit { padding-right: 0; max-width: 60%; }
  .data-table .empty { text-align: center; }

  .inv-table tbody tr { padding-left: 76px; min-height: 84px; }
  .inv-table .cell-photo { position: absolute; left: 16px; top: 14px; width: auto; padding: 0; }
  .inv-thumb { width: 48px; height: 48px; }
  .inv-table td.cell-sold { align-items: flex-start; }
  .inv-table .cell-sold .sold-cell { flex-direction: column; align-items: flex-end; gap: 6px; }
  .inv-table .sold-info { flex-wrap: wrap; justify-content: flex-end; }
  .sold-sum { white-space: nowrap; }
  .inv-table tr.is-sold td:not(.cell-sold):not(:last-child) { opacity: 1; }
  .inv-table tr.is-sold .title-cell { opacity: 0.6; }

  .modal-backdrop { padding: 12px; align-items: flex-end; }
  .login-modal { max-height: calc(100vh - 24px); overflow-y: auto; padding: 26px 18px 20px; border-radius: 20px; }
  .code-table-wrap { margin: 4px -18px 0; max-height: none; }
  .code-table tbody tr { padding-left: 18px; padding-right: 18px; }
  .code-issue { flex-direction: column; }
  .single-connect-body { flex-direction: column; align-items: flex-start; gap: 16px; padding: 18px 16px; }
  .single-actions { width: 100%; }
  .single-actions .btn { flex: 1; }
  .single-qr { width: 180px; height: 180px; align-self: center; }
  .single-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .day-modal { padding: 20px 16px 18px; max-height: calc(100vh - 24px); overflow-y: auto; }
  .day-modal-body { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .day-col-list { max-height: none; min-height: 0; overflow: visible; padding-right: 0; }
  .day-modal-head .inv-modal-title { min-width: 0; font-size: 15px; }
  .code-table th:first-child, .code-table td:first-child, .code-table th:last-child, .code-table td:last-child { padding-left: 0; padding-right: 0; }
}
