:root {
  --bg: #0f172a; --panel: #1e293b; --line: #334155; --text: #e2e8f0; --muted: #94a3b8;
  --working: #16a34a; --idle: #f59e0b; --paused: #6366f1; --finished: #64748b; --notstarted: #475569;
  --danger: #dc2626; --accent: #0ea5e9;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .75rem 1rem; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; }
.topbar nav { display: flex; gap: 1rem; align-items: center; }
.topbar a { color: var(--text); text-decoration: none; }
.topbar .who { color: var(--muted); }
main { padding: 1rem; }

.alert { background: #7f1d1d; color: #fee2e2; padding: .75rem 1rem; border-radius: .5rem; }
.panel, .shiftbar { background: var(--panel); border: 1px solid var(--line);
  border-radius: .75rem; padding: 1rem; margin-bottom: 1rem; }
.shiftbar { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; }
.totals { display: flex; gap: 1.5rem; color: var(--muted); }
.chip { background: var(--line); padding: .1rem .5rem; border-radius: 1rem; font-size: .85rem; }

.areas { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 1100px) { .areas { grid-template-columns: 1fr 1fr; } }

.area-card { background: var(--panel); border: 1px solid var(--line); border-radius: .75rem; padding: .75rem; }
.area-card.area-paused { border-color: var(--paused); box-shadow: 0 0 0 2px rgb(99 102 241 / .35); }
.area-head { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: space-between; align-items: center; }
.area-head h2 { margin: 0; font-size: 1.35rem; }
.area-stats { display: flex; gap: 1rem; color: var(--muted); flex-wrap: wrap; }
.area-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.pause-banner { background: rgb(99 102 241 / .2); border: 1px solid var(--paused);
  padding: .5rem .75rem; border-radius: .5rem; }

.people { display: grid; gap: .75rem; grid-template-columns: 1fr; margin-top: 1rem; }
@media (min-width: 560px) { .people { grid-template-columns: repeat(2, 1fr); } }
/* 1700px y 2200px, no 900px/1400px: .areas pasa a 2 columnas en 1100px, asi
   que cada area-card mide justo la mitad del viewport desde ahi en adelante.
   Con un disparador de 3 columnas mas bajo, la tarjeta de persona se hunde
   por debajo de 220px justo en el rango de una tablet en horizontal
   (1024-1194px), que es el dispositivo objetivo, no un caso de borde. Estos
   valores mantienen la tarjeta de persona por encima de ~250px en todo ese
   rango: ver el detalle numerico en ui-report.md. */
@media (min-width: 1700px) { .people { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 2200px) { .people { grid-template-columns: repeat(4, 1fr); } }

.person-card { background: #0b1220; border: 2px solid var(--line); border-radius: .75rem; padding: .6rem; }
.person-card.status-working { border-color: var(--working); }
.person-card.status-idle { border-color: var(--idle); }
.person-card.status-area_paused { border-color: var(--paused); }
.person-card.status-finished { border-color: var(--finished); opacity: .75; }
.person-card.status-not_started { border-color: var(--notstarted); }
.person-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.person-card h3 { margin: 0; font-size: 1.1rem; }
.code { color: var(--muted); font-size: .8rem; }
.badge { padding: .2rem .6rem; border-radius: 1rem; font-size: .8rem; font-weight: 600; background: var(--line); }
.status-working .badge { background: var(--working); }
.status-idle .badge { background: var(--idle); color: #1c1917; }
.status-area_paused .badge { background: var(--paused); }

.counter { text-align: center; margin: .5rem 0; }
.trays { font-size: 2rem; font-weight: 800; line-height: 1; display: block; }
.trays-label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: .2rem .5rem; margin: .4rem 0; }
.stats div { display: flex; justify-content: space-between; gap: .5rem; }
.stats dt { color: var(--muted); font-size: .72rem; margin: 0; }
.stats dd { margin: 0; font-variant-numeric: tabular-nums; font-size: .78rem; }

.actions { display: grid; gap: .4rem; }
.actions form { display: contents; }
.break-form { display: flex !important; gap: .5rem; }
.break-form select { flex: 1; }
.adjust { display: flex; gap: .5rem; }

.btn { min-height: 44px; border: 0; border-radius: .6rem; font-size: .9rem; font-weight: 700;
  color: #fff; background: var(--line); cursor: pointer; padding: 0 .75rem; width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-tray { background: var(--working); font-size: 1.2rem; min-height: 52px; }
.btn-start { background: var(--accent); }
.btn-pause { background: var(--idle); color: #1c1917; }
.btn-resume { background: var(--working); }
.btn-primary { background: var(--accent); }
.btn-add { background: var(--accent); min-height: 44px; width: auto; }
.btn-ghost { background: transparent; border: 1px solid var(--line); min-height: 44px; width: auto; }
.btn-small { min-height: 36px; font-size: .9rem; }
.btn-end { background: var(--danger); }

select, input { min-height: 48px; border-radius: .5rem; border: 1px solid var(--line);
  background: #0b1220; color: var(--text); padding: 0 .6rem; font-size: 1rem; }

.login { max-width: 360px; margin: 3rem auto; display: grid; gap: 1rem;
  background: var(--panel); padding: 1.5rem; border-radius: .75rem; border: 1px solid var(--line); }
.login label { display: grid; gap: .35rem; }
.login input { width: 100%; }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: .75rem; padding: 1.25rem; min-width: 300px; }
dialog::backdrop { background: rgb(0 0 0 / .6); }
dialog form { display: grid; gap: .75rem; }
.dialog-actions { display: flex; gap: .5rem; justify-content: flex-end; }
.empty { color: var(--muted); }
.hint { color: var(--muted); font-size: .85rem; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: left; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-bottom: 1rem; }
.filters label { display: grid; gap: .25rem; font-size: .85rem; color: var(--muted); }
.filters .btn { width: auto; min-height: 48px; }
.filters a.btn { display: inline-flex; align-items: center; text-decoration: none; }
