@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; }

:root {
  color-scheme: light;
  --background: #fff8fa;
  --surface: #ffffff;
  --surface-soft: #fff0f5;
  --surface-strong: #fce7f3;
  --primary: #be185d;
  --primary-pressed: #9d174d;
  --primary-light: #fce7f3;
  --text: #2d1821;
  --text-muted: #765563;
  --outline: #edc4d3;
  --outline-strong: #d99aae;
  --success: #287a5b;
  --success-soft: #e6f5ef;
  --warning: #a85e13;
  --warning-soft: #fff1df;
  --error: #b4233c;
  --error-soft: #fde8ec;
  --shadow: 0 10px 30px rgba(99, 27, 58, 0.08);
  --radius-sm: 10px;
  --radius: 16px;
}

* { 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; }
button, input, textarea, select { font-size: 16px; }
button { border: 0; cursor: pointer; }
input, textarea { user-select: text; -webkit-user-select: text; }
h1, h2, p { margin: 0; }
h2 { font-size: 17px; line-height: 1.35; }
.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); }

.app-shell { position: fixed; inset: 0; display: flex; flex-direction: column; overflow: hidden; background: radial-gradient(circle at 100% 0, rgba(244, 114, 182, 0.16), transparent 30%), var(--background); }
.app-header { flex: 0 0 auto; padding-left: 20px; padding-right: 20px; color: #fff; background: linear-gradient(145deg, #9d174d, var(--primary) 55%, #db2777); box-shadow: 0 8px 26px rgba(157, 23, 77, 0.18); z-index: 5; }
.header-title-row { height: 52px; display: flex; align-items: center; gap: 8px; }
.header-title-row h1 { font-size: 19px; letter-spacing: -0.02em; }
.header-mark { font-size: 7px; color: #fbcfe8; }
.date-control { height: 48px; padding-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.date-control input { width: 100%; height: 38px; padding: 0 12px; border: 1px solid rgba(255,255,255,.26); border-radius: 10px; color: #fff; background: rgba(255,255,255,.14); font-weight: 600; font-variant-numeric: tabular-nums; outline: 0; }
.date-control input::-webkit-calendar-picker-indicator { filter: invert(1); opacity: .86; }

.tab-view { display: none; min-height: 0; flex: 1 1 auto; }
.tab-view.active { display: flex; flex-direction: column; }
.scroll-content, .overlay-content { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior-y: contain; padding: 20px 16px 28px; }
.stack-xs > * + * { margin-top: 6px; }
.stack-sm > * + * { margin-top: 10px; }
.stack-md > * + * { margin-top: 16px; }

.panel { padding: 14px; border: 1px solid var(--outline); border-radius: var(--radius); background: rgba(255,255,255,.94); box-shadow: var(--shadow); }
.section-kicker, .overlay-kicker { display: block; color: var(--primary); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.register-form > * + * { margin-top: 12px; }
.type-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin: 0; padding: 5px; border: 1px solid var(--outline); border-radius: 13px; 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: 9px; color: var(--text-muted); font-size: 14px; font-weight: 600; text-align: center; }
.type-switch input:checked + span { color: #fff; background: var(--primary); box-shadow: 0 5px 14px rgba(190,24,93,.2); }
.field-row { display: flex; gap: 8px; }
.field { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.field > span { color: var(--text-muted); font-size: 12px; font-weight: 600; }
.field input, .field textarea, .edit-fields input, .edit-fields select { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--outline); border-radius: var(--radius-sm); outline: 0; background: var(--surface-soft); transition: border-color 120ms, box-shadow 120ms, background 120ms; }
.field input:focus, .field textarea:focus, .edit-fields input:focus, .edit-fields select:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(190,24,93,.12); }
.grow { flex: 1; }
.dong-field { width: 112px; }

.button { min-height: 48px; padding: 0 16px; border-radius: 12px; font-weight: 700; transition: transform 80ms, background-color 80ms; }
.button:active, .icon-button:active, .round-button:active, .nav-button:active, .card-button:active { transform: scale(.97); }
.button.primary { color: #fff; background: var(--primary); }
.button.primary:active { background: var(--primary-pressed); }
.button.soft { color: var(--primary); background: var(--primary-light); }
.button.outline { color: var(--primary); border: 1px solid var(--primary); background: #fff; }
.button.share { color: #4a3500; background: #fee500; }
.button.danger-soft { color: var(--error); background: var(--error-soft); }
.button.danger-outline { color: var(--error); border: 1px solid var(--error); background: #fff; }
.button.full { width: 100%; }
.button.large { min-height: 56px; font-size: 17px; }
.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: 12px; font-weight: 700; white-space: nowrap; }
.count-chip { min-height: 26px; padding: 0 9px; color: var(--primary); background: var(--primary-light); }
.empty-state { min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 24px; border: 1px dashed var(--outline-strong); border-radius: var(--radius); color: var(--text-muted); background: rgba(255,255,255,.56); text-align: center; font-size: 13px; }
.empty-state strong { color: var(--text); font-size: 15px; }
.empty-icon { color: var(--primary); font-size: 28px; }
.data-tools { display: flex; flex-direction: column; gap: 14px; }
.data-tools p, .page-intro p { margin-top: 4px; color: var(--text-muted); font-size: 13px; line-height: 1.55; }

.location-group { overflow: hidden; border: 1px solid var(--outline); border-radius: var(--radius); background: var(--surface); box-shadow: 0 5px 18px rgba(99,27,58,.05); }
.group-header { min-height: 50px; padding: 8px 10px 8px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface-soft); }
.group-label { min-width: 0; display: flex; align-items: center; gap: 8px; }
.group-label strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.type-chip { min-height: 23px; padding: 0 8px; color: var(--primary); background: var(--primary-light); }
.type-chip.route { color: #704214; background: #fff0d8; }
.icon-actions { flex: 0 0 auto; display: flex; gap: 4px; }
.icon-button, .round-button { width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--text-muted); background: #fff; font-size: 20px; font-weight: 700; }
.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: .28; pointer-events: none; }
.location-row, .prep-row, .delivery-row, .history-card { min-height: 58px; padding: 8px 10px 8px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--outline); }
.location-name { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.location-name strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.location-name span { color: var(--text-muted); font-size: 12px; }
.edit-card { padding: 12px; border-top: 1px solid var(--outline); background: #fff; }
.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: 3px 4px 10px; }
.page-intro.compact { padding-bottom: 4px; }
.prep-group, .delivery-group { overflow: hidden; border: 1px solid var(--outline); border-radius: var(--radius); background: #fff; }
.toggle-header { width: 100%; min-height: 50px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text); background: var(--surface-soft); text-align: left; font-weight: 700; }
.prep-row input { width: 72px; height: 40px; padding: 0 8px; border: 1px solid var(--outline); border-radius: 10px; outline: 0; background: var(--surface-soft); text-align: center; font-variant-numeric: tabular-nums; }
.route-prep-card { min-height: 70px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid #f1d5a8; border-radius: var(--radius); background: #fffaf2; }
.route-prep-card strong { font-size: 15px; }
.route-prep-card span { display: block; margin-top: 2px; color: var(--text-muted); font-size: 12px; }
.delivery-row, .history-card { width: 100%; color: var(--text); background: #fff; text-align: left; }
.delivery-row > span:first-child, .history-card strong { font-size: 15px; font-weight: 600; }
.delivery-meta { display: flex; align-items: center; gap: 8px; }
.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); }
.status-badge.error { color: var(--error); background: var(--error-soft); }

.report-box { width: 100%; min-height: min(52vh,430px); padding: 16px; resize: none; border: 1px solid var(--outline); border-radius: var(--radius); outline: 0; color: var(--text); background: #fff; box-shadow: var(--shadow); font-size: 14px; line-height: 1.7; font-variant-numeric: tabular-nums; }
.bulk-delete-panel { display: flex; align-items: end; gap: 8px; }
.bulk-delete-panel .button { flex: 0 0 auto; }
.history-card { min-height: 72px; border: 1px solid var(--outline); border-radius: var(--radius); box-shadow: 0 5px 18px rgba(99,27,58,.05); }
.history-card .summary { margin-top: 4px; color: var(--text-muted); font-size: 12px; }
.chevron { color: var(--outline-strong); font-size: 24px; }
.notice { position: relative; padding: 13px 44px 13px 14px; display: flex; flex-direction: column; gap: 3px; border-radius: var(--radius); font-size: 13px; }
.notice.success { color: var(--success); border: 1px solid #b9dfce; background: var(--success-soft); }
.notice-close { position: absolute; top: 7px; right: 7px; width: 34px; height: 34px; color: inherit; background: transparent; font-size: 22px; }

.bottom-nav { flex: 0 0 auto; display: grid; grid-template-columns: repeat(5,1fr); border-top: 1px solid var(--outline); background: rgba(255,255,255,.96); box-shadow: 0 -7px 24px rgba(99,27,58,.06); z-index: 5; }
.nav-button { min-height: 66px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-muted); background: transparent; font-size: 11px; font-weight: 600; }
.nav-button.active { color: var(--primary); }
.nav-icon { height: 25px; display: flex; align-items: center; font-size: 22px; line-height: 1; }

.overlay { position: fixed; inset: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--background); z-index: 20; }
.overlay-header { flex: 0 0 auto; min-height: 68px; padding-left: 12px; padding-right: 16px; display: flex; align-items: center; gap: 10px; color: #fff; background: linear-gradient(145deg,#9d174d,var(--primary) 55%,#db2777); }
.overlay-title-wrap { min-width: 0; flex: 1; }
.overlay-kicker { color: #fbcfe8; font-size: 10px; }
.overlay-title-wrap h1 { overflow: hidden; margin-top: 1px; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.overlay-header .status-badge { color: #fff; background: rgba(255,255,255,.18); }
.unit-display { min-height: 62px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 2px solid #f0a9c4; border-radius: var(--radius); background: #fff; }
.unit-display strong { color: var(--primary); font-size: 31px; font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.unit-display strong.placeholder { opacity: .35; }
.numpad { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; }
.numpad button { min-height: 52px; border: 1px solid var(--outline); border-radius: 12px; background: #fff; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.numpad button:active { background: var(--primary-light); }
.numpad .numpad-action { color: var(--primary); font-size: 13px; }
.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-soft); color: var(--text-muted); font-size: 13px; font-weight: 600; }
.quantity-control > div { display: flex; align-items: center; gap: 14px; }
.quantity-control strong { min-width: 28px; color: var(--primary); font-size: 22px; text-align: center; font-variant-numeric: tabular-nums; }
.round-button { border: 1px solid var(--outline); color: var(--primary); }
.entry-card { min-height: 58px; padding: 8px 8px 8px 13px; display: flex; align-items: center; justify-content: space-between; border-left: 4px solid var(--success); border-radius: 10px; background: #fff; }
.entry-card strong { font-size: 16px; }
.entry-card .entry-meta { color: var(--text-muted); font-size: 12px; font-weight: 400; }
.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: #fff; }
.save-status-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: 12px; }
.save-status-row span:first-child { color: var(--success); font-weight: 600; }
.toast { position: fixed; left: 50%; bottom: calc(82px + env(safe-area-inset-bottom,0px)); max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 999px; color: #fff; background: rgba(45,24,33,.94); box-shadow: 0 8px 24px rgba(45,24,33,.22); transform: translateX(-50%); font-size: 13px; font-weight: 600; z-index: 50; }

button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(190,24,93,.28); outline-offset: 2px; }
@media (max-width: 370px) { .scroll-content { padding-left: 12px; padding-right: 12px; } .dong-field { width: 96px; } .icon-button { width: 38px; height: 38px; } .type-switch span { font-size: 13px; } }
@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; } }
