/* 매출 분석 대시보드 — 2026-09 리뉴얼
   예림 브랜드 컬러(Deep Navy / Brown / Dusty Pink) 기반. 휴대폰 우선, 1024px 이상에서 사이드바 레이아웃. */
:root {
  color-scheme: light;
  /* 2026-10-15 디자인 D(애플 스타일): 예전 이름(navy/pink)은 그대로 두고 값만 강조색/옅은 강조색으로 바꿈 */
  --navy: #0071e3;        /* 강조(버튼·선택) */
  --navy-2: #0077ed;
  --navy-3: #0062c4;
  --brown: #6e6e73;
  --pink: #e8f1fc;        /* 옅은 강조(선택 배경) */
  --pink-soft: #f2f2f7;

  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --line: #e5e5ea;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;

  --base: #0071e3;      /* 기준기간 계열 */
  --base-soft: #e8f1fc;
  --cmp: #aeaeb2;       /* 비교기간 계열 */
  --cmp-soft: #f2f2f7;
  --up: #248a3d;
  --up-soft: #e6f4ea;
  --down: #d70015;
  --down-soft: #fdecee;

  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.18);

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  --sidebar-w: 252px;
  --tabbar-h: 64px;
  --font: "Pretendard Variable", "Pretendard", -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg.ic { width: 18px; height: 18px; flex: none; stroke-width: 2; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* ───────── 공통 버튼 ───────── */
.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);
  background: var(--surface); font-weight: 600;
  transition: background-color 160ms ease, transform 120ms var(--ease-out), box-shadow 160ms ease;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.ghost { background: transparent; }
.icon-button {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  border: 0; background: rgba(255, 255, 255, 0.1); color: inherit;
  transition: background-color 160ms ease, transform 120ms var(--ease-out);
}
.icon-button:active { transform: scale(0.94); }
.icon-button.ghost { background: transparent; }
.icon-button:disabled svg { opacity: 0.5; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { box-shadow: var(--shadow); }
  .btn.primary:hover { background: var(--navy-2); }
  .icon-button:hover { background: rgba(255, 255, 255, 0.18); }
  .icon-button.ghost:hover { background: var(--surface-2); }
}

/* ───────── 레이아웃 ───────── */
.app { min-height: 100dvh; }
.main { min-width: 0; }
.sidebar { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
  background: transparent; color: #fff;
}
/* 유리는 ::before에 — 상단바 자체에 backdrop-filter를 걸면 안쪽 계정 메뉴의 흐림이 막힘 */
.topbar::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: rgba(29, 39, 56, 0.78);
  -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
}
.topbar-logo img { display: block; height: 22px; }
.period-button {
  position: relative; order: 3; flex: 1 0 100%; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 12px; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.08); text-align: left;
  transition: background-color 160ms ease;
}
.period-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.period-base, .period-cmp { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.period-base { font-weight: 700; font-size: 13px; }
.period-cmp { font-size: 11.5px; color: var(--pink); }
.filter-badge {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--pink); color: var(--navy);
  font-size: 11px; font-weight: 800; display: grid; place-items: center;
}
.topbar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.account { position: relative; }
.account-button {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 4px; border: 0; background: none;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--pink); color: var(--navy); font-weight: 800;
}
.account-name { display: none; font-weight: 600; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; width: 260px;
  padding: 8px; border-radius: 14px; background: rgba(255, 255, 255, 0.9); color: var(--text);
  -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow-lg); transform-origin: top right;
}
.account-menu-name { margin: 6px 10px 8px; font-weight: 700; }
.menu-row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border: 0; border-radius: 10px;
  background: none; color: var(--text); text-decoration: none; text-align: left; font-size: 14px;
}
@media (hover: hover) and (pointer: fine) { .menu-row:hover { background: var(--surface-2); } }
.pw-change-panel { padding: 4px 10px 10px; }
.pw-change-panel form { display: grid; gap: 8px; }
.pw-change-panel label { display: grid; gap: 4px; font-size: 12.5px; color: var(--text-2); }
.pw-change-panel input { height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; }
.form-msg { margin: 0; font-size: 12.5px; min-height: 1em; }
.form-msg.error { color: var(--down); }
.form-msg.success { color: var(--up); }

/* 휴대폰: 메뉴 묶음 안의 화면 전환 알약 */
.subnav {
  display: flex; gap: 6px; padding: 10px 14px 4px; overflow-x: auto; scrollbar-width: none;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav:empty { display: none; }
.subnav button {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  font-weight: 600; font-size: 13px; transition: background-color 180ms ease, color 180ms ease;
}
.subnav button svg { width: 16px; height: 16px; }
.subnav button.active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* 적용된 조건 칩 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px 0; }
.chips:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  height: 32px; padding: 0 6px 0 12px; border-radius: 999px;
  background: var(--pink-soft); color: var(--brown); font-weight: 600; font-size: 12.5px;
  border: 1px solid #ecd6cf;
}
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip b { font-weight: 500; color: var(--text-3); margin-right: 2px; }
.chip button {
  display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 50%; background: none; color: inherit;
}
.chip button svg { width: 14px; height: 14px; }

.content { padding: 12px 14px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); outline: none; }

/* 하단 탭바 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(var(--tabs, 4), 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tab {
  position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; background: none; color: var(--text-3); font-size: 11px; font-weight: 600;
  transition: color 200ms ease;
}
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--navy); }

/* ───────── 데스크톱 ───────── */
@media (min-width: 1024px) {
  .app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .sidebar {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; overflow-y: auto;
    background: var(--navy); color: #fff; padding: 28px 16px 20px;
  }
  .sidebar-brand { display: block; padding: 4px 12px 26px; text-decoration: none; color: inherit; }
  .sidebar-logo { display: block; width: 168px; max-width: 100%; }
  .sidebar-sub { display: block; margin-top: 10px; font-size: 13px; letter-spacing: 0.02em; color: var(--pink); font-weight: 600; }
  .nav-group { margin-bottom: 14px; }
  .nav-group-title { margin: 0 12px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; color: #8f9bb0; }
  .nav-item, .nav-link {
    position: relative; display: flex; align-items: center; gap: 12px; width: 100%; height: 42px; padding: 0 12px;
    border: 0; border-radius: 12px; background: none; color: #c9d1de; font-size: 14.5px; font-weight: 600; text-align: left;
    transition: background-color 180ms ease, color 180ms ease;
  }
  .nav-link { text-decoration: none; }
  .nav-link:hover { color: #fff; }
  /* 선택 배경은 ::before로 그려 메뉴를 옮길 때 --pill-y만큼 밀어 둔 뒤 0으로 되돌린다 (dashboard.js syncNav) */
  .nav-item.active { color: var(--navy); }
  .nav-item.active::before {
    content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--pink);
    transform: translateY(var(--pill-y, 0px));
  }
  .nav-item.active svg { stroke-width: 2.4; }
  .sidebar-data { margin: auto 12px 0; padding-top: 16px; font-size: 12px; color: #8f9bb0; display: flex; gap: 6px; align-items: center; }
  .sidebar-data svg { width: 14px; height: 14px; }

  .topbar { flex-wrap: nowrap; padding: 14px 28px; gap: 14px; color: var(--text); border-bottom: 1px solid var(--line); }
  .topbar::before { background: rgba(243, 239, 233, 0.8); }
  .topbar-logo { display: none; }
  .period-button {
    order: 0; flex: 0 1 auto; max-width: 640px; height: 48px; padding: 0 16px;
    background: var(--surface); border-color: var(--line); box-shadow: var(--shadow);
  }
  .period-text { flex-direction: row; gap: 14px; align-items: baseline; }
  .period-base { font-size: 14px; }
  .period-cmp { font-size: 13px; color: var(--brown); }
  .topbar-actions { margin-left: auto; }
  .icon-button { background: var(--surface); box-shadow: var(--shadow); color: var(--text); }
  .account-name { display: inline; }
  .subnav { display: none; }
  .chips { padding: 12px 28px 0; }
  .content { padding: 20px 28px 48px; }
  .tabbar { display: none; }
}
@media (hover: hover) and (pointer: fine) {
  .nav-item:not(.active):hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
  .period-button:hover { background: rgba(255, 255, 255, 0.14); }
}
@media (hover: hover) and (pointer: fine) and (min-width: 1024px) {
  .period-button:hover { background: var(--surface-2); }
  .icon-button:hover { background: var(--surface-2); }
}

/* ───────── 화면 머리말 ───────── */
.view-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.view-icon {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex: none;
  background: var(--navy); color: var(--pink);
}
.view-icon svg { width: 22px; height: 22px; }
.view-title { flex: 1; min-width: 0; }
.view-title h1 { margin: 0; font-size: 20px; letter-spacing: -0.02em; }
.view-meta { margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; color: var(--text-2); }
.view-meta .tag { display: inline-flex; align-items: center; gap: 5px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot-base { background: var(--base); }
.dot-cmp { background: var(--cmp); }
.badge-data {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: 11.5px;
}
.badge-data svg { width: 12px; height: 12px; }
/* 방금 들어온 데이터: 테두리 바깥으로 두 번 퍼지고 멈춘다 (실시간처럼 보이지 않게 무한 반복 금지) */
.badge-data.fresh { border-color: var(--up); color: var(--up); animation: data-ping 1.2s var(--ease-out) 0.4s 2; }
@keyframes data-ping { from { box-shadow: 0 0 0 0 rgba(36, 138, 61, 0.35); } to { box-shadow: 0 0 0 7px rgba(36, 138, 61, 0); } }
@media (prefers-reduced-motion: reduce) { .badge-data.fresh { animation: none; } }
.btn-excel { background: #1d6f42; border-color: #1d6f42; color: #fff; text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .btn-excel:hover { background: #185c37; } }
@media (max-width: 480px) {
  .btn-excel { width: 100%; }
}

/* ───────── 카드/그리드 ───────── */
.grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 720px) and (max-width: 1279px) { .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.grid + .grid, .grid + .card, .card + .grid, .card + .card { margin-top: 12px; }
.span-all { grid-column: 1 / -1; }
.card {
  min-width: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px;
}
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-head h2 { margin: 0; font-size: 15px; letter-spacing: -0.01em; flex: 1; min-width: 0; }
.card-head svg { color: var(--text-3); }
.card-sub { font-size: 12px; color: var(--text-3); }
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 340px; }
.chart-box.donut { height: 200px; }
.insight-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 14px; line-height: 1.6; color: var(--text-2); }
.insight-list li::marker { color: var(--text-3); }
.insight-sub { display: flex; align-items: center; gap: 6px; margin: 14px 0 8px; font-size: 13px; }
.insight-sub svg { width: 15px; height: 15px; color: var(--text-3); }

/* KPI */
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 12px; }
@media (min-width: 1024px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { padding: 14px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; position: relative; overflow: hidden; }
.kpi.hero { grid-column: 1 / -1; background: var(--navy); color: #fff; padding: 18px; }
@media (min-width: 1024px) {
  .kpi.hero { grid-column: span 2; }
  /* 카드 수에 따라 빈칸 없이: 4개 → 한 줄, 5개 → 대표 카드가 두 줄 차지 */
  .kpis:has(> :nth-child(4):last-child) { grid-template-columns: 2fr 1fr 1fr 1fr; }
  .kpis:has(> :nth-child(4):last-child) .kpi.hero { grid-column: auto; }
  .kpis:has(> :nth-child(5)) .kpi.hero { grid-row: span 2; }
}
.kpi-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.kpi-label svg { width: 15px; height: 15px; }
.kpi.hero .kpi-label { color: var(--pink); }
.kpi-value { margin-top: 6px; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi.hero .kpi-value { font-size: 30px; }
.kpi-value small { font-size: 0.55em; font-weight: 700; margin-left: 2px; }
.kpi-cmp { margin-top: 4px; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.kpi.hero .kpi-cmp { color: #b9c3d1; }
.kpi .delta { margin-top: 8px; }
.kpi-deco { position: absolute; right: -14px; bottom: -18px; width: 96px; height: 96px; opacity: 0.08; }
.kpi.hero .kpi-deco { opacity: 0.12; color: var(--pink); }

.delta {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.delta.up { background: var(--up-soft); color: var(--up); }
.delta.down { background: var(--down-soft); color: var(--down); }
.delta.flat { background: var(--surface-2); color: var(--text-3); }
.kpi.hero .delta.up { background: rgba(74, 222, 128, 0.16); color: #86efac; }
.kpi.hero .delta.down { background: rgba(248, 113, 113, 0.18); color: #fca5a5; }
.delta .pct { font-weight: 600; opacity: 0.85; }
.t-up { color: var(--up); }
.t-down { color: var(--down); }

/* 범례 */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.donut-wrap { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; align-items: center; }
.donut-wrap .chart-box { height: 150px; }
.donut-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; font-size: 12.5px; }
.donut-legend li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.donut-legend .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend b { font-variant-numeric: tabular-nums; }
.donut-legend em { font-style: normal; color: var(--text-3); margin-left: 4px; }

/* 목표 게이지 */
.gauge { position: relative; height: 150px; }
.gauge .chart-box { height: 100%; }
.gauge-center { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; }
.gauge-center strong { display: block; font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.gauge-center span { font-size: 12px; color: var(--text-3); }
.stat-rows { display: grid; gap: 6px; margin-top: 10px; font-size: 13px; }
.stat-rows div { display: flex; justify-content: space-between; gap: 8px; }
.stat-rows span { color: var(--text-2); }
.stat-rows b { font-variant-numeric: tabular-nums; }

/* 지도 */
.map-box { height: 320px; border-radius: 12px; overflow: hidden; z-index: 0; }

/* ───────── 표 ───────── */
.tbl-wrap { margin: 0 -16px -16px; overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  position: sticky; top: 0; background: var(--surface-2); color: var(--text-2); font-weight: 700; font-size: 12px;
  text-align: right; padding: 9px 12px; white-space: nowrap; border-bottom: 1px solid var(--line); user-select: none;
}
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl td { padding: 9px 12px; text-align: right; border-bottom: 1px solid #f1ece5; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl td.lbl { white-space: normal; font-weight: 600; min-width: 7em; max-width: 320px; word-break: keep-all; }
.tbl tr.total td { font-weight: 800; background: var(--surface-2); }
.tbl tr.link { cursor: pointer; transition: background-color 140ms ease; }
.tbl tr.link td.lbl { color: var(--base); }
.tbl tr.link td.lbl svg { width: 14px; height: 14px; vertical-align: -2px; margin-left: 2px; opacity: 0.6; }
@media (hover: hover) and (pointer: fine) { .tbl tr.link:hover td { background: #f5f8fd; } }
.tbl-more { display: block; width: 100%; padding: 12px; border: 0; background: none; color: var(--base); font-weight: 700; }
.grade-badge { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; font-weight: 800; font-size: 12px; }
.grade-A { background: var(--navy); color: #fff; }
.grade-B { background: var(--pink); color: var(--navy); }
.grade-C { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }

/* 휴대폰: 표 → 카드 목록 (가로 스크롤 없음) */
@media (max-width: 719px) {
  .tbl-wrap { margin: 0 -8px -8px; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; }
  .tbl tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; padding: 8px 8px; border-bottom: 1px solid #f1ece5; }
  .tbl td { border: 0; padding: 1px 0; text-align: right; display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; white-space: normal; }
  .tbl td::before { content: attr(data-label); color: var(--text-3); font-weight: 500; text-align: left; }
  .tbl td.lbl { grid-column: 1 / -1; font-size: 14px; max-width: none; padding-bottom: 2px; }
  .tbl td.lbl::before { display: none; }
  .tbl td.key { grid-column: 1 / -1; font-size: 14px; }
  .tbl tr.total { background: var(--surface-2); border-radius: 10px; }
  .tbl tr.total td { background: none; }
}

/* 표 정렬 선택 */
.sort-select { margin-left: auto; height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; background: var(--surface); font-size: 12px; max-width: 170px; }

/* ───────── 증감 TOP 목록 ───────── */
.mover-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.mover {
  display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 4px 10px; align-items: center;
  padding: 10px 8px; border-radius: 12px; cursor: pointer; transition: background-color 140ms ease;
}
@media (hover: hover) and (pointer: fine) { .mover:hover { background: var(--surface-2); } }
.mover .rank { font-weight: 800; color: var(--text-3); font-size: 13px; text-align: center; }
.mover .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mover .amt { font-weight: 800; font-variant-numeric: tabular-nums; }
.mover .bar { grid-column: 2 / -1; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.mover .bar i { display: block; height: 100%; border-radius: 99px; transform-origin: left; }
.mover.up .bar i { background: var(--up); }
.mover.down .bar i { background: var(--down); }
.mover.up .amt { color: var(--up); }
.mover.down .amt { color: var(--down); }
.mover .sub { grid-column: 2 / -1; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* 등급 카드 */
.grade-cards { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); margin-bottom: 12px; }
@media (min-width: 720px) { .grade-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.grade-card { padding: 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); display: grid; gap: 6px; }
.grade-card header { display: flex; align-items: center; gap: 10px; }
.grade-card header .grade-badge { width: 34px; height: 34px; font-size: 16px; border-radius: 10px; }
.grade-card header p { margin: 0; font-size: 12px; color: var(--text-3); }
.grade-card .big { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.share-bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--surface-2); margin: 4px 0 12px; }
.share-bar i { display: block; height: 100%; transform-origin: left; }

/* 대리점 선택 */
.dealer-search { position: relative; }
.dealer-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.dealer-search input {
  width: 100%; height: 50px; padding: 0 14px 0 44px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); font-size: 15px; box-shadow: var(--shadow);
}
.dealer-results { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.dealer-results button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); text-align: left; font-weight: 600;
  transition: background-color 140ms ease, transform 120ms var(--ease-out);
}
.dealer-results button:active { transform: scale(0.98); }
.dealer-results button span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) and (pointer: fine) { .dealer-results button:hover { background: var(--surface-2); } }

.profile { display: grid; gap: 8px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); font-size: 13px; }
.profile div { display: grid; gap: 2px; min-width: 0; }
.profile span { color: var(--text-3); font-size: 12px; }
.profile b { overflow-wrap: anywhere; }
.profile .wide { grid-column: 1 / -1; }

/* 안내 */
.notice {
  display: grid; justify-items: center; gap: 10px; text-align: center; padding: 40px 20px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text-2);
}
.notice .notice-icon { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--pink-soft); color: var(--brown); }
.notice .notice-icon svg { width: 28px; height: 28px; }
.notice p { margin: 0; max-width: 420px; line-height: 1.6; }
.notice.error .notice-icon { background: var(--down-soft); color: var(--down); }

/* 불러오는 중 */
.skeleton { display: grid; gap: 12px; }
.sk { border-radius: var(--radius); background: #e9e3da; }
.sk.h1 { height: 44px; width: 60%; }
.sk.kpi-row { height: 110px; }
.sk.kpi { height: 96px; }
.sk.block { height: 280px; }
.skeleton .kpis, .skeleton .grid { margin: 0; }

/* ───────── 시트(필터·세부 내역) ───────── */
.backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(17, 23, 34, 0.38); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.sheet {
  position: fixed; z-index: 70; left: 0; right: 0; bottom: 0; max-height: 90dvh;
  display: flex; flex-direction: column; background: var(--surface); border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow-lg); padding-bottom: env(safe-area-inset-bottom);
}
.sheet-handle { height: 22px; display: grid; place-items: center; touch-action: none; cursor: grab; }
.sheet-handle::before { content: ""; width: 40px; height: 5px; border-radius: 99px; background: #d8d1c6; }
.sheet-header { display: flex; align-items: center; gap: 8px; padding: 0 12px 8px 18px; touch-action: none; }
.sheet-header h2 { flex: 1; margin: 0; font-size: 17px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.sheet-body { flex: 1; overflow-y: auto; padding: 4px 18px 18px; overscroll-behavior: contain; }
.sheet-footer { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.sheet-footer .btn { flex: 1; }
#detail-sheet { max-height: 85dvh; }
@media (min-width: 1024px) {
  .sheet { left: auto; top: 0; width: 440px; max-height: none; border-radius: 22px 0 0 22px; }
  #detail-sheet { width: 560px; max-height: none; }
  .sheet-handle { display: none; }
  .sheet-header { padding: 20px 16px 10px 22px; }
  .sheet-body { padding: 4px 22px 22px; }
}
.fs { border: 0; margin: 0 0 18px; padding: 0; min-width: 0; }
.fs legend { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; margin-bottom: 10px; padding: 0; }
.fs legend svg { width: 16px; height: 16px; color: var(--text-3); }
.preset-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.preset-row button, .segmented button {
  height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--text-2);
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 120ms var(--ease-out);
}
.preset-row button:active, .segmented button:active { transform: scale(0.96); }
.preset-row button.active { background: var(--base); border-color: var(--base); color: #fff; }
.segmented { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.segmented button.active { background: var(--cmp); border-color: var(--cmp); color: #fff; }
.date-pair { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; color: var(--text-3); }
.date-pair input, .cond-grid select, .cond-grid input {
  width: 100%; min-width: 0; height: 42px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2);
}
.date-pair.disabled { opacity: 0.45; }
.cond-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cond-grid label { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--text-2); min-width: 0; }
.cond-grid .wide { grid-column: 1 / -1; }
.hint { display: flex; gap: 6px; align-items: flex-start; margin: 10px 0 0; font-size: 12.5px; color: var(--brown); background: var(--pink-soft); padding: 8px 10px; border-radius: 10px; }
.hint svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }

/* 토스트 */
.toast {
  position: fixed; z-index: 90; left: 50%; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  transform: translateX(-50%); max-width: calc(100vw - 28px);
  padding: 12px 16px; border-radius: 14px; color: #fff; font-size: 13px;
  background: rgba(29, 39, 56, 0.8); border: 1px solid rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), var(--shadow-lg);
}
@media (min-width: 1024px) { .toast { bottom: 24px; } }

/* 로그인 / 관리자 ─────────────────────── */
.login-body {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(340px 340px at calc(50% + 170px) 40%, rgba(220, 188, 180, 0.6) 0%, transparent 70%),
    radial-gradient(380px 380px at calc(50% - 180px) 66%, rgba(44, 79, 140, 0.85) 0%, transparent 70%),
    radial-gradient(1200px 600px at 20% -10%, #34445f 0%, transparent 60%), var(--navy);
}
.login-stack { width: 100%; max-width: 380px; display: grid; gap: 26px; justify-items: center; }
.login-logo { width: 200px; max-width: 70%; }
/* 유리 카드: 반투명 + 배경 흐림, 윗테두리 하이라이트 */
.login-box {
  width: 100%; display: grid; gap: 14px; padding: 28px 24px; border-radius: 22px; color: #fff;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 20px 50px rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  backdrop-filter: blur(22px) saturate(160%);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .login-box { background: rgba(38, 50, 72, 0.96); }
}
.login-box h1 { margin: 0; font-size: 21px; letter-spacing: -0.02em; }
.login-box .subtitle { margin: -6px 0 4px; color: rgba(255, 255, 255, 0.62); font-size: 13px; word-break: keep-all; }
.login-box label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.82); }
.login-box input { height: 46px; padding: 0 14px; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 12px; background: rgba(255, 255, 255, 0.08); color: #fff; font-size: 15px; }
/* 크롬 자동완성 시 흰 글씨가 밝은 배경에 묻히지 않게 */
.login-box input:-webkit-autofill { -webkit-text-fill-color: #fff; -webkit-box-shadow: 0 0 0 40px #2a3850 inset; caret-color: #fff; }
.login-box input:focus { outline: 2px solid rgba(255, 255, 255, 0.7); outline-offset: 1px; background: rgba(255, 255, 255, 0.14); }
.login-box label.remember { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.login-box label.remember input { width: 18px; height: 18px; padding: 0; accent-color: #fff; }
.login-box button[type=submit] { height: 48px; border: 0; border-radius: 12px; background: #fff; color: var(--navy); font-weight: 700; font-size: 15px; margin-top: 4px; }
.login-box .error { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--down-soft); color: var(--down); font-size: 13px; }
.login-box .info { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--pink-soft); color: var(--brown); font-size: 13px; }

.admin-body .topbar { background: var(--navy); color: #fff; }
.admin-body .topbar::before { display: none; }
.admin-brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; margin-right: auto; }
.admin-brand img { height: 24px; }
.admin-brand h1 { margin: 0; font-size: 16px; }
.admin-body .icon-button { background: rgba(255, 255, 255, 0.1); box-shadow: none; color: #fff; }
.admin-link { display: inline-flex; align-items: center; gap: 6px; color: #fff; text-decoration: none; font-weight: 600; padding: 8px 10px; border-radius: 10px; }
#admin-content { max-width: 960px; margin: 0 auto; padding: 20px 14px 48px; display: grid; gap: 14px; }
#admin-content .card h2 { margin: 0 0 12px; font-size: 16px; }
.admin-form { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }
.admin-form label { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.admin-form input[type=text], .admin-form input[type=password] { height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); }
.admin-form label, .admin-form input { min-width: 0; }
.admin-form input[type=text], .admin-form input[type=password] { width: 100%; }
.admin-form .checkbox-label { display: flex; align-items: center; gap: 6px; height: 40px; }
/* 휴대폰: 계정 표를 한 사람당 카드 한 장으로, 로그인 이력은 여백을 줄여 한 화면에 */
@media (max-width: 600px) {
  #users-table-wrap thead { display: none; }
  #users-table-wrap .data-table, #users-table-wrap tbody { display: block; }
  #users-table-wrap tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 12px 0; border-bottom: 1px solid #f1ece5; }
  #users-table-wrap td { padding: 0; border: 0; }
  #users-table-wrap td:first-child { font-weight: 700; }
  #users-table-wrap td:nth-child(5) { order: 1; width: 100%; font-size: 12px; color: var(--text-2); }
  #users-table-wrap .cell-actions { order: 2; width: 100%; white-space: normal; display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }
  #logs-table-wrap .data-table { font-size: 12px; }
  #logs-table-wrap .data-table th, #logs-table-wrap .data-table td { padding: 8px 6px; }
}
.admin-form button { height: 40px; border: 0; border-radius: 10px; background: var(--navy); color: #fff; font-weight: 700; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 9px 10px; background: var(--surface-2); color: var(--text-2); font-size: 12px; white-space: nowrap; }
.data-table td { padding: 9px 10px; border-bottom: 1px solid #f1ece5; white-space: nowrap; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.badge.active { background: var(--up-soft); color: var(--up); }
.badge.inactive { background: var(--down-soft); color: var(--down); }
.small-button { height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 12px; }
.data-table .edit-name, .data-table .edit-role { height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; }
.admin-body .account-menu { color: var(--text); }

/* 매출현황 자동 갱신 실패 알림 (관리자) */
.erp-alert { border: 0; border-radius: 18px; padding: 24px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.erp-alert::backdrop { background: rgba(0,0,0,.35); }
.erp-alert h2 { margin: 0 0 10px; font-size: 18px; color: var(--down); }
.erp-alert p { margin: 0 0 6px; font-size: 14px; line-height: 1.5; }
.erp-alert .erp-alert-sub { color: #8f9bb0; font-size: 12.5px; }
.erp-alert-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }


/* ───────── 디자인 D (2026-10-15): 애플 스타일, 왼쪽 메뉴·상단바만 유리 ─────────
   유리가 보이도록 메뉴 뒤쪽에만 옅은 빛을 깔고, 내용 카드는 불투명 흰색 그대로 둔다. */
.app-body {
  background:
    radial-gradient(520px 700px at 0% 10%, #cfe3ff 0, transparent 70%),
    radial-gradient(600px 360px at 40% -10%, #e7d9ff 0, transparent 70%),
    radial-gradient(420px 600px at 0% 100%, #d6f5ea 0, transparent 70%), var(--bg);
  background-attachment: fixed; letter-spacing: -0.005em;
}
.topbar { color: var(--text); }
.topbar::before {
  background: rgba(255, 255, 255, 0.55); border-bottom: 1px solid rgba(255, 255, 255, 0.6);
  -webkit-backdrop-filter: saturate(200%) blur(28px); backdrop-filter: saturate(200%) blur(28px);
}
.period-button { border-color: var(--line); background: var(--surface); }
.period-cmp { color: var(--text-2); }
.view-icon { background: var(--pink); color: var(--navy); }
.view-title h1 { font-size: 24px; letter-spacing: -0.025em; }
.kpi.hero { background: var(--surface); color: var(--text); }
.kpi.hero .kpi-label { color: var(--text-2); }
.kpi.hero .kpi-cmp { color: var(--text-3); }
.kpi.hero .kpi-deco { color: var(--navy); opacity: 0.08; }
.kpi.hero .delta.up { background: var(--up-soft); color: var(--up); }
.kpi.hero .delta.down { background: var(--down-soft); color: var(--down); }
.kpi-value { font-weight: 700; letter-spacing: -0.03em; }
.btn, .subnav button, .chip { border-radius: 999px; }
.chip { border-color: var(--line); background: var(--surface); color: var(--text); }
@media (min-width: 1024px) {
  .sidebar {
    background: rgba(255, 255, 255, 0.45); color: var(--text);
    -webkit-backdrop-filter: saturate(200%) blur(28px); backdrop-filter: saturate(200%) blur(28px);
    border-right: 1px solid rgba(255, 255, 255, 0.6); box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.04);
  }
  .sidebar-logo { width: 120px; }
  .sidebar-sub { color: var(--text-3); font-weight: 500; letter-spacing: 0; }
  .nav-group-title { color: var(--text-3); letter-spacing: 0; font-weight: 600; font-size: 11px; }
  .nav-item, .nav-link { height: 36px; border-radius: 9px; color: var(--text); font-size: 14px; font-weight: 500; }
  .nav-link:hover { color: var(--text); }
  .nav-item.active { font-weight: 600; }
  .sidebar-data { color: var(--text-3); }
  .topbar { border-bottom: 0; }
  .topbar::before { background: rgba(255, 255, 255, 0.4); }
  .period-button { box-shadow: none; }
  .icon-button { box-shadow: none; border: 1px solid var(--line); }
}
@media (hover: hover) and (pointer: fine) {
  .nav-item:not(.active):hover, .nav-link:hover { background: rgba(0, 0, 0, 0.04); color: var(--text); }
  .period-button:hover { background: var(--surface-2); }
}

/* ───────── 공통 틀·부품 (2026-10-15 통일) ─────────
   매출 대시보드와 배차실이 같은 틀(_shell.html)과 같은 부품을 쓴다. 배차실 쪽 대응 부품은 dispatch-src/globals.css 끝부분. */
.brand-logo { height: 22px; width: auto; flex: none; }
.brand-cube { width: 26px; height: auto; display: block; }
.sidebar-brand { flex-direction: column; align-items: flex-start; gap: 8px; text-decoration: none; }
.sidebar-brand { display: flex; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text b { font-size: 15px; font-weight: 650; letter-spacing: -0.02em; color: var(--text); }
.brand-text small { font-size: 11px; color: var(--text-3); }
.topbar-logo { text-decoration: none; }
.crumb { display: none; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.crumb b { color: var(--text); font-weight: 600; }
.nav-item, .nav-link { text-decoration: none; }
.nav-link.active { background: var(--pink); color: var(--navy); font-weight: 600; }
.nav-count {
  margin-left: auto; min-width: 20px; padding: 1px 7px; border-radius: 999px; text-align: center;
  background: #fff4e5; color: #b25000; font-size: 11px; font-weight: 600;
}
.save-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.05); color: var(--text-2); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.save-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #34c759; }
.save-pill.dirty::before { background: #ff9500; }
.tab { text-decoration: none; }
.tab-link.active { color: var(--navy); }

/* 머리말: 파란 작은 제목 + 큰 제목 + 설명, 오른쪽에 주요 버튼 */
.view-head { align-items: flex-end; margin-bottom: 24px; }
.view-head .eyebrow { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--navy); }
.view-title h1 { font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -0.025em; }
.view-meta { margin-top: 8px; font-size: 13px; }

/* KPI: 라벨 · 큰 숫자 · 보조줄 (아이콘 없이) */
.kpi { padding: 20px 22px; }
.kpi-label { font-size: 13px; font-weight: 500; }
.kpi-label svg, .kpi-deco { display: none; }
.kpi-value { font-size: 28px; margin-top: 6px; }
.kpi.hero .kpi-value { font-size: 34px; }

/* 카드 · 버튼 */
.card { padding: 22px 24px; }
.card-head { margin-bottom: 16px; }
.card-head h2 { font-size: 17px; font-weight: 650; letter-spacing: -0.015em; }
.btn { height: 36px; padding: 0 18px; border-radius: 999px; border: 0; background: rgba(0, 0, 0, 0.05); color: var(--text); font-weight: 600; font-size: 13.5px; text-decoration: none; }
.btn.primary { background: var(--navy); color: #fff; }

@media (min-width: 1024px) {
  .sidebar { padding: 22px 14px 18px; }
  .sidebar-brand { padding: 0 8px 22px; }
  .crumb { display: inline; }
  .topbar { padding: 0 32px; height: 56px; }
  .period-button { height: 36px; border-radius: 999px; padding: 0 14px; }
  .period-text { font-size: 13px; }
  .content { padding: 32px 32px 64px; }
  .topbar-logo { display: none; }
}
@media (max-width: 1023px) {
  .save-pill { margin-left: auto; }
}
.subnav .nav-link {
  flex: none; display: inline-flex; align-items: center; gap: 6px; width: auto; height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-weight: 600; font-size: 13px;
}
.subnav .nav-link svg { width: 16px; height: 16px; }
.subnav .nav-link.active { background: var(--navy); border-color: var(--navy); color: #fff; }


/* ───────── 2차 리뉴얼 (2026-10-15): 오션 색 + 리퀴드 글래스 강조, 짧은 메뉴 ─────────
   시안: docs/시안/2차_구성시안.html (오션 · 유리 강조).
   Windows "투명 효과"가 꺼진 PC는 Chrome이 투명도 감소를 요청하지만, 이 앱은 유리 질감을 유지한다(사용자 결정). */
:root {
  --navy: #0a6f91; --navy-2: #0b7ba1; --navy-3: #075d79;   /* 강조: 오션 */
  --pink: #dcecf2; --pink-soft: #eef4f6;
  --bg: #eef3f5; --line: #dce6ea;
  --text-2: #5f6b72; --text-3: #6e7a80;                     /* 보조 글씨 대비 4.5:1 이상 */
  --base: #0a6f91; --base-soft: #dcecf2;
  --glass-bg: linear-gradient(160deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,.18) 55%, rgba(255,255,255,.30) 100%);
  --glass-solid: linear-gradient(160deg, rgba(255,255,255,.80) 0%, rgba(255,255,255,.58) 60%, rgba(255,255,255,.68) 100%);
  --glass-blur: blur(34px) saturate(170%) brightness(1.04);
  --glass-edge: inset 0 1.5px 0 rgba(255,255,255,1), inset 0 -1px 0 rgba(255,255,255,.45), inset 1px 0 0 rgba(255,255,255,.35), 0 0 0 .5px rgba(10,60,90,.10), 0 10px 30px rgba(10,60,90,.12);
}
.app-body {
  background:
    radial-gradient(55vw 45vw at 0% 0%, #a9d6e8 0, transparent 68%),
    radial-gradient(50vw 45vw at 100% 100%, #bcd0e6 0, transparent 68%),
    radial-gradient(35vw 30vw at 70% 30%, #d6eef3 0, transparent 70%), var(--bg);
  background-attachment: fixed;
}
/* 유리: 메뉴·상단바·KPI·버튼·칩 */
.sidebar, .topbar::before, .kpi, .stat, .period-button, .icon-button, .chip, .subnav button, .subnav .nav-link,
.btn:not(.primary), .button:not(.primary):not(.pending), .tabbar, .date-pill, .doc-select, .account-button .avatar {
  background: var(--glass-bg) !important;
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(255,255,255,.75) !important;
  box-shadow: var(--glass-edge) !important;
}
.sidebar { border-width: 0 1px 0 0 !important; }
.topbar::before { border-width: 0 0 1px 0 !important; }
.tabbar { border-width: 1px 0 0 0 !important; }
/* 표·차트 카드는 읽기 위해 덜 투명하게 */
.card, .route-card, .aside-report, .report-card, .issue, .empty-upload, .table-card {
  background: var(--glass-solid) !important;
  -webkit-backdrop-filter: blur(20px) saturate(130%); backdrop-filter: blur(20px) saturate(130%);
  border: 1px solid rgba(255,255,255,.7) !important;
  box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(10,60,90,.06) !important;
}
.kpi, .stat { position: relative; overflow: hidden; }
.kpi::before, .stat::before {
  content: ""; position: absolute; inset: 0; z-index: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(125deg, rgba(255,255,255,.7) 0, rgba(255,255,255,0) 38%, rgba(255,255,255,0) 70%, rgba(255,255,255,.25) 100%);
}
.kpi > *, .stat > * { position: relative; z-index: 1; }
.stat.attention.stat { background: linear-gradient(160deg, rgba(255,236,210,.8), rgba(255,236,210,.45)) !important; }
.btn.primary, .button.primary {
  background: linear-gradient(180deg, #3a8fac 0%, var(--navy) 60%) !important; color: #fff !important; border: 0 !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 6px 16px rgba(10,111,145,.30) !important;
}
.button.pending { background: rgba(255,236,210,.85) !important; color: #b25000 !important; border: 1px solid rgba(255,255,255,.75) !important; opacity: 1 !important; }
.nav-link.active, .nav-item.active::before {
  background: rgba(255,255,255,.6) !important; color: var(--navy) !important;
  box-shadow: inset 0 1px 0 #fff, 0 0 0 .5px rgba(10,60,90,.1), 0 4px 12px rgba(10,60,90,.10);
}
/* 매출 사이드바는 선택 배경을 ::before(미끄러지는 pill)가 그리므로 버튼 자체는 비워 둔다 */
.nav-item.active { background: none !important; color: var(--navy) !important; }
.subnav button.active, .subnav .nav-link.active { background: var(--text) !important; color: #fff !important; border-color: transparent !important; }

/* 화면 전환 (매출·배차실·입금요청·완조립): 왼쪽 메뉴 맨 위 세로 목록 */
.app-list { display: none; flex-direction: column; gap: 2px; margin: 0 2px 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.app-list a { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--text-2); text-decoration: none; transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out); }
.app-list a svg { width: 18px; height: 18px; }
.app-list a.on { background: var(--pink); color: var(--navy); }
@media (hover: hover) and (pointer: fine) { .app-list a:not(.on):hover { background: rgba(0, 0, 0, 0.04); color: var(--text); } }
@media (prefers-reduced-motion: reduce) { .app-list a { transition: none; } }

/* 배차실 작업 바 (상단바 안) */
.dispatch-bar { flex: 1; min-width: 0; display: flex; }
.work-bar { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.work-bar .spacer { flex: 1; }
.date-pill { display: inline-flex; align-items: center; height: 34px; padding: 0 4px; border-radius: 999px; }
.date-pill button { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 0; background: none; color: var(--text); }
.date-pill label { position: relative; padding: 0 6px; font-size: 13.5px; cursor: pointer; font-variant-numeric: tabular-nums; }
.date-pill input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.doc-select { height: 34px; padding: 0 12px; border-radius: 999px; font-size: 13px; color: var(--text); appearance: auto; }
.save-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.save-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #34c759; }
.save-state.dirty::before { background: #ff9500; }
.work-actions { display: flex; gap: 8px; }
.work-actions .button { height: 34px; min-height: 34px; padding: 0 14px; font-size: 13px; }

/* ⋯ 더 보기 */
.more-menu { position: relative; }
.more-menu summary { list-style: none; width: 36px; padding: 0; justify-content: center; font-weight: 700; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 160px; padding: 6px; border-radius: 14px;
  background: rgba(255,255,255,.85); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); box-shadow: var(--glass-edge);
}
.more-list button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: none; font-size: 13.5px; text-align: left; }
.more-list button:hover { background: rgba(0,0,0,.05); }

/* 요약 KPI: 대표 카드도 같은 크기로 한 줄 */
@media (min-width: 1024px) {
  .kpis:has(> :nth-child(5)) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .kpis .kpi.hero { grid-column: auto !important; grid-row: auto !important; }
  .kpi.hero .kpi-value { font-size: 28px; }
  .app-list { display: flex; }
  .groupnav { display: none !important; }
  .subnav { display: flex; padding: 0; margin: 0 0 16px; }
  .subnav:empty { display: none; }
  .main > .subnav { padding: 20px 32px 0; margin: 0; }
}
@media (max-width: 1023px) {
  .crumb { display: none; }
  .work-bar .doc-select, .work-bar .save-state { display: none; }
  .work-actions {
    position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 35;
    padding: 10px 14px; background: rgba(255,255,255,.45); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    border-top: 1px solid rgba(255,255,255,.75);
  }
  .work-actions .button { flex: 1; height: 42px; justify-content: center; }
  .dispatch-content { padding-bottom: calc(var(--tabbar-h) + 96px) !important; }
}
@media (min-width: 1024px) { body[data-page="dispatch"] .subnav { display: none; } }
.more-list button.danger { color: var(--down); }
.more-list button:disabled { opacity: .45; cursor: not-allowed; }

/* ───────── 달력·드롭다운 통일 (static/js/pickers.js) ─────────
   닫힌 칸: 두 화면의 모든 선택칸·날짜칸을 같은 모양으로. 열린 목록·달력: 앱 유리 팝업. */
html body select, html body input[type="date"] {
  -webkit-appearance: none; appearance: none;
  height: 36px; padding: 0 34px 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background-color: rgba(255,255,255,.72);
  background-repeat: no-repeat; background-position: right 11px center; background-size: 14px;
  color: var(--text); font: inherit; font-size: 13.5px; cursor: pointer;
  box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(10,60,90,.05);
  transition: border-color .15s, box-shadow .15s;
}
html body select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f6b72' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
html body input[type="date"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f6b72' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E");
  font-variant-numeric: tabular-nums;
}
html body input[type="date"]::-webkit-calendar-picker-indicator { display: none; }
html body select:hover, html body input[type="date"]:hover { border-color: #c3d4db; }
html body select:focus-visible, html body input[type="date"]:focus-visible, .picker-open {
  outline: none; border-color: var(--navy) !important; box-shadow: 0 0 0 3px rgba(10,111,145,.18) !important;
}
html body select:disabled, html body input[type="date"]:disabled { opacity: .5; cursor: not-allowed; }
/* 작업 바의 날짜(10. 15. (목))는 알약 안에 투명하게 겹쳐 있으므로 모양을 그대로 둔다 */
html body .date-pill input[type="date"] { position: absolute; inset: 0; height: auto; padding: 0; border: 0; background: none; box-shadow: none !important; opacity: 0; }
html body .doc-select { border-radius: 999px; padding-left: 14px; }

.picker-pop {
  position: fixed; z-index: 1000; padding: 6px; border-radius: 14px;
  background: linear-gradient(160deg, rgba(255,255,255,.92), rgba(255,255,255,.80));
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(255,255,255,.8);
  box-shadow: inset 0 1px 0 #fff, 0 0 0 .5px rgba(10,60,90,.12), 0 16px 40px rgba(10,60,90,.18);
  animation: picker-in .14s ease-out;
}
@keyframes picker-in { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .picker-pop { animation: none; } }
.picker-pop.menu { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; }
.picker-opt {
  display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 12px 0 30px; border: 0; border-radius: 9px;
  background: none; color: var(--text); font: inherit; font-size: 13.5px; text-align: left; white-space: nowrap; position: relative; cursor: pointer;
}
.picker-opt:hover, .picker-opt:focus-visible { background: rgba(10,111,145,.09); outline: none; }
.picker-opt.selected { color: var(--navy); font-weight: 600; }
.picker-opt.selected::before { content: "✓"; position: absolute; left: 11px; font-weight: 700; }
.picker-opt.placeholder { color: var(--text-3); }
.picker-opt:disabled { opacity: .4; cursor: default; }

.picker-pop.cal { width: 268px; padding: 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head b { font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; }
.cal-nav { width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; font-size: 20px; line-height: 1; color: var(--text); cursor: pointer; }
.cal-nav:hover { background: rgba(10,111,145,.09); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-w { text-align: center; font-size: 11.5px; font-weight: 600; color: var(--text-3); padding: 4px 0; }
.cal-d {
  height: 32px; border: 0; border-radius: 50%; background: none; font: inherit; font-size: 13px;
  color: var(--text); cursor: pointer; font-variant-numeric: tabular-nums;
}
.cal-d:hover { background: rgba(10,111,145,.09); }
.cal-w.sun, .cal-d.sun { color: #d70015; }
.cal-w.sat, .cal-d.sat { color: var(--navy); }
.cal-d.out { opacity: .35; }
.cal-d.today { box-shadow: inset 0 0 0 1.5px var(--navy); font-weight: 600; }
.cal-d.selected { background: linear-gradient(180deg, #3a8fac 0%, var(--navy) 70%); color: #fff !important; font-weight: 700; box-shadow: 0 3px 8px rgba(10,111,145,.3); }
.cal-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.cal-foot button { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--navy); padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.cal-foot button:hover { background: rgba(10,111,145,.09); }
.date-field { position: relative; display: block; min-width: 0; flex: 1; }
.date-field input[type="date"] { width: 100%; color: transparent; }
.date-field input[type="date"]::-webkit-datetime-edit { opacity: 0; }
.date-text {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%); pointer-events: none;
  font-size: 13.5px; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.date-text.empty { color: var(--text-3); }

/* 입금요청 문구 (pending.html) */
#pending .view-head .btn { flex: none; }
#pending .notice + .pending-group, #pending .notice { margin-bottom: 12px; }
.pending-group + .pending-group { margin-top: 20px; }
.pending-group h2 { margin: 0 0 10px; font-size: 15px; }
.pending-group h2 small { font-weight: 500; color: var(--text-3); }
.pending-cards { display: grid; gap: 10px; }
.pending-shot { display: block; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; cursor: zoom-in; }
.pending-shot img { display: block; width: 100%; height: auto; }
/* 캡처 확대 보기 (pending.js가 썸네일 자리에서 커지게 움직인다) */
.shot-viewer {
  width: min(1760px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px);
  padding: 0; border: 0; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-lg);
  overflow: hidden; transform-origin: top left;
}
.shot-viewer[open] { display: flex; flex-direction: column; }
.shot-viewer::backdrop { background: rgba(0, 0, 0, .45); backdrop-filter: blur(6px); transition: opacity 200ms var(--ease-out); }
@starting-style { .shot-viewer[open]::backdrop { opacity: 0; } }
.shot-viewer.closing::backdrop { opacity: 0; }
.shot-viewer header { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 18px; border-bottom: 1px solid var(--line); }
.shot-viewer h2 { flex: 1; margin: 0; font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shot-viewer #shot-viewer-size { height: 34px; padding: 0 12px; font-size: 13px; }
.shot-viewer-body { flex: 1; min-height: 0; overflow: auto; padding: 12px; display: grid; gap: 12px; align-content: start; }
.shot-viewer-body img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.shot-viewer-body.actual img { width: auto; max-width: none; cursor: zoom-out; }
@media (max-width: 719px) { .shot-viewer { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); } }
@media (min-width: 720px) { .pending-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .pending-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pending-card { display: grid; gap: 8px; }
.pending-card h3 { margin: 0; font-size: 15px; }
.pending-card pre { margin: 0; font: inherit; font-variant-numeric: tabular-nums; white-space: pre-wrap; color: var(--text-2); }
.pending-card-actions { display: flex; gap: 8px; justify-self: end; }
.pending-card .btn { height: 36px; }
.pending-cards > .card { margin-top: 0; }
@media (max-width: 719px) { #pending .view-title { flex-basis: 100%; } }

/* ===== 완조립 현황 (/wanjorip) — 확정 시안 A. 경남·경북 색은 dataviz 검증 통과 ===== */
.wj { --gn: #2a78d6; --gb: #eb6834; }
.wj .num { font-variant-numeric: tabular-nums; }
.wj-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.wj-seg { display: inline-flex; padding: 3px; background: #e9e9ee; border-radius: 10px; }
.wj-seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; font: inherit; font-weight: 600; color: var(--text-2); cursor: pointer; min-height: 34px; transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out); }
.wj-seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.wj-stamp { margin-left: auto; font-size: 12px; color: var(--text-3); }
.wj-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (min-width: 760px) { .wj-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.wj-card, .wj-panel { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); min-width: 0; }
.wj-card { padding: 16px 18px; }
.wj-label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.wj-value { margin-top: 6px; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.wj-value small { font-size: 15px; font-weight: 600; color: var(--text-2); margin-left: 2px; }
.wj-delta { margin-top: 4px; font-size: 12px; color: var(--text-3); }
.wj-delta .up { color: var(--up); font-weight: 600; }
.wj-delta .down { color: var(--down); font-weight: 600; }
.wj-split { margin-top: 8px; display: flex; gap: 10px; font-size: 12px; color: var(--text-2); }
.wj-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.wj-dot.gn { background: var(--gn); } .wj-dot.gb { background: var(--gb); }
.wj-panel { padding: 18px 20px; margin-bottom: 16px; }
.wj-panel h2 { margin: 0 0 4px; font-size: 16px; letter-spacing: -.01em; }
.wj-sub { margin: 0 0 14px; font-size: 12px; color: var(--text-3); }
.wj-panel-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.wj-panel-head .wj-seg { margin-left: auto; }
.wj-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.wj-trend-pair { display: grid; gap: 18px; }
.wj-trend-pair h3 { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 0 6px; font-size: 15px; }
.wj-trend-total { font-size: 13px; font-weight: 500; color: var(--text-2); }
.wj-trend-total b { font-size: 15px; color: var(--text); }
.wj-chart { position: relative; height: 240px; }
.wj-grid2 { display: grid; gap: 16px; margin-bottom: 16px; }
.wj-grid2 .wj-panel { margin-bottom: 0; }
@media (min-width: 1024px) { .wj-grid2 { grid-template-columns: 1fr 1fr; } }
.wj-table-wrap { overflow-x: auto; }
.wj-table { width: 100%; border-collapse: collapse; }
.wj-table th, .wj-table td { padding: 9px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.wj-table th:first-child, .wj-table td:first-child, .wj-table .wj-left { text-align: left; }
.wj-table th { font-size: 12px; color: var(--text-3); font-weight: 600; }
.wj-table tfoot td { font-weight: 700; border-bottom: 0; }
.wj-table td.zero { color: #c7c7cc; }
.wj-table .wj-items { white-space: normal; color: var(--text-2); font-size: 13px; min-width: 220px; }
.wj-badge { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; color: #fff; }
.wj-badge.gn { background: var(--gn); } .wj-badge.gb { background: var(--gb); }
.wj-rank { list-style: none; margin: 0; padding: 0; }
.wj-rank li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.wj-rank li:last-child { border-bottom: 0; }
.wj-rank .n { color: var(--text-3); font-size: 12px; text-align: center; }
.wj-rank .name b { font-weight: 600; }
.wj-rank .name span { margin-left: 6px; font-size: 12px; color: var(--text-3); }
.wj-rank .q { font-weight: 700; }
.wj-bar { display: flex; gap: 2px; height: 6px; margin-top: 5px; }
.wj-bar i { border-radius: 3px; }
.wj-more { margin-top: 10px; border: 0; background: none; color: var(--navy); font: inherit; font-weight: 600; cursor: pointer; padding: 6px 0; }
.wj-note { font-size: 13px; color: var(--text-3); margin: 0; }
.wj-details summary { cursor: pointer; font-weight: 700; font-size: 16px; list-style: none; display: flex; align-items: center; }
.wj-details summary::-webkit-details-marker { display: none; }
.wj-details summary::after { content: "펼치기"; margin-left: auto; font-size: 13px; color: var(--navy); font-weight: 600; }
.wj-details[open] summary::after { content: "접기"; }
.wj-details[open] summary { margin-bottom: 12px; }
@media (prefers-reduced-motion: reduce) { .wj-seg button { transition: none; } }

/* 휴대폰 매출 묶음 칩 (#groupnav) 바로 아래 화면 칩과 간격 */
.groupnav + .subnav { padding-top: 2px; }
.wj-seg button[data-v="prev"], .wj-seg button[data-v="next"] { padding: 7px 10px; font-size: 18px; line-height: 1; }
.wj-seg button:disabled { color: #c7c7cc; cursor: default; }
