/* v27 고유 경로: 이전 서비스 워커가 업데이트 안내 UI 자산을 가로채지 않도록 한다. */
@font-face { font-family: "Pretendard"; src: url("../assets/fonts/Pretendard-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Pretendard"; src: url("../assets/fonts/Pretendard-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Pretendard"; src: url("../assets/fonts/Pretendard-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

/* 색상 규칙
   1. 라이트 값은 전량 :root에 정의하고 다크는 값만 덮어쓴다.
   2. 강조색은 용도로 나눈다. 다크에서 이 셋을 한 값으로 쓰면
      넓은 면이 형광 슬랩이 되거나 배지가 배경에 묻힌다.
        --primary        글자·아이콘·테두리용. 배경 위에서 읽히는 것이 목적.
        --primary-fill   버튼처럼 넓게 칠하는 면. 항상 흰 글자와 짝을 이룬다.
        --primary-light  칩·배지·활성 탭의 톤 컨테이너. 표면보다 확실히 밝아야 한다.
   3. color-mix()는 쓰지 않는다. iOS Safari 16.2 미만에서 선언째 무시돼 포커스 링까지 사라진다. */
:root {
  color-scheme: light;
  --background: #f6f6f4;
  --background-tint: radial-gradient(1100px 420px at 50% -200px, rgba(192,47,96,.055), transparent 68%);
  --surface: #ffffff;
  --surface-soft: #f1f0ee;
  --surface-strong: #e6e5e1;
  --surface-sunken: #fafaf9;
  --header-bg: rgba(255,255,255,.9);

  --primary: #c02f60;
  --primary-fill: #c73567;
  --primary-fill-pressed: #a92956;
  --primary-light: #f9e6ee;
  --primary-gradient: linear-gradient(135deg, #cc3c68 0%, #c02f60 48%, #93214b 100%);
  --on-primary: #ffffff;
  --on-primary-muted: rgba(255,255,255,.76);

  --text: #1d1d1f;
  --text-muted: #636368;
  --outline: #e3e2de;
  --outline-strong: #c9c8c3;
  --hairline: rgba(29,29,31,.07);

  --success: #1f7454;
  --success-fill: #22795a;
  --success-soft: #e7f4ee;
  --success-border: rgba(31,116,84,.32);
  --success-glow: rgba(31,116,84,.26);
  --warning: #8a5b1c;
  --warning-fill: #92611f;
  --warning-fill-pressed: #744915;
  --warning-soft: #f8f0e3;
  --warning-border: rgba(138,91,28,.36);
  --warning-tint: rgba(138,91,28,.14);
  --warning-glow: rgba(138,91,28,.24);
  --return-tint: #fffaf3;
  --error: #b02c43;
  --error-soft: #fbe8eb;

  --share-bg: #fee500;
  --share-text: #3f2d00;

  --focus-border: rgba(192,47,96,.55);
  --focus-glow: rgba(192,47,96,.13);
  --focus-ring: rgba(192,47,96,.34);
  --primary-border: rgba(192,47,96,.24);

  --shadow-sm: 0 1px 2px rgba(28,28,32,.05), 0 2px 8px rgba(28,28,32,.04);
  --shadow-md: 0 2px 6px rgba(28,28,32,.05), 0 10px 26px rgba(28,28,32,.06);
  --shadow-lg: 0 10px 34px rgba(28,28,32,.1);
  --shadow-primary: 0 6px 18px rgba(192,47,96,.2);
  --nav-shadow: 0 -8px 28px rgba(20,20,24,.06);
  --edge-highlight: inset 0 1px 0 rgba(255,255,255,.16);
  --picker-filter: none;

  --radius-xs: 12px;
  --radius-sm: 14px;
  --radius: 18px;
  --radius-lg: 22px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --background: #1a1619;
    --background-tint: radial-gradient(1100px 420px at 50% -220px, rgba(221,168,180,.05), transparent 66%);
    --surface: #241f23;
    --surface-soft: #2f292d;
    --surface-strong: #3b3439;
    --surface-sunken: #1e1a1d;
    --header-bg: rgba(36,31,35,.86);

    --primary: #dda8b4;
    --primary-fill: #a85a72;
    --primary-fill-pressed: #bd6c84;
    --primary-light: #4a373d;
    --primary-gradient: linear-gradient(135deg, #7e4a5c 0%, #8f5568 48%, #633a49 100%);
    --on-primary: #ffffff;
    --on-primary-muted: rgba(255,255,255,.74);

    --text: #f0ecee;
    --text-muted: #aaa1a6;
    --outline: #42383e;
    --outline-strong: #544850;
    --hairline: rgba(255,255,255,.06);

    --success: #7cc9a6;
    --success-fill: #2f7d5f;
    --success-soft: #1e3830;
    --success-border: rgba(124,201,166,.28);
    --success-glow: rgba(0,0,0,.42);
    --warning: #d0b080;
    --warning-fill: #8f6524;
    --warning-fill-pressed: #a4752c;
    --warning-soft: #33280f;
    --warning-border: rgba(208,176,128,.34);
    --warning-tint: rgba(208,176,128,.18);
    --warning-glow: rgba(0,0,0,.42);
    --return-tint: #2c211d;
    --error: #db9496;
    --error-soft: #3b1c23;

    --share-bg: #d9c400;
    --share-text: #2b2000;

    --focus-border: rgba(221,168,180,.6);
    --focus-glow: rgba(221,168,180,.16);
    --focus-ring: rgba(221,168,180,.42);
    --primary-border: rgba(221,168,180,.28);

    --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
    --shadow-md: 0 2px 6px rgba(0,0,0,.4), 0 12px 28px rgba(0,0,0,.34);
    --shadow-lg: 0 2px 8px rgba(0,0,0,.4), 0 14px 40px rgba(0,0,0,.55);
    --shadow-primary: 0 6px 18px rgba(0,0,0,.44);
    --nav-shadow: 0 -8px 28px rgba(0,0,0,.36);
    --edge-highlight: inset 0 1px 0 rgba(255,255,255,.08);
    --picker-filter: invert(1) brightness(1.7);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #1a1619;
  --background-tint: radial-gradient(1100px 420px at 50% -220px, rgba(221,168,180,.05), transparent 66%);
  --surface: #241f23;
  --surface-soft: #2f292d;
  --surface-strong: #3b3439;
  --surface-sunken: #1e1a1d;
  --header-bg: rgba(36,31,35,.86);

  --primary: #dda8b4;
  --primary-fill: #a85a72;
  --primary-fill-pressed: #bd6c84;
  --primary-light: #4a373d;
  --primary-gradient: linear-gradient(135deg, #7e4a5c 0%, #8f5568 48%, #633a49 100%);
  --on-primary: #ffffff;
  --on-primary-muted: rgba(255,255,255,.74);

  --text: #f0ecee;
  --text-muted: #aaa1a6;
  --outline: #42383e;
  --outline-strong: #544850;
  --hairline: rgba(255,255,255,.06);

  --success: #7cc9a6;
  --success-fill: #2f7d5f;
  --success-soft: #1e3830;
  --success-border: rgba(124,201,166,.28);
  --success-glow: rgba(0,0,0,.42);
  --warning: #d0b080;
  --warning-fill: #8f6524;
  --warning-fill-pressed: #a4752c;
  --warning-soft: #33280f;
  --warning-border: rgba(208,176,128,.34);
  --warning-tint: rgba(208,176,128,.18);
  --warning-glow: rgba(0,0,0,.42);
  --return-tint: #2c211d;
  --error: #db9496;
  --error-soft: #3b1c23;

  --share-bg: #d9c400;
  --share-text: #2b2000;

  --focus-border: rgba(221,168,180,.6);
  --focus-glow: rgba(221,168,180,.16);
  --focus-ring: rgba(221,168,180,.42);
  --primary-border: rgba(221,168,180,.28);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 2px 6px rgba(0,0,0,.4), 0 12px 28px rgba(0,0,0,.34);
  --shadow-lg: 0 2px 8px rgba(0,0,0,.4), 0 14px 40px rgba(0,0,0,.55);
  --shadow-primary: 0 6px 18px rgba(0,0,0,.44);
  --nav-shadow: 0 -8px 28px rgba(0,0,0,.36);
  --edge-highlight: inset 0 1px 0 rgba(255,255,255,.08);
  --picker-filter: invert(1) brightness(1.7);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; background: var(--background); }
body, button, input, textarea, select { font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif; color: var(--text); }
body { user-select: none; -webkit-user-select: none; font-size: 15px; }
button { border: 0; cursor: pointer; font-size: 15px; }
input, textarea, select { font-size: 16px; }
input, textarea { user-select: text; -webkit-user-select: text; }
h1, h2, p { margin: 0; }
h2 { font-size: 17px; line-height: 1.35; letter-spacing: -.02em; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.safe-top { padding-top: env(safe-area-inset-top, 0px); }
.safe-bottom { padding-bottom: env(safe-area-inset-bottom, 0px); }

.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 16px; height: 16px; stroke-width: 1.9; }
.ic.lg { width: 26px; height: 26px; stroke-width: 1.5; }

.app-shell { position: fixed; inset: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--background); background-image: var(--background-tint); }
.app-header { flex: 0 0 auto; min-height: 68px; padding-left: max(18px, calc((100vw - 720px) / 2)); padding-right: max(18px, calc((100vw - 720px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text); border-bottom: 1px solid var(--hairline); background: var(--header-bg); backdrop-filter: blur(18px); z-index: 5; }
.header-title-row { min-width: 0; height: 56px; display: flex; align-items: center; gap: 9px; }
.header-title-row h1 { font-size: 19px; letter-spacing: -.035em; }
.header-mark { width: 6px; height: 6px; border-radius: 50%; background: var(--primary-gradient); box-shadow: 0 0 0 3px var(--primary-light); }
.header-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 7px; }
.date-control { flex: 0 0 auto; display: flex; align-items: center; }
.date-control input { width: 138px; height: 40px; padding: 0 10px; border: 0; border-radius: var(--radius-xs); color: var(--text); background: var(--surface-soft); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; outline: 0; }
.date-control input::-webkit-calendar-picker-indicator { opacity: .5; filter: var(--picker-filter); }
.theme-toggle { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-xs); color: var(--text-muted); background: var(--surface-soft); transition: color 160ms ease, background 160ms ease; }
.theme-toggle[data-theme-state="dark"] { color: var(--primary); background: var(--primary-light); }
.theme-toggle[data-theme-state="light"] { color: var(--warning); background: var(--warning-soft); }

.tab-view { display: none; min-height: 0; flex: 1 1 auto; }
.tab-view.active { display: flex; flex-direction: column; animation: view-in 260ms cubic-bezier(.22,.68,.35,1) both; }
.scroll-content, .overlay-content { width: 100%; max-width: 720px; min-height: 0; flex: 1 1 auto; align-self: center; overflow-y: auto; overscroll-behavior-y: contain; padding: 22px 18px 32px; scrollbar-gutter: stable; }
.stack-xs > * + * { margin-top: 6px; }
.stack-sm > * + * { margin-top: 12px; }
.stack-md > * + * { margin-top: 18px; }

.panel { padding: 18px; border: 1px solid var(--outline); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-md); }
.section-kicker, .overlay-kicker { display: block; color: var(--primary); font-size: 11px; font-weight: 700; letter-spacing: .055em; }
.register-form > * + * { margin-top: 14px; }
.type-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-left: 0; margin-right: 0; padding: 4px; border: 0; border-radius: var(--radius-sm); background: var(--surface-soft); }
.type-switch label { position: relative; }
.type-switch input { position: absolute; opacity: 0; }
.type-switch span { min-height: 42px; display: flex; align-items: center; justify-content: center; border-radius: 10px; color: var(--text-muted); font-size: 13px; font-weight: 600; text-align: center; transition: color 180ms ease, background 180ms ease, box-shadow 180ms ease; }
.type-switch input:checked + span { color: var(--text); background: var(--surface); box-shadow: var(--shadow-sm); }
.field-row { display: flex; gap: 10px; }
.field { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.field > span { color: var(--text-muted); font-size: 11px; font-weight: 600; }
.field input, .field textarea, .edit-fields input, .edit-fields select { width: 100%; min-height: 48px; padding: 10px 13px; border: 1px solid transparent; border-radius: var(--radius-sm); outline: 0; color: var(--text); background: var(--surface-soft); transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease; }
.field input:focus, .field textarea:focus, .edit-fields input:focus, .edit-fields select:focus { border-color: var(--focus-border); background: var(--surface); box-shadow: 0 0 0 3px var(--focus-glow); }
.field input[type="date"]::-webkit-calendar-picker-indicator { filter: var(--picker-filter); }
.grow { flex: 1; }
.dong-field { width: 112px; }

.button { min-height: 48px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: var(--radius-sm); font-weight: 700; transition: transform 90ms ease, background-color 150ms ease, box-shadow 180ms ease, color 150ms ease; }
.button:active, .icon-button:active, .round-button:active, .nav-button:active, .card-button:active, .theme-toggle:active { transform: scale(.97); }
.button.primary { color: var(--on-primary); background: var(--primary-fill); box-shadow: var(--shadow-primary); }
.button.primary:active { background: var(--primary-fill-pressed); }
.button.soft { color: var(--primary); background: var(--primary-light); }
.button.outline { color: var(--text); border: 1px solid var(--outline); background: var(--surface); }
.button.share { color: var(--share-text); background: var(--share-bg); }
.button.danger-soft { color: var(--error); background: var(--error-soft); }
.button.danger-outline { color: var(--error); border: 1px solid var(--error); background: var(--surface); }
.button.full { width: 100%; }
.button.large { min-height: 56px; font-size: 16px; }
.button-row, .button-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.section-heading-row { display: flex; align-items: center; justify-content: space-between; padding: 0 3px; }
.count-chip, .type-chip, .status-badge { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.count-chip { min-height: 26px; padding: 0 9px; color: var(--text-muted); background: var(--surface-strong); }
.empty-state { min-height: 132px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 24px 22px; border: 1px dashed var(--outline); border-radius: var(--radius); color: var(--text-muted); background: var(--surface-sunken); text-align: center; font-size: 12px; }
.empty-state strong { color: var(--text); font-size: 14px; }
.empty-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--primary); background: var(--primary-light); }
.empty-icon .ic { width: 21px; height: 21px; }
.data-tools { overflow: hidden; border: 1px solid var(--outline); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.data-tools summary { min-height: 64px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; list-style: none; }
.data-tools summary::-webkit-details-marker { display: none; }
.data-tools-copy { display: flex; flex-direction: column; gap: 3px; }
.data-tools-copy strong { font-size: 13px; }
.data-tools-copy small { color: var(--text-muted); font-size: 11px; }
.summary-chevron { display: inline-flex; color: var(--text-muted); transition: transform 200ms cubic-bezier(.22,.68,.35,1); }
.data-tools[open] .summary-chevron { transform: rotate(90deg); }
.data-tools p, .page-intro p { margin-top: 4px; color: var(--text-muted); font-size: 12px; line-height: 1.5; }

.location-group { overflow: hidden; border: 1px solid var(--outline); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.group-header { min-height: 52px; padding: 8px 10px 8px 15px; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface-sunken); }
.group-label { min-width: 0; display: flex; align-items: center; gap: 8px; }
.group-label strong { overflow: hidden; font-size: 13px; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; }
.type-chip { min-height: 23px; padding: 0 8px; color: var(--text-muted); background: var(--surface-strong); }
.type-chip.route { color: var(--warning); background: var(--warning-soft); }
.icon-actions { flex: 0 0 auto; display: flex; gap: 4px; }
.icon-button, .round-button { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--text-muted); background: var(--surface-soft); font-size: 18px; font-weight: 700; transition: transform 90ms ease, background 150ms ease, color 150ms ease; }
.icon-button.danger { color: var(--error); background: var(--error-soft); }
.icon-button.on-color { color: #fff; background: rgba(255,255,255,.14); }
.icon-button:disabled { opacity: .3; pointer-events: none; }
.location-row, .prep-row, .delivery-row, .history-card { min-height: 60px; padding: 9px 11px 9px 15px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--hairline); }
.location-name { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.location-name strong { overflow: hidden; font-size: 14px; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; }
.location-name span { color: var(--text-muted); font-size: 11px; }
.edit-card { padding: 12px; border-top: 1px solid var(--outline); background: var(--surface); }
.edit-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.edit-fields .wide { grid-column: 1 / -1; }
.edit-actions { margin-top: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.page-intro { padding: 4px 2px 8px; }
.page-intro h2 { font-size: 22px; letter-spacing: -.035em; }
.page-intro .section-kicker { margin-bottom: 4px; color: var(--text-muted); }
.prep-group, .delivery-group { overflow: hidden; border: 1px solid var(--outline); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.toggle-header { width: 100%; min-height: 52px; padding: 0 15px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text); background: var(--surface-sunken); text-align: left; font-weight: 700; }
.toggle-header .ic { color: var(--text-muted); }
.prep-row input { width: 72px; height: 40px; padding: 0 8px; border: 1px solid var(--outline); border-radius: 10px; outline: 0; color: var(--text); background: var(--surface-soft); text-align: center; font-variant-numeric: tabular-nums; }
.prep-row small { color: var(--text-muted); }
.prep-row-actual { flex: 0 0 auto; min-width: 50px; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.prep-row-actual span { color: var(--text-muted); font-size: 10px; font-weight: 600; }
.prep-row-actual strong { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.prep-row-actual strong.reached { color: var(--success); }
.prep-row-actual.idle strong { color: var(--text-muted); opacity: .45; }
.prep-row-name { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.prep-row-head { min-width: 0; overflow: hidden; display: flex; align-items: center; gap: 6px; }
.prep-row-title { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.goal-badge { flex: 0 0 auto; min-height: 20px; padding: 0 7px 0 5px; display: inline-flex; align-items: center; gap: 3px; border-radius: 999px; color: var(--success); background: var(--success-soft); font-size: 10px; font-weight: 700; white-space: nowrap; }
.goal-badge .ic { width: 12px; height: 12px; stroke-width: 2.4; }
.goal-badge.exceeded { color: #fff; background: var(--success-fill); }
.return-badge { flex: 0 0 auto; min-height: 20px; padding: 0 7px; display: inline-flex; align-items: center; border-radius: 999px; color: var(--warning); background: var(--warning-soft); font-size: 10px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.progress-track { display: block; width: 100%; max-width: 200px; height: 4px; overflow: hidden; border-radius: 999px; background: var(--surface-strong); }
.progress-fill { display: block; height: 100%; border-radius: 999px; background: var(--primary-gradient); transition: width 420ms cubic-bezier(.22,.68,.35,1); }
.progress-fill.done { background: var(--success-fill); }
.route-prep-card { min-height: 70px; padding: 12px 15px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid var(--outline); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.route-prep-card strong { font-size: 14px; }
.route-prep-card span { display: block; margin-top: 2px; color: var(--text-muted); font-size: 11px; }
.delivery-row, .history-card { width: 100%; color: var(--text); background: var(--surface); text-align: left; }
.delivery-row > span:first-child, .history-card strong { font-size: 14px; font-weight: 600; }
.delivery-meta { display: flex; align-items: center; gap: 8px; }
.delivery-selector { margin-left: -18px; margin-right: -18px; padding: 0 18px 3px; display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scroll-padding-left: 18px; scrollbar-width: none; }
.delivery-selector::-webkit-scrollbar { display: none; }
.delivery-chip { width: 172px; min-height: 70px; flex: 0 0 auto; padding: 10px 12px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 6px; border: 1px solid var(--outline); border-radius: var(--radius-sm); color: var(--text); background: var(--surface); box-shadow: var(--shadow-sm); text-align: left; scroll-snap-align: start; transition: color 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease, transform 140ms cubic-bezier(.34,1.4,.64,1); }
.delivery-chip:active { transform: scale(.97); }
.delivery-chip.reached { border-color: var(--success-border); background: var(--success-soft); }
.delivery-chip.exceeded { color: #fff; border-color: transparent; background: var(--success-fill); }
.delivery-chip.exceeded .delivery-chip-title em, .delivery-chip.exceeded .delivery-chip-status,
.delivery-chip.exceeded .delivery-chip-return, .delivery-chip.exceeded .delivery-chip-meta .ic { color: inherit; }
.delivery-chip.active { color: var(--on-primary); border-color: transparent; background: var(--primary-gradient); box-shadow: var(--shadow-primary), var(--edge-highlight); transform: translateY(-1px); }
.delivery-chip-title { width: 100%; overflow: hidden; font-size: 14px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; }
.delivery-chip-title em { font-style: normal; font-weight: 600; color: var(--text-muted); }
.delivery-chip-meta { width: 100%; display: flex; align-items: center; gap: 5px; overflow: hidden; }
.delivery-chip-meta .ic { width: 13px; height: 13px; stroke-width: 2.4; color: var(--success); }
.delivery-chip-status { flex: 0 0 auto; font-size: 12px; font-weight: 600; color: var(--text-muted); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.delivery-chip-return { flex: 0 0 auto; margin-left: auto; display: inline-flex; align-items: center; gap: 2px; color: var(--warning); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.delivery-chip-return .ic { width: 11px; height: 11px; stroke-width: 2.2; color: inherit; }
.delivery-chip-status.success { color: var(--success); }
.delivery-chip-status.warning { color: var(--warning); }
.delivery-chip.active .delivery-chip-status, .delivery-chip.active .delivery-chip-title em,
.delivery-chip.active .delivery-chip-return, .delivery-chip.active .delivery-chip-meta .ic { color: var(--on-primary-muted); }
.delivery-inline { min-width: 0; }
.delivery-inline-header { min-height: 54px; padding: 5px 2px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.delivery-inline-header h1 { overflow: hidden; margin-top: 2px; font-size: 19px; letter-spacing: -.03em; text-overflow: ellipsis; white-space: nowrap; }
.delivery-inline-content { padding: 16px; border: 1px solid var(--outline); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-md); }
/* 배송중 세로 스냅: 맨 위 · 배송지 제목 · 입력된 내역 세 지점에서만 걸린다.
   mandatory 는 제목과 내역 사이(키패드 구간)가 화면보다 길 때 그 사이에 멈추지 못하게 만들어
   중간 내용을 볼 수 없다. 걸리는 느낌은 살리되 아무 데나 멈출 수 있도록 proximity 를 쓴다.
   scroll-padding-top 은 .scroll-content 의 위쪽 여백과 같은 값이라 맨 위 스냅이 스크롤 0에서 맞는다.
   LIMIT: 입력 내역이 적어 아래로 더 굴릴 여지가 없으면 내역 스냅점에 닿지 못한다(스크롤 끝이 먼저다).
   그때는 어차피 내역이 화면에 다 보인다. 항상 걸리게 하려면 마지막 섹션에 화면 높이만큼 여백이 필요하다. */
#tab-delivery .scroll-content { scroll-snap-type: y proximity; scroll-padding-top: 22px; }
#tab-delivery .page-intro, #delivery-detail,
#dd-apartment-mode > section[aria-labelledby="entries-heading"] { scroll-snap-align: start; }
.status-badge { min-height: 28px; padding: 0 10px; font-variant-numeric: tabular-nums; }
.status-badge.neutral { color: var(--primary); background: var(--primary-light); }
.status-badge.success { color: var(--success); background: var(--success-soft); }
.status-badge.warning { color: var(--warning); background: var(--warning-soft); }

.report-box { width: 100%; min-height: min(52vh,430px); padding: 17px; resize: none; border: 1px solid var(--outline); border-radius: var(--radius); outline: 0; color: var(--text); background: var(--surface); box-shadow: var(--shadow-sm); font-size: 13px; line-height: 1.7; font-variant-numeric: tabular-nums; }
.settlement-summary { position: relative; overflow: hidden; padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 14px; border-radius: var(--radius-lg); color: #fff; background: var(--primary-gradient); box-shadow: var(--shadow-lg), var(--edge-highlight); }
.settlement-summary::after { content: ""; position: absolute; top: -80px; right: -60px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255,255,255,.07); pointer-events: none; }
.settlement-metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: center; }
.settlement-metric { min-width: 0; padding: 0 16px; display: flex; flex-direction: column; gap: 5px; }
.settlement-metric:first-child { padding-left: 0; border-right: 1px solid rgba(255,255,255,.2); }
.settlement-metric:last-child { padding-right: 0; }
.settlement-metric span { overflow: hidden; color: rgba(255,255,255,.76); font-size: 11px; font-weight: 600; letter-spacing: .01em; text-overflow: ellipsis; white-space: nowrap; }
.settlement-metric strong { overflow: hidden; color: #fff; font-size: 25px; font-variant-numeric: tabular-nums; letter-spacing: -.04em; text-overflow: ellipsis; white-space: nowrap; }
.settlement-progress { display: flex; flex-direction: column; gap: 7px; }
.settlement-progress .progress-track { max-width: none; height: 5px; background: rgba(255,255,255,.2); }
.settlement-progress .progress-fill { background: #fff; }
.settlement-progress-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: rgba(255,255,255,.82); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.settlement-month { min-height: 56px; width: 100%; padding: 0 15px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--outline); border-radius: var(--radius); color: var(--text); background: var(--surface); box-shadow: var(--shadow-sm); text-align: left; }
.settlement-month-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.settlement-month-copy span { color: var(--text-muted); font-size: 11px; font-weight: 600; }
.settlement-month-copy strong { overflow: hidden; font-size: 14px; font-variant-numeric: tabular-nums; letter-spacing: -.015em; text-overflow: ellipsis; white-space: nowrap; }
.settlement-month .ic { color: var(--outline-strong); }
/* 두 칸을 같은 폭·같은 높이로 못박는다.
   iOS 는 date 입력에 고유 크기를 잡아 width/max-width 를 무시한다. 그래서 날짜 칸이 제 열을
   넘어 버튼 위로 삐져나오고 높이도 버튼(48px)과 어긋났다. 네이티브 외형을 끄면 보통 입력처럼
   계산된다. 값 위치는 WebKit 전용 의사 요소까지 가운데로 맞춰야 버튼 글자와 같은 자리에 놓인다.
   font-size 는 건드리지 않는다 — 16px 미만이면 iOS 가 입력 시 화면을 확대한다.

   세로 가운데는 두 겹으로 잡는다. 높이를 못박으면 iOS 는 값 상자를 내용 영역 위쪽에 붙여 놓는데,
   입력을 flex 컨테이너로 만들면 align-items 가 값 상자를 가운데로 내린다. 그게 먹지 않는
   경우를 대비해 의사 요소의 line-height 로도 같은 자리를 만든다.
   line-height 46px = 높이 48px − 위아래 테두리 1px 씩. 높이를 바꾸면 이 값도 같이 바꿔야 한다. */
.bulk-delete-panel { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: end; gap: 8px; }
.bulk-delete-panel .field { min-width: 0; overflow: hidden; }
.bulk-delete-panel input[type="date"] { -webkit-appearance: none; appearance: none; display: flex; align-items: center; justify-content: center; width: 100%; min-width: 0; max-width: 100%; height: 48px; min-height: 48px; padding: 0 12px; overflow: hidden; text-align: center; }
.bulk-delete-panel input[type="date"]::-webkit-date-and-time-value { flex: 1 1 auto; width: 100%; margin: 0; line-height: 46px; text-align: center; }
.bulk-delete-panel .button { min-width: 0; width: 100%; height: 48px; white-space: nowrap; }
.history-card { min-height: 72px; border: 1px solid var(--outline); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.history-card .summary { margin-top: 4px; color: var(--text-muted); font-size: 11px; }
.chevron { display: inline-flex; color: var(--outline-strong); }
.notice { position: relative; padding: 13px 44px 13px 14px; display: flex; flex-direction: column; gap: 3px; border-radius: var(--radius); font-size: 12px; }
.notice.success { color: var(--success); border: 1px solid var(--success-border); background: var(--success-soft); }
.notice-close { position: absolute; top: 7px; right: 7px; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; color: inherit; background: transparent; }
.date-shift-notice { width: 100%; max-width: 720px; flex: 0 0 auto; align-self: center; padding: 8px 10px 8px 16px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--warning-border); color: var(--warning); background: var(--warning-soft); font-size: 12px; z-index: 4; animation: view-in 300ms cubic-bezier(.22,.68,.35,1) both; }
.date-shift-copy { flex: 1; min-width: 0; line-height: 1.45; }
.date-shift-copy strong { font-weight: 700; }
.date-shift-action { flex: 0 0 auto; min-height: 40px; padding: 0 12px; border-radius: var(--radius-xs); color: #fff; background: var(--warning-fill); font-size: 12px; font-weight: 700; white-space: nowrap; }
.date-shift-action:active { background: var(--warning-fill-pressed); }
.date-shift-close { flex: 0 0 auto; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: inherit; background: transparent; }

.bottom-nav { width: 100%; max-width: 720px; flex: 0 0 auto; align-self: center; display: grid; grid-template-columns: repeat(5,1fr); border: 1px solid var(--hairline); border-bottom: 0; border-radius: 18px 18px 0 0; background: var(--header-bg); box-shadow: var(--nav-shadow); backdrop-filter: blur(18px); z-index: 5; }
.update-notice { width: calc(100% - 28px); max-width: 692px; min-height: 64px; margin: 0 auto 10px; padding: 10px 10px 10px 14px; flex: 0 0 auto; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 10px; border: 1px solid var(--primary-border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-lg); z-index: 6; }
.update-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.update-copy strong { font-size: 13px; }
.update-copy span { overflow: hidden; color: var(--text-muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.update-actions { display: flex; align-items: center; gap: 4px; }
.update-action { min-height: 40px; padding: 0 10px; border-radius: var(--radius-xs); color: var(--text-muted); background: transparent; font-size: 11px; font-weight: 600; white-space: nowrap; }
.update-action.primary { color: var(--on-primary); background: var(--primary-fill); }
.update-action.primary:active { background: var(--primary-fill-pressed); }
.update-action:disabled { opacity: .62; cursor: wait; }
.nav-button { min-height: 70px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--text-muted); background: transparent; font-size: 11px; font-weight: 600; transition: color 160ms ease; }
.nav-button.active { color: var(--primary); }
.nav-icon { min-width: 38px; height: 25px; padding: 3px 9px; display: flex; align-items: center; justify-content: center; border-radius: 999px; transition: background-color 200ms ease, transform 200ms cubic-bezier(.34,1.4,.64,1); }
.nav-button.active .nav-icon { background: var(--primary-light); transform: translateY(-1px); }
.nav-icon .ic { width: 19px; height: 19px; }

.overlay { position: fixed; inset: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--background); background-image: var(--background-tint); z-index: 20; animation: view-in 220ms cubic-bezier(.22,.68,.35,1) both; }
.overlay-header { flex: 0 0 auto; min-height: 68px; padding-left: max(12px, calc((100vw - 720px) / 2)); padding-right: max(16px, calc((100vw - 720px) / 2)); display: flex; align-items: center; gap: 10px; color: var(--text); border-bottom: 1px solid var(--hairline); background: var(--header-bg); backdrop-filter: blur(18px); }
.overlay-title-wrap { min-width: 0; flex: 1; }
.overlay-kicker { color: var(--primary); font-size: 10px; }
.overlay-title-wrap h1 { overflow: hidden; margin-top: 1px; font-size: 16px; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
.overlay-header .icon-button.on-color { color: var(--text); background: var(--surface-soft); }
.overlay-header .status-badge { color: var(--primary); background: var(--primary-light); }
.unit-display { min-height: 66px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--outline); border-radius: var(--radius); background: var(--surface-sunken); }
.unit-display strong { color: var(--primary); font-size: 30px; font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.unit-display strong.placeholder { color: var(--text-muted); opacity: .38; }
.unit-hint { min-height: 18px; margin-top: 6px; display: flex; align-items: center; justify-content: center; gap: 5px; color: var(--warning); font-size: 11px; font-weight: 600; }
.numpad { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; }
.numpad button { min-height: 52px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--outline); border-radius: var(--radius-sm); color: var(--text); background: var(--surface); font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; transition: transform 80ms ease, background 150ms ease, border-color 150ms ease; }
.numpad button:active { border-color: transparent; background: var(--primary-light); transform: scale(.95); }
.numpad .numpad-action { color: var(--primary); font-size: 12px; }
.quantity-control { min-height: 60px; padding: 8px 10px 8px 14px; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--outline); border-radius: var(--radius); background: var(--surface); color: var(--text-muted); font-size: 12px; font-weight: 600; transition: border-color 180ms ease, background 180ms ease, color 180ms ease; }
.quantity-control.return-mode { border-color: var(--warning-border); color: var(--warning); background: var(--warning-soft); }
.quantity-control > div { display: flex; align-items: center; gap: 14px; }
.quantity-control strong { min-width: 32px; color: var(--primary); font-size: 21px; text-align: center; font-variant-numeric: tabular-nums; transition: color 180ms ease; }
.quantity-control strong.return-mode { color: var(--warning); }
.round-button { border: 0; color: var(--primary); }
.quantity-control.return-mode .round-button { color: var(--warning); background: var(--warning-tint); }
.button.return-mode { color: #fff; background: var(--warning-fill); box-shadow: 0 5px 14px var(--warning-glow); }
.button.return-mode:active { background: var(--warning-fill-pressed); }
.button.return-mode:focus-visible { outline-color: var(--warning-border); }
.button.saved-mode { color: #fff; background: var(--success-fill); box-shadow: 0 5px 14px var(--success-glow); }
.button.saved-mode:active { background: var(--success-fill); }
.entry-card { min-height: 58px; padding: 8px 8px 8px 13px; display: flex; align-items: center; justify-content: space-between; border-left: 3px solid var(--success); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-sm); }
.entry-card:first-child { animation: entry-in 320ms cubic-bezier(.22,.68,.35,1) both; }
.entry-card.return { border-left-color: var(--warning); background: var(--return-tint); }
.entry-card strong { font-size: 15px; letter-spacing: -.01em; }
.entry-card .entry-meta { color: var(--text-muted); font-size: 11px; font-weight: 400; }
.entry-card .entry-meta.return { color: var(--warning); font-weight: 700; }
.entry-time { display: block; margin-top: 2px; color: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.route-memo-field textarea { min-height: 300px; padding: 15px; resize: vertical; line-height: 1.65; background: var(--surface); }
.save-status-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: 11px; }
.save-status-row span:first-child { color: var(--success); font-weight: 600; }
.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom,0px)); max-width: calc(100% - 32px); padding: 11px 16px; display: flex; align-items: center; gap: 10px; border-radius: 999px; color: #fff; background: rgba(24,23,27,.94); box-shadow: var(--shadow-lg); transform: translateX(-50%); font-size: 12px; font-weight: 600; z-index: 50; animation: toast-in 240ms cubic-bezier(.22,.68,.35,1) both; }

.settings-toggle { position: relative; margin-top: 2px; margin-right: 14px; margin-bottom: 10px; margin-left: 14px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; border: 1px solid var(--outline); border-radius: var(--radius-sm); background: var(--surface-soft); cursor: pointer; }
.settings-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.settings-toggle-box { width: 24px; height: 24px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--outline-strong); border-radius: 8px; color: transparent; background: var(--surface); transition: color 150ms ease, background 150ms ease, border-color 150ms ease; }
.settings-toggle input:checked + .settings-toggle-box { color: var(--on-primary); border-color: transparent; background: var(--primary-fill); }
.settings-toggle input:focus-visible + .settings-toggle-box { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.settings-toggle-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.settings-toggle-copy strong { font-size: 13px; }
.settings-toggle-copy small { color: var(--text-muted); font-size: 11px; line-height: 1.45; }
.settings-row { padding: 4px 14px 0; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 8px; }
.settings-row .button { white-space: nowrap; }
.settings-note { margin-top: 8px; padding: 0 14px; color: var(--text-muted); font-size: 11px; line-height: 1.5; }
.data-tools .button-grid { padding: 12px 14px 14px; }

.month-panel { display: flex; flex-direction: column; gap: 14px; }
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.month-nav strong { font-size: 16px; font-weight: 700; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.month-metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
.month-metric { min-width: 0; padding: 0 14px; display: flex; flex-direction: column; gap: 4px; }
.month-metric:first-child { padding-left: 0; border-right: 1px solid var(--hairline); }
.month-metric:last-child { padding-right: 0; }
.month-metric span { color: var(--text-muted); font-size: 11px; font-weight: 600; }
.month-metric strong { overflow: hidden; color: var(--primary); font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -.04em; text-overflow: ellipsis; white-space: nowrap; }
.month-sub { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.month-chart { height: 58px; display: flex; align-items: flex-end; gap: 3px; }
.month-bar { flex: 1 1 0; min-width: 2px; border-radius: 3px 3px 0 0; background: var(--primary-gradient); transition: height 380ms cubic-bezier(.22,.68,.35,1); }
.month-bar.blank { background: var(--surface-strong); }
.month-chart-empty { width: 100%; align-self: center; color: var(--text-muted); font-size: 12px; text-align: center; }

.detail-metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.detail-metric { min-width: 0; min-height: 68px; padding: 11px 14px; display: flex; flex-direction: column; justify-content: center; gap: 4px; border: 1px solid var(--outline); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.detail-metric span { color: var(--text-muted); font-size: 11px; font-weight: 600; }
.detail-metric strong { overflow: hidden; color: var(--primary); font-size: 19px; font-variant-numeric: tabular-nums; letter-spacing: -.035em; text-overflow: ellipsis; white-space: nowrap; }

.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 60; }
.modal-scrim { position: absolute; inset: 0; background: rgba(10,9,13,.52); backdrop-filter: blur(3px); animation: fade-in 180ms ease both; }
.modal-card { position: relative; width: 100%; max-width: 400px; max-height: calc(100vh - 80px); max-height: calc(100dvh - 80px); overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--outline); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-lg), var(--edge-highlight); animation: modal-in 240ms cubic-bezier(.22,.68,.35,1) both; }
.modal-title { font-size: 17px; font-weight: 700; letter-spacing: -.025em; }
.modal-message { color: var(--text-muted); font-size: 13px; line-height: 1.62; white-space: pre-line; user-select: text; -webkit-user-select: text; }
.modal-actions { margin-top: 4px; display: grid; gap: 8px; }
.modal-actions .button { min-height: 50px; }

.toast.with-action { padding-right: 8px; }
.toast-action { flex: 0 0 auto; min-height: 36px; padding: 0 14px; border-radius: 999px; color: #fff; background: rgba(255,255,255,.2); font-size: 12px; font-weight: 700; }
.toast-action:active { background: rgba(255,255,255,.32); }

@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes entry-in { from { opacity: 0; transform: translateY(-8px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }

button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.nav-button:focus-visible { outline: none; }
.nav-button:focus-visible .nav-icon { box-shadow: 0 0 0 2px var(--focus-ring); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
@media (max-width: 380px) { .prep-row { padding-left: 11px; padding-right: 8px; } .prep-row input { width: 58px; } .prep-row-actual { min-width: 44px; } }
@media (max-width: 370px) { .app-header { padding-left: 14px; padding-right: 14px; } .date-control input { width: 112px; } .scroll-content { padding-left: 14px; padding-right: 14px; } .dong-field { width: 96px; } .icon-button { width: 38px; height: 38px; } .type-switch span { font-size: 12px; } .bulk-delete-panel .button { padding: 0 10px; font-size: 13px; } .settlement-summary { padding-left: 14px; padding-right: 14px; } .settlement-metric { padding-left: 11px; padding-right: 11px; } .settlement-metric strong { font-size: 21px; } .update-notice { width: calc(100% - 20px); padding-left: 11px; } .update-copy span { display: none; } .update-action { padding-left: 8px; padding-right: 8px; } }
@media (min-width: 721px) { .app-header { min-height: 76px; } .bottom-nav { margin-bottom: 12px; border-bottom: 1px solid var(--hairline); border-radius: 18px; } }
@media (max-height: 720px) { .numpad button { min-height: 44px; } .overlay-content { padding-top: 13px; padding-bottom: 18px; } .route-memo-field textarea { min-height: 230px; } }
@media (max-height: 470px) { .bottom-nav { display: none; } .numpad button { min-height: 38px; } }
