/* Colores de La Barra de Consuelo: terracota, crema y oro. */
:root {
  --brand: #9f4e30;
  --brand-deep: #7e3a22;
  --cream: #f7ebda;
  --gold: #c9a24a;
  --bg: #f5ebdd;
  --surface: #fffaf3;
  --surface-2: #efe2cf;
  --ink: #2b1a12;
  --muted: #7a6152;
  --line: #e4d3bd;
  --accent: #9f4e30;
  --accent-ink: #fff8ee;
  --accent-soft: #f3dccd;
  --danger: #b42318;
  --ok: #18794e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(43, 26, 18, .06), 0 6px 20px rgba(43, 26, 18, .07);
  --watermark: .07;
  --font-display: "Cinzel", Georgia, serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand-deep: #5e2a17;
    --bg: #1a120e;
    --surface: #251a15;
    --surface-2: #30231c;
    --ink: #f7ebda;
    --muted: #b9a08c;
    --line: #3d2d24;
    --accent: #e08a63;
    --accent-ink: #1a120e;
    --accent-soft: #3f2519;
    --danger: #f97066;
    --ok: #4ade80;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --watermark: .05;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
}
/* Silueta dorada del logo como marca de agua. */
body::before {
  content: ""; position: fixed; z-index: -1; pointer-events: none;
  right: -18vmin; bottom: -12vmin; width: 95vmin; height: 75vmin;
  background: url("img/silueta-oro.webp") no-repeat center / contain;
  opacity: var(--watermark);
}
body.auth-page { background: radial-gradient(120% 80% at 50% 0%, var(--brand) 0%, var(--brand-deep) 100%) fixed; }
body.auth-page::before { right: -30vmin; bottom: -8vmin; width: 130vmin; height: 100vmin; opacity: .2; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-family: var(--font-display); font-weight: 600; letter-spacing: .02em; }
small, .muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

#app { max-width: 1200px; margin: 0 auto; padding: 0 16px calc(32px + env(safe-area-inset-bottom)); }

/* ---------- Botones y campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); cursor: pointer; font-weight: 600; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.icon { width: 44px; padding: 0; font-size: 20px; }
.btn:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

label.field { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
label.field > span { color: var(--muted); }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=number], input[inputmode], select {
  width: 100%; min-height: 46px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  font-weight: 400;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack { display: grid; gap: 14px; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

/* ---------- Acceso ---------- */
.auth {
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 28px; padding: calc(32px + env(safe-area-inset-top)) 0 32px;
}
.auth-logo { width: min(240px, 62vw); height: auto; display: block; filter: drop-shadow(0 4px 18px rgba(0, 0, 0, .18)); }
.auth-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid rgba(201, 162, 74, .35);
  border-radius: 22px; padding: 26px 24px 22px; box-shadow: 0 24px 60px rgba(40, 14, 4, .35);
}
.brand { text-align: center; margin-bottom: 18px; }
.brand h1 { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: .06em; }
.brand small { display: block; margin-top: 4px; }
.brand::after { content: ""; display: block; width: 56px; height: 2px; margin: 12px auto 0; background: var(--gold); border-radius: 2px; }
.form-error { color: var(--danger); font-size: 14px; min-height: 20px; margin: 0; }

/* ---------- Cabecera ---------- */
/* Banda terracota a todo el ancho aunque el contenido esté centrado. */
.top {
  position: sticky; top: 0; z-index: 5; margin-bottom: 18px;
  display: flex; align-items: center; gap: 14px;
  padding: calc(10px + env(safe-area-inset-top)) 0 10px;
  background: var(--brand); color: var(--cream);
  box-shadow: 0 0 0 100vmax var(--brand); clip-path: inset(0 -100vmax);
}
.top .logo { height: 46px; width: auto; flex: none; }
.top .who { flex: 1; min-width: 0; padding-left: 14px; border-left: 1px solid rgba(247, 235, 218, .3); }
.top .who small { display: block; font-size: 12px; color: var(--gold); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.top .who strong { display: block; font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .btn { background: rgba(255, 255, 255, .1); border-color: rgba(247, 235, 218, .35); color: var(--cream); }
.top .btn:hover { background: rgba(255, 255, 255, .18); border-color: var(--cream); }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; margin-bottom: 16px; }
.tabs button {
  flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent;
  font-weight: 600; color: var(--muted); cursor: pointer;
}
.tabs button[aria-selected=true] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.weeknav { display: flex; align-items: center; gap: 8px; }
.weeknav .label { flex: 1; text-align: center; font-weight: 700; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.toolbar .weeknav { flex: 1 1 280px; }
.toolbar .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }

/* ---------- Vista del trabajador ---------- */
.next {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%); color: var(--cream);
  border-radius: 20px; padding: 20px 22px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.next::after {
  content: ""; position: absolute; right: -36px; bottom: -30px; width: 190px; height: 150px;
  background: url("img/silueta-oro.webp") no-repeat center / contain; opacity: .28; pointer-events: none;
}
.next > * { position: relative; z-index: 1; }
.next small { color: var(--gold); text-transform: uppercase; letter-spacing: .1em; font-size: 12px; font-weight: 700; }
.next .when { font-family: var(--font-display); font-size: 22px; font-weight: 600; margin-top: 4px; letter-spacing: .02em; }
.next .hours { font-size: 34px; font-weight: 800; letter-spacing: -.01em; }

.week-sum { display: flex; justify-content: space-between; margin: 10px 2px 12px; font-size: 14px; }
.days { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.day {
  display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
}
.day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.day.off { background: transparent; }
.day .dname { text-align: center; }
.day .dname small { display: block; font-size: 12px; text-transform: uppercase; font-weight: 700; }
.day .dname b { font-size: 22px; }
.day .dshifts { display: grid; gap: 6px; align-self: center; }
.shift-line { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.shift-line b { font-size: 18px; }
.tag { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.note { font-size: 14px; color: var(--muted); }

/* ---------- Cuadrante (admin) ---------- */
.grid-wrap {
  overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  -webkit-overflow-scrolling: touch;
}
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 980px; table-layout: fixed; }
.grid th, .grid td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: top; }
.grid thead th { padding: 10px 6px; font-size: 13px; text-align: center; background: var(--surface-2); position: sticky; top: 0; }
.grid thead th.today { color: var(--accent); }
.grid thead th b { display: block; font-size: 18px; }
.grid .who-col { width: 150px; position: sticky; left: 0; z-index: 2; background: var(--surface); text-align: left; }
.grid thead .who-col { background: var(--surface-2); z-index: 3; }
.grid .tot-col { width: 92px; text-align: right; padding: 10px; font-size: 14px; }
.grid tbody th.who-col { padding: 10px; font-weight: 600; }
.grid tbody th.who-col small { display: block; font-weight: 400; font-size: 12px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; background: var(--c); }
.cell { padding: 4px; min-height: 64px; height: 64px; cursor: pointer; }
.cell:hover { background: var(--surface-2); }
.cell.drop { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: -3px; }
.cell .add { display: block; text-align: center; color: var(--muted); font-size: 20px; line-height: 40px; opacity: 0; }
.cell:hover .add, .cell:focus-visible .add { opacity: 1; }
@media (hover: none) { .cell .add { opacity: .35; } }
.chip {
  display: block; margin-bottom: 4px; padding: 5px 6px; border-radius: 8px;
  background: color-mix(in srgb, var(--c) 16%, var(--surface)); border-left: 4px solid var(--c);
  font-size: 13px; line-height: 1.25; cursor: grab;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.chip b { display: block; font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -.01em; }
.chip span { color: var(--muted); font-size: 12px; }
.chip .adj { display: block; font-style: normal; font-size: 11px; font-weight: 800; color: var(--accent); }
.chip.dragging { opacity: .35; }
.drag-ghost { position: fixed; z-index: 50; pointer-events: none; width: 120px; box-shadow: 0 8px 24px rgba(0,0,0,.25); transform: rotate(-2deg); }
.grid tfoot td, .grid tfoot th { padding: 10px 6px; font-size: 13px; text-align: center; background: var(--surface-2); border-bottom: 0; }
.grid tfoot th.who-col { text-align: left; }
.hint { font-size: 13px; color: var(--muted); margin: 10px 2px 0; }

/* ---------- Novedades, fichaje y avisos ---------- */
.badge { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; vertical-align: middle; }
.badge.new { background: var(--gold); color: #2b1a12; }
.badge.changed { background: var(--accent); color: var(--accent-ink); }
.next .badge.changed { background: var(--cream); color: var(--brand); }
.updates { margin-bottom: 14px; border-color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, var(--surface)); }
.updates ul { margin: 8px 0 12px; padding-left: 20px; }
.updates li { margin: 4px 0; }
.clock-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.btn.clock { margin-top: 14px; min-height: 52px; padding: 0 22px; font-size: 17px; background: var(--cream); color: var(--brand); border-color: var(--cream); }
.clock-row .btn.clock { margin-top: 0; flex: 1; }
.btn.clock.ghost-light { background: transparent; color: var(--cream); border-color: rgba(247, 235, 218, .5); }
.clocked { margin: 12px 0 0; font-weight: 700; color: var(--gold); }
.warnings { margin-bottom: 12px; border-color: var(--danger); background: color-mix(in srgb, var(--danger) 7%, var(--surface)); }
.warnings b { color: var(--danger); }
.warnings ul { margin: 6px 0 0; padding-left: 20px; font-size: 14px; }
.chip.warn { box-shadow: inset 0 0 0 2px var(--danger); }
.btn.small { min-height: 34px; padding: 0 10px; font-size: 13px; }
.hours-table td small.src { display: block; font-size: 11px; color: var(--muted); }
.backup-box { padding: 14px; border-radius: 12px; background: var(--surface-2); }
.backup-box p { margin: 4px 0 10px; font-size: 14px; }

/* ---------- Impresión (cuadrante y registro de jornada) ---------- */
#print { display: none; }
@media print {
  @page { margin: 14mm; }
  body.printing { background: #fff !important; color: #000; }
  body.printing::before, body.printing > :not(#print) { display: none !important; }
  body.printing #print { display: block; }
}
.doc { font: 11pt/1.4 "Manrope", system-ui, sans-serif; color: #000; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; border-bottom: 2px solid #9f4e30; padding-bottom: 10px; margin-bottom: 14px; }
.doc-head h1 { font-family: var(--font-display); font-size: 20pt; color: #9f4e30; }
.doc-head p { margin: 2px 0 0; }
.doc-meta { text-align: right; font-size: 10pt; }
.doc-table { width: 100%; border-collapse: collapse; }
.doc-table th, .doc-table td { border: 1px solid #999; padding: 5px 7px; text-align: left; vertical-align: top; }
.doc-table thead th { background: #f3e6d6; }
.doc-table tfoot td { font-weight: 800; }
.doc-table.week { table-layout: fixed; font-size: 9.5pt; }
.doc-table.week .off { color: #888; }
.signs { display: flex; gap: 40px; margin-top: 50px; }
.signs div { flex: 1; border-top: 1px solid #000; padding-top: 6px; font-size: 10pt; }
.doc-note { font-size: 9pt; color: #555; margin-top: 16px; }

/* ---------- Hoy ---------- */
.shifts-today { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.shift-card { display: grid; gap: 12px; align-content: start; }
.sc-head { display: flex; align-items: center; gap: 12px; }
.sc-head .info { flex: 1; min-width: 0; }
.sc-head .info b { display: block; font-size: 17px; }
.sc-head .info small { display: block; font-size: 13px; }
.sc-adjust { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; }
.sc-adjust .muted { margin-right: 4px; font-weight: 600; }
.sc-adjust .btn { flex: 1; min-height: 40px; min-width: 52px; padding: 0 8px; font-size: 15px; font-variant-numeric: tabular-nums; }
.sc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.sc-foot b { font-size: 18px; }
.diff {
  display: inline-block; font-size: 13px; font-weight: 800; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); white-space: nowrap; vertical-align: middle;
}
.diff.plus { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); color: var(--ok); }
.diff.minus { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.shift-card .reset { justify-self: start; min-height: 32px; padding: 0; color: var(--accent); font-size: 14px; }

/* ---------- Equipo ---------- */
.people { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.person { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--c); color: #fff; font-weight: 800;
}
.person .info { flex: 1; min-width: 0; }
.person .info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches label { position: relative; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 34px; height: 34px; border-radius: 50%; background: var(--c); border: 3px solid transparent; cursor: pointer; }
.swatches input:checked + span { border-color: var(--ink); }
.swatches input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Resumen ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 14px; }
.filters label.field { flex: 1 1 140px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.quick .btn { min-height: 36px; font-size: 14px; }
table.summary { width: 100%; border-collapse: collapse; }
.summary th, .summary td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: right; }
.summary th:first-child, .summary td:first-child { text-align: left; }
.summary thead th { font-size: 13px; color: var(--muted); font-weight: 600; }
.summary tfoot td { font-weight: 800; border-bottom: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat small { display: block; font-size: 13px; }
.stat b { font-size: 26px; }

/* ---------- Diálogo y avisos ---------- */
dialog {
  width: min(480px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0;
  border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
}
dialog::backdrop { background: rgba(20, 16, 12, .5); }
dialog form { padding: 22px 20px 20px; }
dialog h2 { font-size: 20px; margin-bottom: 16px; }
.dialog-actions { display: flex; gap: 8px; justify-content: space-between; margin-top: 20px; flex-wrap: wrap; }
.dialog-actions .end { display: flex; gap: 8px; margin-left: auto; }
.duration { font-size: 14px; color: var(--muted); margin: 0; }

#toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 100; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--danger); color: #fff; }

@media (max-width: 600px) {
  .hide-sm { display: none; }
  .toolbar .actions { width: 100%; }
  .toolbar .actions .btn { flex: 1; }
  .grid .who-col { width: 112px; }
  .summary .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }

/* =========================================================
   Capa visual: iconos, navegación tipo app y detalles
   ========================================================= */
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn .ico { width: 18px; height: 18px; }
.btn.icon .ico { width: 22px; height: 22px; }
.btn.primary { box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.card-title { display: flex; align-items: center; gap: 8px; }
.card-title .ico { color: var(--accent); }
.card { box-shadow: 0 1px 2px rgba(43, 26, 18, .04); }

/* Cabecera */
.top .who strong { font-family: var(--font-display); font-weight: 600; letter-spacing: .02em; }
.btn.account .ico { width: 20px; height: 20px; }

/* Pestañas con icono */
.tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: background .15s, color .15s; }
.tabs button[aria-selected=true] { color: var(--accent); }

/* Navegación de semana / día */
.weeknav .label { line-height: 1.2; }
.weeknav .label small { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); font-weight: 800; }

/* Carga y entrada de vistas */
.skel { display: grid; gap: 12px; }
.skel i {
  display: block; height: 84px; border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface) 50%, var(--surface-2) 100%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite linear;
}
.skel i:first-child { height: 130px; }
@keyframes shimmer { to { background-position: -200% 0; } }
#view.fresh > :not(.skel) { animation: rise .3s ease-out both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* Estadísticas con icono */
.stat { position: relative; }
.stat > .ico { position: absolute; top: 14px; right: 14px; width: 22px; height: 22px; color: var(--accent); opacity: .55; }
.stat small { padding-right: 26px; }

/* Etiquetas y estados */
.tag { display: inline-flex; align-items: center; gap: 4px; }
.tag .ico { width: 12px; height: 12px; stroke-width: 3; }
.tag.warn { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.status {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap;
}
.status.live { background: color-mix(in srgb, var(--ok) 15%, var(--surface)); color: var(--ok); }
.status.soon { background: color-mix(in srgb, var(--gold) 22%, var(--surface)); color: color-mix(in srgb, var(--gold) 55%, var(--ink)); }
.status.done { background: var(--surface-2); color: var(--muted); }
.pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; animation: pulse 1.6s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); }
  100% { box-shadow: 0 0 0 9px transparent; }
}

/* ---------- Trabajador ---------- */
.next small { display: flex; align-items: center; gap: 8px; }
.next .hours { line-height: 1.15; margin-top: 2px; }
.next-meta { opacity: .92; margin-top: 4px; }
.next-note { margin-top: 12px; padding: 9px 12px; border-radius: 10px; background: rgba(0, 0, 0, .16); font-size: 14px; }
.countdown { display: inline-block; margin-top: 14px; padding: 6px 14px; border-radius: 999px; background: rgba(255, 255, 255, .15); font-weight: 700; font-size: 14px; }
.progress { height: 8px; margin-top: 16px; border-radius: 99px; background: rgba(255, 255, 255, .2); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--gold); }
.btn.clock .ico { width: 20px; height: 20px; }
.clocked { display: flex; align-items: center; gap: 6px; }
.clocked .ico { width: 18px; height: 18px; stroke-width: 3; }

.week-sum { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start; margin: 12px 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
.pill .ico { width: 16px; height: 16px; color: var(--accent); }

.day { grid-template-columns: 52px 1fr; }
.day .dname { background: var(--surface-2); border-radius: 10px; padding: 6px 0; }
.day.off .dname { background: transparent; }
.day.today .dname { background: var(--accent); color: var(--accent-ink); }
.day.today .dname small { color: inherit; }
.day:not(.off) { border-left: 4px solid var(--accent); }
.day.past { opacity: .6; }

/* ---------- Hoy ---------- */
.shift-card { border-top: 4px solid var(--c); min-width: 0; }
/* iPhone da a los campos de hora un ancho mínimo propio que se sale de la tarjeta. */
.row > * { min-width: 0; }
input[type=time], input[type=date] { -webkit-appearance: none; appearance: none; min-width: 0; display: block; text-align: left; }
input::-webkit-date-and-time-value { text-align: left; }
.shift-card .info b { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.shift-card .info .tag { margin-top: 4px; }
.finish-menu { display: grid; gap: 8px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.finish-menu[hidden] { display: none; }
.finish-menu > small { font-weight: 700; color: var(--muted); }
.fm-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.fm-grid .btn { flex-direction: column; gap: 0; min-height: 52px; padding: 4px; line-height: 1.15; }
.fm-grid .btn b { font-size: 15px; }
.fm-grid .btn small { font-size: 12px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.finish-menu .btn.now { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.btn.finish[aria-expanded=true] { background: var(--danger); color: #fff; }
.btn.finish { width: 100%; margin-top: -2px; border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); color: var(--danger); background: color-mix(in srgb, var(--danger) 6%, var(--surface)); }
.btn.finish:hover { border-color: var(--danger); }
.shift-card .reset { display: inline-flex; align-items: center; gap: 6px; }
.shift-card .reset .ico { width: 16px; height: 16px; }

.timeline { margin-bottom: 14px; }
.tl-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.tl-legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.tl-legend i { display: inline-block; width: 16px; height: 9px; border-radius: 4px; }
.lg-plan { border: 1.5px dashed var(--accent); margin-left: 8px; }
.lg-real { background: var(--accent); }
.tl { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; }
.tl-names { display: grid; grid-template-rows: 24px; grid-auto-rows: 46px; font-size: 13px; font-weight: 700; }
.tl-names span { align-self: start; padding-top: 3px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-area { position: relative; display: grid; grid-template-rows: 24px; grid-auto-rows: 46px; }
.tl-axis { position: relative; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-axis span { position: absolute; top: 3px; transform: translateX(-50%); }
.tl-grid { position: absolute; top: 24px; bottom: 0; width: 1px; background: var(--line); }
.tl-track { position: relative; }
.tl-plan, .tl-bar { position: absolute; border-radius: 8px; font-style: normal; }
.tl-plan { top: 3px; height: 20px; border: 1.5px dashed color-mix(in srgb, var(--c) 80%, transparent); background: transparent; }
.tl-bar { top: 6px; height: 14px; min-width: 4px; background: var(--c); box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.tl-label {
  position: absolute; top: 25px; left: 0; right: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums;
}
.tl-label b { color: var(--ink); }
.tl-label em { font-style: normal; }
.tl-label em.plus { color: var(--ok); }
.tl-label em.minus { color: var(--danger); }
.tl-now { position: absolute; top: 20px; bottom: 0; width: 2px; margin-left: -1px; background: var(--danger); z-index: 2; border-radius: 2px; }
.tl-now span {
  position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
  padding: 1px 6px; border-radius: 6px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 800; font-variant-numeric: tabular-nums;
}

.empty { display: grid; justify-items: center; gap: 8px; padding: 40px 20px; text-align: center; }
.empty .ico { width: 44px; height: 44px; color: var(--gold); stroke-width: 1.5; }
.empty p { margin: 0; max-width: 360px; }

/* ---------- Cuadrante ---------- */
.who-in { display: flex; align-items: center; gap: 8px; }
.who-in > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.avatar.sm { width: 28px; height: 28px; font-size: 13px; }
.grid thead th.today { background: var(--accent); color: var(--accent-ink); }
.grid thead th em { display: block; font-style: normal; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.grid td.weekend { background: color-mix(in srgb, var(--surface-2) 35%, var(--surface)); }
.grid td.is-today { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.grid td.cell:hover { background: var(--surface-2); }
.chip { box-shadow: 0 1px 2px rgba(0, 0, 0, .05); transition: transform .12s, box-shadow .12s; }
.chip:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0, 0, 0, .1); }
.warnings .card-title .ico { color: var(--danger); }

/* ---------- Equipo ---------- */
.section-head h2 { display: flex; align-items: center; gap: 10px; }
.count { font: 700 13px/1 "Manrope", sans-serif; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.person { border-left: 4px solid var(--c); }
.person .info small { display: block; margin-top: 2px; }

/* ---------- Resumen ---------- */
.bars { display: grid; gap: 10px; margin-bottom: 14px; }
.bar-row { display: grid; grid-template-columns: minmax(64px, 140px) 1fr auto; align-items: center; gap: 12px; font-size: 14px; }
.bar-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 12px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar-track i { display: block; height: 100%; border-radius: inherit; background: var(--c); transform-origin: left; animation: grow .7s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes grow { from { transform: scaleX(0); } }
.bar-val { font-weight: 800; min-width: 56px; text-align: right; }
.summary td.num { white-space: nowrap; }
.summary td .avatar.sm { display: inline-grid; vertical-align: middle; margin-right: 8px; }
.summary .btn.small .ico { width: 16px; height: 16px; }

/* ---------- WhatsApp ---------- */
.btn.wa { background: #25d366; border-color: #25d366; color: #fff; text-decoration: none; }
.btn.wa:hover { background: #1fb457; border-color: #1fb457; }
.btn.wa.sent { background: var(--surface-2); border-color: var(--line); color: var(--ok); }
.wa-preview {
  margin: 0; max-height: 240px; overflow: auto; padding: 12px 14px; border-radius: 12px;
  background: #e7f8dc; color: #1c2b20; font: 13px/1.45 "Manrope", system-ui, sans-serif; white-space: pre-wrap;
}
.small-note { margin: 0; font-size: 13px; }
dialog { overflow-x: hidden; }
dialog .stack { grid-template-columns: minmax(0, 1fr); }
dialog .btn { white-space: normal; text-align: center; }
.send-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.send-list .btn.wa { flex: none; white-space: nowrap; }
.send-list li { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; border: 1px solid var(--line); border-radius: 12px; }
.send-list .avatar { background: var(--c); }
.send-list .who-txt { flex: 1; min-width: 0; }
.send-list .who-txt b, .send-list .who-txt small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.send-list .btn.wa { min-height: 40px; padding: 0 14px; }

/* ---------- Móvil: barra de pestañas abajo, como una app ---------- */
@media (max-width: 700px) {
  #app { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
  .tabs {
    position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; margin: 0; gap: 2px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(43, 26, 18, .1);
  }
  .tabs button { flex-direction: column; gap: 3px; min-height: 56px; font-size: 12px; }
  .tabs button .ico { width: 24px; height: 24px; margin: 3px 0; }
  .tabs button[aria-selected=true] { background: transparent; box-shadow: none; }
  .tabs button[aria-selected=true] .ico { width: 56px; height: 30px; margin: 0; padding: 4px 0; border-radius: 99px; background: var(--accent-soft); }
  #toast { bottom: calc(92px + env(safe-area-inset-bottom)); }
  .btn.account { width: 44px; padding: 0; }
  .btn.account span { display: none; }
  .top .logo { height: 40px; }
  .top .who strong { font-size: 15px; }
  .top { margin-bottom: 14px; }
  .tl-names span { max-width: 72px; }
}
@media (max-width: 600px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat b { font-size: 22px; }
}

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