/* iqflows design system — shared by the staff app, login, customer check-in and kiosk. */
:root {
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bg: #f6f7fb; --bg-2: #eef0f7; --panel: #ffffff; --panel-2: #fafbfe;
  --ink: #101326; --ink-2: #3b4060; --muted: #6b7090; --line: #e6e8f0; --line-2: #d9dce8;
  --brand: #5046e5; --brand-2: #7c3aed; --brand-ink: #ffffff; --brand-soft: #eeedfd; --brand-ring: rgba(80, 70, 229, .22);
  --grad: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  --ok: #047857; --ok-soft: #dcf5ea; --warn: #b45309; --warn-soft: #fdf0d5;
  --bad: #d92d4b; --bad-soft: #fde4e8; --info: #1d5fd1; --info-soft: #e0ebfd;
  --radius: 14px; --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 19, 38, .05);
  --shadow: 0 1px 2px rgba(16, 19, 38, .04), 0 6px 24px -8px rgba(16, 19, 38, .10);
  --shadow-lg: 0 24px 60px -12px rgba(16, 19, 38, .28);
  /* Buttons keep the deep gradient in both themes: white text on it stays above 4.5:1. */
  --grad-strong: linear-gradient(135deg, #5046e5 0%, #7c3aed 100%);
  --toast-bg: #151829; --toast-ink: #f3f4fb; --toast-muted: #b9bdd6;
  --sk: #e9ebf3; --sk-sweep: rgba(255, 255, 255, .65);
  /* Motion: transform and opacity only, short (see the Delight section at the end). */
  --t-press: 80ms; --t-fast: 150ms; --t-base: 200ms; --ease-out: cubic-bezier(.2, .8, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0e19; --bg-2: #121527; --panel: #151829; --panel-2: #1a1e33;
    --ink: #eceefb; --ink-2: #c3c7e0; --muted: #8e93b3; --line: #252a42; --line-2: #31375a;
    --brand: #8a83ff; --brand-2: #b38bff; --brand-ink: #0c0e19; --brand-soft: #22234a; --brand-ring: rgba(138, 131, 255, .3);
    --ok: #34d399; --ok-soft: #0e2f26; --warn: #fbbf24; --warn-soft: #33280c;
    --bad: #fb7185; --bad-soft: #3a1520; --info: #7ab0ff; --info-soft: #14284a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px -10px rgba(0, 0, 0, .5);
    --shadow-sm: none;
    --toast-bg: #23284a; --toast-ink: #f3f4fb; --toast-muted: #b9bdd6;
    --sk: #1d2138; --sk-sweep: rgba(255, 255, 255, .06);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.015em; }
h2 { font-size: 22px; font-weight: 800; } h3 { font-size: 15px; font-weight: 700; }
a { color: var(--brand); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--bg-2); padding: 1px 6px; border-radius: 6px; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--brand-ring); }

/* form controls */
input, select, textarea { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 9px 12px; width: 100%; transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); }
input[type="color"] { padding: 3px; height: 40px; }
textarea { min-height: 76px; resize: vertical; }
label { display: grid; gap: 6px; font-size: 12px; color: var(--ink-2); font-weight: 600; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-2); background: var(--panel); border-radius: var(--radius-sm); padding: 8px 14px; cursor: pointer; font-weight: 650; white-space: nowrap; text-decoration: none; color: var(--ink); box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s, transform .1s, box-shadow .15s; }
.btn:hover { border-color: var(--muted); background: var(--panel-2); }
.btn:active:not(:disabled):not([aria-busy="true"]) { transform: scale(.97); transition-duration: var(--t-press); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--brand-ring); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
/* Busy is not disabled: full strength, a spinner and the verb ("Saving..."). */
.btn[aria-busy="true"], .btn[aria-busy="true"]:disabled { opacity: 1; cursor: progress; }
.btn.primary { background: var(--grad-strong); border-color: transparent; color: #fff; box-shadow: 0 4px 14px -4px rgba(80, 70, 229, .55); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); background: var(--bad-soft); }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 8px; }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--bg-2); }

/* app shell */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow: auto; display: flex; flex-direction: column; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -.02em; padding: 4px 10px 18px; }
.logo span { background: var(--grad); color: #fff; border-radius: 9px; width: 30px; height: 30px; display: grid; place-items: center; font-size: 13px; font-weight: 800; box-shadow: 0 4px 12px -3px rgba(80, 70, 229, .6); }
.nav { flex: 1; }
.nav a { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; margin: 1px 0; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-weight: 550; transition: background .15s, color .15s; }
.nav a > span:first-child { display: flex; align-items: center; gap: 10px; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .75; }
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.nav a.active svg { opacity: 1; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); }
.nav .count { background: var(--bad); color: #fff; border-radius: 99px; font-size: 11px; line-height: 18px; min-width: 18px; padding: 0 6px; text-align: center; font-weight: 700; }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); padding: 16px 10px 6px; font-weight: 700; }
.me-card { border-top: 1px solid var(--line); margin-top: 12px; padding: 14px 6px 0; display: grid; gap: 10px; }
.me-card > div:first-child { display: flex; align-items: center; gap: 10px; }
.me-card .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.me-card .name { font-weight: 700; }
.me-card .row .btn { flex: 1; }
/* Full-width buttons wrap their words instead of pushing out of the card (longer labels in Spanish). */
.btn.big { white-space: normal; text-align: center; }
.card h3 > a.small { white-space: nowrap; }
.me-card .lang-row { justify-content: space-between; align-items: center; flex-wrap: nowrap; }

main { padding: 26px 32px 64px; min-width: 0; max-width: 1440px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.top .sub { color: var(--muted); margin-top: 4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card > h3 { margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card > h3 a { font-weight: 600; text-decoration: none; }
.card > h3 a:hover { text-decoration: underline; }
.empty { color: var(--muted); padding: 20px 16px; text-align: center; border-radius: var(--radius-sm); background: var(--panel-2); }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { position: relative; overflow: hidden; padding: 16px 18px; }
.kpi::after { content: ""; position: absolute; right: -24px; top: -24px; width: 80px; height: 80px; border-radius: 50%; background: var(--brand-soft); opacity: .7; }
.kpi .v { position: relative; z-index: 1; font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .l { position: relative; z-index: 1; color: var(--muted); font-size: 12px; font-weight: 600; margin-top: 4px; }
.kpi.alert .v { color: var(--bad); }
.kpi.alert::after { background: var(--bad-soft); }

/* tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--panel-2); }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* pills and dots */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; background: var(--bg-2); color: var(--ink-2); text-transform: capitalize; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 7px; vertical-align: middle; }

/* lists */
.list { display: grid; gap: 8px; }
.item { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); transition: border-color .15s, box-shadow .15s; }
.item:hover { border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.item .t { font-weight: 650; }

/* schedule */
.sched { min-width: 780px; border-collapse: separate; border-spacing: 0; }
.sched th, .sched td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.sched tr > *:last-child { border-right: 0; }
.sched thead th { background: var(--panel-2); padding: 10px; }
.sched td { height: 70px; padding: 5px; cursor: pointer; vertical-align: top; }
.sched td:hover { background: var(--brand-soft); }
.sched th.today { color: var(--brand); box-shadow: inset 0 -2px 0 var(--brand); }
/* Tinted chip with ink text and a role-colour edge: readable (AA) in both themes, whatever colour a role has. */
.shift { --c: var(--brand); border-radius: 8px; padding: 4px 8px; font-size: 11.5px; font-weight: 700; color: var(--ink); margin-bottom: 4px; background: var(--bg-2); background: color-mix(in srgb, var(--c) 16%, var(--panel)); border-left: 3px solid var(--c); }

/* kanban */
.kanban { display: grid; grid-template-columns: repeat(3, minmax(240px, 1fr)); gap: 14px; overflow-x: auto; align-items: start; }
.lane { background: var(--bg-2); border-radius: var(--radius); padding: 12px; min-height: 240px; border: 1px solid transparent; transition: border-color .15s, background .15s; }
.lane h4 { margin: 2px 4px 12px; font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .08em; }
.task { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 9px; cursor: grab; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s; }
.task:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.task.overdue { border-left: 3px solid var(--bad); }
.lane.drop { border-color: var(--brand); background: var(--brand-soft); }

/* staff time-clock keypad */
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 300px; margin: 0 auto; }
.keypad button { font-size: 22px; font-weight: 700; padding: 15px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; box-shadow: var(--shadow-sm); transition: background .1s, transform .1s; }
.keypad button:hover { background: var(--bg-2); }
.keypad button:active { background: var(--brand-soft); transform: scale(.97); }
.keypad button[data-k="→"] { background: var(--grad-strong); color: #fff; border-color: transparent; }
.pin-display { text-align: center; font-size: 30px; letter-spacing: 14px; height: 48px; font-weight: 800; }
.clock-now { text-align: center; font-size: 44px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

/* arrivals map */
#map { height: 480px; border-radius: var(--radius-sm); border: 1px solid var(--line); overflow: hidden; z-index: 0; }
.help-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 13px; display: grid; gap: 6px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.help-item:hover { border-color: var(--line-2); }
.help-item.sel { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }

/* modal + toasts */
.modal-bg { position: fixed; inset: 0; background: rgba(12, 14, 25, .45); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 1000; padding: 16px; animation: fade .15s ease-out; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px; width: min(540px, 100%); max-height: 90vh; overflow: auto; display: grid; gap: 14px; box-shadow: var(--shadow-lg); animation: rise .18s ease-out; }
.modal h3 { font-size: 18px; }
.modal .fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal .fields .full { grid-column: 1 / -1; }
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 1100; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 12px; background: var(--toast-bg); color: var(--toast-ink); padding: 12px 8px 12px 14px; border-radius: 12px; box-shadow: var(--shadow-lg); animation: rise var(--t-base) var(--ease-out); transition: opacity var(--t-fast), transform var(--t-fast); }
.toast .tx { flex: 1; min-width: 0; padding-top: 2px; }
.toast .tx b { display: block; font-weight: 700; }
.toast .tx span { display: block; color: var(--toast-muted); font-size: 13px; overflow-wrap: anywhere; }
.toast .ic { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px; background: rgba(255, 255, 255, .14); }
.toast .ic svg { width: 14px; height: 14px; }
.toast.ok .ic { background: #059669; color: #fff; }
.toast.bad .ic { background: #e11d48; color: #fff; }
.toast-act { flex: none; border: 0; background: transparent; color: #c9c5ff; font: inherit; font-weight: 750; padding: 2px 12px; min-height: 32px; border-radius: 8px; cursor: pointer; }
.toast-act:hover { background: rgba(255, 255, 255, .08); }
.toast-x { flex: none; border: 0; background: transparent; color: var(--toast-muted); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 18px; line-height: 1; }
.toast-x:hover { color: var(--toast-ink); background: rgba(255, 255, 255, .08); }
.toast.leaving { opacity: 0; transform: translateY(6px); pointer-events: none; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

.bell { position: relative; }
.bell svg { width: 18px; height: 18px; }
.bell .count { position: absolute; top: -6px; right: -6px; background: var(--bad); color: #fff; border-radius: 99px; font-size: 10px; line-height: 16px; min-width: 16px; padding: 0 4px; font-weight: 700; }
.notif-panel { position: absolute; right: 32px; top: 72px; width: min(400px, calc(100vw - 32px)); max-height: 70vh; overflow: auto; z-index: 900; box-shadow: var(--shadow-lg); }

/* "Powered by iqflows" badge (customer page, kiosk, embeds) */
.powered { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); text-decoration: none; font-weight: 600; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel); }
.powered:hover { color: var(--ink); border-color: var(--line-2); }
.powered b { background: var(--grad); color: #fff; border-radius: 4px; font-size: 9px; padding: 2px 3px; line-height: 1; }

.menu-btn { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 84vw); z-index: 950; transform: translateX(-100%); transition: transform .22s ease; }
  .side.open { transform: none; box-shadow: var(--shadow-lg); }
  .menu-btn { display: inline-flex; }
  main { padding: 16px 16px 64px; }
  .modal .fields { grid-template-columns: 1fr; }
  .notif-panel { right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  /* Nothing moves or pulses: a busy button keeps its still spinner and its words ("Saving..."), skeletons sit still. */
  .sk::after { display: none; }
}

/* ---------- MapLibre maps (maps.js) ---------- */
.maplibregl-map { font: inherit; border-radius: inherit; }
.maplibregl-ctrl-group { border-radius: 10px !important; box-shadow: var(--shadow) !important; overflow: hidden; }
.iqmap-ctl { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.iqmap-seg { display: inline-flex; background: rgba(255,255,255,.95); border-radius: 10px; padding: 3px; box-shadow: var(--shadow); }
.iqmap-seg button, .iqmap-btn { font: 700 12px var(--font); border: 0; cursor: pointer; color: #3b4060; background: transparent; padding: 6px 11px; border-radius: 8px; }
.iqmap-seg button[aria-pressed="true"] { background: var(--grad); color: #fff; }
.iqmap-btn { background: rgba(255,255,255,.95); box-shadow: var(--shadow); display: inline-flex; align-items: center; min-height: 31px; }
.iqmap-btn[aria-pressed="true"] { background: var(--grad); color: #fff; }
.maplibregl-ctrl-attrib { font-size: 10px; }

/* business pin */
.iqm-biz { display: flex; align-items: center; gap: 5px; background: var(--grad); color: #fff; font: 800 12px var(--font); padding: 6px 10px; border-radius: 10px; box-shadow: 0 6px 16px -4px rgba(80,70,229,.7); white-space: nowrap; position: relative; margin-bottom: 8px; }
.iqm-biz::after { content: ""; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); border: 6px solid transparent; border-top-color: #6b3fe8; border-bottom: 0; }

/* live people: dot, heading arrow, name label */
.iqm-pin { position: relative; width: 18px; height: 18px; cursor: pointer; --c: #e11d48; }
.iqm-pin.iqm-me { --c: #2563eb; cursor: default; }
.iqm-pin.stale { --c: #9ca3af; }
.iqm-dot { position: absolute; inset: 0; border-radius: 50%; background: var(--c); border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); z-index: 2; }
.iqm-arrow { position: absolute; left: 50%; top: 50%; width: 0; height: 0; z-index: 1; transition: transform .4s ease; }
.iqm-arrow::before { content: ""; position: absolute; left: -9px; top: -24px; border-left: 9px solid transparent; border-right: 9px solid transparent; border-bottom: 16px solid var(--c); filter: drop-shadow(0 1px 2px rgba(0,0,0,.3)); opacity: .9; }
.iqm-label { position: absolute; left: 50%; top: 24px; transform: translateX(-50%); background: #fff; color: #101326; font: 700 11.5px var(--font); padding: 3px 8px; border-radius: 99px; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.25); border: 2px solid var(--c); }
.iqm-pin.selected { z-index: 5; }
.iqm-pin.selected .iqm-dot { box-shadow: 0 0 0 4px rgba(255,255,255,.9), 0 0 0 7px var(--c); }
.iqm-pin.selected .iqm-label { background: var(--c); color: #fff; }

/* ---------- Find-us route editor (staff) ---------- */
.route-grid { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
.route-list { display: grid; gap: 12px; }
.route-step { display: grid; grid-template-columns: 34px 160px minmax(0, 1fr); gap: 14px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
.route-step img { width: 160px; height: 120px; object-fit: cover; border-radius: 10px; background: var(--bg-2); }
.route-step .route-body { display: grid; gap: 8px; }
.route-num { width: 30px; height: 30px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 800; }
@media (max-width: 900px) {
  #routeGrid { grid-template-columns: 1fr !important; }
  .route-step { grid-template-columns: 30px minmax(0, 1fr); }
  .route-step img { grid-column: 2; width: 100%; height: 180px; }
  .route-step .route-body { grid-column: 2; }
}

/* ---------- Find-us route viewer (customers): full-screen swipeable photos ---------- */
.rv { position: fixed; inset: 0; z-index: 2000; background: #0b0d1c; color: #fff; display: grid; grid-template-rows: auto 1fr auto; animation: fade .15s ease-out; }
.rv-top { display: flex; justify-content: space-between; align-items: center; padding: max(14px, env(safe-area-inset-top)) 16px 10px; gap: 12px; }
.rv-top b { font-size: 15px; }
.rv-close { width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 22px; cursor: pointer; }
.rv-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.rv-track::-webkit-scrollbar { display: none; }
.rv-slide { flex: 0 0 100%; scroll-snap-align: center; display: grid; grid-template-rows: minmax(0, 1fr) auto; padding: 0 12px; gap: 12px; min-height: 0; }
.rv-slide img { width: 100%; height: 100%; object-fit: contain; border-radius: 14px; background: #000; min-height: 0; }
.rv-cap { display: flex; gap: 12px; align-items: flex-start; font-size: 17px; font-weight: 600; line-height: 1.4; padding: 0 4px; }
.rv-cap .n { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.rv-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px max(16px, env(safe-area-inset-bottom)); }
.rv-dots { display: flex; gap: 6px; }
.rv-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.35); transition: width .2s, background .2s; }
.rv-dots i.on { width: 20px; border-radius: 4px; background: #fff; }
.rv-nav { min-width: 92px; padding: 11px 14px; border-radius: 12px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.1); color: #fff; font: 700 14px var(--font); cursor: pointer; }
.rv-nav.primary { background: var(--grad); border-color: transparent; }
.rv-nav:disabled { opacity: .35; }

/* ---------- Phones and tablets: fingers, the on-screen keyboard and the notch ---------- */
@media (max-width: 900px), (pointer: coarse) {
  /* 16px keeps iPhones from zooming the page when a field takes focus */
  input, select, textarea { font-size: 16px !important; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="file"]), select { min-height: 44px; }
  input[type="checkbox"] { width: 22px !important; height: 22px; flex: none; }
  input[type="color"] { height: 44px; }
  .btn, .btn.sm { min-height: 44px; }
  .btn.icon, .menu-btn, .bell { min-width: 44px; }
  .item > .btn { flex: none; }
  .btn.sm { padding: 8px 12px; font-size: 13px; }
  .nav a { min-height: 44px; }
  .iqmap-seg button, .iqmap-btn { min-height: 44px; min-width: 44px; }
  .maplibregl-ctrl-group button { width: 44px !important; height: 44px !important; }
  /* the small "See all" links in card titles: a finger-sized target without making the title taller */
  .card > h3 a.small { display: inline-flex; align-items: center; min-height: 44px; margin: -14px 0; }
  .rv-close { width: 44px; height: 44px; }
  .toast-act, .toast-x { min-height: 44px; min-width: 44px; margin: -6px 0; }
  .powered { min-height: 44px; }
  .rv-nav { min-height: 44px; }
  th, .nav-group { font-size: 11px; }
  .bell .count, .nav .count { font-size: 11px; }
}
@media (max-width: 900px) {
  /* The page clears the notch and the home bar when it runs full screen from the home screen */
  main { padding: calc(16px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) calc(64px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left)); }
  .side { padding-top: calc(18px + env(safe-area-inset-top)); padding-bottom: calc(18px + env(safe-area-inset-bottom)); padding-left: calc(12px + env(safe-area-inset-left)); }
  .toasts { right: calc(16px + env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom)); }
  .modal-bg { padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)); }
  .modal { max-height: 100%; padding: 18px; }
  /* The header's actions take their own line, so a long title or a Spanish label never pushes them off the screen */
  /* The bell stays in the title row; the page's own buttons get the line under it */
  .top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; margin-bottom: 16px; }
  .top > .row { min-width: 0; max-width: 100%; }
  .top > .row:first-child { flex-wrap: nowrap; align-items: flex-start; }
  .top > .row:last-child { display: contents; }
  #bellBtn { grid-column: 2; grid-row: 1; align-self: start; }
  #actions { grid-column: 1 / -1; grid-row: 2; min-width: 0; }
  #actions:empty { display: none; }
  #actions select { flex: 1 1 140px; width: auto; min-width: 0; }
  /* In the page flow, under the header: floating, it covered the bell that closes it */
  .notif-panel { position: static; width: auto; max-height: none; margin-bottom: 16px; box-shadow: var(--shadow); }
  .btn { white-space: normal; text-align: center; }
  .grid > *, label { min-width: 0; }
  /* Safari sizes a select by its longest option: keep it inside its label */
  label { grid-template-columns: minmax(0, 1fr); }
  select { min-width: 0; max-width: 100%; }
}
/* Big iPhones in landscape get the desktop layout: keep the sidebar, the page and toasts clear of the camera cutout (env() is 0 elsewhere) */
@media (min-width: 901px) {
  .side { padding-left: calc(12px + env(safe-area-inset-left)); }
  main { padding-right: calc(32px + env(safe-area-inset-right)); }
  .toasts { right: calc(18px + env(safe-area-inset-right)); }
}
@media (max-width: 600px) {
  /* to-do lanes stack on phones; a card changes lane from its edit dialog */
  .kanban { grid-template-columns: 1fr; overflow-x: visible; }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .v { font-size: 26px; }
}

/* ---------- Delight (Nov 20): spinner, skeletons, empty states, the week on a phone, getting started, celebration ---------- */
.spin { width: 15px; height: 15px; flex: none; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pop { animation: pop var(--t-base) var(--ease-out); }
@keyframes pop { from { opacity: 0; transform: scale(.6); } }
.enter { animation: rise var(--t-base) var(--ease-out); }

/* Skeleton blocks: the sweep is a moving pseudo-element (transform), never an animated background. */
.sk { position: relative; overflow: hidden; background: var(--sk); border-radius: 8px; }
.sk::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, var(--sk-sweep), transparent); animation: sweep 1.4s ease-in-out infinite; }
@keyframes sweep { to { transform: translateX(100%); } }
.sk-title { width: 180px; height: 24px; }
.sk-sub { width: 130px; height: 12px; margin-top: 8px; }
.sk-v { width: 44px; height: 28px; }
.sk-l { width: 70%; height: 10px; margin-top: 10px; }
.sk-h { width: 45%; height: 14px; margin-bottom: 16px; }
.sk-row { height: 52px; border-radius: var(--radius-sm); margin-top: 8px; }

/* Empty state: what this place is for, what to do, one button. */
.empty-state { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 32px 16px; }
.empty-state .es-ic { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: 4px; }
.empty-state .es-ic svg { width: 24px; height: 24px; }
.empty-state b { font-size: 16px; color: var(--ink); }
.empty-state p { margin: 0 0 8px; color: var(--muted); max-width: 32em; }

/* Inline form error in a dialog, next to the button that failed. */
.form-err { color: var(--bad); background: var(--bad-soft); border-radius: var(--radius-sm); padding: 8px 12px; font-weight: 600; font-size: 13px; animation: rise var(--t-base) var(--ease-out); }

/* The week on a phone: one block per day instead of a sideways table. */
.week-sum { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: 13px; margin: 0 4px 16px; }
.week-sum b { color: var(--ink); font-variant-numeric: tabular-nums; }
.week-list { display: grid; gap: 12px; }
.day-block { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow-sm); }
.day-block.today { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.day-block > header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 4px 8px; }
.day-block > header b { font-size: 15px; }
.day-block > header span { color: var(--muted); font-size: 12px; }
.shift-row { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; width: 100%; min-height: 48px; padding: 8px 12px 8px 8px; margin: 0 0 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: transform var(--t-press) var(--ease-out); }
button.shift-row:active { transform: scale(.98); }
.shift-row i { grid-row: span 2; align-self: stretch; border-radius: 4px; background: var(--c, var(--brand)); }
.shift-row b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shift-row .tm { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.shift-row .rl { color: var(--muted); font-size: 12px; grid-column: 2 / -1; }
.day-block .off { color: var(--muted); padding: 4px 4px 8px; }
.day-block .add-shift { width: 100%; justify-content: flex-start; color: var(--brand); border-style: dashed; box-shadow: none; background: transparent; }

/* To-dos: a circle to tick done (44 px to tap, 22 px to see) */
.task-top { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; }
.task-t { font-weight: 600; padding-top: 2px; min-width: 0; overflow-wrap: anywhere; }
.task.is-done .task-t { text-decoration: line-through; color: var(--muted); }
.task-ck { flex: none; width: 44px; height: 44px; margin: -11px -11px -11px 0; display: grid; place-items: center; border: 0; background: transparent; cursor: pointer; border-radius: 50%; color: #fff; }
.task-ck span { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; transition: transform var(--t-press) var(--ease-out); }
.task-ck:hover span { border-color: var(--ok); }
.task-ck:active span { transform: scale(.9); }
.task-ck[aria-pressed="true"] span { background: var(--ok); border-color: var(--ok); }
.task-ck svg { width: 13px; height: 13px; }
.shift .nw { white-space: nowrap; }
.lane-empty { color: var(--muted); font-size: 13px; padding: 12px 8px; text-align: center; }

/* Getting started (a new install): four steps, any order. */
.start-card { margin-bottom: 16px; }
.start-card .st-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.start-card .st-head h3 { font-size: 17px; }
.start-card .st-head p { margin: 4px 0 0; color: var(--muted); }
.start-card .st-bar { height: 6px; border-radius: 99px; background: var(--bg-2); overflow: hidden; margin-bottom: 16px; }
.start-card .st-bar i { display: block; height: 100%; background: var(--grad-strong); transform-origin: left; transition: transform 300ms var(--ease-out); }
.start-list { display: grid; gap: 8px; }
.start-step { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.start-step .ck { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; color: #fff; }
.start-step.done .ck { background: var(--ok); border-color: var(--ok); }
.start-step .ck svg { width: 14px; height: 14px; }
.start-step .tx b { display: block; font-weight: 650; }
.start-step.done .tx b { color: var(--muted); font-weight: 600; }
.start-step .tx span { display: block; color: var(--muted); font-size: 12px; }
@media (max-width: 480px) {
  /* on a phone the step's button sits under its words, so the words keep the width */
  .start-step { grid-template-columns: 24px minmax(0, 1fr); align-items: start; }
  .start-step .ck { margin-top: 2px; }
  .start-step > .btn, .start-step > .small { grid-column: 2; justify-self: start; }
}
/* tablets in portrait: the whole week fits without sliding sideways */
@media (min-width: 601px) and (max-width: 900px) {
  .sched { min-width: 700px; table-layout: fixed; }
  .sched th:first-child { width: 100px; }
  .sched thead th:last-child { width: 52px; }
  .sched thead th { padding: 10px 6px; font-size: 10px; letter-spacing: .04em; white-space: normal; }
  .sched td { padding: 4px 3px; }
  .sched .shift { padding: 4px 4px 4px 5px; font-size: 10.5px; }
}

/* The one moment of celebration: a card that rises and a check that pops. It never blocks a tap behind it. */
.cheer { position: fixed; left: 0; right: 0; bottom: calc(88px + env(safe-area-inset-bottom)); z-index: 1200; display: grid; justify-items: center; padding: 0 16px; pointer-events: none; }
.cheer-card { pointer-events: auto; width: min(380px, 100%); display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-radius: 16px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: cheer-in 320ms var(--ease-out); transition: opacity 200ms, transform 200ms; cursor: pointer; }
.cheer-card.leaving { opacity: 0; transform: translateY(8px); }
.cheer-card .ck { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--grad-strong); color: #fff; animation: pop 280ms var(--ease-out) 60ms both; }
.cheer-card .ck svg { width: 22px; height: 22px; }
.cheer-card b { display: block; font-size: 16px; }
.cheer-card span { display: block; color: var(--muted); font-size: 13px; }
@keyframes cheer-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@media (prefers-color-scheme: dark) {
  .kpi::after { opacity: .4; }
  .btn.primary { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cheer-card .ck { animation: none !important; }
}

/* ---------- The week as a team uses it (Nov 23): requests, send and print, time off, the next shift ---------- */
.req-card { margin-bottom: 14px; border-color: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.req-card h3 { margin-bottom: 10px; }
.item.req { flex-wrap: wrap; }
.item.req .t b { font-weight: 700; }
.req-acts { gap: 8px; flex-wrap: nowrap; margin-left: auto; }
.week-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 14px; }
.week-tools .small { flex: 1 1 220px; }
.off-chip { border-radius: 8px; padding: 3px 8px; font-size: 11px; font-weight: 700; margin-bottom: 4px; color: var(--ink-2); background: repeating-linear-gradient(135deg, var(--bg-2) 0 6px, var(--panel-2) 6px 12px); border: 1px dashed var(--line-2); }
.off-chip.pending { color: var(--muted); font-weight: 600; }
.off-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; min-height: 40px; padding: 6px 12px; margin: 0 0 8px; border: 1px dashed var(--line-2); border-radius: var(--radius-sm); background: repeating-linear-gradient(135deg, var(--bg-2) 0 6px, var(--panel-2) 6px 12px); }
.off-row span { color: var(--ink-2); font-size: 12px; font-weight: 700; }
.off-row.pending span { color: var(--muted); font-weight: 600; }
.shift.conflict, .shift-row.conflict { border-left-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
.shift-row.conflict .rl, .shift.conflict .flag { color: var(--bad); font-weight: 700; }
.shift-row.asked, .shift.asked { border-style: dashed; }
.shift-row.asked .rl, .shift.asked .flag { color: var(--warn); font-weight: 700; }
.shift .flag { display: block; font-size: 10.5px; }
/* open shifts: sent by an event plan, nobody on them yet */
.open-row th, .open-row td { background: var(--bg-2); }
.shift.open, .shift-row.open { border-style: dashed; border-width: 1px 1px 1px 3px; border-color: var(--line-2); border-left-color: var(--c); background: var(--panel); cursor: pointer; }
.shift-row.open b { color: var(--ink-2); }
/* staff sheets: one printed sheet per person */
#print-sheets { display: none; }
.slip { border: 1px dashed #888; border-radius: 10px; padding: 14px 16px; margin: 0 0 14px; break-inside: avoid; page-break-inside: avoid; color: #000; background: #fff; font-size: 13px; }
.slip header { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; border-bottom: 1px solid #ccc; padding-bottom: 6px; margin-bottom: 6px; }
.slip header b { font-size: 17px; }
.slip ul { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 6px; }
.slip li { display: grid; grid-template-columns: minmax(150px, max-content) max-content 1fr; gap: 2px 14px; }
.slip li .small { grid-column: 1 / -1; color: #333; }
.slip .tm { font-weight: 700; font-variant-numeric: tabular-nums; }
.next-shift { margin-bottom: 16px; display: grid; gap: 4px; border-left: 4px solid var(--c, var(--brand)); }
.next-shift .ns-k { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.next-shift b { font-size: 20px; letter-spacing: -.01em; }
.next-shift .row { margin-top: 10px; gap: 8px; }
@media (max-width: 480px) {
  .req-acts { width: 100%; justify-content: flex-end; }
  .week-tools > .btn { flex: 1 1 auto; }
}
/* No connection: one calm bar under the header saying what is shown and what waits on the device. */
.net-bar { display: grid; gap: 2px; margin: 0 0 14px; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--panel-2); font-size: 13px; }
.net-bar[hidden] { display: none; }
.net-bar b { font-weight: 700; }
.net-bar span { color: var(--ink-2); }
.net-bar.off { border-color: var(--warn); background: var(--warn-soft); }
.net-bar.off b { color: var(--warn); }

/* Printing the week for the wall: just the schedule, black on white. */
@media print {
  .side, .menu-btn, #bellBtn, #actions, #notifPanel, #netBar, .toasts, .cheer, .week-tools, .req-card, .start-card, .add-shift, .sched + p { display: none !important; }
  .app { display: block; }
  body, main, .card, .day-block, .shift-row { background: #fff !important; color: #000 !important; box-shadow: none !important; }
  main { padding: 0 !important; max-width: none; }
  .table-wrap { overflow: visible !important; }
  .sched { min-width: 0 !important; width: 100%; font-size: 11px; }
  .sched td { height: auto; }
  .day-block { break-inside: avoid; }
  body.printing-sheets > *:not(#print-sheets) { display: none !important; }
  body.printing-sheets #print-sheets { display: block; }
}
