/* Locker PWA. Visual language taken from Vallki (Barlow Condensed headings in capitals, sharp 2px corners,
   cut corners on the primary buttons, a dark ink header and a bell-yellow accent instead of Vallki's teal).
   Every colour is a token on :root; the dark theme redefines them. Light by default; the system's dark theme when
   the user has not chosen; and the choice of the user (header button or Settings) as data-theme on <html>. */
@import url("https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700;800&family=Inter:wght@400;500;600;700&display=swap");

:root {
  color-scheme: light;
  --ink: #161d2a;          /* header, primary text on light, splash */
  --ink-2: #232d3d;
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #161d2a;
  --muted: #5f6b7d;
  --line: #dfe3ea;
  --accent: #f2c75c;       /* the bell yellow: switches, active tabs, primary buttons */
  --accent-ink: #1d1600;   /* text over the accent */
  --accent-soft: #fdf1cc;
  --accent-soft-ink: #6b5200;
  --danger: #c0392b;
  --danger-soft: #fbe5e2;
  --warn: #a35f00;
  --warn-soft: #fdf0dc;
  --good: #1e7a3c;
  --good-soft: #dff3e4;
  --header-text: #ffffff;
  --radius: 2px;
  --gutter: 16px;
  --cut: 9px;
  --font-display: "Barlow Condensed", "Arial Narrow", ui-sans-serif, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ink: #0b0f18; --ink-2: #131a26;
    --bg: #0f141d; --card: #171f2c; --text: #eef1f6; --muted: #9aa5b8; --line: #2a3448;
    --accent-soft: #3a3014; --accent-soft-ink: #f5d98a;
    --danger: #ff7b6b; --danger-soft: #3a1d19;
    --warn: #f0b35a; --warn-soft: #3a2b14;
    --good: #6fd08c; --good-soft: #17301f;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #0b0f18; --ink-2: #131a26;
  --bg: #0f141d; --card: #171f2c; --text: #eef1f6; --muted: #9aa5b8; --line: #2a3448;
  --accent-soft: #3a3014; --accent-soft-ink: #f5d98a;
  --danger: #ff7b6b; --danger-soft: #3a1d19;
  --warn: #f0b35a; --warn-soft: #3a2b14;
  --good: #6fd08c; --good-soft: #17301f;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overscroll-behavior-y: none; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-feature-settings: "cv11", "ss01"; }
body { padding-bottom: env(safe-area-inset-bottom); -webkit-tap-highlight-color: transparent; }
a { color: var(--text); }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: .03em; font-weight: 700; margin: 0 0 .5rem; line-height: 1.1; }
h1 { font-size: 2rem; } h2 { font-size: 1.45rem; } h3 { font-size: 1.15rem; }
.muted { color: var(--muted); } .center { text-align: center; } .small { font-size: .85rem; }
.hidden, [hidden] { display: none !important; }

/* ---- header (ink bar with a bell-yellow edge, like the Vallki headers) ---- */
header.top {
  background: var(--ink); color: var(--header-text);
  padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 10px;
  display: flex; align-items: center; gap: 10px;
  position: sticky; top: 0; z-index: 5;
  border-bottom: 3px solid var(--accent);
}
header.top .title { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; letter-spacing: .08em; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
header.top a, header.top button.link { color: var(--header-text); text-decoration: none; background: none; border: 0; font: inherit; font-size: .95rem; cursor: pointer; padding: 6px 8px; border-radius: var(--radius); }
header.top a:hover, header.top button.link:hover { background: rgba(255,255,255,.1); }
/* «WB·Locker»: a middle dot centred on the capitals (their height is about 0.7em) */
header.top .brand-dot { display: inline-block; width: .2em; height: .2em; margin: 0 .16em 0 .08em; border-radius: 50%; background: currentColor; vertical-align: .25em; }
header.top .brand-mark { width: 30px; height: 30px; border-radius: 50%; flex: none; }
/* Phone: the links take less room, so the title (the box name) keeps some space */
@media (max-width: 480px) {
  header.top { gap: 4px; padding-left: 12px; padding-right: 8px; }
  header.top a, header.top button.link { font-size: .85rem; padding: 6px 5px; }
  header.top button.theme { padding: 6px 4px; }
  header.top .title { font-size: 1.15rem; min-width: 0; }
}
header.top .avatar { margin: 0 4px 0 0; }
header.top button.theme { color: var(--header-text); }
header.top button.theme:hover { background: rgba(255,255,255,.1); }

main { max-width: 1100px; margin: 0 auto; padding: var(--gutter); }

/* ---- surfaces ---- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--gutter) calc(var(--gutter) + 2px); margin-bottom: var(--gutter);
  box-shadow: 0 1px 2px rgba(22,29,42,.05);
}
.card.login { max-width: 400px; margin: 0 auto; padding: 28px 24px; border-top: 4px solid var(--accent); box-shadow: 0 18px 40px rgba(0,0,0,.25); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
/* a Pi of the box: the name and the last signal take the whole line when the phone is narrow, the controls wrap below */
.device-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.device-row .grow { flex: 1 1 14rem; }
.grid { display: grid; gap: var(--gutter); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid > * { min-width: 0; }
/* A box on the home screen: the whole card is the link; the accent edge shows it is clickable */
a.card { display: block; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--accent); transform: translateY(-1px); }

/* ---- buttons: outline by default; primary is the bell yellow with a cut corner ---- */
button, .btn {
  font: inherit; font-weight: 600; font-size: .95rem; border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: var(--radius); padding: 9px 16px; cursor: pointer; min-height: 40px;
  transition: filter .15s, background .15s;
}
button:hover { border-color: var(--muted); }
button.primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
  font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; letter-spacing: .06em;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%);
}
button.primary:hover { filter: brightness(1.05); border-color: var(--accent); }
button.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
button.danger:hover { background: var(--danger-soft); }
button:disabled { opacity: .5; cursor: default; }
button.big { width: 100%; min-height: 72px; font-size: 1.4rem; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 9px 12px; min-height: 40px; width: 100%;
}
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; padding: 0; margin: 0; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 35%, transparent); }
label { display: block; font-size: .85rem; font-weight: 500; margin: .7rem 0 .25rem; color: var(--muted); }
/* In a row, a field takes the free room and its button sits beside it on the same line */
.row > input, .row > select { flex: 1 1 12rem; width: auto; min-width: 0; }
form .row input { width: auto; flex: 1; min-width: 120px; }

/* ---- tabs: square pills, the open one in yellow ---- */
.tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-bottom: var(--gutter); padding: 2px 0 4px; }   /* the tabs wrap onto more lines: none is ever cut at the edge */
.tabs a {
  flex: none; white-space: nowrap; padding: 8px 14px; border-radius: var(--radius); text-decoration: none; font-weight: 600; font-size: .92rem;
  color: var(--text); border: 1px solid var(--line); background: var(--card);
}
.tabs a:hover { border-color: var(--muted); }
.tabs a.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
/* From 1000px the nine tabs fit on one line; narrower, each line is stretched to the full width */
@media (max-width: 999px) {
  .tabs a { flex: 1 1 auto; text-align: center; }
}

/* ---- badges ---- */
.badge {
  display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .06em;
  padding: 3px 9px; border-radius: var(--radius); border: 1px solid var(--line); color: var(--muted); background: transparent; line-height: 1.3;
}
.badge.ok { color: var(--accent-soft-ink); background: var(--accent-soft); border-color: var(--accent); }
.badge.yes { color: var(--good); background: var(--good-soft); border-color: transparent; }   /* access granted: green */
.badge.ko { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.badge.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; font-size: .8rem; letter-spacing: .05em; }
td.nowrap { white-space: nowrap; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 12px; }

/* ---- switch: the yellow track ---- */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; margin: 0; color: var(--text); font-size: 1rem; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; min-height: 0; }
.switch .track { width: 44px; height: 26px; background: var(--line); border-radius: 999px; position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .5; }
/* A smaller switch for long lists (the kinds of notice, the permissions of an admin) */
.switch.mini { display: flex; width: max-content; max-width: 100%; gap: 10px; font-size: .92rem; line-height: 1.3; align-items: flex-start; }
.switch.mini .track { width: 36px; height: 20px; margin-top: 1px; }
.switch.mini .track::after { width: 14px; height: 14px; top: 3px; left: 3px; }
.switch.mini input:checked + .track::after { transform: translateX(16px); }
.switch.mini small { display: block; margin-top: 3px; line-height: 1.4; }
/* One option per line, with air between them (kinds of notice, permissions) */
.kind-list { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.kind-list .switch.mini { width: 100%; max-width: none; }
.kind-list .sub-label { margin-bottom: 0; }
.switch:has(input:disabled) { cursor: default; }

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: var(--radius); max-width: 90vw; z-index: 20;
  border-left: 4px solid var(--accent); box-shadow: 0 8px 24px rgba(0,0,0,.3); font-size: .95rem;
}
.toast.error { border-left-color: var(--danger); }
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--bg); border: 1px dashed var(--accent); padding: 8px 10px; border-radius: var(--radius); word-break: break-all; }

/* ---- login: the ink screen with the bell, like the Vallki launch screen ---- */
.login-page {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px var(--gutter);
  background: radial-gradient(120% 90% at 50% 30%, var(--ink-2) 0%, var(--ink) 70%);
  position: relative; overflow: hidden;
}
.login-page::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(242,199,92,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(242,199,92,.07) 1px, transparent 1px);
  background-size: 32px 32px;
}
.login-page > * { position: relative; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 22px; color: #fff; text-align: center; }
.login-brand img { width: 88px; height: 88px; border-radius: 50%; box-shadow: 0 0 40px rgba(242,199,92,.25); }
.login-brand .name { font-family: var(--font-display); font-weight: 800; font-size: 2.4rem; letter-spacing: .2em; text-transform: uppercase; line-height: 1; }
.login-brand .tag { font-size: .8rem; letter-spacing: .25em; text-transform: uppercase; color: #cfd6e2; }
.login-theme { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 12px; font-size: 1.2rem; z-index: 2; }
.login-theme { color: #fff; }

/* ---- splash: shown while the saved session is checked (replaced by the first screen) ---- */
.splash {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  background: radial-gradient(120% 90% at 50% 35%, var(--ink-2) 0%, var(--ink) 70%); color: #fff; text-align: center; position: relative; overflow: hidden;
}
.splash img { width: 104px; height: 104px; border-radius: 50%; box-shadow: 0 0 60px rgba(242,199,92,.35); animation: splash-rise .6s cubic-bezier(.2,.8,.2,1) both; }
/* «WB» over «LOCKER», both centred under the icon: the left padding makes up for the spacing after the last letter */
.splash .name > span { padding-left: .22em; }
.splash .name { display: flex; flex-direction: column; align-items: center; line-height: 1.1; font-family: var(--font-display); font-weight: 800; font-size: 2.6rem; letter-spacing: .22em; text-transform: uppercase; animation: splash-rise .6s .08s cubic-bezier(.2,.8,.2,1) both; }
.splash .bar { position: relative; width: 128px; height: 3px; border-radius: 999px; background: rgba(242,199,92,.2); overflow: hidden; }
.splash .bar::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 34%; background: var(--accent); border-radius: 999px; animation: splash-bar 1.3s ease-in-out infinite; }
.splash .status { font-size: .72rem; letter-spacing: .28em; text-transform: uppercase; color: #cfd6e2; }
@keyframes splash-rise { from { opacity: 0; transform: translateY(14px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes splash-bar { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

/* ---- page sections ---- */
.section-title { display: flex; align-items: center; gap: 10px; margin: 4px 0 var(--gutter); }
.section-title::before { content: ""; width: 6px; height: 22px; background: var(--accent); border-radius: 1px; }
.box-head h2 { margin: 0; }

/* ---- filters of the access table: one line each, pills for the choices ---- */
.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.filters .row { align-items: center; gap: 6px 8px; flex-wrap: wrap; }
.filters > .row > .muted { min-width: 4.5rem; }
.filters button.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
/* A choice you can tick: a pill that turns yellow (the box inside is hidden but still a real checkbox) */
.chip { position: relative; display: inline-flex; margin: 0; font-size: .9rem; color: var(--text); cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 0; height: 0; min-height: 0; margin: 0; padding: 0; }
.chip-text { display: inline-flex; align-items: center; padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); font-weight: 600; line-height: 1.2; white-space: nowrap; }
.chip:hover .chip-text { border-color: var(--muted); }
.chip input:checked + .chip-text { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip input:focus-visible + .chip-text { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Every control of the filters is the same size (44 px, easy to press on a phone) and they do not touch each other:
   the date shortcuts, the range button, the pills, and the two action buttons. The label of each line sits above on a phone. */
.filters { gap: 14px; }
.filters .row { gap: 10px 8px; }
.filters .row > button, .filters .range-trigger, .chip-text, .filters .row > select {
  min-height: 44px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center;
  font-size: .9rem; line-height: 1.2; font-weight: 600;
}
.filters .row > select { justify-content: flex-start; font-weight: 500; }
.filters .range-trigger { min-height: 44px; padding: 0 14px; }
/* both actions («Limpiar filtros» and «Exportar CSV») share the line and the size; «Limpiar filtros» is a normal button with a yellow border */
.filters button.clear-filters { border: 2px solid var(--accent); }
.filters .filter-actions > button { flex: 1 1 7rem; }
@media (max-width: 480px) {
  .filters > .row > .muted { flex: 0 0 100%; min-width: 0; margin-bottom: -2px; }
}

/* ---- one calendar for a date range: the first click picks the start, the second the end ---- */
.range { position: relative; }
.range-trigger { font-size: .9rem; font-weight: 600; white-space: nowrap; min-height: 40px; padding: 8px 12px; }
.range-trigger.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.range-panel { position: fixed; z-index: 15; width: min(300px, calc(100vw - 16px)); padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,.25); }
.range-panel[hidden] { display: none; }
.range-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.range-head strong { font-family: var(--font-display); font-size: 1.05rem; letter-spacing: .04em; text-transform: capitalize; }
.range-head button { min-height: 32px; padding: 2px 10px; line-height: 1; }
.range-week, .range-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.range-week span { font-size: .72rem; font-weight: 600; color: var(--muted); padding: 4px 0; }
.range-grid .day { min-height: 34px; min-width: 0; padding: 0; font-size: .88rem; font-weight: 500; background: transparent; border: 1px solid transparent; }
.range-grid .day:hover { border-color: var(--muted); }
.range-grid .day.today { border-color: var(--line); font-weight: 700; }
.range-grid .day.in { background: var(--accent-soft); border-radius: 0; }
.range-grid .day.edge { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.range-foot { justify-content: space-between; margin-top: 8px; }
/* Our own confirmation: it takes a whole line when it sits in a row of buttons */
.confirm-panel { margin: 8px 0; padding: 10px 12px; }
.row > .confirm-panel { flex: 1 1 100%; }
.range-foot button { min-height: 32px; padding: 2px 10px; }

/* ---- matrix "what to notify through each channel" ---- */
.matrix { width: 100%; border-collapse: collapse; }
.matrix th, .matrix td { padding: 6px 4px; vertical-align: middle; }
.matrix th.group { text-align: left; background: var(--bg); font-size: .8rem; color: var(--muted); padding: 8px 6px; font-family: var(--font-display); font-size: .95rem; letter-spacing: .04em; }
.matrix td.center, .matrix th.center { text-align: center; }
.matrix input[type=checkbox] { width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: var(--accent); }
.matrix .stack { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.matrix button.small { font-size: .72rem; padding: 3px 6px; min-height: 0; }

/* ---- sortable headers of the access table ---- */
button.sort { all: unset; cursor: pointer; font-weight: 600; white-space: nowrap; }
button.sort:hover, button.sort:focus-visible { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }

/* ---- admins of a box: one block per admin, its switches in a tidy grid ---- */
.admin-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.admin-row:last-of-type { border-bottom: 0; }
.admin-row .sub-label { margin: .8rem 0 .4rem; color: var(--muted); font-size: .9rem; }
.perm-grid { display: flex; flex-direction: column; gap: 14px; }
.perm-grid .switch.mini { width: 100%; max-width: none; }

/* ---- picture of a box ---- */
.avatar { flex: none; border-radius: var(--radius); object-fit: cover; display: inline-block; vertical-align: middle; background: var(--line); }
.avatar.letter { display: inline-flex; align-items: center; justify-content: center; color: var(--accent-ink); background: var(--accent); font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; }

/* ---- theme button (header and login) ---- */
button.theme { background: none; border: 0; font: inherit; cursor: pointer; padding: 6px 8px; border-radius: var(--radius); line-height: 1; color: inherit; min-height: 0; }
button.theme:hover { border-color: transparent; }

/* ---- loading feedback: a thin yellow bar at the top, a spinner in a busy button, a dimmed busy control ---- */
#progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; overflow: hidden; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 1000; }
#progress.on { opacity: 1; }
#progress::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%; background: var(--accent); animation: progress-slide 1.1s ease-in-out infinite; }
@keyframes progress-slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.spinner { display: inline-block; width: 1em; height: 1em; margin-right: .5em; vertical-align: -.15em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
button.is-busy, [aria-busy="true"] { cursor: progress; }
button.is-busy:disabled { opacity: .85; }
@media (prefers-reduced-motion: reduce) {
  .spinner, #progress::after, .splash .bar::after { animation-duration: 2.4s; }
  .splash img, .splash .name { animation: none; }
}

/* ---- Avisos del servidor and the channel blocks ---- */
.channel-block { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-top: 14px; background: var(--card); }
.channel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.channel-head h3 { margin: 0; }
/* A channel block folds: its head (title and state) always shows, the rest only when open */
details.channel-block { padding: 10px 14px; }
details.channel-block > summary.channel-head { list-style: none; cursor: pointer; margin-bottom: 0; min-height: 40px; border-radius: var(--radius); }
details.channel-block > summary.channel-head::-webkit-details-marker { display: none; }
details.channel-block > summary.channel-head::before { content: "▸"; order: -1; color: var(--muted); font-size: .9rem; width: 12px; transition: transform .15s; }
details.channel-block[open] > summary.channel-head::before { transform: rotate(90deg); }
details.channel-block > summary.channel-head > h3 { flex: 1; min-width: 0; }
details.channel-block > summary.channel-head:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
details.channel-block > .fold-body { margin-top: 10px; }
details.channel-block:not([open]) > .fold-body { display: none; }
.sub-label { font-family: var(--font-display); font-weight: 700; font-size: 1rem; letter-spacing: .04em; margin: .9rem 0 .3rem; }

/* The matrix keeps a readable width on a phone (the table scrolls sideways inside its box) */
table.matrix { min-width: 560px; }
table.matrix td:first-child, table.matrix th:first-child { min-width: 150px; }
/* Server channel blocks: the switch sits on its own line, its state badge below it, buttons on one line */
.channel-block > .switch { display: flex; width: max-content; max-width: 100%; margin: 6px 0 8px; }
.channel-block > p.badge { display: inline-block; margin: 0 0 8px; }
.channel-block .row { margin-top: 2px; }
.channel-block .row > button { min-height: 40px; }
button.primary { line-height: 1.2; display: inline-flex; align-items: center; justify-content: center; }
.notice { border: 1px solid var(--warn); background: var(--warn-soft); color: var(--warn); border-radius: var(--radius); padding: 9px 12px; margin: 10px 0; font-size: .9rem; line-height: 1.4; }

/* ---- Estado tab ---- */
.metric { margin: 12px 0; }
.metric-head { display: flex; justify-content: space-between; font-size: .9rem; margin-bottom: 5px; }
.bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar .fill { display: block; height: 100%; background: var(--accent); }
.bar .fill.warn { background: var(--warn); }
.bar .fill.danger { background: var(--danger); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 16px; margin: 12px 0; }
.fact { display: flex; flex-direction: column; font-size: .9rem; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.lv-ok { color: var(--accent-soft-ink); } .lv-ko { color: var(--danger); } .lv-warn { color: var(--warn); }

/* ---- access table on a phone: three columns (date, name with its email and code underneath, access), no sideways scroll ---- */
.d-short, .m-only { display: none; }
.d-short > span { display: block; }
@media (max-width: 600px) {
  .d-full, .col-extra { display: none; }
  .d-short { display: block; }
  .m-only { display: block; overflow-wrap: anywhere; }
}
