:root {
  --bg: #f3f4f8;
  --surface: #ffffff;
  --surface-2: #f6f7fa;
  --ink: #12172b;
  --ink-2: #3a4157;
  --muted: #8a90a3;
  --line: #e7e9f0;

  --brand: #ff7a1a;
  --brand-deep: #ef5a00;
  --brand-soft: #fff1e5;
  --brand-ring: rgba(255, 122, 26, 0.18);
  --navy: #0d1430;
  --navy-2: #1b2654;
  --danger: #e5484d;
  --danger-soft: #fdeeee;
  --sms: #3b82f6;
  --sms-soft: #eaf2ff;
  --naver: #03c75a;
  --naver-soft: #e5f8ee;
  --log: #7a3fe0;
  --log-soft: #f1eafe;

  --shadow-sm: 0 1px 2px rgba(16, 24, 48, 0.04), 0 4px 14px rgba(16, 24, 48, 0.05);
  --shadow-lg: 0 -10px 40px rgba(16, 24, 48, 0.16);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0e1c;
    --surface: #141a2e;
    --surface-2: #1b2238;
    --ink: #eef0f6;
    --ink-2: #c4c9d7;
    --muted: #7d859c;
    --line: #262e48;
    --brand-soft: #35210f;
    --danger-soft: #3a1a1e;
    --sms-soft: #172540;
    --naver-soft: #0f2e20;
    --log: #b48cff;
    --log-soft: #261a40;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 -10px 40px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.is-locked { overflow: hidden; }

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

.i { width: 20px; height: 20px; flex: none; display: block; }

.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: calc(112px + var(--safe-b));
}

/* ---------- 헤더 ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 20px 22px;
  color: #fff;
  background:
    radial-gradient(110% 80% at 100% 0%, rgba(255, 122, 26, 0.5) 0%, rgba(255, 122, 26, 0) 55%),
    radial-gradient(80% 70% at 0% 100%, rgba(92, 116, 255, 0.28) 0%, rgba(92, 116, 255, 0) 60%),
    linear-gradient(160deg, var(--navy-2), var(--navy));
  border-radius: 0 0 30px 30px;
}

.hero-glow {
  position: absolute;
  right: -40px;
  top: 40px;
  width: 200px;
  height: 200px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.hero-top { position: relative; display: flex; align-items: center; justify-content: space-between; }

.brand { display: flex; align-items: center; gap: 11px; }

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(140deg, #ffad5c, var(--brand-deep));
  box-shadow: 0 8px 20px rgba(255, 110, 20, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.brand-mark .i { width: 22px; height: 22px; fill: #fff; stroke: none; }

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.brand-text span { font-size: 12px; opacity: 0.65; margin-top: 2px; }

.stat {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.stat strong { font-size: 15px; font-weight: 800; color: #ffb36e; margin: 0 1px; font-variant-numeric: tabular-nums; }

.hero-side { display: flex; align-items: center; gap: 8px; }
.hero-logout {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.hero-logout .i { width: 17px; height: 17px; }
.hero-logout:active { background: rgba(255, 255, 255, 0.2); }
.stat { white-space: nowrap; }

@media (max-width: 340px) {
  .hero .brand-mark { display: none; } /* 고객 수와 로그아웃 버튼 자리 확보 */
}

/* ---------- 로그인 ---------- */
body.is-auth .app, body.is-auth .fab { display: none; }

.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px calc(24px + var(--safe-b));
}
.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 28px 22px 18px;
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.auth-title { margin: 24px 0 20px; font-size: 24px; font-weight: 800; letter-spacing: -0.03em; }
.auth-msg { margin: 0 2px 14px; font-size: 13px; font-weight: 600; line-height: 1.5; color: var(--danger); word-break: keep-all; }
.auth-msg.is-info { color: var(--ink-2); }
.auth-switch { display: block; margin: 12px auto 0; padding: 10px; font-size: 14px; font-weight: 600; color: var(--muted); }

.hero-title {
  position: relative;
  margin: 26px 0 18px;
  font-size: 26px;
  line-height: 1.32;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 0 8px 0 16px;
  border-radius: 17px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 12px 30px rgba(5, 10, 30, 0.28);
}
.search-icon .i { color: var(--muted); }
.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 16px;
}
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--muted);
}
.search-clear .i { width: 18px; height: 18px; }
.search-clear:active { background: var(--surface-2); }

/* ---------- 유가 링크 ---------- */
.price-link {
  margin: 18px 16px 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 14px 14px 16px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s;
}
.price-link:active { transform: scale(0.985); }
.price-link-ic {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand-deep);
}
.price-link-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.price-link-text strong { font-size: 15px; font-weight: 700; }
.price-link-text span { font-size: 13px; color: var(--muted); }
.price-link-arrow .i { color: var(--muted); }
.journal-link { width: calc(100% - 32px); text-align: left; }
.journal-link + .price-link { margin-top: 10px; }
.journal-link-ic { background: var(--log-soft); color: var(--log); }

/* ---------- 목록 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 20px 12px;
}
.result-info { margin: 0; font-size: 14px; color: var(--muted); }
.result-info strong { color: var(--ink); font-weight: 700; }

.seg {
  display: flex;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.seg-btn {
  padding: 6px 11px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.seg-btn.is-active { background: var(--ink); color: var(--surface); }

.list {
  list-style: none;
  margin: 0;
  padding: 0 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* 긴 주소가 있어도 카드가 화면 너비를 넘지 않게 */
  gap: 10px;
}

.card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  animation: rise 0.35s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 25ms);
}
.card.is-new { animation: rise 0.35s var(--ease) both, flash 1.6s ease 0.2s; }

.card-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
  border-radius: 16px;
  text-align: left;
  transition: transform 0.15s, background 0.15s;
}
.card-main:active { transform: scale(0.985); background: var(--surface-2); }

.avatar {
  width: 48px;
  height: 48px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.card-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.card-name { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-phone { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-addr {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  font-size: 13px;
  color: var(--ink-2);
}
.card-addr .i { width: 14px; height: 14px; color: var(--brand); }
.card-addr span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card-call {
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-deep);
  transition: transform 0.15s;
}
.card-call:active { transform: scale(0.92); }

/* ---------- 빈 화면 ---------- */
.empty { padding: 40px 28px 20px; text-align: center; animation: rise 0.4s var(--ease) both; }
.empty-art {
  width: 92px;
  height: 92px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border-radius: 32px;
  background: var(--brand-soft);
  color: var(--brand);
}
.empty-art .i { width: 40px; height: 40px; }
.empty h3 { margin: 0 0 8px; font-size: 19px; font-weight: 800; letter-spacing: -0.02em; }
.empty p { margin: 0 0 24px; font-size: 14px; line-height: 1.6; color: var(--muted); word-break: keep-all; }
.empty-actions { display: grid; gap: 10px; max-width: 280px; margin: 0 auto; }

/* ---------- 버튼 ---------- */
.btn {
  width: 100%;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 700;
  transition: transform 0.15s, filter 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn .i { width: 18px; height: 18px; }
.btn--sm { height: 48px; font-size: 15px; }

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #ff9640, var(--brand-deep));
  box-shadow: 0 10px 24px rgba(255, 110, 20, 0.32);
}
.btn-ghost { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger-solid { background: var(--danger); color: #fff; }

.fab {
  position: fixed;
  left: 50%;
  bottom: calc(20px + var(--safe-b));
  z-index: 10;
  height: 58px;
  padding: 0 26px 0 22px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, #ff9640, var(--brand-deep));
  box-shadow: 0 14px 30px rgba(255, 100, 10, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateX(-50%);
  transition: transform 0.15s;
}
.fab:active { transform: translateX(-50%) scale(0.96); }
.fab .i { width: 22px; height: 22px; stroke-width: 2.4; }

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-2);
}

/* ---------- 바텀 시트 ---------- */
.overlay, .confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 26, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}
.overlay { z-index: 20; }
.confirm-overlay { z-index: 40; }
.overlay.is-open, .confirm-overlay.is-open { opacity: 1; visibility: visible; }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  max-width: 520px;
  max-height: 92vh; /* dvh를 모르는 구형 브라우저용 */
  max-height: 92dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  border-radius: 28px 28px 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateY(105%);
  visibility: hidden;
  transition: transform 0.38s var(--ease), visibility 0.38s;
}
.sheet.is-open { transform: none; visibility: visible; }

.sheet-handle {
  width: 40px;
  height: 5px;
  margin: 10px auto 0;
  border-radius: 99px;
  background: var(--line);
  flex: none;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 6px;
  flex: none;
}
.sheet-head h2 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -0.03em; }
.sheet-close { position: absolute; top: 16px; right: 18px; z-index: 1; }
.sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 20px calc(20px + var(--safe-b));
}

/* ---------- 폼 ---------- */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}
.req { font-style: normal; color: var(--brand); }

.input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: var(--muted); }
.input:focus { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px var(--brand-ring); }
.input--num { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
textarea.input { height: auto; min-height: 96px; padding: 14px 16px; line-height: 1.55; resize: vertical; }

.field-hint { margin: 7px 2px 0; font-size: 12px; color: var(--muted); }
.field-error { margin: 7px 2px 0; font-size: 13px; font-weight: 600; color: var(--danger); display: none; }
.field.has-error .input { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(229, 72, 77, 0.12); }
.field.has-error .field-error { display: block; }
.field.has-error .field-hint { display: none; }
.field.shake { animation: shake 0.35s; }

.form-actions {
  position: sticky;
  bottom: calc(-20px - var(--safe-b));
  margin: 8px -20px 0;
  padding: 12px 20px calc(20px + var(--safe-b));
  background: linear-gradient(to bottom, transparent, var(--surface) 22%);
}

/* ---------- 상세 ---------- */
.profile { padding: 14px 0 22px; text-align: center; }
.avatar--lg {
  width: 78px;
  height: 78px;
  margin: 0 auto;
  border-radius: 26px;
  font-size: 30px;
  box-shadow: 0 12px 28px rgba(16, 24, 48, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.profile-name { margin: 16px 0 4px; font-size: 24px; font-weight: 800; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.profile-phone { margin: 0; font-size: 16px; color: var(--muted); font-variant-numeric: tabular-nums; }

.actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 16px 4px 14px;
  border: 0;
  border-radius: 20px;
  background: var(--surface-2);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink-2);
  text-align: center;
  word-break: keep-all;
  cursor: pointer;
  transition: transform 0.15s;
}
.action:active { transform: scale(0.96); }
.action-ic {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.action--call .action-ic { background: var(--brand-soft); color: var(--brand-deep); }
.action--sms .action-ic { background: var(--sms-soft); color: var(--sms); }
.action--map .action-ic { background: var(--naver); color: #fff; box-shadow: 0 6px 16px rgba(3, 199, 90, 0.35); }
.action--log .action-ic { background: var(--log-soft); color: var(--log); }
@media (max-width: 359px) {
  .actions { gap: 6px; }
  .action { font-size: 12px; }
  .action-ic { width: 42px; height: 42px; }
}

.info {
  margin: 14px 0 0;
  padding: 2px 18px;
  border-radius: 20px;
  background: var(--surface-2);
}
.info-row { padding: 15px 0; border-bottom: 1px solid var(--line); }
.info-row:last-child { border-bottom: 0; }
.info dt { margin-bottom: 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.info dd { margin: 0; font-size: 15px; line-height: 1.55; color: var(--ink); word-break: keep-all; overflow-wrap: anywhere; }
.info-sub { display: block; color: var(--ink-2); font-size: 14px; }
.memo { white-space: pre-wrap; }
.last-day { display: block; font-weight: 700; font-variant-numeric: tabular-nums; }
.last-day em { margin-left: 8px; font-style: normal; font-size: 13px; font-weight: 800; color: var(--brand-deep); }
#lastDelivery .info-sub { margin-top: 3px; }
.info-row--meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.info-row--meta dt { margin: 0; }
.info-row--meta dd { font-size: 13px; color: var(--muted); text-align: right; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  padding: 7px 11px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
}
.chip .i { width: 14px; height: 14px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 0 8px; }
.info-num { display: block; font-variant-numeric: tabular-nums; }

.detail-foot { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }

/* ---------- 배달내역 ---------- */
.sheet-head--nav { gap: 12px; justify-content: flex-start; }
.sheet-head--nav .icon-btn { flex: none; }
.sheet-title { flex: 1; min-width: 0; text-align: center; }
.sheet-title h2 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -0.03em; }
.sheet-title p { margin: 2px 0 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dsummary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
  padding: 14px 6px;
  border-radius: 20px;
  background: var(--surface-2);
  text-align: center;
}
.dsummary div + div { border-left: 1px solid var(--line); }
.dsummary span { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.dsummary strong { display: block; padding: 0 4px; font-size: clamp(13px, 4.1vw, 16px); font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -0.02em; }

.delivery-form { padding: 16px 16px 2px; border: 1.5px solid var(--line); border-radius: 20px; }
.delivery-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; } /* 양 | 단가 */
.delivery-form .chip { margin-top: 8px; }
.delivery-form-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 10px; margin-bottom: 16px; }
.delivery-form-actions .btn { height: 50px; }
input[type="date"].input { min-width: 0; padding-right: 10px; }

.dlist { list-style: none; margin: 14px 0 0; padding: 0; }
.ditem {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.ditem:last-child { border-bottom: 0; }
.ditem-main {
  flex: 1;
  min-width: 0;
  display: block;
  margin: -6px -8px;
  padding: 6px 8px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.ditem-main:active { background: var(--surface-2); }
.ditem.is-editing .ditem-main { background: var(--brand-soft); }
.ditem-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.label-row > label:first-child { margin-bottom: 0; }
.field .check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  cursor: pointer;
}
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); cursor: pointer; }
.input[readonly] { background: var(--bg); color: var(--ink-2); cursor: default; }
.input[readonly]:focus { border-color: var(--line); box-shadow: none; }
.delivery-form-title { margin: 0 0 14px; font-size: 15px; font-weight: 800; color: var(--ink); }
.ditem-day { display: block; font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ditem-meta { display: block; margin-top: 3px; font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.ditem-etc { display: block; margin-top: 3px; font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.ditem-memo { display: block; margin-top: 3px; font-size: 13px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.ditem-amount { flex: none; font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ditem-del {
  flex: none;
  width: 32px;
  height: 32px;
  margin: -5px -6px 0 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.ditem-del .i { width: 17px; height: 17px; }
.dempty { padding: 28px 12px 12px; text-align: center; }
.dempty p { margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: var(--muted); word-break: keep-all; }
.dempty .btn { max-width: 200px; margin: 0 auto; }

/* ---------- 배달일지 ---------- */
.icon-btn-space { width: 40px; height: 40px; flex: none; }
.jtabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-2);
}
.jtab { height: 40px; border-radius: 11px; font-size: 14px; font-weight: 700; color: var(--muted); }
.jtab.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.jnav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 14px 0; }
.jnav strong { flex: 1; text-align: center; font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.jnav .icon-btn:disabled { opacity: 0.35; cursor: default; }

.jrange { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 6px; margin: 14px 0; }
.jrange span { color: var(--muted); }
.jrange .input { height: 46px; padding: 0 8px; font-size: 15px; }
.jrange .btn { grid-column: 1 / -1; }

.jprod { list-style: none; margin: -4px 0 18px; padding: 4px 16px; border-radius: 16px; border: 1px solid var(--line); }
.jprod li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.jprod li:last-child { border-bottom: 0; }
.jprod-qty { flex: 1; font-size: 14px; color: var(--ink-2); }
.jprod-amt { font-size: 14px; font-weight: 800; }

.jday { margin-bottom: 16px; }
.jday-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 4px;
  padding: 0 2px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.jday-list { list-style: none; margin: 0; padding: 0 14px; border-radius: 16px; background: var(--surface-2); }
.jday-list li + li { border-top: 1px solid var(--line); }
.jrow { width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 0; text-align: left; }
.jrow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.jrow-name { font-size: 15px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jrow-meta { font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.jrow-amt { flex: none; font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* 품종 색: 앱에서 공통 코드 순서대로 tone-0, tone-1 … 을 붙임 */
.tone-0 { --tone: #2563eb; --tone-soft: #e8f0ff; }   /* 파랑 */
.tone-1 { --tone: #0f8a5f; --tone-soft: #e2f6ed; }   /* 초록 */
.tone-2 { --tone: #7a3fe0; --tone-soft: #f1eafe; }   /* 보라 */
.tone-3 { --tone: #b45f00; --tone-soft: #fff1dc; }   /* 주황 */
.tone-4 { --tone: #d6336c; --tone-soft: #fdeaf1; }   /* 분홍 */
.tone-none { --tone: var(--ink-2); --tone-soft: var(--surface-2); }
@media (prefers-color-scheme: dark) {
  .tone-0 { --tone: #8ab4ff; --tone-soft: #172540; }
  .tone-1 { --tone: #5fd3a5; --tone-soft: #0f2e20; }
  .tone-2 { --tone: #b48cff; --tone-soft: #261a40; }
  .tone-3 { --tone: #f7b955; --tone-soft: #3a2a0c; }
  .tone-4 { --tone: #ff8fb1; --tone-soft: #3a1624; }
}

.pbadge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 7px;
  background: var(--tone-soft);
  color: var(--tone);
  font-size: 13px;
  font-weight: 800;
}
.pchip { border-color: transparent; background: var(--tone-soft); color: var(--tone); }
.pchip.is-selected { background: var(--tone); color: #fff; }
@media (prefers-color-scheme: dark) {
  .pchip.is-selected { color: #0a0e1c; }
}

/* ---------- 확인 창 ---------- */
.confirm {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 50;
  width: min(340px, calc(100% - 40px));
  padding: 28px 22px 22px;
  border-radius: 26px;
  background: var(--surface);
  text-align: center;
  box-shadow: 0 30px 60px rgba(6, 10, 26, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -46%) scale(0.96);
  transition: opacity 0.22s, transform 0.28s var(--ease), visibility 0.22s;
}
.confirm.is-open { opacity: 1; visibility: visible; transform: translate(-50%, -50%); }
.confirm-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: var(--danger-soft);
  color: var(--danger);
}
.confirm-icon .i { width: 26px; height: 26px; }
.confirm h3 { margin: 0 0 8px; font-size: 19px; font-weight: 800; letter-spacing: -0.02em; }
.confirm p { margin: 0 0 22px; font-size: 14px; line-height: 1.6; color: var(--muted); overflow-wrap: anywhere; }
.confirm p strong { color: var(--ink); }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.confirm-actions .btn { height: 50px; }

/* ---------- 토스트 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-b));
  z-index: 60;
  max-width: calc(100% - 40px);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px 13px 18px;
  border-radius: 16px;
  background: #161c33;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 14px 30px rgba(6, 10, 26, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 16px);
  transition: opacity 0.25s, transform 0.3s var(--ease), visibility 0.25s;
}
.toast.is-show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.toast-action { color: #ffa45c; font-weight: 800; }

@media (prefers-color-scheme: dark) {
  .toast { background: #eef0f6; color: #12172b; }
  .toast-action { color: var(--brand-deep); }
}

/* ---------- 애니메이션 ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
}
@keyframes flash {
  0%, 100% { box-shadow: var(--shadow-sm); }
  30% { box-shadow: 0 0 0 3px var(--brand), var(--shadow-sm); }
}
@keyframes shake {
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
