/* =========================================================
   Purificadora · Agua y Hielo — Tema “Aqua Glass” v2
   Vidrio translúcido sobre un fondo de aurora acuática.
   ========================================================= */

:root {
  --bg: #edf2f8;
  --aur-1: rgba(34, 211, 238, .30);
  --aur-2: rgba(124, 92, 255, .20);
  --aur-3: rgba(47, 107, 255, .18);
  --sheet-bg: #f3f6fb;
  --surface: rgba(255, 255, 255, .80);
  --surface-2: #e4eaf3;
  --surface-hi: #ffffff;
  --fill: rgba(100, 116, 139, .13);
  --fill-2: rgba(100, 116, 139, .07);
  --text: #0b1324;
  --text-2: rgba(30, 41, 59, .62);
  --text-3: rgba(30, 41, 59, .32);
  --sep: rgba(15, 23, 42, .07);
  --ring: rgba(255, 255, 255, .85);
  --tint: #2f6bff;
  --tint-soft: rgba(47, 107, 255, .12);
  --grad: linear-gradient(135deg, #12c2e9 0%, #2f6bff 52%, #7c5cff 100%);
  --grad-deep: linear-gradient(140deg, #0ea5e9 0%, #2f6bff 45%, #6d4aff 100%);
  --green: #10b981;
  --green-soft: rgba(16, 185, 129, .14);
  --orange: #f59e0b;
  --orange-soft: rgba(245, 158, 11, .16);
  --red: #f43f5e;
  --red-soft: rgba(244, 63, 94, .12);
  --indigo: #7c5cff;
  --indigo-soft: rgba(124, 92, 255, .14);
  --teal: #06b6d4;
  --teal-soft: rgba(6, 182, 212, .14);
  --glass: rgba(255, 255, 255, .62);
  --glass-strong: rgba(255, 255, 255, .9);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 18px rgba(15, 23, 42, .05);
  --shadow: 0 12px 32px rgba(15, 23, 42, .10);
  --shadow-lg: 0 30px 80px rgba(15, 23, 42, .25);
  --glow: 0 10px 26px rgba(47, 107, 255, .32);
  --r: 16px;
  --r-lg: 22px;
  --r-xl: 30px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --tabbar-h: 66px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #060912;
  --aur-1: rgba(34, 211, 238, .16);
  --aur-2: rgba(124, 92, 255, .20);
  --aur-3: rgba(47, 107, 255, .14);
  --sheet-bg: #0c111c;
  --surface: rgba(22, 28, 42, .78);
  --surface-2: #1a2131;
  --surface-hi: #2c3549;
  --fill: rgba(148, 163, 184, .16);
  --fill-2: rgba(148, 163, 184, .08);
  --text: #f1f5fb;
  --text-2: rgba(226, 232, 240, .62);
  --text-3: rgba(226, 232, 240, .3);
  --sep: rgba(148, 163, 184, .13);
  --ring: rgba(255, 255, 255, .06);
  --tint: #5b8cff;
  --tint-soft: rgba(91, 140, 255, .18);
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, .16);
  --orange: #fbbf24;
  --orange-soft: rgba(251, 191, 36, .16);
  --red: #fb7185;
  --red-soft: rgba(251, 113, 133, .16);
  --indigo: #a38bff;
  --indigo-soft: rgba(163, 139, 255, .18);
  --teal: #22d3ee;
  --teal-soft: rgba(34, 211, 238, .16);
  --glass: rgba(14, 19, 31, .62);
  --glass-strong: rgba(30, 37, 54, .92);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 12px 32px rgba(0, 0, 0, .45);
  --glow: 0 10px 28px rgba(47, 107, 255, .35);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #060912;
    --aur-1: rgba(34, 211, 238, .16);
    --aur-2: rgba(124, 92, 255, .20);
    --aur-3: rgba(47, 107, 255, .14);
    --sheet-bg: #0c111c;
    --surface: rgba(22, 28, 42, .78);
    --surface-2: #1a2131;
    --surface-hi: #2c3549;
    --fill: rgba(148, 163, 184, .16);
    --fill-2: rgba(148, 163, 184, .08);
    --text: #f1f5fb;
    --text-2: rgba(226, 232, 240, .62);
    --text-3: rgba(226, 232, 240, .3);
    --sep: rgba(148, 163, 184, .13);
    --ring: rgba(255, 255, 255, .06);
    --tint: #5b8cff;
    --tint-soft: rgba(91, 140, 255, .18);
    --green: #34d399;
    --green-soft: rgba(52, 211, 153, .16);
    --orange: #fbbf24;
    --orange-soft: rgba(251, 191, 36, .16);
    --red: #fb7185;
    --red-soft: rgba(251, 113, 133, .16);
    --indigo: #a38bff;
    --indigo-soft: rgba(163, 139, 255, .18);
    --teal: #22d3ee;
    --teal-soft: rgba(34, 211, 238, .16);
    --glass: rgba(14, 19, 31, .62);
    --glass-strong: rgba(30, 37, 54, .92);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 12px 32px rgba(0, 0, 0, .45);
    --glow: 0 10px 28px rgba(47, 107, 255, .35);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100dvh; background: transparent; color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.42; letter-spacing: -.011em;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vmax 45vmax at 8% -5%, var(--aur-1), transparent 62%),
    radial-gradient(50vmax 40vmax at 100% 0%, var(--aur-2), transparent 60%),
    radial-gradient(60vmax 50vmax at 60% 110%, var(--aur-3), transparent 62%),
    var(--bg);
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--tint); text-decoration: none; }
code { font-family: var(--mono); font-size: .92em; }
svg.ic { flex: none; display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--tint-soft); outline-offset: 2px; border-radius: 10px; }

.muted { color: var(--text-2); }
.small { font-size: 13px; }
.center { text-align: center; }
.pad { padding: 24px 0; }
.green { color: var(--green); }
.orange { color: var(--orange); }
.red { color: var(--red); }
.full { width: 100%; }

.soft-tint { background: var(--tint-soft); color: var(--tint); }
.soft-green { background: var(--green-soft); color: var(--green); }
.soft-orange { background: var(--orange-soft); color: var(--orange); }
.soft-red { background: var(--red-soft); color: var(--red); }
.soft-indigo { background: var(--indigo-soft); color: var(--indigo); }
.soft-teal { background: var(--teal-soft); color: var(--teal); }
.soft-gray { background: var(--fill); color: var(--text-2); }

/* Superficie de vidrio compartida */
.group, .stat, .quick-tile:not(.primary), .inv-strip, .inv-tile, .summary, .client-card, .pur-card, .mini-stats div,
.total-card, .chip, .date-pill, .act-btn, .inv-hero, .code-input {
  background: var(--surface);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--ring);
}

/* ---------- Acceso ---------- */
.auth {
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(28px + env(safe-area-inset-top)) 20px calc(28px + env(safe-area-inset-bottom));
}
.auth-card { width: 100%; max-width: 390px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.auth-card.wide { max-width: 580px; align-items: stretch; }
.auth-card > form { width: 100%; }
.auth-title { font-size: 32px; font-weight: 800; letter-spacing: -.035em; margin: 10px 0 0; text-align: center; line-height: 1.1; }
.auth-sub { color: var(--text-2); margin: 0 0 12px; text-align: center; font-size: 15px; max-width: 36ch; }
.auth-title.left, .auth-sub.left { text-align: left; max-width: none; }
.auth-foot { color: var(--text-3); font-size: 12px; margin-top: 32px; }
.brand-mark {
  width: 80px; height: 80px; border-radius: 24px; display: grid; place-items: center; flex: none; color: #fff;
  background: var(--grad); box-shadow: var(--glow), inset 0 1px 0 rgba(255, 255, 255, .4);
}
img.brand-mark { object-fit: cover; background: #fff; }
.brand-mark.shield { background: linear-gradient(140deg, #34d399, #06b6d4); box-shadow: 0 12px 30px rgba(6, 182, 212, .3); }
.back-link { color: var(--tint); font-size: 17px; align-self: flex-start; margin-bottom: 4px; font-weight: 500; }
.link-small { color: var(--text-2); font-size: 13px; margin-top: 4px; }
.link { color: var(--tint); font-size: 15px; font-weight: 600; }

.code-input {
  width: 100%; text-align: center; font-family: var(--mono); font-size: 34px; letter-spacing: .5em;
  padding: 18px 0 18px .5em; border: 0; outline: 0; border-radius: var(--r-lg); transition: box-shadow .15s;
}
.code-input:focus { box-shadow: 0 0 0 4px var(--tint-soft), inset 0 0 0 1px var(--tint); }
.code-input::placeholder { color: var(--text-3); }

.dots { display: flex; gap: 20px; margin: 8px 0 24px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--text-2); transition: background .12s, border-color .12s, transform .12s; }
.dots i.on { background: var(--tint); border-color: var(--tint); transform: scale(1.08); }
.dots.busy { opacity: .4; }
.dots.shake { animation: shake .45s; }
.keypad { display: grid; grid-template-columns: repeat(3, 78px); gap: 16px 24px; justify-content: center; }
.key {
  width: 78px; height: 78px; border-radius: 50%; font-size: 30px; font-weight: 400; transition: background .1s, transform .1s;
  background: var(--surface); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--ring);
}
.key:active { background: var(--tint-soft); transform: scale(.95); }
.key-fn { background: transparent; box-shadow: none; font-size: 22px; color: var(--text-2); }

/* ---------- Formularios ---------- */
.stack { display: flex; flex-direction: column; gap: 12px; }
.group { border-radius: var(--r); overflow: hidden; }
.group > * + * { border-top: 1px solid var(--sep); }
.group.two { display: grid; grid-template-columns: 1fr 1fr; }
.group.two > * + * { border-top: 0; border-left: 1px solid var(--sep); }
.group-title { font-size: 13px; color: var(--text-2); margin: 22px 16px 7px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.field { display: flex; flex-direction: column; gap: 1px; padding: 10px 16px 11px; transition: background .15s; }
.field > span { font-size: 12px; color: var(--text-2); font-weight: 600; transition: color .15s; }
.field input, .field textarea, .field select { border: 0; outline: 0; background: transparent; padding: 3px 0; font-size: 17px; width: 100%; min-height: 28px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--text-3); }
.field:focus-within { background: var(--tint-soft); }
.field:focus-within > span { color: var(--tint); }
.field .hint { color: var(--red); font-size: 12px; }
.field .hint:empty { display: none; }
.field.invalid { background: var(--red-soft); }
.field.invalid > span { color: var(--red); }
.field.valid > span::after { content: " ✓"; color: var(--green); }

.logo-pick { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 4px 0; }
.logo-drop { width: 98px; height: 98px; border-radius: 28px; background: var(--surface); display: grid; place-items: center; overflow: hidden; cursor: pointer; color: var(--text-2); border: 1.5px dashed var(--text-3); }
.logo-drop img { width: 100%; height: 100%; object-fit: cover; }
.logo-drop span { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; }

/* ---------- Filas ---------- */
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; width: 100%; min-height: 54px; text-align: left; }
button.row { transition: background .12s; }
button.row:hover { background: var(--fill-2); }
button.row:active { background: var(--fill); }
.row > svg { color: var(--tint); }
.row:not(.kv) > span:not(.row-ic):not(.num):not(.pill):not(.row-end):not(.radio):not(.stop-num) { flex: 1; }
.row.danger, .row.danger > svg { color: var(--red); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.015em; }
.row-sub { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.wrap .row-title, .wrap .row-sub, .row-title.wrap-text { white-space: normal; }
.row-sub.warn { color: var(--orange); font-weight: 600; }
.row-end { display: flex; align-items: center; gap: 8px; color: var(--text-3); flex: none; font-variant-numeric: tabular-nums; }
.row-end.col { flex-direction: column; align-items: flex-end; gap: 4px; }
.row-ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.amount { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.kv { justify-content: space-between; }
.kv > span:first-child { color: var(--text-2); font-size: 15px; flex: none; }
.kv-v { text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.steps .row-main { font-size: 15px; line-height: 1.35; }
.num { width: 28px; height: 28px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.reveal { font-family: var(--mono); color: var(--tint); font-weight: 600; letter-spacing: .12em; }
.choice .radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--text-3); flex: none; transition: border .15s, box-shadow .15s; }
.choice.on .radio { border: 7px solid var(--tint); }
.choice.on { background: var(--tint-soft); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 46px; padding: 0 18px;
  border-radius: 14px; font-weight: 650; font-size: 16px; white-space: nowrap; transition: transform .1s, opacity .15s, filter .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: var(--glow); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-secondary { background: var(--tint-soft); color: var(--tint); }
.btn-plain { color: var(--tint); height: 40px; }
.btn-danger { background: linear-gradient(135deg, #fb7185, #e11d48); color: #fff; box-shadow: 0 10px 24px rgba(225, 29, 72, .28); }
.btn-danger-soft { background: var(--red-soft); color: var(--red); }
.btn-glass { background: rgba(255, 255, 255, .2); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.btn-lg { height: 54px; font-size: 17px; border-radius: 16px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--tint); flex: none; transition: transform .1s;
  background: var(--surface); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--ring);
}
.icon-btn:active { transform: scale(.92); }
.icon-btn.tint { background: var(--grad); color: #fff; box-shadow: var(--glow); }
.icon-btn:disabled { opacity: .35; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; display: inline-block; animation: spin .7s linear infinite; }
.spinner.lg { width: 30px; height: 30px; color: var(--text-3); }
.loading { display: grid; place-items: center; padding: 40px; }
.loading.full { min-height: 60vh; }

/* ---------- Estructura ---------- */
.sidebar { display: none; }
.main { padding: calc(env(safe-area-inset-top) + 8px) 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 40px); }
.content { max-width: 980px; margin: 0 auto; }
.tabbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40;
  display: flex; justify-content: space-around; gap: 2px; padding: 6px; border-radius: 26px;
  background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--ring);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 10.5px; font-weight: 600; color: var(--text-2); padding: 6px 0 5px; border-radius: 20px; transition: background .15s, color .15s; }
.tab.active { color: var(--tint); background: var(--tint-soft); }

@media (min-width: 900px) {
  .sidebar {
    display: flex; flex-direction: column; position: fixed; top: 14px; bottom: 14px; left: 14px; width: 252px; padding: 18px 12px; border-radius: var(--r-xl);
    background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
    box-shadow: var(--shadow), inset 0 0 0 1px var(--ring); z-index: 30;
  }
  .main { margin-left: 280px; padding: 30px 40px 60px; }
  .tabbar { display: none; }
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }
.side-brand .brand-mark { width: 44px; height: 44px; border-radius: 14px; box-shadow: none; }
.side-brand b { display: block; font-size: 15px; line-height: 1.2; letter-spacing: -.02em; }
.side-brand small { color: var(--text-2); font-size: 12px; }
.side-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow: auto; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 14px; font-weight: 600; font-size: 15px; text-align: left; color: var(--text); transition: background .12s; }
.nav-item svg { color: var(--text-2); }
.nav-item:hover { background: var(--fill-2); }
.nav-item.active { background: var(--grad); color: #fff; box-shadow: var(--glow); }
.nav-item.active svg { color: #fff; }
.side-foot { display: flex; align-items: center; gap: 10px; padding: 12px 6px 0; border-top: 1px solid var(--sep); }
.side-user { flex: 1; min-width: 0; }
.side-user b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user small { font-size: 12px; color: var(--text-2); }

.lt { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 12px 0 20px; }
.lt h1 { font-size: 36px; line-height: 1.05; font-weight: 800; letter-spacing: -.04em; margin: 0; }
.lt-sub { margin: 6px 0 0; color: var(--text-2); font-size: 15px; }
.lt-actions { display: flex; gap: 8px; flex: none; }
.section-title { font-size: 21px; font-weight: 750; letter-spacing: -.03em; margin: 30px 4px 12px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.section-title small { font-weight: 500; font-size: 13px; letter-spacing: 0; }
.footnote { color: var(--text-2); font-size: 13px; margin: 12px 16px; line-height: 1.45; }

.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; font-size: 15px; color: #fff; background: linear-gradient(150deg, #94a3b8, #64748b); }
.avatar.sm { width: 38px; height: 38px; font-size: 13px; }
.avatar.lg { width: 62px; height: 62px; font-size: 22px; }
.avatar.xl { width: 90px; height: 90px; font-size: 32px; background: var(--grad); box-shadow: var(--glow); }
.avatar.tint { background: var(--grad); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.tag { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; vertical-align: -2px; }
.tag.orange { color: var(--orange); }
.dist { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; font-weight: 600; }
.chips, .qchips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 8px 13px; border-radius: 999px; font-size: 13px; color: var(--text-2); }
.chip svg { color: var(--tint); }
.chip b { color: var(--text); }
.qchips .chip { color: var(--tint); font-weight: 700; }
.qchips .chip:active { transform: scale(.95); }

/* ---------- Inicio ---------- */
.quick { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; }
.quick-tile {
  border-radius: var(--r-lg); padding: 16px 14px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between;
  gap: 18px; font-weight: 650; font-size: 14px; color: var(--tint); text-align: left; min-height: 112px; transition: transform .12s;
}
.quick-tile span { color: var(--text); line-height: 1.2; }
.quick-tile.primary { background: var(--grad); color: #fff; box-shadow: var(--glow); position: relative; overflow: hidden; }
.quick-tile.primary::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: rgba(255, 255, 255, .16); }
.quick-tile.primary span { color: #fff; }
.quick-tile:active { transform: scale(.96); }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } }
.stat { border-radius: var(--r-lg); padding: 15px 16px; display: flex; flex-direction: column; }
.stat-ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 12px; flex: none; }
.stat b { font-size: 25px; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat small { color: var(--text-2); font-size: 13px; margin-top: 3px; font-weight: 500; }
.stat em { font-style: normal; color: var(--text-3); font-size: 11px; }
.inv-strip { display: grid; grid-template-columns: repeat(4, 1fr); border-radius: var(--r-lg); padding: 15px 0; }
.inv-chip { display: flex; flex-direction: column; align-items: center; }
.inv-chip + .inv-chip { border-left: 1px solid var(--sep); }
.inv-chip b { font-size: 23px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.inv-chip small { font-size: 12px; color: var(--text-2); font-weight: 500; }
.inv-chip.teal b { color: var(--teal); }
.inv-chip.tint b { color: var(--tint); }
.inv-chip.red b { color: var(--red); }
.inv-chip.indigo b { color: var(--indigo); }

/* ---------- Inventario ---------- */
.inv-hero { border-radius: var(--r-xl); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.inv-hero-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.inv-hero small { color: var(--text-2); font-size: 13px; font-weight: 600; display: block; }
.inv-hero b { font-size: 52px; font-weight: 800; letter-spacing: -.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.inv-hero-ice { text-align: right; }
.inv-hero-ice b { font-size: 30px; color: var(--indigo); }
.inv-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--fill); }
.inv-bar i { display: block; height: 100%; transition: width .4s; }
.b-full { background: linear-gradient(90deg, #06b6d4, #2f6bff); }
.b-empty { background: #a5b4fc; }
.b-broken { background: var(--red); }
.b-client { background: var(--text-3); }
.inv-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text-2); font-weight: 500; }
.inv-legend span { display: inline-flex; align-items: center; gap: 6px; }
.inv-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.inv-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.inv-tile { border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 2px; text-align: left; transition: transform .12s; }
button.inv-tile:active { transform: scale(.97); }
.inv-tile.low { box-shadow: var(--shadow-sm), inset 0 0 0 2px var(--orange); }
.inv-tile b { font-size: 40px; font-weight: 800; letter-spacing: -.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.inv-tile span:not(.stat-ic) { font-size: 14px; font-weight: 650; margin-top: 4px; }
.inv-tile em { font-style: normal; font-size: 12px; color: var(--text-2); }
.inv-tile.low em { color: var(--orange); font-weight: 600; }
.act-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .act-grid { grid-template-columns: repeat(3, 1fr); } }
.act-btn { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); text-align: left; font-weight: 650; font-size: 14px; line-height: 1.2; transition: transform .12s; }
.act-btn .stat-ic { margin: 0; }
.act-btn:active { transform: scale(.97); }

/* ---------- Ruta ---------- */
.scan-hero {
  width: 100%; display: flex; align-items: center; gap: 16px; padding: 20px; border-radius: var(--r-xl); color: #fff; text-align: left;
  background: var(--grad); box-shadow: var(--glow); position: relative; overflow: hidden; transition: transform .12s;
}
.scan-hero::after { content: ""; position: absolute; right: -50px; bottom: -60px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255, 255, 255, .13); }
.scan-hero:active { transform: scale(.98); }
.scan-ic { width: 66px; height: 66px; border-radius: 20px; background: rgba(255, 255, 255, .2); display: grid; place-items: center; flex: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.scan-txt { flex: 1; display: flex; flex-direction: column; gap: 2px; position: relative; z-index: 1; }
.scan-txt b { font-size: 19px; letter-spacing: -.025em; }
.scan-txt small { opacity: .88; font-size: 13px; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0 16px; }
.mini-stats div { border-radius: var(--r); padding: 11px 6px; text-align: center; }
.mini-stats b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.mini-stats small { font-size: 11px; color: var(--text-2); font-weight: 500; }
.scanner { border-radius: var(--r-lg); overflow: hidden; background: #000; min-height: 260px; margin-bottom: 12px; display: grid; place-items: center; }
#reader { width: 100%; border: 0 !important; }
#reader video { width: 100% !important; display: block; }
.scanner .empty { color: #ccc; }
.search {
  display: flex; align-items: center; gap: 8px; border-radius: 14px; padding: 0 14px; height: 44px; color: var(--text-2); margin-bottom: 14px;
  background: var(--surface); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--ring);
}
.search:focus-within { box-shadow: 0 0 0 4px var(--tint-soft), inset 0 0 0 1px var(--tint); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--text); }
.search input::placeholder { color: var(--text-2); }

/* ---------- Venta ---------- */
.sale-client { display: flex; align-items: center; gap: 12px; padding: 4px 4px 14px; }
.sale-client b { display: block; font-size: 19px; letter-spacing: -.02em; }
.sale-client small { color: var(--text-2); font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.stepper { display: flex; align-items: center; background: var(--fill); border-radius: 12px; height: 38px; flex: none; transition: background .15s; }
.stepper button { width: 38px; height: 38px; font-size: 22px; line-height: 1; color: var(--tint); }
.stepper input { width: 44px; text-align: center; border: 0; background: transparent; font-weight: 700; font-size: 17px; outline: 0; font-variant-numeric: tabular-nums; }
.stepper.has { background: var(--tint-soft); }
.total-card { display: flex; justify-content: space-between; align-items: center; border-radius: var(--r-lg); padding: 16px 18px; margin: 12px 0; }
.total-card span { color: var(--text-2); font-weight: 600; }
.total-card b { font-size: 32px; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sale-sum { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 0 16px; }
.sale-sum .big { font-size: 40px; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }

.seg { display: flex; background: var(--fill); border-radius: 13px; padding: 3px; margin-bottom: 14px; }
.seg-btn { flex: 1; min-height: 34px; border-radius: 10px; font-size: 14px; font-weight: 600; padding: 0 6px; color: var(--text-2); transition: background .15s, color .15s; }
.seg-btn.on { background: var(--surface-hi); color: var(--text); box-shadow: 0 3px 10px rgba(15, 23, 42, .12); }

/* ---------- Historial ---------- */
.date-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.date-pill { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; height: 40px; border-radius: 14px; font-weight: 650; font-size: 15px; cursor: pointer; }
.date-pill svg { color: var(--tint); }
.date-pill input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); border-radius: var(--r-lg); padding: 16px 0; }
.summary div { text-align: center; padding: 0 6px; }
.summary div + div { border-left: 1px solid var(--sep); }
.summary small { display: block; color: var(--text-2); font-size: 12px; font-weight: 500; }
.summary b { font-size: 20px; font-variant-numeric: tabular-nums; letter-spacing: -.03em; font-weight: 800; }
.debt-hero { background: linear-gradient(135deg, #fbbf24, #f97316 60%, #ef4444); color: #fff; border-radius: var(--r-xl); padding: 22px; display: flex; flex-direction: column; margin-bottom: 18px; box-shadow: 0 14px 34px rgba(249, 115, 22, .3); }
.debt-hero b { font-size: 40px; letter-spacing: -.045em; font-variant-numeric: tabular-nums; font-weight: 800; }
.debt-hero small, .debt-hero span { opacity: .92; font-size: 14px; font-weight: 500; }
.client-block { margin-bottom: 18px; }
.cb-head { display: flex; align-items: center; gap: 10px; padding: 0 6px 8px; }
.cb-head b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-head > span { font-weight: 700; font-variant-numeric: tabular-nums; }
.client-card { border-radius: var(--r-lg); padding: 14px; margin-bottom: 10px; }
.client-card .cb-head { padding: 0 0 12px; }
.breakdown { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.breakdown div { background: var(--fill-2); border-radius: 12px; padding: 8px 10px; }
.breakdown small { display: block; font-size: 11px; color: var(--text-2); }
.breakdown b { font-size: 16px; font-variant-numeric: tabular-nums; }

/* ---------- Verificación ---------- */
.key-card {
  background: var(--grad-deep); color: #fff; border-radius: var(--r-xl); padding: 22px; position: relative; overflow: hidden;
  box-shadow: 0 20px 44px rgba(61, 90, 254, .32); display: flex; flex-direction: column; gap: 18px;
}
.key-card::before { content: ""; position: absolute; left: -60px; top: -80px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255, 255, 255, .10); }
.key-card > * { position: relative; }
.key-card.compact { padding: 18px; border-radius: var(--r-lg); gap: 14px; width: 100%; }
.key-top { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 14px; opacity: .95; }
.key-digits { display: flex; justify-content: center; gap: 7px; }
.key-digits span {
  width: 46px; height: 62px; border-radius: 14px; background: rgba(255, 255, 255, .17); display: grid; place-items: center;
  font-size: 32px; font-weight: 700; font-family: var(--mono); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
}
.key-digits .gap { width: 8px; background: none; box-shadow: none; }
@media (max-width: 380px) { .key-digits span { width: 38px; height: 52px; font-size: 26px; } }

/* ---------- Clientes ---------- */
.cli-head { display: flex; align-items: center; gap: 14px; padding: 4px; }
.cli-head h3 { margin: 0; font-size: 23px; letter-spacing: -.03em; }
.cli-head p { margin: 2px 0 0; font-size: 13px; }
.qr-card { background: #fff; color: #000; border-radius: var(--r-lg); padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 14px 0; box-shadow: var(--shadow-sm); }
.qr-card p { color: #6e6e73; margin: 0; }
#qr-box img, #qr-box canvas { display: block; width: 200px; height: 200px; }
.callout { display: flex; gap: 10px; align-items: flex-start; background: var(--green-soft); padding: 12px 14px; border-radius: var(--r); font-size: 14px; text-align: left; line-height: 1.38; }
.callout svg { color: var(--green); margin-top: 1px; }
.callout.warn { background: var(--orange-soft); }
.callout.warn svg { color: var(--orange); }

/* ---------- Mapas ---------- */
.map { height: 280px; border-radius: var(--r); overflow: hidden; background: var(--surface-2); position: relative; z-index: 0; box-shadow: inset 0 0 0 1px var(--ring); }
.map.mini { height: 180px; margin: 12px 0; }
.map-wrap { position: relative; isolation: isolate; } /* los botones del mapa no quedan sobre las hojas modales */
.map-fab { position: absolute; top: 10px; right: 10px; z-index: 500; width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--glass-strong); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); color: var(--tint); box-shadow: var(--shadow); }
.map-fab.spin svg { animation: spin 1s linear infinite; }
.map-hint { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 500; padding: 6px 12px; border-radius: 999px; background: var(--glass-strong); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); font-size: 12px; font-weight: 600; pointer-events: none; white-space: nowrap; box-shadow: var(--shadow); }
.coords { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; margin: 8px 6px 0; font-family: var(--mono); }
.coords .link { font-family: var(--font); font-size: 13px; }
.leaflet-container { font-family: var(--font); background: var(--surface-2); }
/* Modo oscuro para el mapa gratuito de OpenStreetMap */
.map-dark .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.7); }
.leaflet-control-zoom { border: 0 !important; box-shadow: var(--shadow) !important; border-radius: 12px !important; overflow: hidden; }
.leaflet-control-zoom a { background: var(--glass-strong) !important; color: var(--text) !important; border-color: var(--sep) !important; }
.leaflet-control-attribution { background: var(--glass) !important; color: var(--text-2) !important; font-size: 9px !important; }
.leaflet-control-attribution a { color: var(--text-2) !important; }
.apple-pin { background: none; border: 0; }
.pin-dot { width: 30px; height: 30px; margin-top: 2px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); position: relative; background: var(--grad); border: 3px solid #fff; box-shadow: 0 6px 14px rgba(0, 0, 0, .35); }
.pin-dot::after { content: ""; position: absolute; width: 8px; height: 8px; border-radius: 50%; background: #fff; top: 8px; left: 8px; }
.gps-me { background: none; border: 0; }
.gps-dot { width: 20px; height: 20px; border-radius: 50%; background: #2f6bff; border: 3px solid #fff; box-shadow: 0 0 0 7px rgba(47, 107, 255, .22), 0 2px 6px rgba(0, 0, 0, .3); }
.gps-alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--r); background: var(--tint-soft); }
.gps-alert svg { color: var(--tint); }
.gps-alert.warn { background: var(--orange-soft); }
.gps-alert.warn svg { color: var(--orange); }
.gps-alert p { margin: 3px 0 0; font-size: 13px; color: var(--text-2); }
.gps-q { font-weight: 700; text-align: center; margin: 14px 10px; font-size: 16px; line-height: 1.3; }

/* ---------- Rutas y navegación ---------- */
.map-fab.second { top: 60px; }
.icon-btn.sm { width: 32px; height: 32px; }
.route-card { border-radius: var(--r-lg); overflow: hidden; margin-bottom: 14px; background: var(--surface); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--ring); }
.route-card .map { border-radius: 0; box-shadow: none; }
.route-map { height: 270px; }
@media (min-width: 900px) { .route-map { height: 360px; } }
.route-bar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 64px; }
.route-bar .muted { font-size: 14px; }
.rb-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rb-txt b { font-size: 16px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-txt small { font-size: 12px; color: var(--text-2); }
.route-empty { margin-bottom: 14px; }
.route-empty .link { font-size: 14px; }
.list-tools { display: flex; justify-content: flex-end; margin: -4px 0 10px; }
.live-link { margin-top: 14px; }

/* Número de parada: mismo azul que el trazado */
.stop-num { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; background: #1A73E8; font-variant-numeric: tabular-nums; }
.stop-num.done { background: var(--green); }
.stop-pin, .plant-pin, .rider-pin { background: none; border: 0; }
.stop-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: #1A73E8; border: 3px solid #1A73E8; font: 800 12px/1 var(--font); box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.stop-dot.done { color: #fff; background: #188038; border-color: #fff; }
.plant-dot { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: #202124; border: 3px solid #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, .4); }

/* Barra de rastreo del repartidor */
.trk-wrap:empty { display: none; }
.trk { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: var(--r); margin-bottom: 12px; background: var(--fill); }
.trk-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: currentColor; }
.trk-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; color: var(--text); }
.trk-txt b { font-size: 14px; }
.trk-txt small { font-size: 12px; color: var(--text-2); line-height: 1.3; }
.trk-acc { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.trk.gray { color: var(--text-3); }
.trk.tint { color: var(--tint); background: var(--tint-soft); }
.trk.green { color: var(--green); background: var(--green-soft); }
.trk.orange { color: var(--orange); background: var(--orange-soft); }
.trk.red { color: var(--red); background: var(--red-soft); }
.trk.green .trk-dot, .trk.tint .trk-dot { box-shadow: 0 0 0 0 currentColor; animation: live 1.8s ease-out infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 currentColor; } 100% { box-shadow: 0 0 0 9px transparent; } }

/* ---------- Monitoreo en vivo ---------- */
.mon { display: grid; gap: 4px; }
.mon-map { height: 56vh; min-height: 320px; }
@media (min-width: 1100px) {
  .content:has(.mon) { max-width: 1280px; }
  .mon { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 22px; align-items: start; }
  .mon-map-wrap { position: sticky; top: 24px; }
  .mon-map { height: calc(100dvh - 160px); }
  .mon-side .section-title:first-child { margin-top: 0; }
}
@media (max-width: 520px) { .mon-legend { font-size: 10.5px; gap: 3px 8px; padding: 6px 9px; } }
.mon-legend { position: absolute; left: 10px; bottom: 22px; z-index: 500; display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 7px 11px; border-radius: 12px; background: var(--glass-strong); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: var(--shadow); font-size: 11.5px; font-weight: 600; max-width: calc(100% - 70px); }
.mon-legend span { display: inline-flex; align-items: center; gap: 5px; }
.mon-legend i { display: inline-block; width: 16px; height: 5px; border-radius: 3px; }
.lg-route { background: #1A73E8; box-shadow: 0 0 0 1.5px #1557B0; }
.lg-ok { background: #188038; }
.lg-off { background: #d93025; }
.lg-old { background: #80868b; }
.rider { position: relative; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; border: 3px solid #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, .4); background: #1A73E8; }
.rider b { font: 800 12px/1 var(--font); position: relative; z-index: 1; }
.rider.ok { background: #188038; }
.rider.off { background: #d93025; animation: alerta 1.2s ease-in-out infinite; }
.rider.old { background: #80868b; opacity: .85; }
.rider-dir { position: absolute; inset: -11px; pointer-events: none; }
.rider-dir::before { content: ""; position: absolute; left: 50%; top: 0; transform: translateX(-50%); border: 7px solid transparent; border-bottom: 10px solid #fff; border-top: 0; filter: drop-shadow(0 -1px 1px rgba(0, 0, 0, .35)); }
@keyframes alerta { 50% { box-shadow: 0 0 0 8px rgba(217, 48, 37, .28), 0 4px 12px rgba(0, 0, 0, .4); } }
.rider-av.ok { background: #188038; }
.rider-av.off { background: #d93025; }
.rider-av.old { background: #80868b; }
.rider-av.free { background: #1A73E8; }

/* ---------- Superadministrador ---------- */
.pur-list { display: grid; gap: 10px; }
@media (min-width: 900px) { .pur-list { grid-template-columns: 1fr 1fr; } }
.pur-card { border-radius: var(--r-lg); padding: 16px; text-align: left; display: flex; flex-direction: column; gap: 12px; width: 100%; transition: transform .12s; }
.pur-card:active { transform: scale(.98); }
.pur-top { display: flex; align-items: center; gap: 12px; }
.pur-top img { width: 44px; height: 44px; border-radius: 14px; object-fit: cover; flex: none; }
.pur-top b { display: block; letter-spacing: -.02em; }
.pur-top small { color: var(--text-2); font-size: 13px; }
.pur-top > svg { color: var(--text-3); }
.pur-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text-2); }
.pur-meta span { display: inline-flex; align-items: center; gap: 5px; }
.pur-meta code { color: var(--text); font-weight: 700; letter-spacing: .08em; }
.form-card { max-width: 620px; }

/* ---------- Vacío / éxito ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 40px 20px; color: var(--text-2); }
.empty-ic { width: 60px; height: 60px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--ring); display: grid; place-items: center; color: var(--tint); margin-bottom: 6px; }
.empty b { color: var(--text); font-size: 17px; }
.empty p { margin: 0; font-size: 14px; max-width: 32ch; }
.success { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; width: 100%; }
.success h2 { margin: 4px 0 0; font-size: 27px; letter-spacing: -.035em; }
.success p { margin: 0; }
.success-check { width: 76px; height: 76px; border-radius: 50%; background: linear-gradient(140deg, #34d399, #10b981); color: #fff; display: grid; place-items: center; box-shadow: 0 12px 30px rgba(16, 185, 129, .35); animation: pop .45s cubic-bezier(.2, 1.4, .4, 1); }
.fine { color: var(--text-2); font-size: 13px; margin: 4px 0 0; }

/* ---------- Hojas modales ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.modal-bg { position: absolute; inset: 0; background: rgba(8, 12, 24, .42); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); opacity: 0; transition: opacity .25s; }
.sheet {
  position: relative; width: 100%; max-height: 92dvh; background: var(--sheet-bg); border-radius: 26px 26px 0 0; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .36s cubic-bezier(.2, .9, .25, 1); box-shadow: var(--shadow-lg);
}
.modal.open .modal-bg { opacity: 1; }
.modal.open .sheet { transform: none; }
.sheet-grab { width: 38px; height: 5px; border-radius: 3px; background: var(--text-3); margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px 8px 20px; flex: none; }
.sheet-head h2 { font-size: 20px; margin: 0; font-weight: 800; letter-spacing: -.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-head .icon-btn { width: 32px; height: 32px; color: var(--text-2); }
.sheet-body { overflow-y: auto; padding: 6px 16px 18px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sheet-foot { display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--sep); flex: none; background: var(--glass); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.sheet-foot .btn { flex: 1; }
.sheet-foot .btn-danger-soft:first-child { flex: 0 0 auto; padding: 0 15px; }
.sheet-msg { margin: 4px 4px 12px; color: var(--text-2); font-size: 15px; line-height: 1.42; }
@media (min-width: 700px) {
  .modal { align-items: center; padding: 24px; }
  .sheet { max-width: 520px; max-height: 88dvh; border-radius: 28px; transform: translateY(16px) scale(.97); opacity: 0; transition: transform .25s, opacity .2s; overflow: hidden; }
  .modal.open .sheet { opacity: 1; transform: none; }
  .sheet.lg { max-width: 640px; }
  .sheet.sm { max-width: 400px; }
  .sheet-grab { display: none; }
  .sheet-head { padding-top: 16px; }
}

.toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 14px); z-index: 300; transform: translate(-50%, -160%); opacity: 0;
  background: var(--glass-strong); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); color: var(--text);
  padding: 11px 20px; border-radius: 999px; font-weight: 650; font-size: 14px; box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--ring);
  transition: transform .3s cubic-bezier(.2, .9, .25, 1), opacity .2s; max-width: 90vw; text-align: center; pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.err { color: var(--red); }
.toast.ok { color: var(--green); }
.toast.warn { color: var(--orange); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
