/* Cosa Nostra · Reservaciones — black & red, mobile first. */
:root {
  --bg: #070707;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .075);
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --text: #f6f3f2;
  --muted: #9b9393;
  --red: #e5202f;
  --red-2: #ff4a55;
  --grad: linear-gradient(135deg, #ff3b48 0%, #d1121f 45%, #6e0910 100%);
  --grad-soft: linear-gradient(135deg, rgba(229, 32, 47, .22), rgba(110, 9, 16, .12));
  --pending: #f5a524;
  --radius: 18px;
  --shadow: 0 20px 60px rgba(0, 0, 0, .55);
  --glow: 0 8px 30px rgba(229, 32, 47, .35);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --nav-h: 72px;
  --top-h: calc(59px + env(safe-area-inset-top));
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(229, 32, 47, .16), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.45 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; }
a { color: var(--red-2); }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.02em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: grid; gap: 14px; }
.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 14px;
  padding: 10px 16px; min-height: 44px; cursor: pointer; white-space: nowrap; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: transform .15s var(--ease), background .2s, border-color .2s, box-shadow .2s;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-2); }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; font-weight: 600; box-shadow: var(--glow); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: #ff8a92; border-color: rgba(229, 32, 47, .35); background: rgba(229, 32, 47, .08); }
.btn.success { color: #fff; border-color: var(--line-2); background: rgba(255, 255, 255, .1); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 6px 12px; min-height: 34px; font-size: 13px; border-radius: 10px; }
.btn.icon { width: 44px; padding: 0; }

/* ---------- Inputs ---------- */
label.field { display: grid; gap: 6px; font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: .02em; }
input, select, textarea {
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 13px; min-height: 46px; width: 100%; outline: none; font-size: 16px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: rgba(229, 32, 47, .7); box-shadow: 0 0 0 4px rgba(229, 32, 47, .15); background: rgba(255, 255, 255, .06); }
input[type="checkbox"] { width: 20px; min-height: 20px; height: 20px; accent-color: var(--red); flex: none; }
select {
  appearance: none; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
}
label.row { flex-wrap: nowrap; cursor: pointer; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 520px) { .grid-3 { grid-template-columns: 1fr 1fr; } .grid-3 > :last-child { grid-column: span 2; } }

/* ---------- App shell (mobile first) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(7, 7, 7, .72); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.wordmark { font-weight: 800; letter-spacing: .22em; font-size: 13px; text-transform: uppercase; }
.wordmark b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer; flex: none;
  background: var(--grad); color: #fff; font-weight: 700; font-size: 14px; box-shadow: var(--glow);
  display: grid; place-items: center; transition: transform .15s var(--ease);
}
.avatar:active { transform: scale(.92); }

.main { padding: 16px 16px calc(var(--nav-h) + 40px + env(safe-area-inset-bottom)); max-width: 1100px; margin: 0 auto; }
.main > * { animation: rise .45s var(--ease) both; }
.main > *:nth-child(2) { animation-delay: .04s; }
.main > *:nth-child(3) { animation-delay: .08s; }
.main > *:nth-child(4) { animation-delay: .12s; }
.main > *:nth-child(n+5) { animation-delay: .16s; }

.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { font-size: 28px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--red-2); }

/* Floating bottom tab bar */
.tabbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 30;
  height: var(--nav-h); display: flex; justify-content: space-around; align-items: center; padding: 6px;
  max-width: 520px; margin: 0 auto;
  background: rgba(20, 18, 18, .78); backdrop-filter: blur(20px) saturate(1.5); -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--line-2); border-radius: 24px; box-shadow: var(--shadow);
  animation: nav-in .5s var(--spring) both;
}
.tabbar a {
  flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 10.5px; font-weight: 600; border-radius: 18px; position: relative;
  transition: color .2s;
}
.tabbar a .ico { width: 42px; height: 30px; border-radius: 12px; display: grid; place-items: center; transition: background .25s var(--ease), transform .25s var(--spring); }
.tabbar a:active .ico { transform: scale(.88); }
.tabbar a.active { color: var(--text); }
.tabbar a.active .ico { background: var(--grad); color: #fff; box-shadow: var(--glow); }
.badge {
  position: absolute; top: 2px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--pending); color: #1a1205; font-size: 11px; font-weight: 800; border-radius: 999px;
  display: grid; place-items: center; animation: pop .4s var(--spring);
}

.fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + 26px + env(safe-area-inset-bottom)); z-index: 25;
  width: 58px; height: 58px; border-radius: 20px; border: 0; cursor: pointer; color: #fff;
  background: var(--grad); box-shadow: 0 12px 34px rgba(229, 32, 47, .5);
  display: grid; place-items: center; animation: pop .5s .2s var(--spring) both;
  transition: transform .2s var(--spring);
}
.fab:active { transform: scale(.9) rotate(90deg); }
.fab svg { width: 26px; height: 26px; }

/* Desktop: side navigation */
.sidebar { display: none; }
@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
  .topbar, .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; padding: 26px 16px;
    border-right: 1px solid var(--line); background: linear-gradient(180deg, rgba(229, 32, 47, .08), transparent 40%);
  }
  .sidebar .wordmark { padding: 0 10px 26px; font-size: 14px; }
  .sidebar nav { display: grid; gap: 4px; }
  .sidebar nav a {
    display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: var(--muted);
    text-decoration: none; font-weight: 500; position: relative; transition: background .2s, color .2s;
  }
  .sidebar nav a:hover { background: var(--surface); color: var(--text); }
  .sidebar nav a.active { background: var(--grad-soft); color: var(--text); box-shadow: inset 2px 0 0 var(--red); }
  .sidebar nav a .badge { position: static; margin-left: auto; }
  .sidebar .me { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 14px; background: var(--surface); }
  .main { padding: 32px 36px 60px; }
  .fab { bottom: 32px; right: 32px; }
}

/* ---------- Cards / lists ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.list { display: grid; gap: 10px; }
.item {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; display: flex; gap: 14px; align-items: center; cursor: pointer;
  transition: transform .15s var(--ease), background .2s, border-color .2s;
  animation: rise .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms);
}
.item:hover { background: var(--surface-2); border-color: var(--line-2); }
.item:active { transform: scale(.98); }
.item .time { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 64px; font-size: 14px; }
.item .main-col { flex: 1; min-width: 0; }
.item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 36px 16px; border: 1px dashed var(--line-2); border-radius: var(--radius); }
.section-title { display: flex; align-items: baseline; gap: 8px; margin: 26px 0 12px; }
.section-title h3 { font-size: 17px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; background: var(--surface-2); white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-pending { color: var(--pending); background: rgba(245, 165, 36, .12); }
.st-approved { color: #ff6b74; background: rgba(229, 32, 47, .15); }
.st-seated { color: #fff; background: rgba(255, 255, 255, .12); }
.st-completed, .st-cancelled, .st-rejected, .st-no_show { color: var(--muted); }
.pill.role { background: transparent; border: 1px solid var(--line-2); color: var(--muted); }
.pill.role::before { display: none; }
.vip { background: var(--grad); color: #fff; font-size: 10px; border-radius: 6px; padding: 1px 6px; font-weight: 800; letter-spacing: .04em; vertical-align: 1px; }

.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: transparent; padding: 8px 14px; border-radius: 10px; cursor: pointer; color: var(--muted); white-space: nowrap; font-weight: 600; font-size: 13.5px; transition: background .25s var(--ease), color .2s; }
.tabs button.active { background: var(--grad); color: #fff; box-shadow: var(--glow); }

/* ---------- Floor view ---------- */
.floor-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 4px 16px; margin: 0 -16px 10px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 14px;
  min-width: 54px; padding: 8px 12px; cursor: pointer; display: grid; justify-items: center; gap: 1px;
  transition: transform .2s var(--spring), background .25s, border-color .25s, box-shadow .25s;
}
.chip:active { transform: scale(.92); }
.chip .d { font-size: 10.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.chip .n { font-size: 17px; font-weight: 700; }
.chip.time-chip { padding: 9px 14px; font-weight: 600; font-size: 14px; }
.chip.active { background: var(--grad); border-color: transparent; color: #fff; box-shadow: var(--glow); }
.chip.active .d { color: rgba(255, 255, 255, .8); }
.chip.pick { position: relative; overflow: hidden; color: var(--muted); place-items: center; }
.chip.pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }

.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; margin: 2px 0 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

.floor-wrap { border-radius: 24px; padding: 1px; background: linear-gradient(160deg, rgba(229, 32, 47, .45), rgba(255, 255, 255, .06) 35%, rgba(255, 255, 255, .03)); }
.floor {
  position: relative; width: 100%; aspect-ratio: 995 / 1295; container-type: inline-size;
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .05) 1px, transparent 0) 0 0 / 18px 18px,
    radial-gradient(80% 50% at 50% 0%, rgba(229, 32, 47, .1), transparent 70%),
    #0b0a0a;
  border-radius: 23px; overflow: hidden; touch-action: manipulation;
}
.floor.editing { touch-action: none; }
/* Floor page: sized to the screen, no scrolling. The floor takes whatever height is left
   and keeps the drawing's proportions. */
.main.fixed {
  height: calc(100dvh - var(--top-h)); display: flex; flex-direction: column; overflow: hidden;
  padding-top: 12px; padding-bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom));
}
.main.fixed > * { flex: none; }
.floor-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.floor-head h1 { font-size: 24px; white-space: nowrap; }
.floor-head h1::first-letter { text-transform: uppercase; }
.summary { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.summary b { color: var(--text); font-weight: 700; }
.main.fixed .chips { margin-bottom: 8px; }
.floor-area { flex: 1 1 auto !important; min-height: 0; container-type: size; display: flex; justify-content: center; align-items: center; }
.floor-area .floor-wrap { width: min(100cqw, 100cqh * 995 / 1295); }
.main.fixed .legend { justify-content: center; margin: 8px 0 0; }
@media (min-width: 960px) {
  .main.fixed { height: 100dvh; padding-top: 24px; padding-bottom: 20px; }
}

.tbl {
  position: absolute; transform: translate(-50%, -50%) rotate(var(--rot, 0deg));
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  border: 1.5px solid rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .04);
  border-radius: 10px; cursor: pointer; user-select: none; padding: 1px; color: var(--text);
  transition: background .3s, border-color .3s, box-shadow .3s, transform .25s var(--spring);
  animation: table-in .5s var(--spring) both; animation-delay: calc(var(--i, 0) * 22ms);
}
.tbl:hover { border-color: rgba(255, 255, 255, .6); }
.tbl:active { transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(.9); }
.tbl.round { border-radius: 50%; }
.tbl.booth { border-radius: 30% 30% 12% 12%; }
.tbl .lbl { font-weight: 700; font-size: clamp(9px, 3.3cqw, 18px); line-height: 1.05; letter-spacing: -.01em; }
.tbl .cap { font-size: clamp(7px, 2cqw, 11px); color: var(--muted); }
.tbl .who { font-size: clamp(7px, 2cqw, 11px); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 3px; }
.tbl .dots {
  position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: #fff; color: #000; font-size: 10px; font-weight: 800; display: grid; place-items: center; animation: pop .4s var(--spring);
}
.tbl.s-pending { border-color: var(--pending); background: rgba(245, 165, 36, .14); animation: table-in .5s var(--spring) both, pulse-amber 2.2s 1s infinite; }
.tbl.s-approved { border-color: transparent; background: var(--grad); box-shadow: 0 6px 22px rgba(229, 32, 47, .45); }
.tbl.s-approved .cap, .tbl.s-approved .who { color: rgba(255, 255, 255, .85); }
.tbl.s-seated { border-color: #fff; background: linear-gradient(135deg, #3a0a0e, #170405); box-shadow: 0 0 0 3px rgba(255, 255, 255, .08); }
.tbl.selected { box-shadow: 0 0 0 3px var(--red-2), var(--glow); }
.tbl.inactive { opacity: .3; border-style: dashed; }
.tbl.fixture {
  cursor: default; pointer-events: none; border: 1px solid rgba(255, 255, 255, .08); border-radius: 6px;
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .035) 0 6px, transparent 6px 12px);
}
.floor.editing .tbl.fixture { pointer-events: auto; }
.floor.editing .tbl { cursor: grab; }
.floor.editing .tbl.selected { border-color: var(--red-2); }
@container (max-width: 420px) { .tbl .who { display: none; } }

.editor { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 1000px) { .editor { grid-template-columns: minmax(0, 520px) 300px; } }

/* ---------- Sheets / modals ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, .55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: fade .25s var(--ease);
}
.overlay.closing { animation: fade-out .22s var(--ease) forwards; }
.modal {
  width: 100%; max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  background: linear-gradient(180deg, #171414, #0f0d0d); border: 1px solid var(--line-2); border-bottom: 0;
  border-radius: 28px 28px 0 0; box-shadow: var(--shadow);
  animation: sheet-up .42s var(--spring);
}
.overlay.closing .modal { animation: sheet-down .22s var(--ease) forwards; }
.modal::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .2); margin: 10px auto 0; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 12px 20px 6px; }
.modal-head h2 { font-size: 20px; flex: 1; }
.modal-body { padding: 12px 20px 20px; display: grid; gap: 16px; }
.modal-foot {
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; position: sticky; bottom: 0;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(15, 13, 13, 0), #0f0d0d 30%);
}
.modal-foot .btn { flex: 1 1 auto; }
@media (min-width: 700px) {
  .overlay { align-items: center; padding: 24px; }
  .modal { max-width: 560px; border-radius: 26px; border-bottom: 1px solid var(--line-2); animation: modal-in .35s var(--spring); }
  .modal.wide { max-width: 720px; }
  .modal::before { display: none; }
  .modal-head { padding-top: 20px; }
  .overlay.closing .modal { animation: modal-out .2s var(--ease) forwards; }
  .modal-foot .btn { flex: 0 0 auto; }
}

dl.info { display: grid; grid-template-columns: 120px 1fr; gap: 10px 14px; margin: 0; font-size: 14.5px; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; overflow-wrap: anywhere; font-weight: 500; }
.timeline { display: grid; gap: 10px; font-size: 13px; border-left: 2px solid rgba(229, 32, 47, .4); padding-left: 14px; }
.note { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 14px; white-space: pre-wrap; }
.err { color: #ff8a92; font-size: 14px; }
.err:empty { display: none; }
.lock { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; color: var(--muted); }

.suggest { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; animation: rise .25s var(--ease); }
.suggest button { display: flex; width: 100%; align-items: center; text-align: left; gap: 8px; padding: 12px 14px; background: transparent; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.suggest button:last-child { border-bottom: 0; }
.suggest button:hover { background: var(--surface-2); }
.chosen { display: flex; align-items: center; gap: 12px; background: var(--grad-soft); border: 1px solid rgba(229, 32, 47, .3); padding: 12px 14px; border-radius: 14px; animation: pop .35s var(--spring); }

/* ---------- Data table ---------- */
.data { width: 100%; border-collapse: collapse; font-size: 14px; }
.data th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.data td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data tr:last-child td { border-bottom: 0; }
.data tr.off td { opacity: .4; }
.scroll-x { overflow-x: auto; }

/* ---------- Login ---------- */
.login {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; overflow: hidden; position: relative;
  background: #050505;
}
.login::before, .login::after {
  content: ""; position: absolute; width: 140vmax; height: 140vmax; left: 50%; top: 50%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(229, 32, 47, .35), transparent 55%);
  transform: translate(-50%, -95%); animation: drift 12s ease-in-out infinite alternate;
}
.login::after { background: radial-gradient(circle, rgba(125, 11, 20, .45), transparent 50%); transform: translate(-30%, -10%); animation-duration: 15s; animation-direction: alternate-reverse; }
.login-box { width: 100%; max-width: 320px; text-align: center; position: relative; z-index: 1; animation: rise .6s var(--ease) both; }
.login-box.leaving { animation: login-out .3s var(--ease) forwards; }
.login .wordmark { font-size: 20px; letter-spacing: .3em; }
.login .tag { margin-top: 6px; font-size: 11px; letter-spacing: .26em; text-transform: uppercase; color: var(--muted); }
.code-dots { display: flex; justify-content: center; gap: 18px; margin: 44px 0 14px; height: 18px; }
.code-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .25); transition: background .2s, border-color .2s, transform .25s var(--spring), box-shadow .2s; }
.code-dots i.on { background: var(--grad); border-color: transparent; transform: scale(1.15); box-shadow: 0 0 16px rgba(229, 32, 47, .7); }
.code-dots.loading i { background: var(--grad); border-color: transparent; animation: wave .9s var(--ease) infinite; }
.code-dots.loading i:nth-child(2) { animation-delay: .1s; }
.code-dots.loading i:nth-child(3) { animation-delay: .2s; }
.code-dots.loading i:nth-child(4) { animation-delay: .3s; }
.code-dots.ok i { background: #fff; border-color: transparent; box-shadow: 0 0 22px rgba(255, 255, 255, .8); transform: scale(1.25); }
.code-dots.shake { animation: shake .45s; }
.code-dots.shake i { border-color: var(--red-2); background: rgba(229, 32, 47, .4); }
.login .hint { min-height: 22px; font-size: 13.5px; color: var(--muted); margin: 0; transition: color .2s; }
.login .hint.err { color: #ff8a92; display: block; }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); justify-content: center; gap: 16px 22px; margin-top: 26px; }
.keypad button {
  height: 76px; width: 76px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .05); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  font-size: 28px; font-weight: 500; cursor: pointer; user-select: none; -webkit-user-select: none;
  transition: transform .12s var(--ease), background .2s, border-color .2s;
}
.keypad button.pressed { transform: scale(.88); background: rgba(229, 32, 47, .35); border-color: rgba(229, 32, 47, .7); transition-duration: .05s; }
.keypad button.txt { font-size: 14px; font-weight: 600; border: 0; background: transparent; color: var(--muted); backdrop-filter: none; }
.keypad button.txt.pressed { background: transparent; color: var(--text); }

.code-big { font-size: 56px; font-weight: 800; letter-spacing: .25em; text-align: center; padding: 10px 0 4px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; animation: pop .5s var(--spring); }

/* ---------- Toasts ---------- */
#toasts { position: fixed; top: calc(12px + env(safe-area-inset-top)); left: 12px; right: 12px; z-index: 100; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast {
  max-width: 440px; width: fit-content; pointer-events: auto; font-size: 14px; font-weight: 500;
  background: rgba(24, 21, 21, .92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line-2); border-radius: 16px; padding: 12px 16px; box-shadow: var(--shadow);
  display: flex; gap: 10px; align-items: center; animation: toast-in .45s var(--spring);
}
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #34d399; flex: none; }
.toast.error::before { background: var(--red-2); }
.toast.leaving { animation: toast-out .25s var(--ease) forwards; }

/* ---------- Keyframes ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.6); } }
@keyframes nav-in { from { opacity: 0; transform: translateY(30px); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes modal-out { to { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes table-in { from { opacity: 0; transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(.4); } }
@keyframes pulse-amber { 0%, 100% { box-shadow: 0 0 0 0 rgba(245, 165, 36, .45); } 50% { box-shadow: 0 0 0 7px rgba(245, 165, 36, 0); } }
@keyframes wave { 0%, 100% { transform: translateY(0) scale(1); } 40% { transform: translateY(-10px) scale(1.1); } }
@keyframes shake { 20% { transform: translateX(-10px); } 40% { transform: translateX(9px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
@keyframes drift { to { transform: translate(-60%, -80%) scale(1.15); } }
@keyframes login-out { to { opacity: 0; transform: scale(1.08); filter: blur(6px); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-20px) scale(.95); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-12px) scale(.97); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Collapsible "more details" block in forms */
details.more { border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; background: var(--surface); }
details.more summary { cursor: pointer; padding: 13px 0; font-weight: 600; font-size: 14px; color: var(--muted); list-style: none; display: flex; align-items: center; justify-content: space-between; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: "+"; font-size: 20px; font-weight: 400; transition: transform .25s var(--spring); }
details.more[open] summary::after { transform: rotate(45deg); }
details.more[open] > .stack { padding-bottom: 14px; animation: rise .3s var(--ease); }
.chip.closed { opacity: .28; cursor: not-allowed; background: transparent; border-style: dashed; }
.chip.closed .n { text-decoration: line-through; text-decoration-thickness: 1.5px; }

/* iOS gives date inputs an intrinsic width that ignores width: 100% and pushes the sheet
   sideways; drop the native sizing and keep every grid cell shrinkable. */
input[type="date"], input[type="time"] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; text-align: left; }
input::-webkit-date-and-time-value { text-align: left; margin: 0; }
input::-webkit-calendar-picker-indicator { margin-left: auto; filter: invert(1) opacity(.6); }
label.field, .grid-2 > *, .grid-3 > * { min-width: 0; }
.modal, .modal-body { overflow-x: hidden; }
.modal { touch-action: pan-y; }

.money { position: relative; }
.money span { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 16px; pointer-events: none; }
.money input { padding-left: 26px; }
.toggle-line { margin: 0 0 14px; justify-content: flex-end; }
.tabs { width: fit-content; }
@media (max-width: 520px) { .tabs { width: 100%; } .tabs button { flex: 1; padding: 8px 10px; } }
.grid-2, .grid-3 { align-items: end; }
