/* 사장님 앱 화면 — 사무실 대시보드 손익보고서(PR_CSS)와 같은 색·모양을 휴대폰 폭으로 */
:root {
  --brand: #196F8F;
  --surface-1: #fcfcfb; --bg: #f3f4f6;
  --text-primary: #0b0b0b; --text-secondary: #52514e; --text-muted: #898781;
  --gridline: #e1e0d9; --baseline: #c3c2b7; --border: rgba(11, 11, 11, .10);
  --good-text: #006300; --critical: #d03b3b; --good-bg: #eaf7ea; --critical-bg: #fbeaea;
  --warn: #9a4a06; --warn-bg: #fff4ea;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #4a3aa7; --series-other: #b3b1a8; --series-prior: #c3c2b7;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text-primary);
  font-family: -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  font-size: 16px; line-height: 1.45;
}
button { font: inherit; }
.hidden { display: none !important; }

.pr { max-width: 560px; margin: 0 auto; padding: calc(10px + env(safe-area-inset-top)) 12px calc(88px + env(safe-area-inset-bottom)); }

/* 기간 선택 */
.seg { display: flex; gap: 6px; margin-bottom: 8px; }
.seg button { flex: 1; padding: 11px 0; border-radius: 10px; background: #fff; border: 1px solid #cdd6de; font-size: 1rem; font-weight: 700; color: #33404d; }
.seg button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.per { display: flex; align-items: center; justify-content: space-between; background: #fff; border-radius: 12px; padding: 4px; border: 1px solid #dde3e8; }
.per b { font-size: 1.05rem; text-align: center; flex: 1; }
.per b small { font-weight: 600; color: var(--text-secondary); font-size: .85em; }
.per button { width: 48px; height: 44px; border: 0; background: none; font-size: 1.7rem; line-height: 1; color: var(--brand); font-weight: 800; border-radius: 10px; }
.per button:disabled { color: #c9d0d6; }
.upd { font-size: .75rem; color: var(--text-muted); margin: 6px 2px 10px; }
.banner { border-radius: 10px; padding: 9px 12px; margin: 0 0 10px; font-size: .85rem; background: var(--warn-bg); color: var(--warn); }
.banner.bad { background: var(--critical-bg); color: var(--critical); }

/* 머리 띠 */
.hero { background: linear-gradient(135deg, #1c5cab 0%, #2a78d6 55%, #1baf7a 130%); border-radius: 16px; padding: 16px; color: #fff; margin-bottom: 10px; }
.hero .eyebrow { font-size: .7rem; font-weight: 600; letter-spacing: .04em; opacity: .85; margin: 0 0 4px; }
.hero h1 { margin: 0 0 4px; font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em; word-break: keep-all; }
.hero .sub { margin: 0; font-size: .8rem; opacity: .92; }

/* 3칸 */
.stat-tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; }
.stat-label { font-size: .8rem; color: var(--text-secondary); font-weight: 600; margin: 0 0 4px; }
.stat-value { font-size: 1.45rem; font-weight: 800; letter-spacing: -.01em; margin: 0 0 3px; }
.unit { font-size: .6em; font-weight: 600; color: var(--text-secondary); margin-left: 2px; }
.stat-prior { font-size: .75rem; color: var(--text-muted); margin: 0 0 6px; }
.badge { display: inline-flex; gap: 4px; font-size: .75rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.badge.up { color: var(--good-text); background: var(--good-bg); }
.badge.down { color: var(--critical); background: var(--critical-bg); }
.badge.flat { color: var(--text-secondary); background: var(--gridline); }
.badge span { font-weight: 600; }

/* 카드 */
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.card h2 { font-size: .95rem; font-weight: 700; margin: 0 0 2px; }
.card .card-sub { font-size: .72rem; color: var(--text-muted); margin: 0 0 10px; }
.card.vatc { border: 2px solid rgba(42, 120, 214, .35); }
.vat-hero { border-radius: 12px; padding: 12px; background: linear-gradient(135deg, rgba(42, 120, 214, .10), rgba(27, 175, 122, .10)); }
.vat-hero .k { font-size: .78rem; color: var(--text-secondary); font-weight: 600; margin: 0 0 4px; }
.vat-hero .v { font-size: 1.5rem; font-weight: 800; margin: 0 0 4px; }
.due { margin-top: 8px; background: var(--warn-bg); border-radius: 8px; padding: 8px 10px; font-size: .8rem; }
.due.past { background: #eef1f4; color: var(--text-secondary); }
.chk-list { list-style: none; margin: 8px 0 0; padding: 0; font-size: .78rem; }
.chk-list li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--gridline); color: var(--text-secondary); }
.chk-list li:last-child { border-bottom: none; }
.chk-list li b { color: var(--text-primary); white-space: nowrap; }
.chk-list li.past b { color: var(--text-muted); }
.note { font-size: .72rem; color: var(--text-muted); margin: 8px 0 0; line-height: 1.6; }

/* 그래프 */
.viz-root { position: relative; width: 100%; }
.viz-root svg { display: block; width: 100%; height: auto; overflow: visible; }
.ax { font-size: 11px; fill: var(--text-muted); font-weight: 600; }
.grid-line { stroke: var(--gridline); } .axis-line { stroke: var(--baseline); }
.cat { font-size: 12px; fill: var(--text-secondary); font-weight: 700; }
.val { font-size: 11px; fill: var(--text-secondary); font-weight: 700; }
.dc-v { font-size: 19px; font-weight: 800; fill: var(--text-primary); }
.dc-l { font-size: 11px; fill: var(--text-muted); font-weight: 600; }
.empty-chart { margin: 4px 0 2px; padding: 18px 12px; text-align: center; font-size: .85rem; color: var(--text-muted); background: #f4f5f7; border-radius: 10px; }
.chart-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin-top: 8px; font-size: .75rem; color: var(--text-secondary); font-weight: 600; }
.lg-item { display: flex; align-items: center; gap: 5px; }
.lg-sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: 0 0 auto; }
.donut + .donut { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--gridline); }
.donut svg { display: block; width: 190px; height: 190px; margin: 0 auto; }
.donut-legend { display: grid; gap: 5px; margin-top: 8px; font-size: .78rem; color: var(--text-secondary); }
.donut-legend .lg-amt { margin-left: auto; color: var(--text-muted); }
.donut-legend .lg-pct { width: 48px; text-align: right; font-weight: 700; color: var(--text-primary); }

/* 읽는 법 */
.insight-list { margin: 0; padding: 0; list-style: none; }
.insight-list li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--gridline); font-size: .85rem; line-height: 1.55; color: var(--text-secondary); }
.insight-list li:last-child { border-bottom: none; }
.insight-list .dot { flex: 0 0 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 800; color: #fff; background: var(--series-1); }
.insight-list strong { color: var(--text-primary); }

/* 표 */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
.swipe { font-size: .7rem; color: var(--text-muted); margin: -4px 0 6px; }
table { border-collapse: collapse; font-size: .78rem; width: 100%; }
thead th { text-align: right; font-weight: 700; color: var(--text-secondary); font-size: .7rem; padding: 6px 5px; border-bottom: 1px solid var(--baseline); white-space: nowrap; }
thead th:first-child, tbody td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface-1); }
tbody td { text-align: right; padding: 6px 5px; border-bottom: 1px solid var(--gridline); white-space: nowrap; font-variant-numeric: tabular-nums; }
tbody tr.subtotal td { font-weight: 700; background: #f1f5fb; }
tbody tr.item td:first-child { color: var(--text-secondary); padding-left: 12px; }
tbody tr.net td { font-weight: 800; background: #e9f6f0; }
td.delta-up { color: var(--good-text); } td.delta-down { color: var(--critical); }

.notes { margin: 0; padding-left: 16px; font-size: .72rem; color: var(--text-muted); line-height: 1.7; }
.foot { text-align: center; color: var(--text-muted); font-size: .72rem; margin: 14px 0 6px; line-height: 1.7; }

/* 안내·오류 화면 */
.msg { background: var(--surface-1); border: 1px solid var(--border); border-radius: 16px; padding: 28px 18px; margin-top: 30px; text-align: center; }
.msg h1 { font-size: 1.2rem; margin: 0 0 8px; }
.msg p { color: var(--text-secondary); margin: 0; font-size: .92rem; }

/* 처음 이용 안내 */
.consent { text-align: left; margin-top: 16px; }
.consent img { display: block; margin: 0 auto 10px; border-radius: 14px; }
.consent h1 { text-align: center; }
.consent .lead { text-align: center; font-weight: 700; color: var(--text-primary); margin-bottom: 12px; }
.consent ul { margin: 0 0 16px; padding-left: 18px; color: var(--text-secondary); font-size: .9rem; line-height: 1.6; }
.consent li { margin-bottom: 6px; }
.agree { display: block; width: 100%; padding: 15px; border: 0; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 800; font-size: 1.05rem; }

/* 홈 화면 추가 안내 */
.guide { border: 2px solid rgba(25, 111, 143, .35); background: #f4fafc; }
.steps { list-style: none; margin: 0 0 10px; padding: 0; }
.steps li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed var(--gridline); font-size: .9rem; line-height: 1.6; }
.steps li:last-child { border-bottom: 0; }
.steps svg { vertical-align: -5px; background: #fff; border: 1px solid #dde3e8; border-radius: 6px; padding: 1px; }
.steps small { color: var(--text-muted); }
.sn { flex: 0 0 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; font-size: .8rem; display: flex; align-items: center; justify-content: center; margin-top: 2px; }
.guide-off { width: 100%; padding: 10px; border-radius: 10px; border: 1px solid #cdd6de; background: #fff; color: var(--text-secondary); font-weight: 700; }
.guide-link { text-align: center; margin: 0 0 10px; }
.guide-link button { border: 0; background: none; color: var(--brand); font-weight: 700; font-size: .85rem; text-decoration: underline; padding: 6px; }

/* 아래 고정 버튼 */
.fix { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; padding: 9px 12px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid #dde3e8; z-index: 10; }
.fix > * { flex: 1; text-align: center; padding: 13px 0; border-radius: 12px; font-weight: 800; font-size: 1rem; border: 0; text-decoration: none; }
.call { background: var(--brand); color: #fff; }
.kk { background: #FEE500; color: #3c1e1e; }

.sheet { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 20; display: flex; align-items: flex-end; }
.sheet-box { background: #fff; width: 100%; max-width: 560px; margin: 0 auto; border-radius: 18px 18px 0 0; padding: 16px 14px calc(14px + env(safe-area-inset-bottom)); }
.sheet-t { font-weight: 700; margin: 0 0 10px; text-align: center; }
.sheet a { display: flex; justify-content: space-between; padding: 15px 14px; margin-bottom: 8px; border-radius: 12px; background: #eef5f8; color: var(--brand); font-weight: 800; font-size: 1.05rem; text-decoration: none; }
.sheet a span { color: var(--text-secondary); font-weight: 600; }
.sheet-x { width: 100%; padding: 13px; border-radius: 12px; border: 1px solid #dde3e8; background: #fff; font-weight: 700; }

.tip { position: fixed; z-index: 30; pointer-events: none; background: #fcfcfb; border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: .78rem; line-height: 1.5; color: var(--text-secondary); box-shadow: 0 4px 16px rgba(0, 0, 0, .14); transform: translate(-50%, -110%); white-space: nowrap; }
.tip b { color: var(--text-primary); }
