/* 한 줄 폰 화면 · 고무바닥 같은 어두운 요약판 · 원판 색 구분 · 하단 탭 */
:root {
  --bg: #F1F3F0;
  --surface: #FFFFFF;
  --ink: #17201C;
  --muted: #5D6963;
  --line: #DCE2DE;
  --accent: #2448C8;
  --accent-ink: #FFFFFF;
  --accent-soft: #E3E9FB;
  --slab: #1B2420;
  --slab-ink: #F2F5F3;
  --slab-muted: #A7B4AE;
  --slab-track: #34413B;
  --bar: #C9D2CD;
  --bad: #C2402F;
  --p-red: #D2402F;
  --p-blue: #2D55D6;
  --p-yellow: #DDAA12;
  --p-green: #2E9A5B;
  --f-display: "Black Han Sans", "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --f-body: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1412; --surface: #171E1B; --ink: #E8EEEB; --muted: #93A19A; --line: #28322E;
    --accent: #7D97FF; --accent-ink: #0F1412; --accent-soft: #1E2645;
    --slab: #222C28; --slab-ink: #F2F5F3; --slab-muted: #A2AFA9; --slab-track: #3A4742;
    --bar: #3A4641; --bad: #F07462;
    --p-red: #E8604F; --p-blue: #6A8BFF; --p-yellow: #F0C33C; --p-green: #4CBF7C;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--f-body); font-size: 15px; line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  padding-top: env(safe-area-inset-top, 0px);
}
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app {
  max-width: 560px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 14px calc(96px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 18px;
}

/* login */
.login {
  min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  padding-block: 32px;
}
.login-in { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.login-brand { font-family: var(--f-display); font-size: 40px; line-height: 1.1; }
.login-sub { margin: -6px 0 10px; color: var(--muted); }
.login form { display: flex; flex-direction: column; gap: 14px; }
.login-help { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.btn-block { width: 100%; border: 0; border-radius: 12px; padding: 14px; font-weight: 700; font-size: 16px; }

#tab-cost, #tab-sales { display: flex; flex-direction: column; gap: 18px; }
#notice:empty { display: none; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-family: var(--f-display); font-size: 22px; letter-spacing: .01em; }
.top-side { display: flex; align-items: center; gap: 12px; }
.sync { font-size: 12px; color: var(--muted); white-space: nowrap; }
.link-btn { background: none; border: 0; padding: 6px 0; font-size: 13px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

.notice {
  background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; margin: 0;
  font-size: 14px;
}

/* headline slab */
.slab {
  background: var(--slab); color: var(--slab-ink);
  border-radius: 18px; padding: 20px 18px 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.eyebrow { font-size: 12px; letter-spacing: .08em; color: var(--slab-muted); font-weight: 500; }
.big { font-family: var(--f-display); font-size: clamp(32px, 10vw, 44px); line-height: 1.05; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.big-sub { font-size: 14px; color: var(--slab-muted); margin-top: -4px; }
.track { height: 10px; background: var(--slab-track); border-radius: 99px; overflow: hidden; }
.track > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s ease; }
.track-legend { display: flex; justify-content: space-between; font-size: 13px; color: var(--slab-muted); }
.pairs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 0; }
.pairs div { background: var(--slab-track); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.pairs dt { font-size: 12px; color: var(--slab-muted); }
.pairs dd { margin: 2px 0 0; font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.eta { font-size: 13.5px; color: var(--slab-ink); margin: 2px 0 0; line-height: 1.55; }
.delta-up { color: #7EE0A6; } .delta-down { color: #FF9B8C; }

/* sections */
.block { display: flex; flex-direction: column; gap: 10px; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.block-head h2 { font-size: 17px; margin: 0; font-weight: 700; }
.btn-add {
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 99px;
  padding: 8px 14px; font-weight: 700; font-size: 14px; white-space: nowrap;
}
.btn-ghost {
  background: transparent; border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 14px; font-weight: 500; font-size: 14px; color: var(--muted); width: 100%;
}
.list { background: var(--surface); border-radius: 14px; overflow: hidden; }
.row {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center;
  width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line);
  padding: 12px 14px;
}
.list > .row:first-child, .list > .group:first-child > .group-head { border-top: 0; }
.row:active { background: var(--accent-soft); }
.row .r-main { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.row .r-amt { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.row .r-sub { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.group-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 14px 6px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted); font-weight: 700;
}
.group-head .num { font-weight: 700; color: var(--ink); }
.cat { display: inline-flex; align-items: center; gap: 8px; }
.plate {
  width: 16px; height: 16px; border-radius: 50%; flex: none; display: inline-block;
  background: radial-gradient(circle, var(--surface) 0 2.5px, var(--c) 3px);
}
.empty { background: var(--surface); border-radius: 14px; padding: 18px 16px; color: var(--muted); font-size: 14px; }
.empty b { color: var(--ink); display: block; margin-bottom: 4px; }

.stack { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--line); gap: 2px; }
.stack > span { background: var(--c); min-width: 3px; }
.stack-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); }
.stack-legend span { display: inline-flex; align-items: center; gap: 6px; }

/* sales */
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.month-nav h2 { font-family: var(--f-display); font-size: 22px; font-weight: 400; margin: 0; }
.nav-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 18px; line-height: 1; }
.nav-btn:disabled { opacity: .35; cursor: default; }
.chart-card { background: var(--surface); border-radius: 14px; padding: 12px 10px 6px; }
.chart-card svg { display: block; width: 100%; height: auto; }
.chart-title { font-size: 12.5px; color: var(--muted); padding: 0 4px 4px; }
.mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.mini div { background: var(--surface); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.mini dt { font-size: 12px; color: var(--muted); }
.mini dd { margin: 2px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; font-size: 14.5px; }
@media (max-width: 360px) { .mini { grid-template-columns: 1fr 1fr; } }

/* tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.tabbar-in { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; }
.tabbar button {
  background: none; border: 0; padding: 10px 0 12px; font-weight: 700; font-size: 15px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.tabbar button::before { content: ""; width: 28px; height: 4px; border-radius: 99px; background: transparent; }
.tabbar button[aria-selected="true"] { color: var(--ink); }
.tabbar button[aria-selected="true"]::before { background: var(--accent); }

/* sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.scrim { position: absolute; inset: 0; background: rgba(8, 12, 10, .5); }
.sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 92%;
  overflow-y: auto; background: var(--surface); border-radius: 20px 20px 0 0;
  padding-top: 18px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  padding-left: max(18px, env(safe-area-inset-left, 0px));
  padding-right: max(18px, env(safe-area-inset-right, 0px));
}
.sheet h3 { margin: 0 0 14px; font-size: 18px; }
.sheet form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 500; }
.field input {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-height: 48px;
  -webkit-appearance: none; appearance: none;
}
.login .field input { background: var(--surface); }
.field input.money { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hint { font-size: 12.5px; color: var(--muted); min-height: 1.2em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { position: relative; }
.chips input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.chips label > span, .chip-btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 99px; padding: 7px 13px; font-size: 14px; font-weight: 500;
}
.chips input:checked + span { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chips input:checked + span .plate { background: radial-gradient(circle, var(--ink) 0 2.5px, var(--c) 3px); }
.chips input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.err { color: var(--bad); font-size: 13.5px; min-height: 1em; }
.sheet-actions { display: flex; gap: 10px; }
.sheet-actions button { flex: 1; border-radius: 12px; padding: 13px; font-weight: 700; border: 0; font-size: 15px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:disabled { opacity: .6; }
.btn-cancel { background: var(--bg); }
.sheet-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn-del { background: none; border: 0; color: var(--bad); font-weight: 700; padding: 8px 0; }
.who { font-size: 12px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 50;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--surface); border-radius: 12px; padding: 10px 16px; font-size: 14px;
  max-width: calc(100% - 32px); text-align: center;
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
