:root {
  --bg: #eef3f9;
  --surface: #ffffff;
  --surface-2: #f3f6fb;
  --ink: #0b1b2e;
  --ink-2: #51607a;
  --ink-3: #8592a8;
  --line: #dbe3ee;
  --line-2: #c4d0e0;
  --brand: var(--th-brand, #0171b9);
  --brand-deep: var(--th-brand-deep, #00487a);
  --brand-ink: var(--th-night, #04223f);
  --brand-light: var(--th-brand-light, #3da6df);
  --brand-wash: var(--th-wash, #e6f3fc);
  --outline: var(--th-outline, #030d24);
  --tag: var(--th-brand, #0171b9);
  --tag-ink: #ffffff;
  --ok: #17803d;
  --ok-bg: #e3f3e8;
  --warn: #a8510a;
  --warn-bg: #fdf0e1;
  --bad: #c42b2b;
  --bad-bg: #fbe7e7;
  --focus: var(--th-brand, #0171b9);
  --courier: var(--th-courier, var(--th-brand, #0171b9));
  --scrim: rgba(13, 18, 28, 0.48);
  --shadow-sheet: 0 -8px 40px rgba(13, 18, 28, 0.16);
  --shadow-pop: 0 10px 30px rgba(13, 18, 28, 0.14);

  --font: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-num: "Barlow Condensed", "Onest", system-ui, sans-serif;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-pill: 999px;

  --t-xs: 0.75rem;
  --t-sm: 0.8125rem;
  --t-md: 0.9375rem;
  --t-lg: 1.125rem;
  --t-xl: 1.5rem;
  --t-2xl: 2rem;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--th-d-bg, #061426);
    --surface: var(--th-d-surface, #0c1e35);
    --surface-2: var(--th-d-surface-2, #122842);
    --ink: #eaf2fb;
    --ink-2: #9fb3cc;
    --ink-3: #6d819c;
    --line: var(--th-d-line, #1c3452);
    --line-2: var(--th-d-line-2, #284566);
    --brand-wash: var(--th-wash-dark, #0e2f52);
    --tag: var(--th-tag-dark, #1e8fd8);
    --ok: #4cc27a;
    --ok-bg: #143322;
    --warn: #f0a24f;
    --warn-bg: #3a2814;
    --bad: #f07272;
    --bad-bg: #3a1a1d;
    --focus: var(--th-focus-dark, #5bb8ee);
    --scrim: rgba(0, 0, 0, 0.6);
    --shadow-sheet: 0 -8px 40px rgba(0, 0, 0, 0.5);
    --shadow-pop: 0 10px 30px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: var(--th-d-bg, #061426);
  --surface: var(--th-d-surface, #0c1e35);
  --surface-2: var(--th-d-surface-2, #122842);
  --ink: #eaf2fb;
  --ink-2: #9fb3cc;
  --ink-3: #6d819c;
  --line: var(--th-d-line, #1c3452);
  --line-2: var(--th-d-line-2, #284566);
  --brand-wash: var(--th-wash-dark, #0e2f52);
  --tag: var(--th-tag-dark, #1e8fd8);
  --ok: #4cc27a;
  --ok-bg: #143322;
  --warn: #f0a24f;
  --warn-bg: #3a2814;
  --bad: #f07272;
  --bad-bg: #3a1a1d;
  --focus: var(--th-focus-dark, #5bb8ee);
  --scrim: rgba(0, 0, 0, 0.6);
  --shadow-sheet: 0 -8px 40px rgba(0, 0, 0, 0.5);
  --shadow-pop: 0 10px 30px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--t-md);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

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

.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 44px; padding: 0 1.1rem;
  border: 1px solid transparent; border-radius: var(--r-md);
  background: var(--surface-2); color: var(--ink);
  font-size: var(--t-md); font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { background: var(--line); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; }
.btn--primary { background: var(--ink); color: var(--surface); }
.btn--primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--surface)); }
.btn--ghost { background: transparent; border-color: var(--line); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--danger { background: transparent; border-color: var(--line); color: var(--bad); }
.btn--danger:hover { background: var(--bad-bg); border-color: transparent; }
.btn--wa { background: #1faa59; color: #fff; }
.btn--wa:hover { background: #18914b; }
.btn--block { width: 100%; }
.btn--sm { min-height: 34px; padding: 0 0.75rem; font-size: var(--t-sm); border-radius: var(--r-sm); }
.btn.is-busy { pointer-events: none; opacity: 0.7; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; padding: 0;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink);
}
.icon-btn:hover { background: var(--surface-2); }

.field { display: grid; gap: 0.35rem; align-content: start; }
.field > label, .field-label { font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); }
.field-hint { font-size: var(--t-xs); color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 0.6rem 0.8rem;
  border: 1px solid var(--line-2); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink);
  font-size: 1rem;
}
.select { height: 44px; padding-top: 0; padding-bottom: 0; }
.textarea { min-height: 76px; resize: vertical; line-height: 1.4; }
.select option, .select optgroup { background-color: var(--surface); color: var(--ink); }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--bad); }
.field-error { font-size: var(--t-xs); color: var(--bad); font-weight: 500; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: var(--r-md); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  display: grid; place-items: center; min-height: 40px; padding: 0 0.5rem;
  border-radius: 9px; font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); text-align: center; cursor: pointer;
}
.seg input:checked + label { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px var(--line); }
.seg input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 1px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer; font-weight: 600; font-size: var(--t-sm); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 42px; height: 24px; border-radius: var(--r-pill); background: var(--line-2); transition: background-color .15s; flex: none; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .switch-track { background: var(--ok); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }

.chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  min-height: 36px; padding: 0 0.85rem;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surface); color: var(--ink);
  font-size: var(--t-sm); font-weight: 600; white-space: nowrap;
}
.chip:hover { border-color: var(--line-2); }
.chip[aria-pressed="true"], .chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chip-count { font-weight: 500; opacity: 0.6; font-variant-numeric: tabular-nums; }

.price-tag {
  display: inline-flex; align-items: baseline; gap: 2px;
  padding: 1px 8px 0;
  background: var(--tag); color: var(--tag-ink);
  font-family: var(--font-num); font-weight: 700; font-size: 1.375rem; line-height: 1.15;
  letter-spacing: 0.01em; font-variant-numeric: tabular-nums;
  border: 2px solid var(--outline); border-radius: 7px;
  box-shadow: 2px 2px 0 var(--outline);
}
.price-tag small { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; }
.price-tag--lg { font-size: 1.75rem; padding: 2px 10px 0; }

.badge { display: inline-flex; align-items: center; gap: 0.35rem; padding: 2px 8px; border-radius: var(--r-pill); font-size: var(--t-xs); font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge--ok { background: var(--ok-bg); color: var(--ok); }
.badge--warn { background: var(--warn-bg); color: var(--warn); }
.badge--bad { background: var(--bad-bg); color: var(--bad); }
.badge--info { background: var(--brand-wash); color: var(--brand-deep); }
.badge--dark { background: var(--ink); color: var(--surface); }
.btn--accent { background: var(--brand); color: #fff; font-weight: 700; }
.btn--accent:hover { background: var(--brand-deep); }
.btn--warn { color: var(--warn); }
.btn--danger-solid { background: var(--bad); color: #fff; }
.btn--danger-solid:hover { background: color-mix(in srgb, var(--bad) 85%, #000); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }

.scrim {
  position: fixed; inset: 0; z-index: 60; background: var(--scrim);
  opacity: 0; transition: opacity 0.2s;
}
.scrim.is-open { opacity: 1; }

.sheet {
  position: fixed; z-index: 70; left: 0; right: 0; bottom: 0;
  max-height: min(92dvh, 900px);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-sheet);
  transform: translateY(102%); transition: transform 0.26s cubic-bezier(.2,.8,.2,1);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet.is-open { transform: translateY(0); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.1rem 0.75rem; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: var(--t-lg); font-weight: 700; }
.sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 1rem 1.1rem; }
.sheet-foot { padding: 0.85rem 1.1rem 1rem; border-top: 1px solid var(--line); display: grid; gap: 0.6rem; }

@media (min-width: 760px) {
  .sheet {
    left: auto; top: 0; bottom: 0; width: 440px; max-height: none;
    border-radius: var(--r-lg) 0 0 var(--r-lg);
    transform: translateX(102%);
    box-shadow: var(--shadow-pop);
  }
  .sheet.is-open { transform: translateX(0); }
  .sheet--wide { width: 560px; }
}

.toast-stack { position: fixed; z-index: 90; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 0.5rem; width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
.toast {
  padding: 0.7rem 1rem; border-radius: var(--r-md);
  background: var(--ink); color: var(--surface);
  font-size: var(--t-sm); font-weight: 500; box-shadow: var(--shadow-pop);
  animation: toast-in 0.18s ease-out;
}
.toast--bad { background: var(--bad); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }
@media (min-width: 760px) { .toast-stack { bottom: 24px; } }

.empty { display: grid; justify-items: center; gap: 0.5rem; padding: 3rem 1rem; text-align: center; color: var(--ink-2); }
.empty strong { color: var(--ink); font-size: var(--t-lg); }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 0, var(--line) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: var(--r-md); }
@keyframes shimmer { to { background-position: -200% 0; } }

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

.pw { position: relative; }
.pw .input { padding-right: 48px; }
.pw-toggle {
  position: absolute; top: 50%; right: 4px; transform: translateY(-50%);
  display: grid; place-items: center; width: 40px; height: 36px;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink-3); cursor: pointer;
}
.pw-toggle:hover { color: var(--ink); background: var(--surface-2); }
.pw-toggle[aria-pressed="true"] { color: var(--brand); }
.pw-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.pw-toggle .icon { width: 20px; height: 20px; }
.pw input::-ms-reveal, .pw input::-ms-clear { display: none; }

.logo-cut { transition: filter .2s; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-cut {
    filter: drop-shadow(1.5px 0 0 #fff) drop-shadow(-1.5px 0 0 #fff) drop-shadow(0 1.5px 0 #fff) drop-shadow(0 -1.5px 0 #fff)
            drop-shadow(3px 3px 0 rgba(0, 0, 0, .35));
  }
}
:root[data-theme="dark"] .logo-cut {
  filter: drop-shadow(1.5px 0 0 #fff) drop-shadow(-1.5px 0 0 #fff) drop-shadow(0 1.5px 0 #fff) drop-shadow(0 -1.5px 0 #fff)
          drop-shadow(3px 3px 0 rgba(0, 0, 0, .35));
}
.linklike { border: 0; background: none; padding: 0; color: inherit; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

[data-outline="off"] .logo-cut, [data-outline="off"] .hero-helm { filter: none !important; }

.mmap { position: relative; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; background: #e8eef3; border-radius: var(--r-lg); cursor: grab; isolation: isolate; }
.mmap:active { cursor: grabbing; }
.mmap-tiles, .mmap-marks { position: absolute; inset: 0; }
.mmap-tile { position: absolute; left: 0; top: 0; width: 256px; height: 256px; max-width: none; opacity: 0; transition: opacity .25s; pointer-events: none; }
.mmap-tile.is-in { opacity: 1; }
.mmap-marks { pointer-events: none; }
.mmap-mark { position: absolute; left: 0; top: 0; transition: transform 1.2s linear; will-change: transform; }
.mmap.is-moving .mmap-mark { transition: none; }
.mmap-ctrl { position: absolute; right: 10px; top: 10px; display: grid; gap: 6px; z-index: 2; }
.mmap-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 18px; font-weight: 700; line-height: 1; box-shadow: var(--shadow-pop); display: grid; place-items: center; padding: 0; }
.mmap-btn.is-off { opacity: .45; }
.mmap-attr { position: absolute; right: 6px; bottom: 4px; z-index: 2; font-size: 10px; color: #4a5568; background: rgba(255, 255, 255, .78); padding: 1px 6px; border-radius: 6px; }
.mmap-attr a { color: inherit; text-decoration: none; }
.mpin { position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); display: grid; justify-items: center; gap: 2px; }
.mpin-badge { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50% 50% 50% 6px; transform: rotate(-45deg); background: var(--brand); color: #fff; border: 3px solid #fff; box-shadow: 0 6px 16px rgba(0, 0, 0, .28); }
.mpin-badge > * { transform: rotate(45deg); }
.mpin-badge .icon { width: 20px; height: 20px; }
.mpin-badge .icon-emoji { font-size: 20px; line-height: 1; }
.mpin-badge .icon-img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.mpin--courier .mpin-badge { background: var(--courier); }
.mpin--member .mpin-badge { background: #334155; }
.mpin--courier::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 14px; height: 6px; margin-left: -7px; border-radius: 50%; background: rgba(0, 0, 0, .25); filter: blur(1px); }
.mpin-label { order: -1; padding: 2px 8px; border-radius: 999px; background: var(--ink); color: var(--surface); font-size: 11px; font-weight: 700; white-space: nowrap; box-shadow: var(--shadow-pop); }
.mpin--courier .mpin-badge::before { content: ""; position: absolute; inset: -9px; border-radius: inherit; border: 2px solid var(--courier); opacity: 0; animation: mpin-pulse 2s ease-out infinite; }
@keyframes mpin-pulse { 0% { opacity: .6; transform: scale(.85); } 100% { opacity: 0; transform: scale(1.35); } }
@media (prefers-reduced-motion: reduce) { .mmap-mark { transition: none; } .mpin--courier .mpin-badge::before { animation: none; } }
.mmap.is-osm-dark .mmap-tile { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.8); }
.loc-preview { height: 150px; margin-top: 4px; pointer-events: none; }
.loc-preview .mmap-ctrl { display: none; }
