:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e5e7eb;
  --accent: #f97316;
  --accent-2: #ea580c;
  --on-accent: #ffffff;
  --navy: #0f172a;
  --navy-2: #1e293b;
  --ok: #16a34a;
  --danger: #dc2626;
  --aviso: #b45309;
  --lluvia: #2563eb;
  --glass: rgba(255, 255, 255, .82);
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 20px rgba(15, 23, 42, .07);
  --shadow-lg: 0 10px 30px rgba(249, 115, 22, .35);
  --r: 18px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0e15;
    --surface: #131a25;
    --surface-2: #1b2431;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --border: #243042;
    --navy: #0b1220;
    --navy-2: #172033;
    --aviso: #fbbf24;
    --lluvia: #60a5fa;
    --glass: rgba(19, 26, 37, .82);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
    --shadow-lg: 0 10px 30px rgba(249, 115, 22, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
body.modal { overflow: hidden; }
#app { max-width: 720px; margin: 0 auto; padding: 0 16px calc(150px + var(--safe-b)); }
#app.entrar > * { animation: aparecer .28s ease both; }
@keyframes aparecer { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
.i { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -.22em; }

/* ---------- Cabeceras ---------- */
.top { display: flex; align-items: center; gap: 10px; padding: calc(var(--safe-t) + 12px) 0 12px; position: sticky; top: 0; z-index: 10; background: var(--bg); }
.top .titulo { flex: 1; min-width: 0; }
.top .titulo h1 { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .titulo small { color: var(--muted); font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titulo-grande { font-size: 32px; font-weight: 800; letter-spacing: -.02em; flex: 1; }
.icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: none; background: var(--surface); border: 1px solid var(--border); cursor: pointer; font-size: 18px; box-shadow: var(--shadow); }
.icon.vidrio { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .22); color: #fff; box-shadow: none; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }

/* ---------- Hero de inicio ---------- */
.hero {
  margin: 0 -16px; padding: calc(var(--safe-t) + 16px) 20px 22px; color: #fff;
  background: radial-gradient(110% 90% at 100% 0%, rgba(249, 115, 22, .55), transparent 55%), linear-gradient(160deg, var(--navy), var(--navy-2));
  border-radius: 0 0 28px 28px;
}
.hero-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.marca { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -.01em; font-size: 17px; }
.marca .logo { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; color: #fff; box-shadow: 0 4px 12px rgba(249, 115, 22, .5); }
.saludo { color: rgba(255, 255, 255, .72); font-size: 15px; }
.hero h1 { font-size: 27px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
.stat { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); border-radius: 14px; padding: 10px 8px; text-align: center; }
.stat b { display: block; font-size: 24px; font-weight: 800; line-height: 1.1; }
.stat span { font-size: 11px; color: rgba(255, 255, 255, .7); line-height: 1.2; display: block; margin-top: 2px; }
.stat.alerta b { color: #fca5a5; }

/* ---------- Encabezados de bloque ---------- */
.h-sec { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: 24px 0 10px; }
.h-sec h2 { white-space: nowrap; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.h-sec small { color: var(--muted); font-size: 14px; }

/* ---------- Segmentos y chips ---------- */
.segmento { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 2px; }
.segmento button { white-space: nowrap; border: 0; background: none; padding: 6px 12px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.segmento button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { --c: #64748b; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 8px 12px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; flex: none; }
.chip .i { color: var(--c); }
.chip b { font-size: 12px; background: var(--surface-2); border-radius: 999px; padding: 0 6px; }
.chip.on { background: var(--c); border-color: var(--c); color: #fff; }
.chip.on .i { color: #fff; }
.chip.on b { background: rgba(255, 255, 255, .25); }

/* ---------- Tarjetas de obra ---------- */
.lista { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.obra { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 10px; box-shadow: var(--shadow); cursor: pointer; }
.portada { width: 76px; height: 76px; border-radius: 14px; object-fit: cover; display: grid; place-items: center; font-weight: 800; font-size: 24px; color: #fff; background: linear-gradient(135deg, var(--c, var(--accent)), color-mix(in srgb, var(--c, var(--accent)) 55%, #000)); }
.obra-nombre { font-weight: 700; font-size: 17px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.obra-dir { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.obra-dir .i { width: 14px; height: 14px; margin-right: 3px; }
.obra-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.estado { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.estado::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.estado.activa { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.estado.pausada { color: #d97706; background: color-mix(in srgb, #d97706 13%, transparent); }
.hoy-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 58px; height: 58px; border-radius: 16px; border: 0; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; cursor: pointer; box-shadow: 0 4px 12px rgba(249, 115, 22, .35); }
.hoy-btn .i { width: 22px; height: 22px; }
.hoy-btn.hecho { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); color: var(--ok); box-shadow: none; }
.hoy-btn.hecho b { font-size: 18px; line-height: 1; }
.hoy-btn.hecho .i { width: 14px; height: 14px; }

/* ---------- Avisos y vacíos ---------- */
.aviso { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border)); border-radius: var(--r); padding: 14px; margin-top: 16px; box-shadow: var(--shadow); font-size: 14px; }
.aviso > .i { color: var(--accent); width: 22px; height: 22px; }
.aviso b { display: block; font-size: 15px; }
.aviso .btn { margin-top: 10px; min-height: 38px; padding: 8px 14px; font-size: 14px; }
.vacio { text-align: center; padding: 36px 20px; color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--r); }
.vacio .i { width: 40px; height: 40px; color: var(--accent); margin-bottom: 8px; }
.vacio b { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--border); background: var(--surface); border-radius: 14px; padding: 12px 16px; min-height: 48px; font-weight: 700; cursor: pointer; text-align: center; }
.btn.primario { background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: var(--on-accent); border-color: transparent; box-shadow: 0 4px 14px rgba(249, 115, 22, .3); }
.btn.oscuro { background: var(--text); color: var(--bg); border-color: transparent; }
.btn.peligro { color: var(--danger); }
.btn.texto { background: none; border: 0; box-shadow: none; color: var(--muted); font-weight: 600; }
.btn.grande { width: 100%; min-height: 56px; font-size: 17px; border-radius: 16px; }
.btn:disabled { opacity: .5; }
.fila { display: flex; gap: 8px; align-items: center; }
.fila > * { flex: 1; min-width: 0; }

.fab { position: fixed; right: max(16px, calc(50% - 344px)); bottom: calc(84px + var(--safe-b)); z-index: 20; display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 14px 20px; font-weight: 800; font-size: 16px; color: #fff; background: linear-gradient(180deg, var(--accent), var(--accent-2)); box-shadow: var(--shadow-lg); cursor: pointer; }
.fab .i { width: 22px; height: 22px; stroke-width: 2.5; }

/* ---------- Navegación inferior ---------- */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; justify-content: center; gap: 4px; padding: 8px 12px calc(8px + var(--safe-b)); background: var(--glass); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px); border-top: 1px solid var(--border); }
.nav a { flex: 0 1 140px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px; }
.nav a .i { width: 24px; height: 24px; }
.nav a.on { color: var(--accent); }

/* ---------- Bienvenida ---------- */
.bienvenida { min-height: 100vh; margin: 0 -16px; padding: calc(var(--safe-t) + 48px) 24px calc(32px + var(--safe-b)); color: #fff; display: flex; flex-direction: column; gap: 22px;
  background: radial-gradient(100% 60% at 100% 0%, rgba(249, 115, 22, .6), transparent 60%), radial-gradient(80% 50% at 0% 100%, rgba(37, 99, 235, .35), transparent 60%), linear-gradient(170deg, #0f172a, #111827); }
.logo-grande { width: 76px; height: 76px; border-radius: 22px; background: var(--accent); display: grid; place-items: center; box-shadow: 0 12px 30px rgba(249, 115, 22, .5); }
.logo-grande .i { width: 42px; height: 42px; }
.bienvenida h1 { font-size: 38px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; }
.lema { font-size: 18px; color: rgba(255, 255, 255, .78); }
.ventajas { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.ventajas li { display: flex; gap: 14px; align-items: flex-start; }
.ventajas li > .i { width: 40px; height: 40px; padding: 9px; border-radius: 12px; background: rgba(255, 255, 255, .1); color: #fdba74; }
.ventajas b { display: block; }
.ventajas span { color: rgba(255, 255, 255, .65); font-size: 14px; }
.form-bienv { display: grid; gap: 10px; margin-top: auto; }
.form-bienv .campo { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .18); color: #fff; }
.form-bienv .campo::placeholder { color: rgba(255, 255, 255, .5); }

/* ---------- Portada de obra ---------- */
.obra-hero { position: relative; margin: 0 -16px; min-height: 230px; padding: calc(var(--safe-t) + 12px) 16px 18px; color: #fff; display: flex; flex-direction: column; border-radius: 0 0 28px 28px; overflow: hidden;
  background: linear-gradient(135deg, var(--c, var(--accent)), color-mix(in srgb, var(--c, var(--accent)) 40%, #0f172a)); }
.obra-hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.obra-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .35), rgba(0, 0, 0, .05) 40%, rgba(0, 0, 0, .75)); }
.obra-hero > * { position: relative; z-index: 1; }
.obra-hero .barra { display: flex; justify-content: space-between; }
.obra-hero .texto { margin-top: auto; padding-top: 50px; }
.obra-hero h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.obra-hero p { color: rgba(255, 255, 255, .85); font-size: 14px; margin-top: 4px; }
.obra-hero .estado { margin-bottom: 8px; background: rgba(255, 255, 255, .2); color: #fff; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 6px; text-align: center; box-shadow: var(--shadow); }
.kpi b { display: block; font-size: 22px; font-weight: 800; line-height: 1.1; }
.kpi span { font-size: 11px; color: var(--muted); }
.kpi.alerta b { color: var(--danger); }
.kpi.lluvia b { color: var(--lluvia); }

/* Mapa de actividad */
.actividad { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); }
.mapa { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.mapa i { aspect-ratio: 1; border-radius: 4px; background: var(--surface-2); }
.mapa i.n1 { background: color-mix(in srgb, var(--accent) 30%, var(--surface-2)); }
.mapa i.n2 { background: color-mix(in srgb, var(--accent) 55%, var(--surface-2)); }
.mapa i.n3 { background: color-mix(in srgb, var(--accent) 80%, var(--surface-2)); }
.mapa i.n4 { background: var(--accent-2); }
.mapa i.fut { background: transparent; }
.mapa i.hoy { outline: 2px solid var(--text); outline-offset: 1px; }
.leyenda { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-top: 10px; }
.leyenda span { display: inline-flex; gap: 3px; align-items: center; }
.leyenda i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Lista de partes */
.parte { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 12px; box-shadow: var(--shadow); }
.fecha-bloque { width: 56px; height: 60px; border-radius: 14px; background: var(--surface-2); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.fecha-bloque b { font-size: 24px; font-weight: 800; }
.fecha-bloque span { font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-top: 3px; }
.fecha-bloque.hoy { background: var(--accent); color: #fff; }
.fecha-bloque.hoy span { color: rgba(255, 255, 255, .85); }
.parte-titulo { font-weight: 700; }
.parte-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; color: var(--muted); margin-top: 2px; }
.parte-meta span { display: inline-flex; align-items: center; gap: 3px; }
.parte-meta .i { width: 14px; height: 14px; }
.parte-meta .rojo { color: var(--danger); font-weight: 600; }
.parte-meta .azul { color: var(--lluvia); font-weight: 600; }
.mini-fotos { display: flex; gap: 4px; margin-top: 8px; }
.mini-fotos img, .mini-fotos span { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.mini-fotos span { background: var(--surface-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.chev { color: var(--muted); }

/* ---------- Parte del día ---------- */
.dia { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.dia-num { font-size: 56px; font-weight: 800; letter-spacing: -.04em; line-height: .9; color: var(--accent); }
.dia-txt b { display: block; font-size: 20px; font-weight: 800; text-transform: capitalize; }
.dia-txt span { color: var(--muted); }
.pildoras { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pildora { display: inline-flex; align-items: center; gap: 5px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 600; }
.pildora.rojo { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 14px; }
.panel label, .lbl { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.campo { width: 100%; border: 1px solid var(--border); background: var(--surface-2); border-radius: 12px; padding: 11px 13px; min-height: 46px; outline: none; transition: border-color .15s, box-shadow .15s; }
.campo:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
textarea.campo { resize: vertical; min-height: 92px; }
.con-icono { position: relative; }
.con-icono > .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.con-icono .campo { padding-left: 40px; }

/* Línea de tiempo */
.tl { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.tl::before { content: ""; position: absolute; left: 21px; top: 12px; bottom: 12px; width: 2px; background: var(--border); border-radius: 2px; }
.tl-item { --c: #64748b; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; position: relative; cursor: pointer; }
.tl-item[hidden] { display: none; }
.tl-marca { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tl-dot { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: var(--c); box-shadow: 0 0 0 4px var(--bg); }
.tl-hora { font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.tl-card > img { width: 100%; max-height: 300px; object-fit: cover; display: block; }
.tl-body { padding: 10px 12px 12px; }
.sec-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); padding: 3px 9px; border-radius: 999px; }
.sec-tag .i { width: 13px; height: 13px; }
.audio-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 6px; }
.audio-tag .i { width: 13px; height: 13px; }
.tl-body p { margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tl-body p.sin { color: var(--muted); font-style: italic; }
.tl-item.incid .tl-card { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }

.cta-informe { margin-top: 22px; border-radius: 22px; padding: 18px; color: #fff; display: grid; gap: 12px;
  background: radial-gradient(90% 120% at 100% 0%, rgba(249, 115, 22, .5), transparent 60%), linear-gradient(150deg, var(--navy), var(--navy-2)); }
.cta-informe b { font-size: 19px; display: block; }
.cta-informe span { color: rgba(255, 255, 255, .72); font-size: 14px; }

/* Dock de captura */
.dock { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(10px + var(--safe-b)); z-index: 20; width: min(calc(100% - 20px), 520px); display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; padding: 8px 6px; border-radius: 26px; background: var(--glass); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px); border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(15, 23, 42, .18); }
.dock > button, .dock > label { display: flex; flex-direction: column; align-items: center; gap: 3px; border: 0; background: none; font-size: 11px; font-weight: 700; color: var(--text); cursor: pointer; padding: 4px 0; }
.dock .i { width: 24px; height: 24px; }
.dock .principal { position: relative; }
.dock .principal span:first-of-type { width: 66px; height: 66px; margin-top: -30px; border-radius: 22px; display: grid; place-items: center; color: #fff; background: linear-gradient(180deg, var(--accent), var(--accent-2)); box-shadow: var(--shadow-lg); border: 4px solid var(--bg); }
.dock .principal .i { width: 30px; height: 30px; }

/* ---------- Registro / búsqueda ---------- */
.buscador { position: relative; margin-bottom: 10px; }
.buscador .i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.buscador input { width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: 16px; padding: 14px 14px 14px 44px; font-size: 17px; box-shadow: var(--shadow); outline: none; -webkit-appearance: none; }
.buscador input:focus { border-color: var(--accent); }
.resultado { --c: #64748b; display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 10px; box-shadow: var(--shadow); }
.resultado .vis { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; display: grid; place-items: center; color: #fff; background: var(--c); }
.resultado .donde { font-size: 12px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resultado p { font-size: 15px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
mark { background: color-mix(in srgb, var(--accent) 35%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
select.campo { -webkit-appearance: none; appearance: none; margin-bottom: 10px; }

/* ---------- Ajustes ---------- */
.grupo { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-bottom: 14px; }
.grupo h2 { font-size: 17px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.grupo h2 .i { color: var(--accent); }
.logo-fila { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.logo-prev { width: 120px; height: 64px; border-radius: 12px; border: 1px dashed var(--border); background: #fff; display: grid; place-items: center; color: #94a3b8; overflow: hidden; }
.logo-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.version { text-align: center; color: var(--muted); font-size: 13px; margin-top: 8px; }
.ayuda { font-size: 14px; color: var(--muted); }

/* ---------- Hoja modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(2, 6, 23, .5); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fundido .2s ease; }
.sheet { background: var(--bg); width: 100%; max-width: 720px; max-height: 94vh; overflow-y: auto; border-radius: 26px 26px 0 0; padding: 10px 16px calc(18px + var(--safe-b)); display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; animation: subir .28s cubic-bezier(.2, .9, .3, 1); -webkit-overflow-scrolling: touch; }
.sheet::before { content: ""; width: 40px; height: 5px; border-radius: 3px; background: var(--border); justify-self: center; }
.sheet-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sheet-top h2 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.sheet .prev { width: 100%; max-height: 38vh; object-fit: contain; border-radius: 16px; background: #000; }
.sheet audio { width: 100%; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.acciones .btn { flex: 1; }
.colores { display: flex; gap: 10px; flex-wrap: wrap; }
.colores button { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--bg); background: var(--c); box-shadow: 0 0 0 1px var(--border); cursor: pointer; }
.colores button.on { box-shadow: 0 0 0 2px var(--text); }
@keyframes subir { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fundido { from { opacity: 0; } to { opacity: 1; } }

/* Grabadora */
.grabadora { display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px; }
.rec { width: 72px; height: 72px; border-radius: 50%; border: 0; display: grid; place-items: center; color: #fff; background: var(--danger); cursor: pointer; flex: none; box-shadow: 0 6px 18px rgba(220, 38, 38, .35); }
.rec .i { width: 30px; height: 30px; }
.rec.on { animation: latido 1.2s ease-in-out infinite; }
.rec.on::after { content: ""; position: absolute; }
@keyframes latido { 0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .5); } 50% { box-shadow: 0 0 0 14px rgba(220, 38, 38, 0); } }
.grabadora b { display: block; }
.reloj { font-variant-numeric: tabular-nums; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.btn.activo { background: var(--danger); color: #fff; border-color: var(--danger); }

#toast { position: fixed; left: 50%; bottom: calc(120px + var(--safe-b)); transform: translate(-50%, 10px); background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 14px; font-size: 15px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100% - 32px); text-align: center; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Tiempo del día ---------- */
.clima { gap: 12px; }
.clima-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.clima-top h3 { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: 6px; }
.clima-top .icon { width: 36px; height: 36px; border-radius: 11px; box-shadow: none; }
.franjas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.franja { --fc: #d97706; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 10px 4px 12px; border-radius: 14px;
  background: color-mix(in srgb, var(--fc) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--fc) 24%, var(--border)); }
.franja.tarde { --fc: #ea580c; }
.franja.noche { --fc: #6366f1; }
.franja-n { font-weight: 800; font-size: 14px; }
.franja small { font-size: 11px; color: var(--muted); }
.franja .franja-i { width: 34px; height: 34px; color: var(--fc); margin: 6px 0 2px; }
.franja-t { font-size: 21px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.franja-e { font-size: 12px; font-weight: 600; line-height: 1.2; min-height: 2.4em; display: flex; align-items: center; justify-content: center; }
.franja-d { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.franja-d .i { width: 13px; height: 13px; }
.franja em { font-style: normal; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--fc); margin-top: 4px; }
.clima-res { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; font-weight: 600; }
.clima-res span { display: inline-flex; align-items: center; gap: 4px; }
.clima-res .i { width: 15px; height: 15px; color: var(--muted); }
.clima-avisos { display: flex; flex-wrap: wrap; gap: 6px; }
.clima-aviso { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--aviso); background: color-mix(in srgb, var(--aviso) 14%, transparent); padding: 4px 10px; border-radius: 999px; }
.clima-aviso .i { width: 13px; height: 13px; }
.clima-lugar { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; margin-bottom: -6px; }
.clima-lugar .i { width: 14px; height: 14px; color: var(--accent); }
.clima-lugar span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.enlace { border: 0; background: none; padding: 2px 4px; color: var(--accent-2); font-weight: 700; font-size: 13px; cursor: pointer; flex: none; }
.clima-fuente { font-size: 11px; color: var(--muted); }
.clima-msg { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--muted); }
.clima-msg > .i { width: 22px; height: 22px; color: var(--accent); }
.clima-msg b { display: block; color: var(--text); }
.girando { animation: girar 1s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.ubic { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 6px 6px 6px 12px; }
.ubic > .i { color: var(--accent); }
.ubic span { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ubic .btn { min-height: 38px; padding: 6px 12px; font-size: 14px; flex: none; }

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