/* Nevalia Turnos — mismo sistema visual que la plataforma Nevalia (docs/BRANDBOOK.md de telemed-webapp).
   Cabecera blanca, barra de navegación azul marino, acción principal en turquesa oscuro, bordes menta.
   La plataforma es sólo clara: aquí tampoco hay modo oscuro, para que se vea igual en todos lados. */
:root {
  /* Paleta oficial */
  --brand-navy: #0D2B45;
  --brand-teal: #0BB39E;       /* relleno de marca, nunca texto */
  --brand-teal-dark: #07806F;  /* la marca cuando es texto o botón principal */
  --brand-mint: #E6F4F1;
  --brand-mint-dark: #C7E3DD;
  --brand-surface: #F5F7FA;
  --n-100: #E8EDF3;
  --n-200: #D3DCE6;
  --n-400: #8497AF;
  --n-500: #5A7391;
  --n-800: #203247;

  /* Roles */
  --bg: var(--brand-surface);
  --surface: #ffffff;
  --surface-2: var(--brand-surface);
  --fg: var(--brand-navy);
  --muted: var(--n-500);
  --line: var(--brand-mint-dark);
  --accent: var(--brand-teal-dark);
  --accent-fg: #ffffff;
  --accent-soft: var(--brand-mint);
  --link: var(--brand-teal-dark);

  /* Navegación (igual que la barra del panel profesional) */
  --nav-fondo: var(--brand-navy);
  --nav-texto: rgba(255, 255, 255, .72);
  --nav-texto-activo: #ffffff;
  --nav-item-hover: rgba(255, 255, 255, .08);
  --nav-item-activo: rgba(255, 255, 255, .12);
  --nav-acento: var(--brand-teal);

  /* Turnos */
  --day: #9A5A0A;          /* accent-amber-strong */
  --day-bg: #FEF3E2;       /* accent-amber-surface */
  --night: #1E40AF;        /* info-strong */
  --night-bg: #EFF6FF;
  --free: var(--n-400);
  --free-bg: var(--n-100);

  /* Estados */
  --good: #15803D;  --good-bg: #ECFDF5;  --good-line: #A7D9BC;
  --warn: #92400E;  --warn-bg: #FEF3C7;  --warn-line: #EBD08A;
  --danger: #991B1B; --danger-bg: #FEE2E2; --danger-line: #F2B8B8;
  --info: #1E40AF;  --info-bg: #EFF6FF;  --info-line: #BFDBFE;

  --elev-1: 0 2px 8px rgba(8, 80, 65, .08);
  --elev-3: 0 8px 28px rgba(8, 80, 65, .13);
  --elev-4: 0 20px 60px rgba(8, 80, 65, .25);
  --shadow: var(--elev-1);

  --font-display: "Manrope", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r-control: 10px;
  --r-card: 14px;
  --r-panel: 20px;
  --radius: var(--r-card);
  --top-h: 60px;
  --nav-h: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; text-wrap: balance; margin: 0; }
h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; font-weight: 700; }
h3 { font-size: .95rem; font-weight: 700; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--link); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand-teal); outline-offset: 2px; }

.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

/* ---------- Ingreso ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px max(16px, env(safe-area-inset-left)) 24px max(16px, env(safe-area-inset-right));
  background:
    radial-gradient(1200px 500px at 50% -200px, var(--brand-mint), transparent 70%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  padding: 32px 28px;
  box-shadow: var(--elev-3);
  display: grid;
  gap: 18px;
}
.auth-alt { border-top: 1px solid var(--line); padding-top: 16px; font-size: .88rem; color: var(--muted); text-align: center; }
.auth-alt a { font-weight: 600; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { width: 40px; height: 40px; object-fit: contain; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; letter-spacing: -.01em; }
.brand-sub { color: var(--muted); font-size: .8rem; }

/* ---------- Estructura ---------- */
.shell { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  min-height: var(--top-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.topbar .brand img { width: 30px; height: 30px; }
.topbar .brand > div { min-width: 0; }
.topbar .brand-name { font-size: 1rem; font-weight: 700; white-space: nowrap; }
.topbar .brand-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who-text { display: grid; text-align: right; min-width: 0; line-height: 1.25; }
.who-text b { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-text span { font-size: .75rem; color: var(--muted); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--brand-teal-dark); color: #fff; font-weight: 700; font-size: .8rem; letter-spacing: .02em;
}
@media (max-width: 560px) { .who-text { display: none; } }

/* Barra de navegación: abajo en el teléfono, a la izquierda en escritorio. Azul marino como el panel. */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--nav-fondo);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  gap: 2px;
}
.nav a {
  position: relative;
  display: grid; justify-items: center; gap: 2px;
  padding: 7px 2px; border-radius: var(--r-control);
  color: var(--nav-texto); text-decoration: none; font-size: .72rem; font-weight: 500;
}
.nav a svg { width: 22px; height: 22px; }
.nav a:hover { background: var(--nav-item-hover); color: var(--nav-texto-activo); }
.nav a[aria-current="page"] { background: var(--nav-item-activo); color: var(--nav-texto-activo); font-weight: 600; }
.nav a[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px;
  border-radius: 0 0 4px 4px; background: var(--nav-acento);
}
.nav-foot { display: none; }

.content {
  max-width: 1040px; margin: 0 auto;
  padding: 24px max(16px, env(safe-area-inset-right)) calc(var(--nav-h) + 32px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: grid; gap: 20px; align-content: start;
}
.content > * { min-width: 0; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 248px 1fr; grid-template-rows: auto 1fr; }
  .topbar { grid-column: 1 / -1; }
  .nav {
    position: sticky; top: var(--top-h); align-self: start; height: calc(100vh - var(--top-h));
    grid-auto-flow: row; grid-auto-rows: max-content; grid-auto-columns: auto;
    align-content: start; padding: 12px 8px; gap: 2px;
  }
  .nav a { grid-auto-flow: column; justify-content: start; align-items: center; gap: 10px; padding: 12px 16px; font-size: .9rem; }
  .nav a svg { width: 20px; height: 20px; }
  .nav a[aria-current="page"]::before { top: 6px; bottom: 6px; left: 0; right: auto; width: 3px; height: auto; border-radius: 0 4px 4px 0; }
  .nav-foot {
    display: block; margin-top: 12px; padding: 12px 16px 0; border-top: 1px solid rgba(255, 255, 255, .12);
    color: var(--nav-texto); font-size: .75rem;
  }
  .content { padding: 32px 32px 48px; width: 100%; }
}

/* ---------- Bloques ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; }
.page-head p { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 20px;
  display: grid; gap: 14px;
  box-shadow: var(--shadow);
}
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.grow { flex: 1 1 auto; }

/* Tarjeta de sección: título, bajada, cuerpo y el botón Guardar al pie de su propia tarjeta */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--shadow); overflow: hidden;
}
.card-head { padding: 20px 20px 0; display: grid; gap: 4px; }
.card-head p { color: var(--muted); font-size: .875rem; }
.card-body { padding: 16px 20px 20px; display: grid; gap: 16px; }
.card-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2);
}
.card-foot .error { margin-right: auto; }

/* Fila de ajuste: qué es a la izquierda, el control a la derecha */
.set-list { display: grid; }
.set-row { display: grid; gap: 8px; padding: 14px 0; border-top: 1px solid var(--n-100); }
.set-row:first-child { border-top: 0; padding-top: 0; }
.set-list:not([hidden]) + .set-list .set-row:first-child { border-top: 1px solid var(--n-100); padding-top: 14px; }
.set-row:last-child { padding-bottom: 0; }
.set-row .set-label { display: grid; gap: 2px; }
.set-row .set-label b { font-size: .9rem; font-weight: 600; }
.set-row .set-label small { color: var(--muted); font-size: .8rem; }
.set-row .set-ctl { min-width: 0; }
@media (min-width: 640px) {
  .set-row { grid-template-columns: minmax(0, 1fr) minmax(180px, 260px); align-items: center; gap: 24px; }
}
.input-unit { position: relative; }
.input-unit input { padding-right: 52px; }
.input-unit > span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; pointer-events: none; }

/* Sub-pestañas (Ajustes) */
.subtabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); padding-bottom: 4px; scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs button {
  flex: none; border: 0; background: transparent; cursor: pointer;
  padding: 10px 16px; border-radius: var(--r-control);
  font-size: .875rem; font-weight: 500; color: var(--n-500); white-space: nowrap;
}
.subtabs button:hover { background: var(--brand-mint); color: var(--n-800); }
.subtabs button[aria-current="true"] { background: var(--brand-mint); color: var(--brand-teal-dark); font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 16px; display: grid; gap: 4px; box-shadow: var(--shadow);
}
.stat .label { font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.stat .value { font-family: var(--font-display); font-size: 1.45rem; font-weight: 800; letter-spacing: -.01em; }
.stat .hint { font-size: .8rem; color: var(--muted); }
.stat.primary { background: var(--brand-navy); border-color: var(--brand-navy); color: #fff; }
.stat.primary .label, .stat.primary .hint { color: rgba(255, 255, 255, .75); }
.stat.owed .value { color: var(--warn); }
.stat.settled .value { color: var(--good); }

.lines { display: grid; gap: 0; }
.lines > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.lines > div:last-child { border-bottom: 0; }
.lines .neg { color: var(--danger); }
.lines .total { font-weight: 700; border-top: 1px solid var(--fg); border-bottom: 0; margin-top: 4px; }

/* ---------- Controles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 6px 14px;
  border-radius: var(--r-control); border: 1px solid var(--line);
  background: var(--surface); color: var(--fg);
  font-weight: 600; font-size: .875rem; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--brand-mint); }
.btn.primary { background: var(--brand-teal-dark); border-color: transparent; color: #fff; }
.btn.primary:hover { background: #0a7364; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--n-100); }
.btn.icon { min-width: 36px; padding: 6px; }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: .82rem; }
.btn.lg { min-height: 46px; padding: 10px 20px; font-size: .95rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }
@media (pointer: coarse) { .btn { min-height: 44px; } .btn.sm { min-height: 36px; } }

.seg { display: inline-flex; background: var(--n-100); border: 1px solid var(--line); border-radius: var(--r-control); padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 8px; font-weight: 500; font-size: .85rem; color: var(--n-500); cursor: pointer; }
.seg button:hover { color: var(--n-800); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); font-weight: 600; box-shadow: var(--elev-1); }

.period-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.period-nav { display: flex; align-items: center; gap: 4px; }
.period-nav .label { font-family: var(--font-display); font-weight: 700; min-width: 0; padding: 0 6px; text-align: center; }

.form { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: .8rem; font-weight: 600; color: var(--n-500); }
.field small { color: var(--muted); font-size: .78rem; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="time"], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: var(--r-control);
  background: var(--surface); color: var(--fg);
}
@media (pointer: coarse) {
  input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="time"], select { min-height: 44px; }
}
input::placeholder, textarea::placeholder { color: var(--n-400); }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-teal); outline-offset: 0; border-color: transparent; }
.check { display: flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand-teal-dark); }
.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.choice label {
  position: relative;
  border: 1px solid var(--line); border-radius: var(--r-control); padding: 14px 14px 14px 44px; cursor: pointer;
  display: grid; gap: 2px; background: var(--surface);
}
.choice label::before {
  content: ""; position: absolute; left: 14px; top: 16px; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--n-400); background: var(--surface);
}
.choice label:hover { background: var(--brand-mint); }
.choice label:has(input:checked) { border-color: var(--brand-teal-dark); background: var(--brand-mint); box-shadow: inset 0 0 0 1px var(--brand-teal-dark); }
.choice label:has(input:checked)::before { border-color: var(--brand-teal-dark); background: radial-gradient(circle, var(--brand-teal-dark) 0 4px, var(--surface) 5px); }
.choice label:has(input:focus-visible) { outline: 2px solid var(--brand-teal); outline-offset: 2px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice b { font-size: .92rem; font-weight: 600; }
.choice span { font-size: .8rem; color: var(--muted); }
.error { color: var(--danger); font-size: .875rem; }
.error:empty { display: none; }

/* Interruptor */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .9rem; }
.switch input { appearance: none; -webkit-appearance: none; margin: 0; flex: none; width: 40px; height: 24px; border-radius: 999px; background: var(--n-200); position: relative; cursor: pointer; transition: background-color .2s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(13, 43, 69, .25); transition: transform .2s; }
.switch input:checked { background: var(--brand-teal-dark); }
.switch input:checked::after { transform: translateX(16px); }

/* Feriados como fichas */
.hol-year { display: grid; gap: 8px; }
.hol-year h3 { font-size: .8rem; color: var(--muted); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.hol-list { display: flex; flex-wrap: wrap; gap: 6px; }
.hol-chip {
  display: inline-flex; align-items: center; gap: 2px; padding: 0 2px 0 10px; height: 30px;
  border-radius: 999px; background: var(--brand-mint); color: var(--fg); font-size: .8rem; font-weight: 500;
}
.hol-chip.past { background: var(--n-100); color: var(--muted); }
.hol-chip button { border: 0; background: transparent; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.hol-chip button:hover { background: rgba(13, 43, 69, .08); color: var(--danger); }
.hol-add { display: flex; gap: 8px; flex-wrap: wrap; }
.hol-add input { max-width: 200px; }

/* ---------- Turnos ---------- */
.chip {
  display: inline-grid; place-items: center;
  min-width: 26px; height: 24px; padding: 0 7px;
  border-radius: 6px; font-weight: 700; font-size: .78rem;
}
.chip.D { background: var(--day-bg); color: var(--day); }
.chip.N { background: var(--night-bg); color: var(--night); }
.chip.L { background: var(--free-bg); color: var(--free); }
.chip.none { background: transparent; color: var(--muted); }

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .8rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

.upcoming { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.upcoming .u {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: grid; gap: 4px; justify-items: center;
  font-size: .75rem; color: var(--muted); background: var(--surface-2);
}
.upcoming .u.today { border-color: var(--accent); }
.upcoming .u b { color: var(--fg); font-size: .85rem; }

.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.month .dow { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: center; padding: 4px 0; }
.month .cell {
  min-height: 64px; border-radius: 10px; padding: 6px;
  background: var(--surface-2); border: 1px solid var(--line);
  display: grid; align-content: space-between; gap: 4px; position: relative;
}
.month .cell.D { background: var(--day-bg); border-color: transparent; }
.month .cell.N { background: var(--night-bg); border-color: transparent; }
.month .cell.blank { background: transparent; border: 0; }
.month .cell.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.month .num { font-size: .8rem; font-weight: 600; }
.month .cell.hol .num { color: var(--danger); }
.month .sh { font-size: .72rem; font-weight: 700; }
.month .cell.D .sh { color: var(--day); }
.month .cell.N .sh { color: var(--night); }
.month .cell.L .sh { color: var(--free); }
.month .ov { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
@media (max-width: 480px) {
  .month { gap: 3px; }
  .month .cell { min-height: 52px; padding: 4px; border-radius: 8px; }
  .month .sh { font-size: .64rem; }
}

.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
td.num, th.num { text-align: right; }
tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 700; background: var(--surface-2); }

.team-grid th, .team-grid td { padding: 4px; text-align: center; font-size: .75rem; }
.team-grid th.name, .team-grid td.name {
  text-align: left; position: sticky; left: 0; z-index: 1; background: var(--surface);
  padding: 4px 10px; font-size: .82rem; max-width: 140px; overflow: hidden; text-overflow: ellipsis;
}
.team-grid th.hol { color: var(--danger); }
.team-grid th.today { background: var(--accent-soft); color: var(--accent); }
.team-grid td button {
  width: 28px; height: 26px; border-radius: 6px; border: 0; font-weight: 700; font-size: .72rem; cursor: default; position: relative;
}
.team-grid.editable td button { cursor: pointer; }
.team-grid td button.D { background: var(--day-bg); color: var(--day); }
.team-grid td button.N { background: var(--night-bg); color: var(--night); }
.team-grid td button.L { background: transparent; color: var(--free); }
.team-grid td button.none { background: transparent; color: var(--line); }
.team-grid td button.bad { box-shadow: inset 0 0 0 2px var(--danger); }
.team-grid td button.ov::after { content: ""; position: absolute; top: 2px; right: 2px; width: 5px; height: 5px; border-radius: 50%; background: var(--warn); }
.team-grid tfoot td { font-size: .7rem; color: var(--muted); font-weight: 600; }
.team-grid tfoot td.gap { color: var(--danger); }

.members { display: grid; gap: 8px; }
.member {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface-2);
}
.member .pos { font-family: var(--font-display); font-weight: 800; color: var(--muted); width: 22px; text-align: center; }
.member .info { min-width: 0; display: grid; gap: 2px; }
.member .info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member .info span { font-size: .8rem; color: var(--muted); }
.member .acts { display: flex; gap: 2px; }
.member.inactive { opacity: .55; }
.tag { display: inline-block; font-size: .7rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--brand-mint); color: var(--brand-teal-dark); vertical-align: middle; }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.good { background: var(--good-bg); color: var(--good); }

.cycle { display: flex; flex-wrap: wrap; gap: 4px; }

.notice { border-radius: var(--r-control); padding: 10px 14px; font-size: .875rem; background: var(--info-bg); color: var(--info); border: 1px solid var(--info-line); }
.notice.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.notice.good { background: var(--good-bg); color: var(--good); border-color: var(--good-line); }

.empty { color: var(--muted); text-align: center; padding: 22px 8px; font-size: .9rem; }

/* ---------- Diálogo y toast ---------- */
dialog {
  border: 1px solid var(--line); border-radius: var(--r-panel); padding: 0;
  background: var(--surface); color: var(--fg);
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
  box-shadow: var(--elev-4);
}
dialog::backdrop { background: rgba(13, 43, 69, .55); }
dialog .dlg { display: grid; gap: 16px; padding: 20px; }
dialog .dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
dialog .dlg-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
dialog .dlg-foot .left { margin-right: auto; }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); z-index: 50;
  background: var(--brand-navy); color: #fff; padding: 10px 16px; border-radius: var(--r-control);
  font-size: .9rem; font-weight: 500; max-width: calc(100vw - 32px); box-shadow: var(--shadow);
}
#toast.err { background: var(--danger); color: #fff; }

/* ---------- Hoja imprimible (PDF) ---------- */
#print-area { display: none; }
@page { size: A4 landscape; margin: 9mm; }
@media print {
  html.printing body > *:not(#print-area) { display: none !important; }
  html.printing, html.printing body { background: #fff !important; color: #0D2B45; }
  html.printing #print-area { display: block; }
  #print-area {
    font: 9pt/1.3 "Inter", system-ui, sans-serif; color: #0D2B45;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  #print-area .p-head {
    display: flex; justify-content: space-between; align-items: flex-end; gap: 12mm;
    padding-bottom: 3mm; margin-bottom: 4mm; border-bottom: 2px solid #0BB39E;
  }
  #print-area .p-brand { display: flex; align-items: center; gap: 3mm; }
  #print-area .p-brand img { width: 12mm; height: 12mm; object-fit: contain; }
  #print-area .p-app { font: 800 13pt "Manrope", "Inter", sans-serif; letter-spacing: -.01em; }
  #print-area .p-team { color: #5A7391; font-size: 9pt; }
  #print-area .p-title { text-align: right; }
  #print-area .p-title h1 { font: 800 16pt "Manrope", "Inter", sans-serif; margin: 0; }
  #print-area .p-title p { color: #5A7391; margin: 1mm 0 0; }

  #print-area .p-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
  #print-area .p-grid th, #print-area .p-grid td {
    border: 0.5pt solid #D3DCE6; text-align: center; padding: 1.2mm 0; font-size: 8pt; white-space: nowrap; background: none;
    text-transform: none; letter-spacing: 0; color: #0D2B45;
  }
  #print-area .p-grid .who { width: 26mm; text-align: left; padding-left: 2mm; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
  #print-area .p-grid .t { width: 11mm; font-weight: 600; }
  #print-area .p-grid .t.b { background: #E6F4F1; }
  #print-area .p-grid thead th { background: #0D2B45; color: #fff; font-weight: 500; font-size: 6.5pt; line-height: 1.15; border-color: #0D2B45; }
  #print-area .p-grid thead th b { display: block; font-size: 8.5pt; font-weight: 700; }
  #print-area .p-grid thead th.wk { background: #203247; }
  #print-area .p-grid thead th.hol b { color: #FCA5A5; }
  #print-area .p-grid td.c { font-weight: 700; position: relative; height: 8mm; font-size: 9pt; }
  #print-area .p-grid tbody .who { font-size: 9pt; }
  #print-area .p-grid td.wk { background: #F5F7FA; }
  #print-area .p-grid td.D { background: #FEF3E2; color: #9A5A0A; }
  #print-area .p-grid td.N { background: #E3EBFD; color: #1E40AF; }
  #print-area .p-grid td.L { color: #8497AF; font-weight: 500; }
  #print-area .p-grid td.c i { font-style: normal; color: #92400E; font-size: 7pt; vertical-align: super; line-height: 0; }
  #print-area .p-grid tbody tr { break-inside: avoid; }
  #print-area .p-grid tfoot th, #print-area .p-grid tfoot td { color: #5A7391; font-weight: 500; font-size: 7pt; }
  #print-area .p-grid tfoot td.gap { background: #FEE2E2; color: #991B1B; font-weight: 700; }

  #print-area .p-foot { display: flex; justify-content: space-between; gap: 8mm; margin-top: 4mm; color: #5A7391; font-size: 8pt; }
  #print-area .p-legend { display: flex; gap: 5mm; align-items: center; }
  #print-area .p-legend span { display: inline-flex; align-items: center; gap: 1.5mm; }
  #print-area .sw { display: inline-block; width: 5mm; text-align: center; font-style: normal; font-weight: 700; border-radius: 1mm; border: 0.5pt solid #D3DCE6; }
  #print-area .sw.D { background: #FEF3E2; color: #9A5A0A; }
  #print-area .sw.N { background: #E3EBFD; color: #1E40AF; }
  #print-area .sw.L { color: #8497AF; }
  #print-area .p-legend .hol { color: #991B1B; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .nav a, .seg button { transition: background-color .15s, color .15s, filter .15s; }
}
