/* ── torns (/admin/shifts, admin/rota.js) ──────────────────────────────────
   The rota page on the admin's own surfaces: admin.css for the panels,
   buttons, tags and lists, kit.css for the sheets, meters, alerts and the
   hues, timegrid.css for Dia. What is here is only what Torns adds: the
   head with its phase and tiles, the coverage matrix, the shift and person
   sheets' insides, the people table, the department cards, the live night.

   Colour is the admin's. Gold says "time" (today's column, the clock while
   simulating) and "wants to drop out", the one state the night has to
   notice from across a room; a department's own hue is only ever a dot or
   an edge. Every state also has a word, never colour alone. */

/* ═══════════════════════════════════════════════════════════════════════
   THE HEAD
   ═══════════════════════════════════════════════════════════════════════ */

.tn-head{ margin-bottom:1rem }
.tn-head:empty{ display:none }
.tn-top{
  display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap;
  gap:.6rem 1rem; margin-bottom:.35rem;
}
.tn-titlebox{ display:flex; align-items:center; flex-wrap:wrap; gap:.5rem .9rem; min-width:0 }
.tn-h1{ margin:0; font-size:1.35rem }
.tn-phasebox{ display:flex; align-items:center }
/* the phase is a segmented control whose lit button says how public the
   rota is: grey nobody, blue their own, green everybody */
.tn-phase button.on{ font-weight:650 }
.tn-phase.is-published button.on{ color:var(--accent) }
.tn-phase.is-open button.on{ color:var(--good) }
.tn-phase-badge.is-published{ color:var(--accent); border-color:var(--accent-line); background:var(--accent-soft) }
.tn-phase-badge.is-open{ color:var(--good); border-color:var(--good-line); background:var(--good-bg) }
.tn-phase-hint{ font-size:.84rem; color:var(--muted); margin:0 0 .9rem; max-width:70ch }

.tn-actions{ display:flex; align-items:center; gap:.35rem; flex-wrap:wrap; justify-content:flex-end }
.tn-actions-inline{ display:flex; align-items:center; gap:.15rem; flex-wrap:wrap }
.tn-actions .btn svg{ flex:none }
.tn-actions-more{ display:none; padding-inline:.6rem }
.tn-new svg{ width:15px; height:15px }

/* five numbers, each a door into the list behind it */
.tn-tiles{ display:grid; grid-template-columns:repeat(5, minmax(0, 1fr)); gap:.6rem; margin-bottom:.4rem }
.tn-tile{ min-height:5rem }
.tn-tile b{ font-size:1.45rem }
.tn-leadnote{ margin:.4rem 0 0 .2rem }
/* Dia wants the height for its grid: the head keeps its title, phase
   and buttons, and lets the five numbers go while Dia is on */
.tn-head.is-tool .tn-tiles,.tn-head.is-tool .tn-phase-hint{ display:none }
.tn-head.is-tool .tn-top{ margin-bottom:0 }

/* a lead's note and the lock in a sheet */
.tn-locknote{ display:flex; align-items:center; gap:.4rem; margin:0 0 .8rem; color:var(--muted) }
.tn-locknote[hidden]{ display:none }

/* ── the popover and the phone's "Més" ─────────────────────────────── */
.tn-pop{
  position:absolute; z-index:40; min-width:14rem; max-width:min(22rem, calc(100vw - 24px));
  padding:.6rem; background:var(--card); border:1px solid var(--line-strong);
  border-radius:var(--r); box-shadow:var(--shadow-pop);
  animation:menu-in .14s cubic-bezier(.2,.8,.3,1); transform-origin:top left;
}
.tn-pop-title{ font-size:.72rem; font-weight:650; letter-spacing:.06em; text-transform:uppercase; color:var(--faint); margin:.1rem .2rem .5rem }
.tn-pop-days{ display:flex; flex-wrap:wrap; gap:.35rem }
.tn-menu{ padding:.3rem; display:flex; flex-direction:column; gap:1px }
.tn-menu-item{
  display:flex; align-items:center; gap:.6rem; width:100%; min-height:2.5rem;
  padding:.45rem .7rem; font:inherit; font-size:.88rem; font-weight:500; color:var(--ink);
  text-align:left; background:none; border:0; border-radius:8px; cursor:pointer;
}
.tn-menu-item svg{ color:var(--faint) }
.tn-menu-item:hover{ background:var(--accent-soft) }

/* a small round button with an icon: ↶ ↷ ? ☎ */
.tn-iconbtn{ text-decoration:none; flex:none }
.tn-iconbtn svg{ width:16px; height:16px }
.tn-iconbtn:disabled{ opacity:.4; cursor:default }

/* ═══════════════════════════════════════════════════════════════════════
   COBERTURA
   ═══════════════════════════════════════════════════════════════════════ */

.tn-attn .panel-head{ margin-bottom:.7rem }
.tn-filterchip{ display:inline-flex; align-items:center; gap:.3rem; color:var(--accent); border-color:var(--accent-line); background:var(--accent-soft) }

/* the matrix: departments down, days across. The label column sticks
   when the days scroll sideways on a narrow desk. */
.tn-matrix-wrap{ overflow-x:auto; margin:0 calc(var(--pad) * -1); padding:0 var(--pad) .25rem }
.tn-matrix{
  display:grid; min-width:max-content;
  grid-template-columns:13rem repeat(var(--days, 5), minmax(9rem, 1fr));
  border:1px solid var(--line); border-radius:var(--r); background:var(--card);
}
.tn-mx-row{ display:contents }
.tn-mx-row > *{ border-top:1px solid var(--line) }
.tn-mx-row.is-head > *{ border-top:0 }
.tn-mx-corner,.tn-mx-label{ position:sticky; left:0; z-index:2; background:var(--card); border-right:1px solid var(--line) }
.tn-mx-corner{ border-top-left-radius:var(--r) }
.tn-mx-dayhead{
  display:flex; flex-wrap:wrap; align-items:baseline; gap:.15rem .45rem;
  padding:.55rem .7rem; font-size:.82rem; background:var(--well);
  border-left:1px solid var(--line);
}
.tn-mx-dayhead b{ font-weight:650 }
.tn-mx-dayhead span{ color:var(--muted); font-variant-numeric:tabular-nums }
.tn-mx-dayhead small{ flex-basis:100%; font-size:.68rem; color:var(--faint); text-transform:uppercase; letter-spacing:.05em }
.tn-mx-dayhead.is-today{ box-shadow:inset 0 -2px 0 var(--gold, #b8892b); background:var(--gold-soft, #f8f0dc) }
.tn-mx-label{ display:flex; flex-direction:column; gap:.2rem; padding:.6rem .75rem; min-width:0 }
.tn-mx-name{
  display:flex; align-items:center; gap:.45rem; min-width:0;
  font:inherit; color:var(--ink); background:none; border:0; padding:0; cursor:pointer; text-align:left;
}
.tn-mx-name b{ font-weight:650; font-size:.9rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.tn-mx-name svg{ color:var(--faint); flex:none }
.tn-mx-name:hover b{ text-decoration:underline; text-underline-offset:2px }
.tn-mx-meta{ display:flex; flex-wrap:wrap; gap:.25rem }
.tn-mx-meta .tag{ margin:0 }
.tn-mx-leads{ font-size:.74rem; color:var(--faint); overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.tn-mx-sum{ font-size:.74rem; color:var(--muted); font-variant-numeric:tabular-nums }
.tn-mx-cell{
  position:relative; display:flex; flex-direction:column; gap:.35rem;
  padding:.45rem; min-height:3.6rem; border-left:1px solid var(--line);
}
.tn-mx-cell.is-empty{ background:repeating-linear-gradient(135deg, transparent 0 7px, var(--well) 7px 8px) }
/* the "+" that adds a shift here: on hover with a mouse, faint on touch */
.tn-mx-add{
  display:inline-flex; align-items:center; justify-content:center; align-self:center;
  width:1.9rem; height:1.6rem; margin-top:auto;
  color:var(--faint); background:none; border:1px dashed var(--line-strong); border-radius:8px; cursor:pointer;
  opacity:0; transition:opacity .12s, color .12s, border-color .12s;
}
.tn-mx-cell:hover .tn-mx-add,.tn-mx-add:focus-visible{ opacity:1 }
.tn-mx-add:hover{ color:var(--accent); border-color:var(--accent-line); background:var(--accent-soft) }
@media (hover:none){ .tn-mx-add{ opacity:.55 } }

/* a shift as a card: hours, n/max, a meter; ★ a lead, a dot a drop */
.tn-card{
  display:flex; flex-direction:column; gap:.3rem; width:100%;
  padding:.4rem .5rem .45rem; font:inherit; text-align:left; color:var(--ink);
  background:var(--card); border:1px solid var(--line-strong); border-left:3px solid var(--line-strong);
  border-radius:8px; cursor:pointer;
  transition:transform .12s cubic-bezier(.2,.8,.3,1), box-shadow .12s, opacity .15s;
}
.tn-card:hover{ transform:translateY(-1px); box-shadow:var(--shadow-pop) }
.tn-card-line{ display:flex; align-items:baseline; justify-content:space-between; gap:.4rem }
.tn-card-time{ font-size:.78rem; font-weight:600; font-variant-numeric:tabular-nums; white-space:nowrap }
.tn-card-n{ font-size:.74rem; font-weight:650; color:var(--muted); font-variant-numeric:tabular-nums }
.tn-card-title{ font-size:.72rem; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.tn-card-foot{ display:flex; align-items:center; gap:.35rem }
.tn-card-foot .kit-meter{ flex:1 1 auto; min-width:2rem }
.tn-card-names{ font-size:.76rem; color:var(--muted); line-height:1.35 }
.tn-card.is-big{ padding:.6rem .75rem }
.tn-card.is-big .tn-card-time{ font-size:.9rem }
.tn-card.is-dim{ opacity:.32 }
.tn-card.is-dim:hover{ opacity:.8 }
/* how full, said by the card's edge and its number (the grid's blocks
   keep their department's colour and say it with the number alone) */
:is(.tn-card,.tn-lrow).tn-st-ok{ border-left-color:var(--accent) }
:is(.tn-card,.tn-lrow).tn-st-short{ border-left-color:var(--warn); background:var(--warn-bg) }
:is(.tn-card,.tn-lrow).tn-st-critical{ border-left-color:var(--bad); background:var(--bad-bg); border-color:var(--bad-line) }
:is(.tn-card,.tn-lrow).tn-st-full{ border-left-color:var(--good) }
.tn-st-short .tn-card-n{ color:var(--warn) }
.tn-st-critical .tn-card-n{ color:var(--bad) }
.tn-st-full .tn-card-n{ color:var(--good) }
.tn-star-on{ color:var(--gold-ink, #7a5a14); fill:currentColor; flex:none }
.tn-dropdot{
  flex:none; width:.55rem; height:.55rem; border-radius:50%;
  background:var(--gold, #b8892b); box-shadow:0 0 0 2px var(--gold-soft, #f8f0dc);
}

/* a phone: the day on top, a fold per department */
.tn-coverphone > .tn-days{ margin-bottom:.6rem }
.tn-rsec{ border:1px solid var(--line); border-radius:var(--r); background:var(--card); margin-bottom:.5rem; overflow:hidden }
.tn-rsec > summary{
  list-style:none; display:flex; align-items:center; gap:.5rem; min-height:48px;
  padding:.55rem .8rem; cursor:pointer;
}
.tn-rsec > summary::-webkit-details-marker{ display:none }
.tn-rsec > summary::after{ content:'\25B8'; margin-left:.2rem; color:var(--faint); transition:transform .15s }
.tn-rsec[open] > summary::after{ transform:rotate(90deg) }
.tn-rsec > summary b{ font-weight:650; flex:0 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.tn-rsec > summary .tag{ margin:0 }
.tn-rsec-n{ margin-left:auto; font-size:.8rem; color:var(--muted); font-variant-numeric:tabular-nums }
.tn-rsec-cards{ display:grid; gap:.45rem; padding:0 .6rem .6rem }
.tn-rsec-add{ justify-self:start }
.tn-phone-add{ width:100%; margin-top:.4rem }
.tn-none{ padding:1rem .2rem; font-size:.88rem; color:var(--faint); text-align:center }

/* ═══════════════════════════════════════════════════════════════════════
   DIA
   ═══════════════════════════════════════════════════════════════════════ */

/* rota.js measures where the grid starts and sets --tg-top, so the grid
   takes the rest of the window; this is only until it has */
#tnDay{ --tg-top:16rem }
.tn-daybar{ display:flex; flex-direction:column; gap:.55rem; margin-bottom:.7rem }
.tn-daybar .tn-days{ margin:0 }
.tn-daytools{ display:flex; align-items:center; flex-wrap:wrap; gap:.4rem .9rem }
.tn-daytools .tn-switch{ margin:0 }
.tn-daytools .kit-status{ margin-left:auto }
.tn-dayhint{ margin:0; font-size:.85rem; color:var(--muted) }
.tn-gridhost{ min-width:0 }

/* what a shift's block says, in the grid's own type */
.tn-gi-top{ justify-content:space-between }
.tn-gi-top .tg-title{ -webkit-line-clamp:1; white-space:nowrap; font-variant-numeric:tabular-nums }
.tn-gi-n{ flex:none; font-size:.68rem; font-weight:700; color:var(--muted); font-variant-numeric:tabular-nums }
.tg-item .kit-meter{ min-width:0; margin:2px 0 1px; height:.3rem }
.tn-gi-names{ display:flex; flex-wrap:wrap; gap:0 .35rem; font-size:.68rem; color:var(--muted); line-height:1.3 }
.tn-gi-name.is-cap{ color:var(--ink); font-weight:600 }
.tn-gi-name.is-drop::after{
  content:''; display:inline-block; width:.42rem; height:.42rem; margin-left:.2rem; vertical-align:middle;
  border-radius:50%; background:var(--gold, #b8892b);
}
.tg-item.tn-st-short .tn-gi-n{ color:var(--warn) }
.tg-item.tn-st-critical{ box-shadow:0 0 0 1px var(--bad-line) }
.tg-item.tn-st-critical .tn-gi-n{ color:var(--bad) }
.tg-item.tn-st-full .tn-gi-n{ color:var(--good) }
.tg-item.is-dim{ opacity:.35 }
/* the programme column: read, never moved — a hatched, quieter block */
.tg-item.tn-gi-prog{
  cursor:default; background-color:var(--well);
  background-image:repeating-linear-gradient(135deg, rgba(17,24,39,.04) 0 6px, transparent 6px 12px);
}

/* the same day as a list */
.tn-daylist{ display:flex; flex-direction:column; gap:.4rem }
.tn-lrow{
  display:grid; grid-template-columns:6.3rem minmax(0, 1fr) auto; align-items:center; gap:.7rem;
  width:100%; padding:.6rem .75rem; font:inherit; text-align:left; color:var(--ink);
  background:var(--card); border:1px solid var(--line); border-left:3px solid var(--line-strong);
  border-radius:var(--r-sm); cursor:pointer;
}
button.tn-lrow:hover{ border-color:var(--accent-line) }
.tn-lrow.is-prog{ cursor:default; background:var(--well); border-left-style:dashed; color:var(--muted) }
.tn-lrow.is-dim{ opacity:.35 }
.tn-lrow-time{ font-size:.85rem; font-weight:600; font-variant-numeric:tabular-nums; white-space:nowrap }
.tn-lrow-main{ display:flex; flex-direction:column; gap:.1rem; min-width:0 }
.tn-lrow-main b{ display:flex; align-items:center; gap:.4rem; font-weight:600; min-width:0 }
.tn-lrow-main small{ font-size:.76rem; color:var(--faint); overflow:hidden; text-overflow:ellipsis }
.tn-lrow-names{ color:var(--muted) }
.tn-lrow-right{ display:flex; flex-direction:column; align-items:flex-end; gap:.3rem; min-width:3.6rem }
.tn-lrow-right .kit-meter{ width:3.6rem }
.tn-night{
  display:flex; align-items:center; gap:.6rem; margin:.4rem 0 .1rem;
  font-size:.7rem; font-weight:650; letter-spacing:.08em; text-transform:uppercase; color:var(--graphite, #1f2229);
}
.tn-night::before,.tn-night::after{ content:''; flex:1 1 auto; height:2px; background:var(--graphite, #1f2229); opacity:.75 }

/* ═══════════════════════════════════════════════════════════════════════
   SHEETS
   ═══════════════════════════════════════════════════════════════════════ */

.tn-sheet .tn-sec{ margin-top:1.1rem }
.tn-sheet .tn-sec[hidden]{ display:none }
.tn-sheet .tn-sec > h3{ margin:0 0 .5rem }
.tn-sheet-meta{ display:flex; align-items:center; flex-wrap:wrap; gap:.4rem .8rem; font-size:.85rem; color:var(--muted); margin:.2rem 0 .3rem }
.tn-meta-cap{ display:inline-flex; align-items:center; gap:.25rem; color:var(--ink) }
.tn-meta-cap svg{ color:var(--gold-ink, #7a5a14); fill:currentColor }
.tn-pill-full{ color:var(--good); border-color:var(--good-line); background:var(--good-bg) }
.tn-pill-short{ color:var(--warn); border-color:var(--warn-line); background:var(--warn-bg) }
.tn-pill-critical{ color:var(--bad); border-color:var(--bad-line); background:var(--bad-bg) }
.tn-pill-gold{ color:var(--gold-ink, #7a5a14); border-color:var(--gold, #b8892b); background:var(--gold-soft, #f8f0dc) }

/* who is on it */
.tn-who{ border:1px solid var(--line); border-radius:var(--r); overflow:hidden }
.tn-nobody{ padding:.8rem .9rem; margin:0 }
.tn-who-row{
  display:grid; grid-template-columns:minmax(0, 1fr) auto; align-items:center; gap:.35rem .6rem;
  padding:.55rem .6rem .55rem .85rem; border-top:1px solid var(--line); background:var(--card);
}
.tn-who-row:first-child{ border-top:0 }
.tn-who-row.is-drop{ background:var(--gold-soft, #f8f0dc) }
.tn-who-main{ display:flex; flex-wrap:wrap; align-items:baseline; gap:.15rem .5rem; min-width:0 }
.tn-who-name{
  font:inherit; font-weight:600; color:var(--ink); background:none; border:0; padding:0; cursor:pointer; text-align:left;
}
.tn-who-name:hover{ text-decoration:underline; text-underline-offset:2px }
.tn-who-load{ font-size:.76rem; color:var(--faint); font-variant-numeric:tabular-nums }
.tn-who-chips{ display:flex; flex-wrap:wrap; gap:.25rem; flex-basis:100% }
/* a reason can be a whole sentence: it wraps rather than run out of a sheet */
:is(.tn-who-chips, .cand-tags, .tn-pwarn, .tn-pprobs, .tn-pday-head) .kit-tag{ white-space:normal; margin:0 }
.tn-who-acts{ display:flex; align-items:center; gap:.3rem }
.tn-star svg{ color:var(--faint) }
.tn-star.on{ border-color:var(--gold, #b8892b); background:var(--gold-soft, #f8f0dc) }
.tn-star.on svg{ color:var(--gold-ink, #7a5a14); fill:currentColor }
.tn-remove{ color:var(--muted) }
.tn-remove:hover:not(:disabled){ color:var(--bad) }
.tn-dropbox{ grid-column:1 / -1; display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:.4rem .8rem; font-size:.84rem }
.tn-dropbox p{ margin:0; color:var(--gold-ink, #7a5a14) }
.tn-dropbtns{ display:flex; gap:.35rem; flex-wrap:wrap }
.tn-attend{ grid-column:1 / -1; justify-self:start }
.tn-attend button.on.is-present{ color:var(--good) }
.tn-attend button.on.is-absent{ color:var(--bad) }

/* a status as a word in a pill */
.tn-chip{
  display:inline-flex; align-items:center; gap:.25rem;
  font-size:.7rem; font-weight:650; line-height:1; padding:.25rem .5rem; border-radius:2rem;
  color:var(--muted); background:var(--well); border:1px solid var(--line-strong);
}
.tn-chip.good{ color:var(--good); background:var(--good-bg); border-color:var(--good-line) }
.tn-chip.bad{ color:var(--bad); background:var(--bad-bg); border-color:var(--bad-line) }
.tn-chip.warn{ color:var(--warn); background:var(--warn-bg); border-color:var(--warn-line) }
.tn-chip.gold{ color:var(--gold-ink, #7a5a14); background:var(--gold-soft, #f8f0dc); border-color:var(--gold, #b8892b) }

/* who could go on it */
.tn-add-tools{ display:flex; flex-wrap:wrap; gap:.5rem; align-items:center; margin-bottom:.5rem }
.tn-add-tools input[type=search]{ flex:1 1 12rem; margin:0; width:auto }
.tn-sheet input[type=search]{ font-size:16px }
.tn-fillmin{ margin-bottom:.5rem }
.tn-fillmin[hidden]{ display:none }
.tn-cand.is-off .cand-left > b{ color:var(--muted) }
.tn-cand .cand-left small{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.tn-cands-more{ width:100%; border-radius:0; border-top:1px solid var(--line) }
.tn-cands .muted{ padding:.8rem .9rem; margin:0 }

/* its fields */
.tn-form{ display:flex; flex-direction:column; gap:.75rem }
.tn-form .field{ margin:0 }
.tn-form-row{ display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:.75rem; align-items:end }
.tn-form-row[hidden]{ display:none }
.tn-form-row .tn-switch{ align-self:end; min-height:var(--control) }
.tn-field > span{ display:flex; align-items:center; gap:.3rem }
.tn-field.is-fixed > span{ color:var(--faint) }
.tn-hint{ display:block; margin-top:.3rem; font-size:.76rem; color:var(--faint); line-height:1.4 }
/* when: the start on its own line, the length as chips with the stepper
   beside them for anything the chips don't have (a 4 h bar shift) */
.tn-form-row.tn-timing{ grid-template-columns:minmax(0, 1fr); align-items:start }
.tn-durbox{ display:flex; flex-wrap:wrap; align-items:center; gap:.45rem .6rem }
.tn-durbox .kit-dur{ flex-wrap:wrap }
/* a field a lead may only read looks it */
.tn-sheet :is(input, select, textarea):disabled{ background-color:var(--well); color:var(--muted); cursor:not-allowed }
.tn-stepper{ max-width:100% }
.tn-step-out{
  display:inline-flex; align-items:center; justify-content:center;
  min-width:4.2rem; height:2.5rem; padding:0 .4rem; font-weight:650; font-variant-numeric:tabular-nums;
  border-left:1px solid var(--line); border-right:1px solid var(--line);
}
.tn-sheet .kit-status{ margin-top:.6rem }

/* a yes/no as a switch, with what it means under it */
.tn-switch{ display:flex; align-items:flex-start; gap:.65rem; cursor:pointer; padding:.35rem 0; position:relative }
.tn-switch input{ position:absolute; opacity:0; width:2.4rem; height:1.4rem; margin:0; cursor:pointer }
.tn-switch-ui{
  flex:none; position:relative; width:2.4rem; height:1.4rem; margin-top:.05rem;
  border-radius:1rem; background:var(--line-strong); transition:background .15s;
}
.tn-switch-ui::after{
  content:''; position:absolute; top:2px; left:2px; width:calc(1.4rem - 4px); height:calc(1.4rem - 4px);
  border-radius:50%; background:#fff; box-shadow:0 1px 2px rgba(17,24,39,.25); transition:transform .15s;
}
.tn-switch input:checked + .tn-switch-ui{ background:var(--accent) }
.tn-switch input:checked + .tn-switch-ui::after{ transform:translateX(1rem) }
.tn-switch input:focus-visible + .tn-switch-ui{ outline:2px solid var(--accent); outline-offset:2px }
.tn-switch input:disabled + .tn-switch-ui{ opacity:.5 }
.tn-switch:has(input:disabled){ cursor:default }
.tn-switch-text{ display:flex; flex-direction:column; gap:.1rem; min-width:0 }
.tn-switch-text b{ font-size:.86rem; font-weight:550 }
.tn-switch-text small{ font-size:.76rem; color:var(--faint); line-height:1.4 }
.tn-sheet > .tn-switch{ margin-top:.2rem }

.tn-checks{ display:flex; flex-wrap:wrap; gap:.4rem }
.tn-checks .check-chip{ min-height:2.25rem; padding:.25rem .8rem }
.tn-shiftlog{ margin-top:1.2rem }
.tn-log-mini{ display:flex; flex-direction:column; gap:.2rem; padding-bottom:.4rem }

/* ═══════════════════════════════════════════════════════════════════════
   PERSONES
   ═══════════════════════════════════════════════════════════════════════ */

.tn-fair .panel-head{ margin-bottom:.6rem }
.tn-fair-avg{ font-size:.85rem; color:var(--muted) }
.tn-bars{ display:grid; gap:.35rem; max-width:40rem }
.tn-bar{ display:grid; grid-template-columns:3.6rem 1fr 2.4rem; align-items:center; gap:.6rem }
.tn-bar-label{ font-size:.8rem; color:var(--muted); text-align:right; font-variant-numeric:tabular-nums }
.tn-bar-track{ height:.7rem; border-radius:2rem; background:var(--well); overflow:hidden }
.tn-bar-track i{
  display:block; height:100%; width:calc(var(--p, 0) * 100%); border-radius:2rem;
  background:var(--accent); opacity:.8; transition:width .5s cubic-bezier(.2,.8,.3,1);
}
.tn-bar.is-zero .tn-bar-track i{ background:var(--bad) }
.tn-bar-n{ font-size:.85rem; font-variant-numeric:tabular-nums }

.tn-people .filter-row{ margin-bottom:.6rem }
.tn-pfilter{ flex-wrap:wrap }
.tn-ptools{ margin-bottom:.75rem }
.tn-ptable{ border:1px solid var(--line); border-radius:var(--r); overflow:hidden }
.tn-prow{
  display:grid; align-items:center; gap:.4rem .9rem;
  grid-template-columns:minmax(11rem, 1.2fr) 8.2rem minmax(7rem, .9fr) minmax(10rem, 1.8fr) 8.5rem minmax(7rem, 1fr);
  padding:.55rem .85rem; border-top:1px solid var(--line); background:var(--card);
}
.tn-prow:first-child{ border-top:0 }
.tn-prow.is-head{
  font-size:.7rem; font-weight:650; letter-spacing:.06em; text-transform:uppercase; color:var(--faint);
  background:var(--well); padding-block:.5rem;
}
.tn-pcell{ min-width:0 }
.tn-pwho{ display:flex; flex-direction:column; align-items:flex-start; gap:.1rem }
.tn-pwho small{ font-size:.75rem; color:var(--faint) }
.tn-pwho .tag{ margin:0 }
.tn-pname{
  font:inherit; font-weight:600; color:var(--ink); background:none; border:0; padding:0; text-align:left; cursor:pointer;
}
.tn-pname:hover{ color:var(--accent); text-decoration:underline; text-underline-offset:2px }
.tn-pprefs{ font-size:.8rem; color:var(--muted) }
.tn-pchip{ display:inline-flex; align-items:center; gap:.3rem }
.tn-pchip svg{ color:var(--gold-ink, #7a5a14); fill:currentColor }
.tn-pchip.is-drop{ border-color:var(--gold, #b8892b); background:var(--gold-soft, #f8f0dc) }
.tn-pwarn{ display:flex; flex-wrap:wrap; gap:.25rem }

/* the five party days as letters in circles: here, away, not answered */
.tn-dots{ display:inline-flex; gap:3px }
.tn-dotday{
  display:inline-flex; align-items:center; justify-content:center;
  width:1.45rem; height:1.45rem; border-radius:50%;
  font-size:.6rem; font-weight:700; text-transform:uppercase; letter-spacing:0;
}
.tn-dotday.is-in{ color:#fff; background:var(--good) }
.tn-dotday.is-out{ color:var(--faint); background:var(--well); text-decoration:line-through }
.tn-dotday.is-unknown{ color:var(--faint); border:1px dashed var(--line-strong) }

/* hours against the target */
.tn-hours{ display:flex; flex-direction:column; gap:.25rem; min-width:0 }
.tn-hours-n{ font-size:.8rem; font-weight:600; font-variant-numeric:tabular-nums }
.tn-hours-n small{ font-weight:500; color:var(--gold-ink, #7a5a14) }
.tn-hours.is-bad .tn-hours-n{ color:var(--bad) }
.tn-hours.is-warn .tn-hours-n{ color:var(--warn) }
.tn-hours.is-good .tn-hours-n{ color:var(--good) }
.kit-meter.lots > b{ background:var(--gold, #b8892b) }

/* ── the person sheet ── */
.tn-pfacts{ display:flex; flex-direction:column; gap:.45rem; margin:.2rem 0 .3rem }
.tn-pfacts-top{ display:flex; flex-wrap:wrap; align-items:center; gap:.5rem 1rem }
.tn-pfacts-top .tn-hours{ width:8rem }
.tn-pfacts-line{ margin:0; font-size:.85rem; color:var(--muted) }
.tn-phoneline{ display:flex; flex-wrap:wrap; gap:.4rem }
.tn-phoneline .btn{ text-decoration:none }
.tn-pprobs{ gap:.3rem }
.tn-ptimeline{ display:flex; flex-direction:column; gap:.8rem }
.tn-pday-head{ display:flex; align-items:center; gap:.5rem; margin-bottom:.3rem; font-size:.85rem }

/* the day as a strip, 06:00 → 06:00, midnight in graphite */
.tn-track{ position:relative; height:.9rem; border-radius:4px; background:var(--well); border:1px solid var(--line); margin-bottom:.35rem; overflow:hidden }
.tn-tick{ position:absolute; top:0; bottom:0; width:1px; background:var(--line-strong) }
.tn-tick.is-midnight{ width:2px; background:var(--graphite, #1f2229); opacity:.7 }
.tn-trk{ position:absolute; top:1px; bottom:1px; border-radius:3px; background:var(--edge, var(--accent)); opacity:.9 }
.tn-trk.is-act{
  background:repeating-linear-gradient(135deg, var(--faint) 0 3px, transparent 3px 6px);
  border:1px solid var(--faint); opacity:.75;
}
.tn-pday-list{ display:flex; flex-direction:column; gap:.2rem }
.tn-pline{
  display:flex; align-items:center; gap:.5rem; width:100%; min-height:2.2rem; padding:.3rem .5rem;
  font:inherit; font-size:.85rem; text-align:left; color:var(--ink);
  background:none; border:0; border-radius:8px;
}
button.tn-pline{ cursor:pointer }
button.tn-pline:hover{ background:var(--accent-soft) }
.tn-pline svg{ color:var(--gold-ink, #7a5a14); fill:currentColor; flex:none }
.tn-pline-time{ font-variant-numeric:tabular-nums; color:var(--muted); white-space:nowrap; min-width:6.3rem }
.tn-pline b{ font-weight:600; min-width:0; overflow:hidden; text-overflow:ellipsis }
.tn-pline.is-act{ color:var(--muted) }
.kit-dot.is-act{ background:none; border:1.5px dashed var(--faint) }

/* ═══════════════════════════════════════════════════════════════════════
   DEPARTAMENTS
   ═══════════════════════════════════════════════════════════════════════ */

.tn-rgrid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(18rem, 1fr)); gap:.75rem }
.tn-rcard{
  display:flex; flex-direction:column; gap:.55rem; min-width:0;
  padding:.85rem .95rem .75rem; background:var(--card);
  border:1px solid var(--line); border-top:3px solid var(--edge, var(--line-strong)); border-radius:var(--r);
}
.tn-rcard-head{ display:flex; flex-direction:column; gap:.35rem }
.tn-rcard-name{
  display:flex; align-items:center; gap:.5rem; min-width:0;
  font:inherit; color:var(--ink); background:none; border:0; padding:0; text-align:left; cursor:pointer;
}
.tn-rcard-name b{ font-size:1rem; font-weight:650 }
.tn-rcard-name svg{ color:var(--faint) }
.tn-rcard-name:hover b{ text-decoration:underline; text-underline-offset:2px }
.tn-rcard-badges{ display:flex; flex-wrap:wrap; gap:.3rem }
.tn-rcard-badges .tag{ margin:0 }
.tn-rfacts{ display:grid; grid-template-columns:auto 1fr; gap:.25rem .7rem; margin:0; font-size:.84rem }
.tn-rfacts dt{ color:var(--faint); font-size:.74rem; padding-top:.1rem }
.tn-rfacts dd{ margin:0; min-width:0; overflow-wrap:anywhere }
.tn-rfacts dd small{ color:var(--faint) }
.tn-linkchip{ display:inline-flex; align-items:center; gap:.3rem; color:var(--accent); border-color:var(--accent-line); background:var(--accent-soft) }
.tn-rdesc{
  margin:0; font-size:.84rem; color:var(--muted);
  display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden;
}
.tn-rwarn{ margin:0; font-size:.78rem; color:var(--warn) }
.tn-rcard-foot{ display:flex; flex-wrap:wrap; align-items:center; gap:.45rem .7rem; margin-top:auto; padding-top:.5rem; border-top:1px solid var(--line) }
.tn-rcard-foot .kit-meter{ flex:1 1 4rem }
.tn-rsum{ font-size:.8rem; color:var(--muted); font-variant-numeric:tabular-nums }
.tn-rcard-foot .row-acts{ display:flex; gap:.3rem; margin-left:auto }
.tn-rcard-foot .more svg{ width:16px; height:16px }
.tn-rcard.is-new{ border-style:dashed; border-top-width:1px; background:var(--well); justify-content:center }
.tn-rnew-title{ font-weight:650 }

/* ═══════════════════════════════════════════════════════════════════════
   DEMANDA · HISTORIAL
   ═══════════════════════════════════════════════════════════════════════ */

.tn-dsum{ margin:0 0 .9rem; font-size:.95rem; max-width:70ch }
.tn-dsum.is-short{ color:var(--warn); font-weight:600 }
.tn-dtable{ border:1px solid var(--line); border-radius:var(--r); overflow:hidden }
.tn-drow{
  display:grid; align-items:center; gap:.6rem;
  grid-template-columns:minmax(10rem, 1.6fr) repeat(4, minmax(4.5rem, .7fr)) minmax(7rem, 1fr) minmax(4.5rem, .7fr);
  padding:.55rem .85rem; border-top:1px solid var(--line); background:var(--card);
}
.tn-drow:first-child{ border-top:0 }
.tn-drow.is-head{ font-size:.7rem; font-weight:650; letter-spacing:.06em; text-transform:uppercase; color:var(--faint); background:var(--well) }
.tn-drow.is-head span:not(:first-child){ text-align:right }
.tn-drow.is-total{ background:var(--well); font-weight:650 }
.tn-dname{ display:flex; align-items:center; gap:.45rem; min-width:0 }
.tn-dname b{ font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.tn-dnum{ display:flex; flex-direction:column; align-items:flex-end; gap:.25rem; font-variant-numeric:tabular-nums }
.tn-dnum .kit-meter{ width:100%; max-width:6rem }
.tn-dnum.is-short{ color:var(--warn); font-weight:650 }

.tn-log .panel-head{ margin-bottom:.4rem }
.tn-logday h3{ margin:1rem 0 .35rem }
.tn-logline{
  display:flex; align-items:baseline; gap:.75rem; width:100%;
  padding:.45rem .6rem; font:inherit; font-size:.88rem; text-align:left; color:var(--ink);
  background:none; border:0; border-radius:8px;
}
button.tn-logline{ cursor:pointer }
button.tn-logline:hover{ background:var(--accent-soft) }
.tn-logline time{ flex:none; color:var(--faint); font-variant-numeric:tabular-nums; font-size:.82rem }
.tn-logline b{ font-weight:600 }
.tn-logmore{ margin-top:.8rem }

/* ═══════════════════════════════════════════════════════════════════════
   EN DIRECTE — big type, made to be read at 3 a.m.
   ═══════════════════════════════════════════════════════════════════════ */

.tn-clock{ padding-block:.8rem }
.tn-clock-line{ display:flex; align-items:center; flex-wrap:wrap; gap:.5rem .8rem }
.tn-clock-line b{ font-size:1.15rem; font-weight:700; font-variant-numeric:tabular-nums }
.tn-clock-line svg{ color:var(--gold, #b8892b) }
.tn-stamp{ margin-left:auto; font-size:.78rem; color:var(--faint) }
.tn-clock.is-sim{ border-color:var(--gold, #b8892b); box-shadow:0 0 0 1px var(--gold, #b8892b), var(--shadow); background:var(--gold-soft, #f8f0dc) }
.tn-simfold{ margin-top:.5rem }
.tn-simfold > summary{
  cursor:pointer; font-size:.84rem; font-weight:600; color:var(--muted);
  min-height:2.2rem; display:inline-flex; align-items:center;
}
.tn-simbox{ display:flex; flex-direction:column; align-items:flex-start; gap:.5rem; margin-top:.3rem; max-width:100% }
.tn-simbox .tn-days{ max-width:100% }
.tn-simrow{ display:flex; flex-wrap:wrap; align-items:center; gap:.5rem .75rem }
.tn-live-before{ font-size:.95rem }
.tn-livesec > h3{ margin:0 0 .6rem }
.tn-livesec{ display:flex; flex-direction:column; gap:.6rem }
.tn-livecard{
  border:1px solid var(--line); border-left:4px solid var(--edge, var(--accent)); border-radius:var(--r);
  padding:.7rem .8rem; background:var(--card);
}
.tn-livecard-head{ display:flex; align-items:center; justify-content:space-between; gap:.6rem; margin-bottom:.5rem }
.tn-livecard-title{
  display:flex; align-items:baseline; flex-wrap:wrap; gap:.2rem .5rem; min-width:0;
  font:inherit; color:var(--ink); background:none; border:0; padding:0; text-align:left; cursor:pointer;
}
.tn-livecard-title b{ font-size:1.05rem; font-weight:700 }
.tn-livecard-title span{ font-size:.9rem; color:var(--muted); font-variant-numeric:tabular-nums }
.tn-liverows{ display:flex; flex-direction:column }
.tn-liverow{
  display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:.4rem .7rem;
  padding:.45rem 0; border-top:1px solid var(--line);
}
.tn-liverow:first-child{ border-top:0 }
.tn-liverow-who{ display:flex; align-items:center; flex-wrap:wrap; gap:.4rem; min-width:0 }
.tn-liverow-who b{ font-size:1rem; font-weight:600 }
.tn-liverow-acts{ display:flex; align-items:center; gap:.4rem; margin-left:auto }
.tn-liverow-acts .tn-attend{ margin:0 }
.tn-liverow.is-absent .tn-liverow-who b{ color:var(--muted); text-decoration:line-through }
.tn-livehelp{ margin-top:.5rem }
.tn-livehelp > summary{
  cursor:pointer; display:inline-flex; align-items:center; min-height:2.4rem;
  font-weight:650; color:var(--bad);
}
.tn-livehelp .tn-cands{ margin-top:.3rem }
.tn-droprow{ display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:.5rem .8rem; padding:.5rem 0; border-top:1px solid var(--line) }
.tn-droprow:first-of-type{ border-top:0 }
.tn-droprow > div:first-child{ display:flex; flex-direction:column; gap:.1rem; min-width:0 }
.tn-droprow small{ font-size:.8rem; color:var(--muted) }
.tn-reason{ color:var(--gold-ink, #7a5a14) !important }
.tn-oncall{ display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:.4rem .8rem; padding:.4rem 0 }
.tn-oncall > b{ display:flex; align-items:center; gap:.4rem }
.tn-oncall-people{ display:flex; flex-wrap:wrap; gap:.35rem }
.tn-oncall-people .btn{ text-decoration:none }

/* ═══════════════════════════════════════════════════════════════════════
   PROPOSA REPARTIMENT
   ═══════════════════════════════════════════════════════════════════════ */

.tn-af-intro{ margin:.2rem 0 .6rem }
.tn-af-opts{ margin-top:0 }
.tn-af-optbox{ display:flex; flex-direction:column; align-items:flex-start; gap:.6rem; padding-bottom:.8rem }
.tn-af-optbox select{ width:auto; min-width:14rem }
.tn-af-label{ font-size:.78rem; font-weight:550; color:var(--muted) }
.tn-af-sum{ margin:.6rem 0; padding:.6rem .75rem; font-size:.88rem; font-weight:550; background:var(--well); border:1px solid var(--line); border-radius:var(--r-sm) }
.tn-af-list{ display:flex; flex-direction:column; gap:.6rem }
.tn-af-group{ border:1px solid var(--line); border-radius:var(--r-sm); overflow:hidden }
.tn-af-ghead{ display:flex; align-items:center; gap:.45rem; padding:.5rem .7rem; background:var(--well); font-size:.86rem }
.tn-af-ghead b{ font-weight:650; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.tn-af-count{ margin-left:auto; font-size:.78rem; color:var(--muted); font-variant-numeric:tabular-nums; white-space:nowrap }
.tn-af-line{
  display:flex; align-items:center; gap:.65rem; padding:.45rem .7rem; min-height:2.75rem;
  border-top:1px solid var(--line); cursor:pointer;
}
.tn-af-line:hover{ background:var(--accent-soft) }
.tn-af-line > span{ display:flex; flex-direction:column; min-width:0 }
.tn-af-line b{ font-weight:600; font-size:.88rem }
.tn-af-line small{ font-size:.76rem; color:var(--faint) }

/* ═══════════════════════════════════════════════════════════════════════
   LOADING
   ═══════════════════════════════════════════════════════════════════════ */

.tn-skel-lanes{ display:grid; grid-template-columns:13rem repeat(5, 1fr); gap:.5rem }
.tn-skel-lane{ height:4.2rem; border-radius:10px }
.tn-skel-lane:nth-child(6n+1){ height:4.2rem }
.tn-fail{ text-align:center }
.tn-fail .btn{ margin-top:.4rem }

/* ═══════════════════════════════════════════════════════════════════════
   SMALLER SCREENS
   ═══════════════════════════════════════════════════════════════════════ */

@media (max-width:1100px){
  .tn-prow{ grid-template-columns:minmax(10rem, 1.2fr) 8.2rem minmax(10rem, 1.8fr) 8rem minmax(6rem, 1fr) }
  .tn-prow > :nth-child(3){ display:none }
}
@media (max-width:959px){
  .tn-tiles{ grid-template-columns:repeat(3, minmax(0, 1fr)) }
  .tn-tiles > :first-child{ grid-column:1 / -1 }
}
@media (max-width:759px){
  /* En directe is read on a phone in a pocket at 3 a.m.: the head keeps
     its title, phase and buttons and lets the numbers go */
  .tn-head.is-live .tn-tiles,.tn-head.is-live .tn-phase-hint,.tn-head.is-live .tn-leadnote{ display:none }
  /* the title and its two buttons on one line, the phase full width under */
  .tn-top{
    display:grid; grid-template-columns:minmax(0, 1fr) auto; align-items:center; gap:.55rem .6rem;
    grid-template-areas:"title acts" "phase phase";
  }
  .tn-titlebox{ display:contents }
  .tn-h1{ grid-area:title; font-size:1.2rem }
  .tn-phasebox{ grid-area:phase }
  .tn-actions{ grid-area:acts; flex-wrap:nowrap }
  .tn-actions-inline{ display:none }
  .tn-actions-more{ display:inline-flex }
  .tn-phase{ display:flex; width:100% }
  .tn-phase button{ flex:1 1 0 }
  .tn-tiles{ grid-template-columns:repeat(2, minmax(0, 1fr)); gap:.5rem }
  .tn-tile{ min-height:0; padding:.65rem .75rem }
  .tn-tile b{ font-size:1.25rem }

  /* the people table becomes a card per person */
  .tn-ptable{ border:0; overflow:visible; display:flex; flex-direction:column; gap:.5rem }
  .tn-prow.is-head{ display:none }
  .tn-prow{
    grid-template-columns:minmax(0, 1fr) auto; gap:.45rem .7rem;
    border:1px solid var(--line); border-radius:var(--r); padding:.7rem .8rem;
  }
  .tn-prow > :nth-child(3){ display:block; grid-column:1 / -1 }
  .tn-prow > :nth-child(4),.tn-prow > :nth-child(6){ grid-column:1 / -1 }
  .tn-prow > :nth-child(5){ grid-column:1 / -1 }
  .tn-pprefs:empty{ display:none }

  .tn-drow{ grid-template-columns:repeat(3, minmax(0, 1fr)); gap:.4rem .6rem; padding:.7rem .8rem }
  .tn-drow.is-head{ display:none }
  .tn-drow > .tn-dname{ grid-column:1 / -1 }
  .tn-drow .tn-dnum{ align-items:flex-start }
  .tn-drow .tn-dnum::before{ content:attr(data-label); font-size:.66rem; font-weight:650; letter-spacing:.04em; text-transform:uppercase; color:var(--faint) }

  .tn-lrow{ grid-template-columns:4.9rem minmax(0, 1fr) auto; gap:.55rem; padding:.6rem }
  .tn-lrow-time{ font-size:.8rem; white-space:normal }
  .tn-form-row{ grid-template-columns:minmax(0, 1fr) }
  .tn-who-row{ grid-template-columns:minmax(0, 1fr) }
  .tn-who-acts{ justify-content:flex-start }
  .tn-daytools .kit-status{ flex-basis:100%; margin-left:0 }
}
@media (pointer:coarse){
  .tn-mx-add{ width:2.75rem; height:2.25rem }
  .tn-card{ min-height:3.25rem }
  .tn-lrow,.tn-pline,.tn-logline{ min-height:48px }
  .tn-switch{ min-height:44px; align-items:center }
  .tn-switch input{ height:44px; top:0 }
  .tn-dotday{ width:1.6rem; height:1.6rem }
  .tn-step-out{ height:44px }
  .tn-af-line{ min-height:48px }
  .tn-livehelp > summary,.tn-simfold > summary{ min-height:44px }
}
@media (prefers-reduced-motion:reduce){
  .tn-card,.tn-bar-track i,.tn-switch-ui,.tn-switch-ui::after,.tn-pop{ transition:none; animation:none }
  .tn-card:hover{ transform:none }
}

/* "Cal atenció" on a narrow screen: the icon stays beside its sentence,
   the button goes under it on the right — six of them still fit a thumb's scroll */
@media (max-width:480px){
  .tn-attn .kit-alert{ display:grid; grid-template-columns:auto minmax(0, 1fr); align-items:start; gap:.35rem .6rem; padding:.55rem .65rem }
  .tn-attn .kit-alert-icon{ margin-top:.1rem }
  .tn-attn .kit-alert > .btn{ grid-column:2; justify-self:end; margin:0 }
}
