/* Letras guardadas dentro del proyecto (funcionan sin internet) */
@font-face { font-family: 'Instrument Serif'; src: url('../shared/fonts/instrument-serif-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Instrument Serif'; src: url('../shared/fonts/instrument-serif-latin-400-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../shared/fonts/inter-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../shared/fonts/inter-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../shared/fonts/inter-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../shared/fonts/inter-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
/* Maxolan · sistema visual compartido (app Maxolan + app Clínicas)
   Blanco luminoso, colores pastel con degradado que se funde a mitad de botón,
   sin negro: el texto es un azul pizarra profundo. */
:root {
  --bg: #FFFFFF;
  --ink: #233047;        /* texto principal (pizarra, no negro) */
  --muted: #66708A;      /* texto secundario */
  --line: #E9ECF3;
  --pearl: #F5F7FB;      /* fondos suaves */

  /* Pares de degradado: color vivo suave → casi blanco */
  --rosa-a: #F4A9C8;  --rosa-b: #FDEAF2;  --rosa-t: #7A2352;
  --rojo-a: #F39A9A;  --rojo-b: #FDE6E4;  --rojo-t: #8C2230;
  --cielo-a: #8CC8F4; --cielo-b: #E3F2FE; --cielo-t: #164A78;
  --verde-a: #86D9B0; --verde-b: #E2F7EC; --verde-t: #11583B;
  --naranja-a: #FFBE85; --naranja-b: #FFEEDD; --naranja-t: #8A4210;
  --lavanda-a: #BFB1F6; --lavanda-b: #EFEAFE; --lavanda-t: #46318F;
  --mantequilla-a: #F5D37A; --mantequilla-b: #FDF5DA; --mantequilla-t: #6A5100;
  --aqua-a: #93DCDD; --aqua-b: #E2F7F7; --aqua-t: #0E5759;
  --perla-a: #DCE3EE; --perla-b: #F7F9FC; --perla-t: #34405A;

  /* Prioridades */
  --p1: #E8797B; --p1-t: #8C2230; --p1-s: #FDE6E4;
  --p2: #F4A35E; --p2-t: #8A4210; --p2-s: #FFEEDD;
  --p3: #6DB4EA; --p3-t: #164A78; --p3-s: #E3F2FE;
  --p4: #6CC99A; --p4-t: #11583B; --p4-s: #E2F7EC;

  /* Botón principal: azul cielo → lavanda */
  --cta-a: #4F86E0; --cta-b: #8B78E8;

  --radius: 16px;
  --radius-s: 12px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 var(--font); font-feature-settings: "tnum" 1;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: inherit; text-decoration: none; }
button { font-family: var(--font); }
:focus-visible { outline: 3px solid var(--cta-a); outline-offset: 3px; }
main:focus, main:focus-visible { outline: none; }

/* Degradado "a mitad de botón": color pleno arriba-izquierda, se funde hacia la mitad */
.g { background: linear-gradient(150deg, var(--a) 0%, var(--a) 18%, var(--b) 62%, var(--b) 100%); color: var(--t); }
.g-rosa { --a: var(--rosa-a); --b: var(--rosa-b); --t: var(--rosa-t); }
.g-rojo { --a: var(--rojo-a); --b: var(--rojo-b); --t: var(--rojo-t); }
.g-cielo { --a: var(--cielo-a); --b: var(--cielo-b); --t: var(--cielo-t); }
.g-verde { --a: var(--verde-a); --b: var(--verde-b); --t: var(--verde-t); }
.g-naranja { --a: var(--naranja-a); --b: var(--naranja-b); --t: var(--naranja-t); }
.g-lavanda { --a: var(--lavanda-a); --b: var(--lavanda-b); --t: var(--lavanda-t); }
.g-mantequilla { --a: var(--mantequilla-a); --b: var(--mantequilla-b); --t: var(--mantequilla-t); }
.g-aqua { --a: var(--aqua-a); --b: var(--aqua-b); --t: var(--aqua-t); }
.g-perla { --a: var(--perla-a); --b: var(--perla-b); --t: var(--perla-t); }

/* Cabecera con navegación */
.top {
  position: sticky; top: 0; z-index: 5; background: rgba(255,255,255,.92);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.top-in {
  max-width: 1120px; margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 20px 12px;
  display: flex; align-items: center; gap: 12px;
}
.nav { display: flex; gap: 6px; }
.nav button {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: #fff;
  color: var(--ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.nav button:disabled { opacity: .35; cursor: default; }
.nav button:not(:disabled):hover { background: var(--pearl); }
.brand { font-weight: 800; font-size: 21px; letter-spacing: -0.03em; display: inline-flex; align-items: baseline; gap: 8px; margin-left: 6px; }
.brand-sub { font-weight: 500; font-size: 14px; letter-spacing: 0; color: var(--muted); }
.live { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--verde-t); }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--verde-a); box-shadow: 0 0 0 3px var(--verde-b); }
@media (max-width: 560px) { .brand-sub, .live span.txt { display: none; } }

main { max-width: 1120px; margin: 0 auto; padding: 20px 20px 56px; }

/* Saludo */
.saludo { margin: 8px 0 24px; }
.saludo p { margin: 0 0 4px; color: var(--muted); font-size: 15px; }
.saludo h1 { margin: 0; font-size: clamp(30px, 6vw, 44px); line-height: 1.08; letter-spacing: -0.035em; font-weight: 700; max-width: 20ch; }

/* Botonera */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; } }
.tile {
  position: relative; display: flex; flex-direction: column; justify-content: space-between;
  min-height: 150px; padding: 20px; border-radius: var(--radius); border: 1px solid rgba(255,255,255,.7);
  font: inherit; text-align: left; cursor: pointer; overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -14px rgba(35, 48, 71, .35); }
.tile:active { transform: translateY(0) scale(.99); }
.tile .n { font-size: 54px; font-weight: 800; line-height: 1; letter-spacing: -0.045em; }
.tile .t { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.tile .s { font-size: 14px; opacity: .85; margin-top: 2px; font-weight: 500; }
.tile .ico { position: absolute; top: 18px; right: 18px; width: 26px; height: 26px; opacity: .8; }
.tile.wide { grid-column: span 2; min-height: 168px; }
.badge { position: absolute; top: 18px; right: 18px; background: rgba(255,255,255,.85); font-weight: 700; font-size: 13px; padding: 5px 10px; border-radius: 999px; }
.pulse { position: absolute; top: 24px; right: 24px; width: 12px; height: 12px; border-radius: 50%; background: var(--rojo-t); }
.pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--rojo-t); animation: ring 2.4s ease-out infinite; }
@keyframes ring { from { transform: scale(1); opacity: .7; } to { transform: scale(2.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pulse::after { animation: none; } .tile, .toast { transition: none; animation: none; } }

.next { margin-top: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 18px 20px; border-radius: var(--radius); background: var(--pearl); }
.next .hora { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; min-width: 84px; color: var(--verde-t); }
.next .q { flex: 1 1 220px; }
.next .q b { display: block; font-size: 17px; }
.next .q span { color: var(--muted); font-size: 15px; }

/* Vistas */
.vh { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 4px 0 18px; }
.vh h1 { margin: 0; font-size: clamp(28px, 6vw, 42px); letter-spacing: -0.035em; line-height: 1.05; }
.band { height: 10px; border-radius: 999px; margin: 4px 0 18px; }
.sub { color: var(--muted); }
.sec-t { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin: 30px 0 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); font: 600 15px var(--font); cursor: pointer; background: #fff; color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--cielo-b); border-color: var(--cielo-a); color: var(--cielo-t); }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.card {
  display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: 16px; padding: 16px 18px 16px 12px;
  border-radius: var(--radius); background: #fff; border: 1px solid var(--line); transition: border-color .15s;
}
a.card:hover { border-color: var(--cielo-a); }
.card .bar { border-radius: 999px; }
.card b { display: block; font-size: 17px; letter-spacing: -0.01em; }
.card .eq { color: var(--muted); font-size: 15px; }
.card .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 8px; font-size: 14px; color: var(--muted); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }

.empty { padding: 26px; background: var(--pearl); border-radius: var(--radius); color: var(--muted); }

/* Detalle */
.hero { border-radius: var(--radius); padding: 20px 22px; margin-bottom: 14px; }
.hero .k { font-size: 15px; font-weight: 600; opacity: .9; }
.hero .p { font-size: clamp(30px, 6vw, 42px); font-weight: 800; letter-spacing: -0.04em; line-height: 1.05; margin: 4px 0; }
.box { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; }
.box .lbl { font-size: 14px; color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.box p { margin: 0; font-size: 18px; line-height: 1.4; }
.qa { list-style: none; margin: 0 0 12px; padding: 0; }
.qa li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 2px; border-bottom: 1px solid var(--line); font-size: 15px; }
.qa li span { color: var(--muted); }
.alerta { background: var(--rojo-b); color: var(--rojo-t); border-radius: var(--radius-s); padding: 14px 16px; font-weight: 600; margin-bottom: 12px; }

.prio-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.prio-pick button { min-height: 54px; border-radius: var(--radius-s); border: 2px solid transparent; font: 700 15px var(--font); cursor: pointer; opacity: .55; }
.prio-pick button[aria-pressed="true"] { opacity: 1; border-color: currentColor; }
@media (max-width: 480px) { .prio-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.acciones { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .acciones { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.accion { min-height: 72px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid rgba(255,255,255,.7); font: 700 16px var(--font); text-align: left; cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; }
.accion small { font-weight: 500; font-size: 13px; opacity: .85; }
.accion.peligro { background: #fff; border: 1px solid var(--rojo-a); color: var(--rojo-t); }
.accion.peligro.seguro { background: var(--rojo-a); color: #fff; }

.slots { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 8px 0 14px; }
@media (min-width: 760px) { .slots { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.slots .dia { grid-column: 1 / -1; font-weight: 700; font-size: 15px; margin-top: 8px; color: var(--muted); text-transform: capitalize; }
.slots button { min-height: 54px; border-radius: var(--radius-s); border: 1px solid var(--verde-a); background: #fff; color: var(--verde-t); font: 700 16px var(--font); cursor: pointer; }
.slots button[aria-pressed="true"] { background: linear-gradient(150deg, var(--verde-a), var(--verde-b) 70%); border-color: var(--verde-a); }

.hist { list-style: none; margin: 0; padding: 0; }
.hist li { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 12px; padding: 8px 0; font-size: 15px; }
.hist li::before { content: ""; width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--cielo-a); }
.hist span { color: var(--muted); font-size: 13px; display: block; }

/* Formularios */
.form { display: grid; gap: 14px; max-width: 620px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: 15px; }
.form input, .form select, .form textarea {
  font: 400 17px var(--font); padding: 12px 14px; min-height: 50px; border-radius: var(--radius-s);
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.form input:focus, .form textarea:focus, .form select:focus { border-color: var(--cielo-a); outline: 3px solid var(--cielo-b); }
.cta {
  min-height: 62px; border: 0; border-radius: var(--radius); cursor: pointer;
  background: linear-gradient(120deg, var(--cta-a) 0%, var(--cta-a) 30%, var(--cta-b) 100%);
  color: #fff; font: 700 18px var(--font); letter-spacing: -0.01em;
  transition: transform .15s ease, box-shadow .15s ease;
}
.cta:hover { box-shadow: 0 12px 26px -14px rgba(79, 134, 224, .8); transform: translateY(-1px); }
.cta:active { transform: scale(.99); }
.cta.big { min-height: 76px; font-size: 20px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #fff; color: var(--ink); border: 1px solid var(--line); box-shadow: 0 14px 30px -16px rgba(35,48,71,.45);
  padding: 14px 22px; border-radius: 18px; font-weight: 700; animation: subir .25s ease-out; z-index: 20;
  width: max-content; max-width: calc(100vw - 32px); text-align: center;
}
@keyframes subir { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

.horario { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-radius: var(--radius-s); background: var(--mantequilla-b); color: var(--mantequilla-t); font-weight: 600; margin-bottom: 18px; font-size: 15px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Pie con la web de Maxolan */
.pie { max-width: 1120px; margin: 0 auto; padding: 8px 20px calc(32px + env(safe-area-inset-bottom)); }
.pie a { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 0 20px;
  border-radius: var(--radius); background: linear-gradient(150deg, var(--perla-a) 0%, var(--perla-b) 60%); color: var(--perla-t); font-weight: 700; }
.pie a span { font-weight: 500; color: var(--muted); }
.pie a:hover { filter: saturate(1.2); }

/* Tipografía del primer panel: títulos en Instrument Serif (elegante), resto en Inter */
.brand { font-family: var(--serif); font-weight: 400; font-size: 26px; letter-spacing: 0; }
.brand-sub { font-family: var(--font); }
.saludo h1, .vh h1, .q, .hero .p, .sec-t, .tile .n, .next .hora {
  font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em;
}
.saludo h1 { font-size: clamp(38px, 7vw, 58px); line-height: 1.05; max-width: 26ch; }
.saludo h1 em { font-style: italic; color: var(--muted); }
.vh h1 { font-size: clamp(36px, 6.5vw, 52px); }
.q { font-size: clamp(32px, 6vw, 44px); line-height: 1.1; }
.hero .p { font-size: clamp(40px, 7vw, 56px); }
.sec-t { font-size: 28px; }
.tile .n { font-size: 64px; line-height: .95; }
.next .hora { font-size: 32px; }
.tile .t, .eq, .lz b { letter-spacing: -0.01em; }

/* Albarán */
.albaran { border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; background: #fff; margin-bottom: 16px; }
.alb-cab { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.alb-marca { font-family: var(--serif); font-size: 40px; line-height: 1; }
.alb-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.alb-num { text-align: right; display: grid; gap: 2px; }
.alb-num span { color: var(--muted); font-size: 14px; }
.alb-num b { font-family: var(--serif); font-weight: 400; font-size: 30px; }
.alb-dos { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 18px; }
.alb-l { font-size: 12.5px; color: var(--muted); font-weight: 600; letter-spacing: .02em; margin-bottom: 4px; }
.alb-trabajo { margin: 0 0 18px; font-size: 17px; white-space: pre-line; }
.alb-tabla { width: 100%; border-collapse: collapse; margin-bottom: 22px; font-size: 15px; }
.alb-tabla th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.alb-tabla td { padding: 12px 8px; border-bottom: 1px solid var(--line); }
.alb-tabla td:last-child, .alb-tabla th:last-child { text-align: right; white-space: nowrap; }
.alb-firmas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.alb-linea { height: 56px; border-bottom: 1px solid var(--muted); }
.alb-acciones { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.alb-acciones button[disabled] { opacity: .55; cursor: default; }
@media print {
  .top, .pie, .no-print, .toast { display: none !important; }
  main { padding: 0; max-width: none; }
  .albaran { border: 0; padding: 0; }
  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Selector de isla */
.islas { display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 22px; }
.islas button { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: 600 15px var(--font); cursor: pointer; }
.islas button[aria-pressed="true"] { border-color: transparent; background: linear-gradient(150deg, var(--a, var(--cielo-a)) 0%, var(--b, var(--cielo-b)) 70%); color: var(--t, var(--cielo-t)); }
.isla-pick { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.isla-pick button { min-height: 76px; border-radius: var(--radius); border: 2px solid transparent; font: 400 26px var(--serif); cursor: pointer; }
.isla-pick button[aria-pressed="true"] { opacity: 1; border-color: currentColor; }
