/* ============================================================
   Drivesy — estética iOS minimalista
   Fondo blanco · header negro · botones negros con texto blanco
   ============================================================ */
:root {
  --bg: #ffffff;
  --surface: #f5f5f7;
  --surface-2: #ebebf0;
  --card: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --faint: #a1a1a6;
  --line: rgba(0, 0, 0, .08);
  --line-strong: rgba(0, 0, 0, .14);
  --black: #000000;
  --white: #ffffff;
  --green: #34c759;
  --green-bg: #e3f7e8;
  --green-ink: #1a7f37;
  --yellow: #ffcc00;
  --yellow-bg: #fff6cc;
  --yellow-ink: #8a6d00;
  --red: #ff3b30;
  --red-bg: #ffe5e3;
  --red-ink: #c4271d;
  --blue: #0a84ff;
  --blue-bg: #e1efff;
  --blue-ink: #0060c7;
  --orange: #ff9500;
  --orange-bg: #fff0db;
  --orange-ink: #a85f00;
  --gray-bg: #eeeef1;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.18);
  --header-h: 56px;
  --header-gap: 10px;
  --header-total: calc(var(--header-h) + var(--header-gap) * 2 + env(safe-area-inset-top, 0px));
  --brand: #000000;
  --brand-accent: #0a84ff;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --gutter: 16px;
}
@media (min-width: 768px) { :root { --gutter: 28px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img { max-width: 100%; display: block; }
/* tamaño por defecto de los iconos: cualquier SVG sin tamaño propio mide 20px
   (especificidad 0 para que las reglas con clase lo sobrescriban) */
:where(svg:not([width])) { width: 20px; height: 20px; flex: none; vertical-align: middle; }
:where(.segmented button svg, .badge svg) { width: 15px; height: 15px; }
.group-item > svg { color: var(--text); }
.chev { display: inline-flex; }
.chev svg { width: 16px; height: 16px; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.02em; line-height: 1.15; }
p { margin: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.bold { font-weight: 600; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 22px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1; }

/* ---------------------------------------------------------------- header */
.header {
  position: sticky; z-index: 50; top: calc(var(--header-gap) + env(safe-area-inset-top, 0px));
  margin: calc(var(--header-gap) + env(safe-area-inset-top, 0px)) var(--header-gap) var(--header-gap);
  height: var(--header-h); border-radius: 18px;
  background: rgba(18,18,20,.55); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: .5px solid rgba(255,255,255,.14); box-shadow: 0 8px 28px rgba(0,0,0,.12);
  color: #fff; display: flex; align-items: center; gap: 8px; padding: 0 10px 0 16px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; font-weight: 700; font-size: 17px; letter-spacing: -0.02em; min-width: 0; }
.brand-mark { width: 30px; height: 30px; flex: none; border-radius: 8px; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header .spacer { flex: 1; }
.header-cta { border: .5px solid rgba(255,255,255,.22) !important; }
.hdr-btn { height: 34px; min-width: 34px; padding: 0 10px; border-radius: 999px; border: .5px solid rgba(255,255,255,.22); background: transparent; color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .04em; cursor: pointer; flex: none; transition: background .15s; }
.hdr-btn.icon { padding: 0; width: 34px; }
.hdr-btn:hover { background: rgba(255,255,255,.12); }
.hdr-btn svg { width: 17px; height: 17px; }
@media (max-width: 480px) { .hdr-btn span { display: none; } .hdr-btn { width: 34px; padding: 0; } .header { gap: 6px; } }
.header-cta .short { display: none; }
@media (max-width: 560px) { .header-cta .long { display: none; } .header-cta .short { display: inline; } }
.avatar-btn { border: 0; background: transparent; padding: 0; cursor: pointer; border-radius: 50%; }
.header-link { color: rgba(255,255,255,.8); text-decoration: none; font-size: 14px; font-weight: 500; padding: 8px 4px; white-space: nowrap; }
.header-link:hover { color: #fff; }
@media (max-width: 480px) { .header-link.hide-sm { display: none; } }

/* ---------------------------------------------------------------- botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--black); color: var(--white); font-weight: 600; font-size: 15px;
  text-decoration: none; white-space: nowrap; transition: transform .12s ease, opacity .15s ease, background .15s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.btn.sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn.lg { height: 52px; padding: 0 28px; font-size: 16px; }
.btn.block { width: 100%; }
.btn.light { background: var(--surface); color: var(--text); }
.btn.light:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; color: var(--text); }
.btn.ghost:hover { background: var(--surface); }
.btn.outline { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn.danger { background: var(--red-bg); color: var(--red-ink); }
.btn.success { background: var(--green); color: #fff; }
.btn.brand { background: var(--brand); color: #fff; }
.btn.icon { width: 40px; height: 40px; padding: 0; }
.btn.icon.sm { width: 32px; height: 32px; }
.btn svg { width: 18px; height: 18px; flex: none; }
.link-btn { background: none; border: 0; padding: 0; color: var(--blue); font-weight: 500; cursor: pointer; text-decoration: none; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--red); }

/* ---------------------------------------------------------------- formularios */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: 12px; border: 1px solid transparent;
  background: var(--surface); outline: none; transition: border-color .15s, background .15s, box-shadow .15s; font-size: 16px;
}
.input:focus, .select:focus, .textarea:focus { background: #fff; border-color: var(--black); box-shadow: 0 0 0 3px rgba(0,0,0,.06); }
.textarea { min-height: 110px; resize: vertical; }
.select { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236e6e73' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
.input.code { text-transform: uppercase; letter-spacing: .12em; font-weight: 600; text-align: center; font-size: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .form-grid.two { grid-template-columns: 1fr 1fr; } }
.error-text { color: var(--red-ink); font-size: 13px; font-weight: 500; min-height: 0; }
.color-input { width: 46px; height: 46px; border: 0; border-radius: 12px; padding: 0; background: none; cursor: pointer; }
.color-input::-webkit-color-swatch-wrapper { padding: 0; }
.color-input::-webkit-color-swatch { border: 1px solid var(--line-strong); border-radius: 12px; }

/* segmented control iOS */
.segmented { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 2px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; color: var(--text); white-space: nowrap; transition: background .15s, box-shadow .15s; flex: 1;
}
.segmented button.active { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 1px rgba(0,0,0,.04); }
.segmented.block { display: flex; width: 100%; }
.segmented.dark { background: #1c1c1e; }
.segmented.dark button { color: #fff; }
.segmented.dark button.active { background: #3a3a3c; }

/* ---------------------------------------------------------------- layout */
.app { min-height: calc(100vh - var(--header-total)); min-height: calc(100dvh - var(--header-total)); }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 24px var(--gutter) 48px; }
.container.narrow { max-width: 560px; }
.container.mid { max-width: 820px; }
.page-title { font-size: 30px; font-weight: 800; }
@media (min-width: 768px) { .page-title { font-size: 36px; } }
.section-title { font-size: 20px; font-weight: 700; }
.eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; border: 1px solid var(--line); }
.card.flat { box-shadow: none; }
.card.pad-lg { padding: 24px; }
.card-title { font-size: 17px; font-weight: 700; }
.group { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }
.group-item { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); min-height: 56px; }
.group-item:last-child { border-bottom: 0; }
.group-item.clickable { cursor: pointer; }
.group-item.clickable:hover { background: var(--surface); }
.chev { color: var(--faint); flex: none; }

.grid { display: grid; gap: 16px; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); gap: 12px; }
.grid.two { grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid.two { grid-template-columns: 1fr 1fr; } }

.stat { background: var(--surface); border-radius: var(--radius); padding: 16px; }
.stat .num { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; }
.stat .lbl { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat.warn { background: var(--red-bg); }
.stat.warn .num { color: var(--red-ink); }
.stat.pend { background: var(--yellow-bg); }
.stat.pend .num { color: var(--yellow-ink); }

/* badges & chips */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--gray-bg); color: var(--muted); white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: none; }
.badge.dot::before { display: block; }
.badge.green { background: var(--green-bg); color: var(--green-ink); }
.badge.yellow { background: var(--yellow-bg); color: var(--yellow-ink); }
.badge.red { background: var(--red-bg); color: var(--red-ink); }
.badge.blue { background: var(--blue-bg); color: var(--blue-ink); }
.badge.orange { background: var(--orange-bg); color: var(--orange-ink); }
.badge.black { background: #000; color: #fff; }
.count-pill { min-width: 20px; height: 20px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }

/* avatar */
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex: none; overflow: hidden; object-fit: cover; }
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
.avatar.xs { width: 26px; height: 26px; font-size: 11px; }
.avatar.lg { width: 88px; height: 88px; font-size: 30px; }
.avatar.on-dark { background: #2c2c2e; color: #fff; }
.logo { width: 56px; height: 56px; border-radius: 14px; background: #fff; border: 1px solid var(--line); object-fit: contain; flex: none; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; overflow: hidden; }
.logo.sm { width: 40px; height: 40px; border-radius: 10px; font-size: 15px; }
.logo.lg { width: 96px; height: 96px; border-radius: 24px; font-size: 32px; }

/* ---------------------------------------------------------------- empty state (rueda frenando) */
.empty-hero { min-height: calc(100dvh - var(--header-total)); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px var(--gutter) 64px; gap: 22px; }
.empty-hero h1 { font-size: 26px; font-weight: 800; max-width: 520px; }
@media (min-width: 768px) { .empty-hero h1 { font-size: 32px; } }
.empty-hero p { color: var(--muted); max-width: 440px; }
.wheel-scene { width: min(300px, 70vw, 48vh); height: auto; overflow: visible; flex: none; }
.wheel-spin { transform-origin: 160px 120px; animation: brake 3.2s cubic-bezier(.12,.75,.25,1) infinite; }
.wheel-body { animation: nose 3.2s ease-out infinite; transform-origin: 160px 200px; }
.skid { stroke-dasharray: 140; stroke-dashoffset: 140; animation: skid 3.2s ease-out infinite; }
.speed-line { animation: speed 3.2s ease-out infinite; }
@keyframes brake { 0% { transform: rotate(0deg); } 70% { transform: rotate(1080deg); } 100% { transform: rotate(1080deg); } }
@keyframes nose { 0%, 50% { transform: translateX(0); } 62% { transform: translateX(6px) rotate(1deg); } 72%, 100% { transform: translateX(0) rotate(0); } }
@keyframes skid { 0%, 35% { stroke-dashoffset: 140; opacity: .9; } 70% { stroke-dashoffset: 0; opacity: .9; } 100% { stroke-dashoffset: 0; opacity: .25; } }
@keyframes speed { 0% { opacity: .9; transform: translateX(0); } 55% { opacity: 0; transform: translateX(-30px); } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .wheel-spin, .wheel-body, .skid, .speed-line { animation: none; } .skid { stroke-dashoffset: 0; } }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty svg { width: 44px; height: 44px; color: var(--faint); }

/* ---------------------------------------------------------------- listado global */
.hero-band { background: #000; color: #fff; padding: calc(var(--header-total) + 28px) var(--gutter) 44px; margin-top: calc(-1 * var(--header-total)); }
.hero-band .inner { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.hero-band h1 { font-size: 30px; font-weight: 800; }
@media (min-width: 768px) { .hero-band h1 { font-size: 44px; } }
.hero-band p { color: rgba(255,255,255,.7); max-width: 560px; }
.search { position: relative; max-width: 520px; }
.search input { background: #1c1c1e; color: #fff; border: 0; padding-left: 44px; }
.search input:focus { background: #2c2c2e; border-color: transparent; box-shadow: none; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: #8e8e93; }

.school-card { background: #fff; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); cursor: pointer; transition: transform .2s ease, box-shadow .2s ease; display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.school-card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(0,0,0,.12); }
.school-card .banner { aspect-ratio: 16/8; background: linear-gradient(135deg, #1c1c1e, #3a3a3c); position: relative; }
.school-card .banner img { width: 100%; height: 100%; object-fit: cover; }
.school-card .body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.school-card .logo { margin-top: -28px; position: relative; box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.school-card h3 { font-size: 18px; font-weight: 700; margin-top: 6px; }

/* ---------------------------------------------------------------- página de autoescuela */
.school-page { font-family: var(--school-font, var(--font)); }
.school-page h1, .school-page h2, .school-page h3, .school-page .heading-font { font-family: var(--school-heading, var(--school-font, var(--font))); }
.carousel { position: relative; aspect-ratio: 21/8; background: linear-gradient(135deg, #1c1c1e, #48484a); overflow: hidden; }
@media (max-width: 640px) { .carousel { aspect-ratio: 16/9; } }
.carousel .slide { position: absolute; inset: 0; opacity: 0; transition: opacity .6s ease; }
.carousel .slide.active { opacity: 1; }
.carousel .slide img { width: 100%; height: 100%; object-fit: cover; }
.carousel .dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.carousel .dots button { width: 7px; height: 7px; border-radius: 50%; border: 0; background: rgba(255,255,255,.5); padding: 0; cursor: pointer; }
.carousel .dots button.active { background: #fff; width: 18px; border-radius: 4px; }
.school-head { display: flex; gap: 16px; align-items: flex-end; margin-top: -44px; position: relative; flex-wrap: wrap; }
.school-head .logo { box-shadow: 0 6px 20px rgba(0,0,0,.15); border: 3px solid #fff; }
.school-head .title-wrap { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 50px; }
.school-head h1 { font-size: 28px; font-weight: 800; }
@media (min-width: 768px) { .school-head h1 { font-size: 34px; } }
.school-layout { display: grid; grid-template-columns: 1fr; gap: 28px; margin-top: 24px; }
@media (min-width: 960px) { .school-layout { grid-template-columns: minmax(0, 1fr) 340px; } }
.aside-sticky { position: sticky; top: calc(var(--header-total) + 16px); display: flex; flex-direction: column; gap: 16px; }
.map { position: relative; isolation: isolate; width: 100%; height: 260px; border-radius: var(--radius); overflow: hidden; background: var(--surface); z-index: 0; }
.map.tall { height: 340px; }

/* contenido enriquecido */
.rich { font-size: 16px; line-height: 1.65; overflow-wrap: anywhere; }
.rich::after { content: ''; display: block; clear: both; }
.rich h1 { font-size: 28px; margin: .8em 0 .4em; }
.rich h2 { font-size: 22px; margin: .8em 0 .4em; }
.rich h3 { font-size: 18px; margin: .8em 0 .3em; }
.rich p { margin: 0 0 .8em; }
.rich ul, .rich ol { margin: 0 0 .9em; padding-left: 1.4em; }
.rich li { margin: .2em 0; }
.rich blockquote { margin: 0 0 1em; padding: 6px 16px; border-left: 3px solid var(--brand); color: var(--muted); background: var(--surface); border-radius: 0 10px 10px 0; }
.rich mark { background: #fff59d; padding: 0 .1em; border-radius: 3px; }
.rich hr { border: 0; border-top: 1px solid var(--line-strong); margin: 1.2em 0; }
.rich a { color: var(--brand-accent); }
.rich table { border-collapse: collapse; width: 100%; margin-bottom: 1em; }
.rich td, .rich th { border: 1px solid var(--line-strong); padding: 6px 10px; }
.rt-img { margin: 8px auto 14px; display: block; position: relative; }
.rt-img img { width: 100%; border-radius: 12px; }
.rt-img figcaption { font-size: 13px; color: var(--muted); text-align: center; margin-top: 6px; }
.rt-img[data-size="s"] { width: 30%; }
.rt-img[data-size="m"] { width: 50%; }
.rt-img[data-size="l"] { width: 75%; }
.rt-img[data-size="xl"] { width: 100%; }
.rt-img[data-align="left"] { float: left; margin: 4px 18px 10px 0; }
.rt-img[data-align="right"] { float: right; margin: 4px 0 10px 18px; }
.rt-img[data-align="center"] { margin-left: auto; margin-right: auto; float: none; clear: both; }
@media (max-width: 560px) { .rt-img[data-size="s"] { width: 42%; } .rt-img[data-size="m"] { width: 60%; } }

/* ---------------------------------------------------------------- editor de texto enriquecido */
.rte { border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; display: flex; flex-direction: column; min-height: 0; }
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); background: #fbfbfd; border-radius: var(--radius) var(--radius) 0 0; position: sticky; top: 0; z-index: 3; }
.rte-toolbar .sep { width: 1px; background: var(--line-strong); margin: 4px 4px; }
.rte-toolbar button, .rte-toolbar label.tb { width: 34px; height: 34px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; color: var(--text); position: relative; flex: none; }
.rte-toolbar button:hover, .rte-toolbar label.tb:hover { background: var(--surface-2); }
.rte-toolbar button.on { background: #000; color: #fff; }
.rte-toolbar svg { width: 17px; height: 17px; }
.rte-toolbar select { height: 34px; border: 0; background: transparent; border-radius: 8px; padding: 0 6px; font-size: 13px; font-weight: 500; cursor: pointer; max-width: 130px; }
.rte-toolbar select:hover { background: var(--surface-2); }
.rte-toolbar input[type=color] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.rte-toolbar .swatch { position: absolute; bottom: 5px; left: 9px; right: 9px; height: 3px; border-radius: 2px; }
.rte-area { padding: 18px; min-height: 260px; outline: none; flex: 1; overflow-y: auto; }
.rte-area:empty::before { content: attr(data-placeholder); color: var(--faint); }
.rte-area .rt-img { cursor: grab; outline: 2px solid transparent; outline-offset: 2px; border-radius: 12px; user-select: none; }
.rte-area .rt-img:hover { outline-color: rgba(10,132,255,.35); }
.rte-area .rt-img.selected { outline-color: var(--blue); }
.rte-area .rt-img.dragging { opacity: .35; }
.rte-drop-line { height: 3px; background: var(--blue); border-radius: 2px; margin: 4px 0; pointer-events: none; }
.img-tools { position: absolute; z-index: 260; display: flex; gap: 2px; background: #1c1c1e; border-radius: 12px; padding: 4px; box-shadow: var(--shadow-lg); }
.img-tools button { height: 32px; min-width: 32px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: #fff; font-size: 12px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.img-tools button:hover, .img-tools button.on { background: #3a3a3c; }
.img-tools svg { width: 16px; height: 16px; }
.img-tools .sep { width: 1px; background: #48484a; margin: 4px 2px; }

.editor-shell { position: fixed; inset: 0; z-index: 200; background: #fff; display: flex; flex-direction: column; }
.editor-shell .bar { height: calc(56px + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) var(--gutter) 0; background: #000; color: #fff; display: flex; align-items: center; gap: 10px; flex: none; }
.editor-shell .bar .title { font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editor-shell .content { flex: 1; overflow: auto; padding: 16px var(--gutter) calc(24px + var(--safe-b)); }
.editor-shell .content .rte { max-width: 900px; margin: 0 auto; min-height: 100%; }
.editor-shell .preview-wrap { max-width: 900px; margin: 0 auto; }
.btn.on-dark { background: #fff; color: #000; }
.btn.on-dark-ghost { background: #2c2c2e; color: #fff; }

/* ---------------------------------------------------------------- personalizador (editor + vista previa) */
.customizer { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }
@media (min-width: 1100px) { .customizer { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.customizer .preview-frame { border-radius: var(--radius-lg); border: 1px solid var(--line-strong); overflow: hidden; background: #fff; box-shadow: var(--shadow); }
@media (min-width: 1100px) { .customizer .preview-pane { position: sticky; top: calc(var(--header-total) + 16px); max-height: calc(100dvh - var(--header-total) - 32px); overflow: auto; border-radius: var(--radius-lg); } }
.preview-frame .preview-chrome { height: 34px; background: #f2f2f4; display: flex; align-items: center; gap: 6px; padding: 0 12px; border-bottom: 1px solid var(--line); }
.preview-chrome i { width: 10px; height: 10px; border-radius: 50%; background: #d1d1d6; display: block; }
.preview-chrome span { font-size: 12px; color: var(--muted); margin-left: 8px; }
.customizer-switch { display: flex; }
@media (min-width: 1100px) { .customizer-switch { display: none; } }
@media (max-width: 1099px) { .customizer[data-show="editor"] .preview-pane { display: none; } .customizer[data-show="preview"] .editor-pane { display: none; } }
.banner-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.banner-thumb { position: relative; aspect-ratio: 16/8; border-radius: 12px; overflow: hidden; background: var(--surface); }
.banner-thumb img { width: 100%; height: 100%; object-fit: cover; }
.banner-thumb .tools { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; }
.banner-thumb .tools button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.banner-thumb .tools svg { width: 14px; height: 14px; }
.upload-tile { aspect-ratio: 16/8; border-radius: 12px; border: 1.5px dashed var(--line-strong); display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 4px; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 600; background: transparent; }
.upload-tile:hover { background: var(--surface); }
.logo-picker { display: flex; align-items: center; gap: 14px; }
.font-sample { font-size: 13px; color: var(--muted); }
.save-bar { position: sticky; bottom: 0; z-index: 10; padding: 12px 0 calc(12px + var(--safe-b)); background: linear-gradient(to top, #fff 70%, rgba(255,255,255,0)); display: flex; gap: 10px; justify-content: flex-end; align-items: center; }

/* ---------------------------------------------------------------- dashboard (sidebar / tabbar iOS) */
/* Tablet y ordenador: barra lateral plegable. Móvil (también en horizontal): barra flotante abajo */
.dash { display: grid; grid-template-columns: 1fr; min-height: calc(100dvh - var(--header-total)); }
.sidebar { display: none; }
.side-school { display: flex; align-items: center; gap: 10px; padding: 4px 4px 16px 8px; min-height: 60px; }
.side-school .name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.side-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--text); font-weight: 500; font-size: 15px; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; position: relative; white-space: nowrap; }
.side-item:hover { background: var(--surface-2); }
.side-item.active { background: #000; color: #fff; }
.side-item svg { width: 20px; height: 20px; flex: none; }
.side-item .count-pill { margin-left: auto; }
.dash-main { min-width: 0; padding: 22px var(--gutter) calc(110px + var(--safe-b)); }
@media (min-width: 768px) and (min-height: 501px) {
  .dash { grid-template-columns: 250px minmax(0, 1fr); }
  .sidebar { display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; border-right: 1px solid rgba(0,0,0,.1); background: #ececf0; position: sticky; scrollbar-width: none; top: var(--header-total); height: calc(100dvh - var(--header-total)); overflow-y: auto; overflow-x: hidden; }
  .dash-main { padding-bottom: 48px; }
  .tabbar { display: none !important; }
}
@media (min-width: 768px) and (max-width: 1024px) and (min-height: 501px) { .dash { grid-template-columns: 220px minmax(0, 1fr); } }
.dash-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.dash-head h1 { font-size: 26px; font-weight: 800; flex: 1; min-width: 0; }
@media (min-width: 768px) { .dash-head h1 { font-size: 30px; } }
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(10px + var(--safe-b)); z-index: 60;
  width: min(560px, calc(100% - 24px));
  background: rgba(255,255,255,.9); backdrop-filter: saturate(180%) blur(22px); -webkit-backdrop-filter: saturate(180%) blur(22px);
  border: 1px solid var(--line); border-radius: 26px; box-shadow: 0 10px 30px rgba(0,0,0,.14), 0 2px 6px rgba(0,0,0,.06);
  display: flex; gap: 2px; padding: 6px;
}
.tab { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 7px 2px 6px; border: 0; background: none; color: #8e8e93; font-size: 10.5px; font-weight: 600; cursor: pointer; position: relative; border-radius: 20px; transition: background .15s, color .15s; -webkit-tap-highlight-color: transparent; }
.tab svg { width: 23px; height: 23px; flex: none; }
.tab-label { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.tab.active { color: #000; background: rgba(0,0,0,.06); }
.tab:active { transform: scale(.95); }
.tab .count-pill { position: absolute; top: 2px; left: calc(50% + 5px); height: 17px; min-width: 17px; font-size: 10px; padding: 0 5px; }
/* móvil en horizontal: barra más ancha y más baja, icono y texto en línea */
.tabbar.landscape { width: min(820px, calc(100% - 24px)); padding: 5px; bottom: calc(8px + var(--safe-b)); }
.tabbar.landscape .tab { flex-direction: row; gap: 7px; padding: 8px 8px; font-size: 12.5px; }
.tabbar.landscape .tab svg { width: 19px; height: 19px; }
.tabbar.landscape .tab .count-pill { position: static; margin-left: 2px; }
@media (max-width: 359px) { .tab { font-size: 9.5px; } .tab svg { width: 21px; height: 21px; } }
.group-item.is-active { background: var(--surface); font-weight: 600; }
@media (orientation: landscape) and (max-height: 500px) { .dash-main { padding-bottom: calc(76px + var(--safe-b)); } }

/* listas de gestión */
.list-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.list-toolbar .input { max-width: 340px; flex: 1; min-width: 180px; }
.person { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.person:last-child { border-bottom: 0; }
.person .info { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 3px; }
.person .name { font-weight: 600; font-size: 16px; }
.person .actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.person .controls { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 10px; margin-top: 6px; }
.stepper { display: inline-flex; align-items: center; gap: 0; background: var(--surface); border-radius: 12px; height: 46px; overflow: hidden; }
.stepper button { width: 44px; height: 46px; border: 0; background: transparent; font-size: 20px; cursor: pointer; font-weight: 500; }
.stepper button:hover { background: var(--surface-2); }
.stepper input { width: 52px; border: 0; background: transparent; text-align: center; font-weight: 700; font-size: 17px; outline: none; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.vehicle-card { display: flex; flex-direction: column; gap: 10px; }
.vehicle-top { display: flex; gap: 12px; align-items: center; }
.vehicle-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--surface); display: flex; align-items: center; justify-content: center; flex: none; }
.vehicle-icon svg { width: 28px; height: 28px; }
.vehicle-card.broken { border-color: rgba(255,59,48,.35); background: linear-gradient(#fff, #fff8f7); }
.plate { display: inline-flex; align-items: center; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-weight: 700; font-size: 12px; letter-spacing: .06em; border: 1.5px solid #000; border-radius: 5px; padding: 1px 6px 1px 0; background: #fff; overflow: hidden; }
.plate::before { content: 'E'; background: #003399; color: #ffcc00; font-size: 9px; padding: 3px 4px; margin-right: 6px; align-self: stretch; display: flex; align-items: center; }

.theory-card { overflow: hidden; padding: 0; display: flex; flex-direction: column; }
.theory-card .img { aspect-ratio: 16/9; background: linear-gradient(135deg, #1c1c1e, #3a3a3c); color: #fff; display: flex; align-items: center; justify-content: center; }
.theory-card .img img { width: 100%; height: 100%; object-fit: cover; }
.theory-card .img svg { width: 40px; height: 40px; opacity: .6; }
.theory-card .body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress > div { height: 100%; background: #000; border-radius: 3px; transition: width .3s; }

.booking-item { display: flex; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); align-items: center; flex-wrap: wrap; }
.booking-item:last-child { border-bottom: 0; }
.date-tile { width: 54px; flex: none; text-align: center; border-radius: 12px; background: var(--surface); padding: 6px 0; }
.date-tile .m { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--red); }
.date-tile .d { font-size: 22px; font-weight: 800; line-height: 1.1; }
.date-tile.yellow { background: var(--yellow-bg); }
.date-tile.green { background: var(--green-bg); }
.booking-item .info { flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 2px; }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); }
.alert svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.alert.red { background: var(--red-bg); color: var(--red-ink); }
.alert.yellow { background: var(--yellow-bg); color: var(--yellow-ink); }
.alert.blue { background: var(--blue-bg); color: var(--blue-ink); }
.alert .grow { color: var(--text); }

/* ---------------------------------------------------------------- calendario */
.cal { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
.cal-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.cal-title { font-size: 18px; font-weight: 700; flex: 1; min-width: 140px; text-transform: capitalize; }
.cal-nav { display: flex; gap: 4px; align-items: center; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); font-weight: 500; }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i { width: 10px; height: 10px; border-radius: 3px; display: block; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month-dow { padding: 8px 6px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; text-align: center; border-bottom: 1px solid var(--line); }
.month-cell { min-height: 96px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-width: 0; transition: background .12s; }
.month-cell:nth-child(7n) { border-right: 0; }
.month-cell:hover { background: #fafafa; }
.month-cell.other { background: #fcfcfd; }
.month-cell.other .daynum { color: var(--faint); }
.month-cell.past { cursor: default; }
.month-cell.past .daynum { color: var(--faint); }
.daynum { font-size: 13px; font-weight: 600; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; border-radius: 50%; align-self: flex-start; }
.month-cell.today .daynum { background: var(--red); color: #fff; }
.month-cell.selected .daynum { background: #000; color: #fff; }
.ev-pill { font-size: 11px; font-weight: 600; padding: 2px 5px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.35; }
.ev-more { font-size: 11px; color: var(--muted); font-weight: 600; padding-left: 4px; }
.ev-dots { display: none; gap: 3px; flex-wrap: wrap; padding: 0 2px; }
.ev-dots i { width: 6px; height: 6px; border-radius: 50%; display: block; }
@media (max-width: 640px) {
  .month-cell { min-height: 58px; align-items: center; }
  .daynum { align-self: center; }
  .month-cell .ev-pill, .month-cell .ev-more { display: none; }
  .ev-dots { display: flex; justify-content: center; }
}
.c-yellow { background: var(--yellow-bg); color: var(--yellow-ink); box-shadow: inset 3px 0 0 var(--yellow); }
.c-green { background: var(--green-bg); color: var(--green-ink); box-shadow: inset 3px 0 0 var(--green); }
.c-blue { background: var(--blue-bg); color: var(--blue-ink); box-shadow: inset 3px 0 0 var(--blue); }
.c-gray { background: var(--gray-bg); color: var(--muted); box-shadow: inset 3px 0 0 #c7c7cc; }
.c-red { background: var(--red-bg); color: var(--red-ink); box-shadow: inset 3px 0 0 var(--red); }
.dot-yellow { background: var(--yellow); } .dot-green { background: var(--green); } .dot-blue { background: var(--blue); } .dot-gray { background: #c7c7cc; } .dot-red { background: var(--red); }

.time-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.time-grid { display: grid; min-width: 100%; }
.time-grid.week { grid-template-columns: 52px repeat(7, minmax(84px, 1fr)); min-width: 660px; }
.time-grid.day { grid-template-columns: 52px minmax(0, 1fr); }
.tg-head { position: sticky; top: 0; background: #fff; z-index: 2; padding: 8px 4px; text-align: center; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tg-head .n { font-size: 20px; font-weight: 700; color: var(--text); display: block; line-height: 1.2; }
.tg-head.today .n { color: var(--red); }
.tg-corner { border-bottom: 1px solid var(--line); }
.tg-hours { position: relative; }
.tg-hour { height: 56px; font-size: 11px; color: var(--muted); text-align: right; padding-right: 8px; transform: translateY(-7px); font-weight: 500; }
.tg-col { position: relative; border-left: 1px solid var(--line); }
.tg-slot { height: 56px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .1s; }
.tg-slot:hover { background: rgba(0,0,0,.035); }
.tg-slot.past { background: repeating-linear-gradient(-45deg, #fafafa, #fafafa 6px, #f3f3f5 6px, #f3f3f5 12px); cursor: not-allowed; }
.tg-slot.disabled { cursor: default; }
.tg-slot.disabled:hover { background: transparent; }
.tg-event { position: absolute; left: 3px; right: 3px; border-radius: 8px; padding: 4px 7px; font-size: 11.5px; font-weight: 600; overflow: hidden; cursor: pointer; line-height: 1.3; z-index: 1; transition: transform .1s; }
.tg-event:hover { transform: scale(1.01); z-index: 3; }
.tg-event .t { font-weight: 700; }
.tg-event .s { font-weight: 500; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.time-grid.day .tg-event { font-size: 13px; padding: 6px 10px; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); z-index: 4; pointer-events: none; }
.now-line::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }

/* selector de horas (reserva) */
.hour-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
.hour-chip { height: 46px; border-radius: 12px; border: 1px solid var(--line-strong); background: #fff; font-weight: 600; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; font-size: 15px; }
.hour-chip small { font-size: 10px; font-weight: 600; }
.hour-chip:hover:not(:disabled) { border-color: #000; }
.hour-chip.selected { background: #000; color: #fff; border-color: #000; }
.hour-chip:disabled { cursor: not-allowed; background: var(--surface); color: var(--faint); border-color: transparent; }
.hour-chip.busy-yellow:disabled { background: var(--yellow-bg); color: var(--yellow-ink); }
.hour-chip.busy-green:disabled { background: var(--green-bg); color: var(--green-ink); }
.vehicle-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 8px; }
.vehicle-opt { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 14px; border: 1.5px solid var(--line-strong); cursor: pointer; background: #fff; text-align: left; }
.vehicle-opt.selected { border-color: #000; box-shadow: inset 0 0 0 1px #000; }
.vehicle-opt:disabled { opacity: .5; cursor: not-allowed; }
.vehicle-opt svg { width: 26px; height: 26px; flex: none; }

/* ---------------------------------------------------------------- modales / hojas */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 250; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .2s ease; }
.modal { background: #fff; border-radius: var(--radius-lg); width: 100%; max-width: 520px; max-height: calc(100dvh - 40px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .25s cubic-bezier(.2,.9,.3,1.2); overflow: hidden; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 6px; }
.modal-head h2 { font-size: 19px; font-weight: 700; flex: 1; }
.modal-body { padding: 10px 18px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 12px 18px calc(16px + var(--safe-b)); display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-foot .btn { flex: 0 1 auto; }
.grabber { display: none; width: 38px; height: 5px; border-radius: 3px; background: #d1d1d6; margin: 8px auto 0; }
@media (max-width: 640px) {
  .backdrop { align-items: flex-end; padding: 0; }
  .modal { border-radius: 22px 22px 0 0; max-height: 92dvh; animation: sheet .3s cubic-bezier(.2,.9,.3,1); max-width: none; }
  .grabber { display: block; }
  .modal-foot .btn { flex: 1; }
}
@media (orientation: landscape) and (max-height: 500px) { .modal { max-height: 96dvh; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }
@keyframes sheet { from { transform: translateY(100%); } }

.menu { position: fixed; z-index: 270; background: rgba(255,255,255,.96); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: 14px; box-shadow: var(--shadow-lg); min-width: 230px; padding: 6px; animation: pop .18s ease; border: 1px solid var(--line); }
.menu .menu-head { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu button { width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; border-radius: 9px; cursor: pointer; font-size: 15px; display: flex; align-items: center; gap: 10px; }
.menu button:hover { background: var(--surface); }
.menu button.danger { color: var(--red); }
.menu svg { width: 18px; height: 18px; }

/* toasts */
.toast-root { position: fixed; left: 50%; transform: translateX(-50%); top: calc(var(--header-total) + 4px); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 420px; }
.toast { background: rgba(28,28,30,.95); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); animation: toast .3s cubic-bezier(.2,.9,.3,1.2); display: flex; gap: 10px; align-items: center; pointer-events: auto; }
.toast.error { background: var(--red); }
.toast.success { background: #1a7f37; }
@keyframes toast { from { opacity: 0; transform: translateY(-12px) scale(.96); } }

/* ---------------------------------------------------------------- auth & onboarding */
.auth-wrap { min-height: calc(100dvh - var(--header-total)); display: flex; align-items: center; justify-content: center; padding: 28px var(--gutter); background: var(--surface); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 24px; padding: 28px 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 18px; }
.auth-card h1 { font-size: 26px; font-weight: 800; }
.join-banner { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; background: var(--surface); }
.option-card { display: flex; flex-direction: column; gap: 14px; }
.option-card .icon-wrap { width: 48px; height: 48px; border-radius: 14px; background: #000; color: #fff; display: flex; align-items: center; justify-content: center; }
.option-card .icon-wrap svg { width: 24px; height: 24px; }
.onboard-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 860px) { .onboard-grid { grid-template-columns: 1fr 1fr; } }

/* bienvenida */
.welcome { position: fixed; inset: 0; z-index: 400; background: #000; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; text-align: center; padding: 32px; animation: fade .4s ease; }
.welcome .logo { width: 110px; height: 110px; border-radius: 28px; font-size: 40px; color: #000; animation: pop .6s cubic-bezier(.2,.9,.3,1.3); }
.welcome h1 { font-size: 30px; font-weight: 800; max-width: 600px; }
@media (min-width: 768px) { .welcome h1 { font-size: 42px; } }
.welcome p { color: rgba(255,255,255,.7); font-size: 17px; }
.welcome .bar { width: min(260px, 70vw); height: 4px; border-radius: 2px; background: #2c2c2e; overflow: hidden; }
.welcome .bar > div { height: 100%; background: #fff; width: 0; animation: fill 7s linear forwards; }
@keyframes fill { to { width: 100%; } }

/* QR */
.qr-card { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.qr-box { width: 220px; height: 220px; padding: 14px; background: #fff; border-radius: 18px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.qr-box img, .qr-box canvas { width: 100% !important; height: 100% !important; }
.code-display { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 22px; font-weight: 700; letter-spacing: .08em; background: var(--surface); padding: 8px 16px; border-radius: 12px; user-select: all; }
.scanner { width: 100%; aspect-ratio: 1; max-width: 360px; margin: 0 auto; border-radius: 18px; overflow: hidden; background: #000; }
.scanner video { object-fit: cover; }

/* perfil */
.profile-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.avatar-edit { position: relative; cursor: pointer; border: 0; background: none; padding: 0; border-radius: 50%; }
.avatar-edit .cam { position: absolute; right: -2px; bottom: -2px; width: 30px; height: 30px; border-radius: 50%; background: #000; color: #fff; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; }
.avatar-edit .cam svg { width: 15px; height: 15px; }
.bono { background: #000; color: #fff; border-radius: var(--radius-lg); padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.bono .big { font-size: 52px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.bono .sub { color: rgba(255,255,255,.65); font-size: 14px; }

/* leaflet ajustes */
.leaflet-container { font-family: var(--font); }
.map-search { display: flex; gap: 8px; }
.map-results { display: flex; flex-direction: column; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.map-results button { text-align: left; border: 0; border-bottom: 1px solid var(--line); background: #fff; padding: 10px 12px; cursor: pointer; font-size: 13px; }
.map-results button:last-child { border-bottom: 0; }
.map-results button:hover { background: var(--surface); }

.spinner { width: 28px; height: 28px; border: 3px solid var(--surface-2); border-top-color: #000; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; padding: 80px 0; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; box-shadow: 0 0 0 3px rgba(52,199,89,.25); }
.sync-dot.off { background: var(--orange); box-shadow: 0 0 0 3px rgba(255,149,0,.25); }

@media print {
  .header, .sidebar, .tabbar, .no-print { display: none !important; }
}
@media (max-width: 767px), (max-height: 500px) { .dash .save-bar { bottom: calc(76px + var(--safe-b)); } }
.dash .rte-toolbar { top: var(--header-total); }
@media (max-width: 600px) {
  .school-head { flex-direction: column; align-items: flex-start; gap: 12px; margin-top: -48px; }
  .school-head .title-wrap { padding-top: 0; width: 100%; min-width: 0; }
  .school-head h1 { font-size: 26px; }
}

/* barras de desplazamiento ocultas en toda la app (se sigue pudiendo deslizar) */
html, body, * { scrollbar-width: none; -ms-overflow-style: none; }
::-webkit-scrollbar { display: none; width: 0; height: 0; }
/* sidebar: gris con contraste y sin barra de desplazamiento visible (sigue deslizando) */
.sidebar::-webkit-scrollbar { display: none; width: 0; }
.sidebar .side-item:hover { background: #dcdce1; }
.sidebar .side-item.active { background: #000; }
.sidebar .logo { border-color: rgba(0,0,0,.1); }

/* ================================================================ MODO OSCURO */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0e10; --surface: #1c1c1e; --surface-2: #2c2c2e; --card: #161618;
  --text: #f5f5f7; --muted: #a1a1a6; --faint: #6e6e73;
  --line: rgba(255,255,255,.09); --line-strong: rgba(255,255,255,.18);
  --black: #ffffff; --white: #000000;
  --green-bg: rgba(48,209,88,.16); --green-ink: #30d158;
  --yellow-bg: rgba(255,214,10,.16); --yellow-ink: #ffd60a;
  --red-bg: rgba(255,69,58,.16); --red-ink: #ff6961;
  --blue-bg: rgba(10,132,255,.2); --blue-ink: #64a8ff;
  --orange-bg: rgba(255,159,10,.16); --orange-ink: #ffb340;
  --gray-bg: #2c2c2e;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.35);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.6);
}
[data-theme="dark"] body { background: var(--bg); }
[data-theme="dark"] .header { border-color: rgba(255,255,255,.14); box-shadow: 0 8px 28px rgba(0,0,0,.5); }
/* botones: en oscuro se invierten (blanco con texto negro) */
[data-theme="dark"] .btn { background: #fff; color: #000; }
[data-theme="dark"] .btn.light { background: var(--surface-2); color: var(--text); }
[data-theme="dark"] .btn.light:hover { background: #3a3a3c; }
[data-theme="dark"] .btn.ghost, [data-theme="dark"] .btn.outline { background: transparent; color: var(--text); }
[data-theme="dark"] .btn.ghost:hover { background: var(--surface); }
[data-theme="dark"] .btn.danger { background: var(--red-bg); color: var(--red-ink); }
[data-theme="dark"] .btn.success { background: #30d158; color: #000; }
[data-theme="dark"] .header .btn, [data-theme="dark"] .btn.on-dark-ghost { background: transparent; color: #fff; }
[data-theme="dark"] .btn.on-dark-ghost { background: #2c2c2e; }
[data-theme="dark"] .input:focus, [data-theme="dark"] .select:focus, [data-theme="dark"] .textarea:focus { background: var(--surface-2); border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.08); }
[data-theme="dark"] .select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a1a1a6' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }
[data-theme="dark"] .segmented button.active { background: #48484a; box-shadow: none; }
[data-theme="dark"] .badge.black, [data-theme="dark"] .side-item.active, [data-theme="dark"] .sidebar .side-item.active { background: #fff; color: #000; }
[data-theme="dark"] .sidebar { background: #1a1a1d; border-right-color: rgba(255,255,255,.08); }
[data-theme="dark"] .sidebar .side-item:hover { background: #2a2a2e; }
[data-theme="dark"] .logo { background: #fff; border-color: transparent; color: #000; }
[data-theme="dark"] .school-card, [data-theme="dark"] .cal, [data-theme="dark"] .modal, [data-theme="dark"] .auth-card,
[data-theme="dark"] .rte, [data-theme="dark"] .preview-frame, [data-theme="dark"] .tg-head, [data-theme="dark"] .hour-chip,
[data-theme="dark"] .vehicle-opt, [data-theme="dark"] .map-results button, [data-theme="dark"] .editor-shell { background: var(--card); }
[data-theme="dark"] .school-head .logo { border-color: var(--bg); }
[data-theme="dark"] .rte-toolbar, [data-theme="dark"] .preview-frame .preview-chrome { background: #1f1f22; }
[data-theme="dark"] .rte-toolbar button.on { background: #fff; color: #000; }
[data-theme="dark"] .rte-toolbar select { color: var(--text); }
[data-theme="dark"] .save-bar { background: linear-gradient(to top, var(--bg) 70%, rgba(14,14,16,0)); }
[data-theme="dark"] .tabbar { background: rgba(28,28,30,.88); border-color: rgba(255,255,255,.1); box-shadow: 0 10px 30px rgba(0,0,0,.6); }
[data-theme="dark"] .tab { color: #8e8e93; }
[data-theme="dark"] .tab.active { color: #fff; background: rgba(255,255,255,.1); }
[data-theme="dark"] .vehicle-card.broken { background: linear-gradient(var(--card), rgba(255,69,58,.08)); }
[data-theme="dark"] .plate { background: #fff; color: #000; }
[data-theme="dark"] .progress > div, [data-theme="dark"] .hour-chip.selected, [data-theme="dark"] .month-cell.selected .daynum { background: #fff; color: #000; border-color: #fff; }
[data-theme="dark"] .hour-chip:hover:not(:disabled) { border-color: #fff; }
[data-theme="dark"] .vehicle-opt.selected { border-color: #fff; box-shadow: inset 0 0 0 1px #fff; }
[data-theme="dark"] .month-cell:hover { background: #1f1f22; }
[data-theme="dark"] .month-cell.other { background: #121214; }
[data-theme="dark"] .tg-slot.past { background: repeating-linear-gradient(-45deg, #141416, #141416 6px, #1a1a1d 6px, #1a1a1d 12px); }
[data-theme="dark"] .tg-slot:hover { background: rgba(255,255,255,.05); }
[data-theme="dark"] .menu { background: rgba(36,36,38,.96); border-color: rgba(255,255,255,.1); }
[data-theme="dark"] .menu button:hover { background: var(--surface-2); }
[data-theme="dark"] .option-card .icon-wrap, [data-theme="dark"] .avatar-edit .cam { background: #fff; color: #000; }
[data-theme="dark"] .avatar-edit .cam { border-color: var(--card); }
[data-theme="dark"] .bono { background: linear-gradient(135deg, #1c1c1e, #2c2c2e); border: 1px solid rgba(255,255,255,.08); }
[data-theme="dark"] .spinner { border-top-color: #fff; }
[data-theme="dark"] .hero-band { background: #000; border-bottom: 1px solid rgba(255,255,255,.06); }
[data-theme="dark"] .stat.warn, [data-theme="dark"] .stat.pend { background: var(--surface); }
[data-theme="dark"] .rich mark { color: #000; }
[data-theme="dark"] .upload-tile:hover { background: var(--surface); }
[data-theme="dark"] .modal-foot { border-top-color: var(--line); }
[data-theme="dark"] .grabber { background: #48484a; }
[data-theme="dark"] .leaflet-container { background: #1c1c1e; }
[data-theme="dark"] .wheel-scene circle[fill="#1d1d1f"] { fill: #3a3a3c; }
[data-theme="dark"] .skid { stroke: #a1a1a6; }
[data-theme="dark"] .wheel-scene line { stroke: #2c2c2e; }

/* pie legal y casilla de términos */
.site-footer { border-top: 1px solid var(--line); margin-top: 24px; padding: 22px var(--gutter) calc(22px + var(--safe-b)); }
.site-footer .inner { max-width: 1180px; margin: 0 auto; display: flex; gap: 12px 22px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.site-footer nav { display: flex; gap: 6px 18px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 500; }
.site-footer a:hover { color: var(--text); text-decoration: underline; }
.auth-wrap + .site-footer { margin-top: 0; background: var(--surface); border-top-color: transparent; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); line-height: 1.45; cursor: pointer; }
.check-row input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--black); cursor: pointer; }
.legal-text h2 { font-size: 18px; margin: 1.4em 0 .5em; }
.legal-text ul { padding-left: 1.2em; }
.install-steps { margin: 4px 0 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 10px; line-height: 1.45; }

.push-nudge { position: fixed; z-index: 90; left: 50%; transform: translateX(-50%); bottom: calc(24px + var(--safe-b)); width: min(560px, calc(100% - 24px)); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-radius: 20px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: toast .35s cubic-bezier(.2,.9,.3,1.2); }
.push-nudge .grow { min-width: 180px; }
@media (max-width: 767px), (max-height: 500px) { .push-nudge { bottom: calc(92px + var(--safe-b)); } }
