/* ── horaris i torns: peces comunes ────────────────────────────────────
   The pieces admin/kit.js builds for Horaris and Torns, and the tokens
   their pages (and the time grid) read. Loaded after admin.css, which it
   leans on throughout: the same surfaces, lines, ink, accent and radii,
   the same .btn, .segmented, .cal-tab, .stepper, .picker-menu, .stat and
   .edit-dialog. Nothing here restyles a page that doesn't load it.

   Colour stays the admin's own. The party's gold is here only for time
   (the "ara" line, the selection ring), the "Moment clau" marker and one
   room hue; graphite only for the midnight divider and the gutter
   numerals. Both are tokens, so a different call later is one edit. */

:root{
  --gold:#b8892b;        /* rings and lines: 3.2:1 on white, enough for a line, not for text */
  --gold-ink:#7a5a14;    /* gold that has to be read: 6.4:1 */
  --gold-soft:#f8f0dc;
  --graphite:#1f2229;

  /* what a room or a department can wear (kit.js HUES); no purple */
  --hue-or:#b8892b;
  --hue-brasa:#c2410c;
  --hue-vi:#9f1239;
  --hue-cel:#1d6fa5;
  --hue-teal:#0f766e;
  --hue-salvia:#4d7c0f;
  --hue-terra:#8a5a3c;
  --hue-grafit:#3f4451;
}

/* ── hues ─────────────────────────────────────────────────────────────
   One class per hue sets two properties everything else reads: --edge
   (the dot, the left rule, the ring) and --fill (a wash of it behind a
   block's text, light enough that --ink still reads on it). */
.hue-or{ --edge:var(--hue-or) }
.hue-brasa{ --edge:var(--hue-brasa) }
.hue-vi{ --edge:var(--hue-vi) }
.hue-cel{ --edge:var(--hue-cel) }
.hue-teal{ --edge:var(--hue-teal) }
.hue-salvia{ --edge:var(--hue-salvia) }
.hue-terra{ --edge:var(--hue-terra) }
.hue-grafit{ --edge:var(--hue-grafit) }
.hue-or,.hue-brasa,.hue-vi,.hue-cel,.hue-teal,.hue-salvia,.hue-terra,.hue-grafit{
  --fill:color-mix(in srgb, var(--edge) 12%, #fff);
}
/* Safari before 16.2 has no color-mix: the sunk well reads as a fill too */
@supports not (color:color-mix(in srgb, red 50%, white)){
  .hue-or,.hue-brasa,.hue-vi,.hue-cel,.hue-teal,.hue-salvia,.hue-terra,.hue-grafit{ --fill:var(--well) }
}
/* a room's colour as a dot, beside its name anywhere */
.kit-dot{
  display:inline-block; flex:none; vertical-align:middle;
  width:.62rem; height:.62rem; border-radius:50%;
  background:var(--edge, var(--line-strong));
}

/* the activity kinds' icons; the key moment is the one in gold */
.kit-kind,.kit-icon{ display:inline-block; vertical-align:-3px; flex:none }
.kit-kind.kind-moment{ color:var(--gold) }

/* a sheet is open: the page under it stays put (iOS scrolls it otherwise) */
html.kit-lock{ overflow:hidden }

/* ═══════════════════════════════════════════════════════════════════════
   TOASTS
   ═══════════════════════════════════════════════════════════════════════
   Ink, like the signs editor's: the one dark thing on a light desk, so it
   is seen without being looked for. Centred on the content column on a
   desk, above the tab bar on a phone, and above a sheet's footer when it
   speaks from inside one. */

.toast-host{
  position:fixed; z-index:60; left:50%; bottom:1.25rem;
  transform:translateX(-50%);
  display:flex; flex-direction:column; align-items:center; gap:.5rem;
  width:max-content; max-width:calc(100vw - 2rem);
  pointer-events:none;
}
.toast-host:empty{ display:none }
@media (min-width:960px){
  body > .toast-host{ left:calc(50% + var(--side-w) / 2) }
}
@media (max-width:959px){
  .toast-host{ bottom:calc(var(--tab-h) + .75rem) }
  /* a page with a floating "+" keeps it clear */
  body:has(> .kit-fab:not([hidden])) > .toast-host{ bottom:calc(var(--tab-h) + 5.25rem) }
}
/* on a phone the toasts are one width, edge to edge, not a ragged stack */
@media (max-width:699px){
  .toast-host{ width:calc(100vw - 1.5rem); align-items:stretch }
}
.toast-host.in-dialog{ left:50%; bottom:calc(5rem + env(safe-area-inset-bottom)) }
/* from a side panel, the toast speaks from the middle of the panel */
@media (min-width:700px){
  .kit-sheet.side > .toast-host.in-dialog{
    left:calc(100vw - min(28rem, 100vw) / 2);
    max-width:calc(min(28rem, 100vw) - 2rem);
  }
}

.toast{
  pointer-events:auto;
  display:flex; align-items:center; gap:.6rem;
  max-width:100%; min-height:2.75rem;
  padding:.4rem .4rem .4rem 1rem; border-radius:var(--r);
  background:var(--ink); color:#fff;
  font-size:.86rem; line-height:1.35;
  box-shadow:var(--shadow-pop);
  animation:kit-toast-in .26s cubic-bezier(.2,.8,.3,1);
}
.toast-text{ flex:1 1 auto; min-width:0; overflow-wrap:anywhere; padding:.2rem 0 }
/* a coloured dot says how it went; the words say what */
.toast.good::before,.toast.bad::before,.toast.warn::before{
  content:''; flex:none; width:.55rem; height:.55rem; border-radius:50%; margin-left:-.15rem;
}
.toast.good::before{ background:#6ee7a8 }
.toast.bad::before{ background:#fda29b }
.toast.warn::before{ background:#fec84b }
.toast .btn.small{
  flex:none; color:#c7cdf5; background:transparent;
  border-color:rgba(255,255,255,.24); box-shadow:none;
}
.toast .btn.small:hover:not(:disabled){ background:rgba(255,255,255,.1); border-color:rgba(255,255,255,.4) }
.toast .btn.small:focus-visible{ outline-color:#c7cdf5 }
.toast-x{
  flex:none; width:2rem; height:2rem; border-radius:8px;
  display:inline-flex; align-items:center; justify-content:center;
  font:inherit; font-size:1.15rem; line-height:1;
  color:rgba(255,255,255,.62); background:none; border:0; cursor:pointer;
}
.toast-x:hover{ color:#fff; background:rgba(255,255,255,.1) }
.toast-x:focus-visible{ outline-color:#c7cdf5 }
.toast.out{ animation:kit-toast-out .2s cubic-bezier(.4,0,.6,1) forwards }
@media (pointer:coarse){
  .toast-x{ width:44px; height:44px }
  .toast{ padding-right:.25rem }
}
@keyframes kit-toast-in{ from{ opacity:0; transform:translateY(10px) scale(.97) } }
@keyframes kit-toast-out{ to{ opacity:0; transform:translateY(6px) scale(.98) } }

/* ═══════════════════════════════════════════════════════════════════════
   SHEETS
   ═══════════════════════════════════════════════════════════════════════
   An .edit-dialog that is a panel on the right from 700px up (or a
   centred card), and a sheet from the bottom below that. Head and foot
   stay put; the body between them scrolls. */

dialog.kit-sheet{
  padding:0; overflow:hidden;
  max-width:100%;                 /* the UA's modal inset would keep a phone sheet off the edges */
  background:var(--card);
}
dialog.kit-sheet[open]{ display:flex; flex-direction:column }
dialog.kit-sheet:focus{ outline:none }

.kit-sheet .sheet-head{
  position:relative; flex:none; align-items:flex-start;
  padding:1rem .85rem .7rem 1.25rem;
  border-bottom:1px solid transparent; transition:border-color .15s;
}
.kit-sheet .sheet-head.scrolled{ border-bottom-color:var(--line) }
.kit-sheet .sheet-titles{ flex:1 1 auto; min-width:0; padding-top:.15rem }
.kit-sheet .sheet-head h2{ margin:0; font-size:1.08rem; line-height:1.3; overflow-wrap:anywhere }
.kit-sheet .sheet-sub{ margin-top:.15rem; font-size:.82rem; color:var(--muted); overflow-wrap:anywhere }
.kit-sheet .sheet-sub[hidden]{ display:none }
.kit-sheet .kit-x{ flex:none; font-size:1.2rem }

.kit-sheet .sheet-body{
  flex:1 1 auto; min-height:0;
  overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch;
  padding:.2rem 1.25rem 1.25rem;
}
.kit-sheet .sheet-foot{
  position:sticky; bottom:0; flex:none;
  display:flex; align-items:center; flex-wrap:wrap; gap:.5rem;
  padding:.75rem 1.25rem calc(.75rem + env(safe-area-inset-bottom));
  border-top:1px solid var(--line); background:var(--card);
}
.kit-sheet .sheet-foot[hidden]{ display:none }
/* everything after a .push sits at the right end: "Duplica…" left, "Esborra" right */
.kit-sheet .sheet-foot .push{ margin-left:auto }
/* a page that draws its own .dialog-actions in a sheet body gets a plain
   row: the edit dialog's sticky bar is sized for its padding, not ours */
.kit-sheet .sheet-body .dialog-actions{ position:static; margin:1rem 0 0; padding:0; border:0; background:none }
.kit-grab{ display:none }
.kit-sheet.is-leaving{ pointer-events:none }
.kit-sheet.is-leaving::backdrop{ animation:kit-fade-out .2s forwards }

@media (min-width:700px){
  dialog.kit-sheet.side{
    /* pinned by its insets, not by an auto margin: Chrome resolves the
       UA dialog insets so that margin-left:auto still lands it on the left */
    inset:0 0 0 auto; margin:0;
    width:min(28rem, 100vw); height:100dvh; max-height:100dvh;
    border-width:0 0 0 1px; border-radius:var(--r-lg) 0 0 var(--r-lg);
  }
  dialog.kit-sheet.side[open]{ animation:kit-side-in .3s cubic-bezier(.2,.8,.3,1) }
  dialog.kit-sheet.side.is-leaving{ animation:kit-side-out .22s cubic-bezier(.4,0,.6,1) forwards }
  /* a side panel leaves the page readable beside it */
  .kit-sheet.side::backdrop{ background:rgba(17,24,39,.2) }

  dialog.kit-sheet.center{ width:min(36rem, 94vw); max-height:min(calc(100dvh - 3rem), 56rem) }
  dialog.kit-sheet.center.is-leaving{ animation:kit-fade-out .16s forwards }
}
@media (max-width:699px){
  dialog.kit-sheet{
    inset:auto 0 0 0; margin:0; width:100%; max-height:90dvh;
    border-width:1px 0 0; border-radius:var(--r-lg) var(--r-lg) 0 0;
  }
  dialog.kit-sheet[open]{ animation:kit-rise .34s cubic-bezier(.2,.9,.25,1.02) }
  dialog.kit-sheet.is-leaving{ animation:kit-sink .22s cubic-bezier(.4,0,.6,1) forwards }
  .kit-grab{
    display:block; flex:none; width:2.6rem; height:5px; margin:.5rem auto 0;
    border-radius:3px; background:var(--line-strong);
  }
  /* the grab bar and the head are what a thumb pulls down */
  .kit-grab,.kit-sheet .sheet-head{ touch-action:none }
  .kit-sheet .sheet-head{ padding:.55rem .6rem .6rem 1rem }
  .kit-sheet .sheet-body{ padding:.2rem 1rem 1rem }
  .kit-sheet .sheet-foot{ padding-left:1rem; padding-right:1rem }
}
@keyframes kit-side-in{ from{ transform:translateX(100%) } }
@keyframes kit-side-out{ to{ transform:translateX(100%) } }
@keyframes kit-rise{ from{ transform:translateY(100%) } }
@keyframes kit-sink{ to{ transform:translateY(100%) } }
@keyframes kit-fade-out{ to{ opacity:0 } }

/* the copy fallback: off screen, but selectable */
.kit-offscreen{ position:fixed; left:-9999px; top:0; width:1px; height:1px; opacity:0 }
.kit-copybox{ font-size:.86rem; white-space:pre; overflow:auto }

/* ── "are you sure?" ──────────────────────────────────────────────────── */

.kit-confirm{ width:min(26rem, 92vw) }
.kit-confirm h2{ margin-bottom:.45rem }
.kit-confirm-text{ font-size:.95rem; line-height:1.5; color:var(--ink); white-space:pre-line; overflow-wrap:anywhere }
.kit-confirm h2 + .kit-confirm-text{ font-size:.9rem; color:var(--muted) }
.kit-confirm .dialog-actions{ margin-top:1.2rem }
/* the destructive answer, solid: the outline .btn.danger is for a row */
.btn.kit-danger{
  color:#fff; background:var(--bad); border-color:var(--bad);
  box-shadow:0 1px 2px rgba(180,35,24,.3);
}
.btn.kit-danger:hover:not(:disabled){ background:#912018; border-color:#912018 }
@media (max-width:480px){
  .kit-confirm .dialog-actions .btn{ flex:1 1 0 }
}

/* ═══════════════════════════════════════════════════════════════════════
   PICKING PEOPLE
   ═══════════════════════════════════════════════════════════════════════
   A box that looks like any other field and holds chips. The menu under it
   is the existing .picker-menu. */

.kit-picker{ position:relative; min-width:0 }
.kit-chips{
  display:flex; flex-wrap:wrap; align-items:center; gap:.3rem;
  min-height:var(--control); padding:.25rem .3rem;
  background:var(--card); border:1px solid var(--line-strong); border-radius:10px;
  cursor:text; transition:border-color .12s, box-shadow .12s;
}
.kit-chips:hover{ border-color:#bfc5cf }
.kit-chips:focus-within{
  border-color:var(--accent);
  box-shadow:0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
/* read-only, or every place taken: the chips without the field around them */
.kit-chips.is-off{ border-color:transparent; background:none; padding-left:0; cursor:default; min-height:0 }
.kit-chips-none{ color:var(--faint) }
.kit-chips.is-full{ cursor:default }
.kit-chips input{
  flex:1 1 7rem; width:auto; min-width:6rem; min-height:2rem;
  padding:.2rem .45rem; border:0; border-radius:6px; background:none;
  font-size:16px;                 /* under 16px iOS zooms on focus */
}
.kit-chips input:hover{ border-color:transparent }
.kit-chips input:focus{ box-shadow:none }
.kit-chips input[hidden]{ display:none }

.kit-chip{
  display:inline-flex; align-items:center; gap:.1rem; max-width:100%;
  min-height:1.95rem; padding:0 .1rem 0 .7rem;
  font-size:.84rem; font-weight:550; color:var(--ink);
  background:var(--accent-soft); border:1px solid var(--accent-line); border-radius:2rem;
  animation:menu-in .14s cubic-bezier(.2,.8,.3,1);
}
.kit-chips.is-off .kit-chip{ padding-right:.7rem }
.kit-chip-name{ min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.kit-chip button{
  flex:none; width:28px; height:28px; border-radius:50%;
  display:inline-flex; align-items:center; justify-content:center;
  font:inherit; font-size:1.05rem; line-height:1;
  color:var(--muted); background:none; border:0; cursor:pointer;
}
.kit-chip button:hover{ color:var(--bad); background:var(--bad-bg) }
/* somebody picked who clashes: a dot on their chip, the reason as its title */
.kit-chip.has-warn::before,.kit-chip.has-bad::before{
  content:''; flex:none; width:.45rem; height:.45rem; border-radius:50%; margin-right:.3rem;
}
.kit-chip.has-warn::before{ background:var(--warn) }
.kit-chip.has-bad::before{ background:var(--bad) }
.kit-chip.has-warn{ border-color:var(--warn-line) }
.kit-chip.has-bad{ border-color:var(--bad-line) }
@media (pointer:coarse){
  .kit-chip{ min-height:2.3rem }
  .kit-chip button{ width:44px; height:44px; margin:-.4rem -.3rem -.4rem -.2rem }
  .kit-chips input{ min-height:2.4rem }
}

/* the menu's options carry the reasons somebody fits or doesn't */
.kit-picker .picker-menu{ max-height:17rem }
.picker-item.is-empty{ cursor:default; color:var(--faint); font-size:.86rem }
.picker-item.is-empty:hover{ background:none }
.kit-tags{ display:flex; flex-wrap:wrap; gap:.25rem; margin-top:.25rem }
.kit-tag{
  display:inline-flex; align-items:center;
  font-size:.72rem; font-weight:550; line-height:1.2;
  padding:.14rem .48rem; border-radius:2rem; white-space:nowrap;
  color:var(--muted); background:var(--well); border:1px solid var(--line);
}
.kit-tag.good{ color:var(--good); background:var(--good-bg); border-color:var(--good-line) }
.kit-tag.warn{ color:var(--warn); background:var(--warn-bg); border-color:var(--warn-line) }
.kit-tag.bad{ color:var(--bad); background:var(--bad-bg); border-color:var(--bad-line) }
.kit-tag.info{ color:var(--accent); background:var(--accent-soft); border-color:var(--accent-line) }

/* ═══════════════════════════════════════════════════════════════════════
   SMALL CONTROLS
   ═══════════════════════════════════════════════════════════════════════ */

/* the kit's segmented controls keep each option on one line; when they
   don't fit, the row scrolls (as admin.css already does under 700px) */
.segmented[data-kit]{ max-width:100%; overflow-x:auto; scrollbar-width:none }
.segmented[data-kit]::-webkit-scrollbar{ display:none }
.segmented[data-kit] button{ flex:1 0 auto; white-space:nowrap }
.segmented[data-kit] button:disabled{ opacity:.5; cursor:default }

/* a count inside a pill or a segmented option */
.kit-count{
  display:inline-flex; align-items:center; justify-content:center;
  min-width:1.3rem; height:1.25rem; padding:0 .35rem; margin-left:.1rem;
  font-size:.68rem; font-weight:650; line-height:1;
  color:var(--muted); background:var(--well); border:1px solid var(--line); border-radius:2rem;
}
.cal-tab.on .kit-count{ color:var(--accent-ink); background:rgba(255,255,255,.2); border-color:transparent }

/* ── the days ── */
.kit-daystrip{
  position:relative;              /* the pills measure their place from here */
  flex-wrap:nowrap; margin-bottom:0; padding:2px;
  overflow-x:auto; scrollbar-width:none; -webkit-overflow-scrolling:touch;
}
.kit-daystrip::-webkit-scrollbar{ display:none }
.kit-daystrip .cal-tab{
  flex:none; display:inline-flex; align-items:center; gap:.4rem; white-space:nowrap;
  transition:background .12s, color .12s, border-color .12s, box-shadow .12s;
}
.kit-daystrip .cal-tab small{ font-size:.7rem; font-weight:500; opacity:.78 }
.kit-daystrip .cal-tab small.kit-count{ opacity:1 }
.kit-daystrip .cal-tab:disabled{ opacity:.5; cursor:default }
/* a block dragged over a day: let go and it moves there, same time */
.kit-daystrip .cal-tab.is-drop{ border-color:var(--gold); box-shadow:0 0 0 2px var(--gold-soft), 0 0 0 3px var(--gold) }

/* ── time ── */
.kit-time{ display:inline-flex; width:max-content; max-width:100%; vertical-align:middle }
.kit-time .step{ width:44px; height:44px; flex:none }
.kit-time .step-num{
  width:5.6rem; height:44px; min-height:0; padding:0 .4rem;
  font-size:.95rem; font-variant-numeric:tabular-nums; text-align:center;
}
.kit-time .step-num::-webkit-calendar-picker-indicator{ display:none }
.kit-time .step-num::-webkit-date-and-time-value{ text-align:center }
.kit-time .step-num:disabled{ color:var(--faint); background:var(--well) }
@media (pointer:coarse){ .kit-time .step-num{ width:6.4rem; font-size:16px } }

/* ── one of a few, as chips: the lengths, and any row like them ── */
.kit-dur,.kit-choices{ display:flex; flex-wrap:wrap; gap:.35rem }
.kit-dur button,.kit-choices button{
  display:inline-flex; align-items:center; gap:.35rem;
  min-height:2rem; padding:.25rem .75rem;
  font:inherit; font-size:.82rem; font-weight:550; color:var(--muted); white-space:nowrap;
  background:var(--card); border:1px solid var(--line-strong); border-radius:2rem; cursor:pointer;
  transition:background .12s, color .12s, border-color .12s;
}
.kit-dur button:hover:not(:disabled),.kit-choices button:hover:not(:disabled){ color:var(--ink); border-color:#bfc5cf }
.kit-dur button[aria-pressed="true"],.kit-choices button[aria-pressed="true"]{
  color:var(--accent); background:var(--accent-soft); border-color:var(--accent-line); font-weight:650;
}
.kit-dur button:disabled,.kit-choices button:disabled{ opacity:.5; cursor:default }
@media (pointer:coarse){
  .kit-dur button,.kit-choices button{ min-height:44px; padding:.4rem .9rem }
}

/* ── colour ── */
.kit-swatches{ display:flex; flex-wrap:wrap; gap:.45rem }
.kit-swatch{
  position:relative; flex:none; width:2rem; height:2rem; padding:0;
  border-radius:50%; border:2px solid var(--card); cursor:pointer;
  background:var(--edge);
  box-shadow:0 0 0 1px var(--line-strong);
  transition:box-shadow .14s, transform .14s cubic-bezier(.2,.8,.3,1);
}
.kit-swatch:hover:not(:disabled){ transform:scale(1.08) }
/* automatic: no colour of its own, the first one its siblings left free */
.kit-swatch.auto{
  background:conic-gradient(var(--hue-or), var(--hue-brasa), var(--hue-vi), var(--hue-cel),
    var(--hue-teal), var(--hue-salvia), var(--hue-terra), var(--hue-grafit), var(--hue-or));
  opacity:.8;
}
.kit-swatch[aria-pressed="true"]{ box-shadow:0 0 0 2px var(--edge, var(--ink)) }
.kit-swatch.auto[aria-pressed="true"]{ box-shadow:0 0 0 2px var(--ink); opacity:1 }
.kit-swatch[aria-pressed="true"]::after{
  content:''; position:absolute; inset:0; margin:auto; width:14px; height:14px; background:#fff;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center/contain no-repeat;
          mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center/contain no-repeat;
}
.kit-swatch:disabled{ cursor:default; opacity:.55 }
.kit-swatch:focus-visible{ outline:2px solid var(--accent); outline-offset:3px; border-radius:50% }
@media (pointer:coarse){ .kit-swatch{ width:2.6rem; height:2.6rem } }

/* ── keys ── */
.kit-kbd{
  display:inline-flex; align-items:center; justify-content:center;
  min-width:1.6rem; height:1.6rem; padding:0 .4rem;
  font:inherit; font-size:.74rem; font-weight:650; line-height:1; color:var(--ink);
  background:var(--card); border:1px solid var(--line-strong); border-bottom-width:2px; border-radius:6px;
}
.kit-combo{ display:inline-flex; gap:.2rem }
.kit-or{ color:var(--faint); font-size:.78rem; margin:0 .3rem }
.kit-keys{ display:grid; grid-template-columns:auto 1fr; align-items:center; gap:.5rem 1.1rem; margin:0 }
.kit-keys dt{ display:flex; align-items:center; flex-wrap:wrap; justify-content:flex-end }
.kit-keys dd{ margin:0; font-size:.88rem; color:var(--muted) }
.kit-keys .kit-keys-section{
  grid-column:1 / -1; justify-content:flex-start; margin-top:.8rem;
  font-size:.7rem; font-weight:650; letter-spacing:.08em; text-transform:uppercase; color:var(--faint);
}
.kit-keys .kit-keys-section:first-child{ margin-top:0 }

/* ── days, as ticks ("Duplica a altres dies") or as dots (who is there when) ── */
.kit-days{ display:flex; flex-wrap:wrap; gap:.4rem }
.kit-days .check-chip{ min-height:2.25rem; padding:.25rem .8rem }
.kit-days.dots{ gap:3px; align-items:center }
.kit-days.dots i{ width:.6rem; height:.6rem; border-radius:50%; background:var(--line) }
.kit-days.dots i.on{ background:var(--good) }
.kit-days.dots i.off{ background:var(--bad-line) }
.kit-days.dots i.unknown{ background:none; border:1px dashed var(--line-strong) }
@media (pointer:coarse){ .kit-days .check-chip{ min-height:44px } }

/* ═══════════════════════════════════════════════════════════════════════
   READ-OUTS
   ═══════════════════════════════════════════════════════════════════════ */

/* ── a meter: n of max, with a notch at the minimum ── */
.kit-meter{
  position:relative; display:block; height:.4rem; min-width:2.5rem;
  border-radius:2rem; background:var(--line);
}
.kit-meter > b{
  display:block; height:100%; max-width:100%; border-radius:inherit;
  background:var(--accent); transition:width .4s cubic-bezier(.2,.8,.3,1);
}
.kit-meter.short > b{ background:var(--warn) }
.kit-meter.critical{ background:var(--bad-line) }
.kit-meter.critical > b{ background:var(--bad) }
.kit-meter.full > b{ background:var(--good) }
.kit-meter > i{
  position:absolute; top:-3px; bottom:-3px; width:2px; margin-left:-1px;
  border-radius:1px; background:var(--ink); opacity:.5;
}

/* ── stat tiles that are buttons (the page's filters) ── */
button.stat{ font:inherit; color:inherit; text-align:left; cursor:pointer; width:100% }
.stat.bad b{ color:var(--bad) }
.stat.good b{ color:var(--good) }
.stat.muted b{ color:var(--faint) }
.stat[aria-pressed="true"]{ border-color:var(--accent); box-shadow:0 0 0 1px var(--accent), var(--shadow) }
.stat .kit-meter{ margin-top:.55rem }

/* ── what needs attention ── */
.kit-alerts{ list-style:none; margin:0; padding:0; display:grid; gap:.4rem }
.kit-alert{
  display:flex; align-items:center; gap:.65rem; min-height:2.9rem;
  padding:.5rem .55rem .5rem .75rem;
  font-size:.86rem; line-height:1.4;
  background:var(--card); border:1px solid var(--line); border-radius:var(--r-sm);
}
.kit-alert-icon{ flex:none; display:inline-flex; color:var(--faint) }
.kit-alert-icon svg{ width:18px; height:18px }
.kit-alert-text{ flex:1 1 auto; min-width:0; overflow-wrap:anywhere }
button.kit-alert-text{
  font:inherit; color:inherit; text-align:left; background:none; border:0; padding:.15rem 0;
  cursor:pointer; border-radius:4px;
}
button.kit-alert-text:hover{ text-decoration:underline; text-underline-offset:2px }
.kit-alert > .btn{ flex:none }
.kit-alert.critical{ background:var(--bad-bg); border-color:var(--bad-line); font-weight:600 }
.kit-alert.critical .kit-alert-icon,.kit-alert.bad .kit-alert-icon{ color:var(--bad) }
.kit-alert.bad{ border-color:var(--bad-line) }
.kit-alert.warn{ background:var(--warn-bg); border-color:var(--warn-line) }
.kit-alert.warn .kit-alert-icon{ color:var(--warn) }
.kit-alert.info{ background:var(--well) }
.kit-alert.info .kit-alert-icon{ color:var(--accent) }
.kit-alert.ok{ color:var(--good); border-style:dashed; background:none }
.kit-alert.ok .kit-alert-icon{ color:var(--good) }
.kit-alert-more{ display:flex }
.kit-alert-more .btn{ margin-left:.25rem }
@media (max-width:480px){
  .kit-alert{ flex-wrap:wrap }
  .kit-alert > .btn{ margin-left:auto }
}

/* ── the "Desant… / Desat" line ── */
.kit-status{
  display:inline-flex; align-items:center; gap:.4rem; min-height:1.5rem;
  font-size:.78rem; color:var(--faint); white-space:nowrap;
}
.kit-status:empty{ display:none }
.kit-status::before{
  content:''; flex:none; width:.45rem; height:.45rem; border-radius:50%; background:var(--line-strong);
}
.kit-status.saving::before{ background:var(--accent); animation:kit-pulse 1s ease-in-out infinite }
.kit-status.saved::before{ background:var(--good) }
.kit-status.stale{ color:var(--warn) }
.kit-status.stale::before{ background:var(--warn) }
.kit-status.error{ color:var(--bad); font-weight:600 }
.kit-status.error::before{ background:var(--bad) }
@keyframes kit-pulse{ 50%{ opacity:.25 } }

/* ── an empty pane ── */
.kit-empty{
  display:flex; flex-direction:column; align-items:center; gap:.6rem;
  padding:2.25rem 1rem; text-align:center; color:var(--muted);
}
.kit-empty-icon{
  display:inline-flex; align-items:center; justify-content:center;
  width:3rem; height:3rem; border-radius:50%;
  color:var(--faint); background:var(--well); border:1px solid var(--line);
}
.kit-empty-icon svg{ width:22px; height:22px }
.kit-empty-icon .kit-glyph{ font-size:1.3rem; line-height:1 }
.kit-empty p{ max-width:42ch; font-size:.92rem }
.kit-empty .kit-empty-sub{ font-size:.82rem; color:var(--faint); margin-top:-.3rem }
.kit-empty .btn{ margin-top:.2rem }

/* ── the round "+" a phone list floats ── */
.kit-fab{
  position:fixed; z-index:5; right:1.5rem; bottom:1.5rem;
  display:inline-flex; align-items:center; justify-content:center;
  width:3.5rem; height:3.5rem; border-radius:50%;
  font:inherit; font-size:1.7rem; font-weight:400; line-height:1;
  color:var(--accent-ink); background:var(--accent); border:0; cursor:pointer;
  box-shadow:0 8px 24px rgba(51,71,201,.34), 0 2px 6px rgba(17,24,39,.14);
  transition:transform .16s cubic-bezier(.2,.8,.3,1), box-shadow .16s;
  animation:kit-pop-in .3s cubic-bezier(.2,.8,.3,1.2) both;
}
.kit-fab svg{ width:24px; height:24px }
.kit-fab:hover{ box-shadow:0 10px 28px rgba(51,71,201,.42), 0 2px 6px rgba(17,24,39,.16) }
.kit-fab:active{ transform:scale(.92) }
.kit-fab:focus-visible{ outline:2px solid var(--accent); outline-offset:3px; border-radius:50% }
.kit-fab[hidden]{ display:none }
@media (max-width:959px){
  .kit-fab{ right:1rem; bottom:calc(var(--tab-h) + 1rem) }
}
@keyframes kit-pop-in{ from{ opacity:0; transform:scale(.6) } }

/* ═══════════════════════════════════════════════════════════════════════
   THE DESK
   ═══════════════════════════════════════════════════════════════════════
   Horaris is worked in a grid of rooms, like Torns and Convidats: it gets
   the whole desk too (admin.css gives the other two theirs). */
@media (min-width:960px){
  body[data-page="program"] .wrap{ max-width:110rem }
}

/* ── the help panel (admin/help.js) ─────────────────────────────────── */
.help-btn{ gap:.35rem }
.help-q{
  display:inline-grid; place-items:center; width:1.15rem; height:1.15rem; border-radius:50%;
  border:1.5px solid currentColor; font-size:.7rem; font-weight:800; line-height:1;
}
.help-intro{ margin:0 0 1.1rem; color:var(--muted, #4b5563); line-height:1.5 }
.help-steps{ list-style:none; margin:0; padding:0; counter-reset:help }
.help-step{ position:relative; padding:0 0 1.15rem 2.4rem; counter-increment:help }
.help-step::before{
  content:counter(help); position:absolute; left:0; top:-.05rem;
  width:1.6rem; height:1.6rem; border-radius:50%; display:grid; place-items:center;
  background:var(--accent, #3347c9); color:#fff; font-size:.8rem; font-weight:750;
}
.help-step:not(:last-child)::after{
  content:''; position:absolute; left:.78rem; top:1.75rem; bottom:.35rem; width:2px;
  background:var(--line, #e7e9ee); border-radius:1px;
}
.help-step h3{ margin:0 0 .25rem; font-size:.98rem }
.help-step p{ margin:0; line-height:1.5; color:var(--ink, #111827) }
.help-pics{ display:flex; flex-wrap:wrap; gap:.5rem; margin-top:.6rem; align-items:center }
.help-demo{
  display:inline-flex; flex-direction:column; gap:.1rem; min-width:9.5rem; max-width:13rem;
  padding:.35rem .55rem .35rem .6rem; border-radius:7px; font-size:.74rem; line-height:1.25;
  border:1px solid #c9d6c3; border-left:3px solid #6f8f63; background:#eef3ea; color:var(--ink, #111827);
}
.help-demo small{ color:var(--muted, #4b5563) }
.help-demo.is-ghost{ border:1.5px dashed #6f8f63; background:rgba(238,243,234,.45); opacity:.75 }
.help-demo.is-ghost b{ font-style:italic }
.help-demo.is-grey{ border-color:var(--line-strong, #d2d6de); border-left-color:var(--line-strong, #d2d6de); background:var(--well, #f3f4f6); color:var(--faint, #6b7280); filter:grayscale(1); opacity:.75 }
.help-demo.is-btn{
  min-width:0; flex-direction:row; align-items:center; padding:.4rem .8rem; border-radius:999px;
  background:var(--accent, #3347c9); border:0; color:#fff;
}
.help-demo.is-btn b{ font-weight:650 }
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]) .help-demo:not(.is-btn):not(.is-grey){ background:rgba(111,143,99,.18); border-color:rgba(111,143,99,.5); color:inherit }
}
.help-sheet .help-step h3{ text-transform:none; letter-spacing:0; color:var(--ink, #111827); font-size:1rem; font-weight:700 }
.help-q{ flex:none; box-sizing:border-box }
.help-row{ display:flex; justify-content:flex-end; margin:0 0 .5rem }
