/* Puerteñito UI. System font stack, light/dark via prefers-color-scheme and data-theme. */
:root {
  --bg: #f7f7f8; --fg: #1a1a1f; --muted: #5b5f6b; --card: #ffffff; --border: #d9dbe1;
  --accent: #1d4ed8; --accent-fg: #ffffff; --danger: #b42318; --ok: #067647; --warn: #b54708;
  --focus: #f59e0b; --radius: 8px; --max: 1100px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #121317; --fg: #e8e8ec; --muted: #a0a4b0; --card: #1c1e24; --border: #30333b; --accent-fg: #ffffff; }
}
:root[data-theme="dark"] { --bg: #121317; --fg: #e8e8ec; --muted: #a0a4b0; --card: #1c1e24; --border: #30333b; }
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif); line-height: 1.45; }
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; background: var(--card); padding: .5rem; z-index: 10; }
header.top { background: var(--card); border-bottom: 1px solid var(--border); }
header.top .bar { max-width: var(--max); margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
header.top .brand { font-weight: 700; text-decoration: none; color: var(--fg); display: flex; align-items: center; gap: .5rem; }
header.top .brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); display: inline-block; }
nav.main { display: flex; gap: .25rem; flex-wrap: wrap; }
nav.main a { text-decoration: none; color: var(--fg); padding: .35rem .6rem; border-radius: var(--radius); }
nav.main a[aria-current="page"], nav.main a:hover { background: var(--bg); }
.spacer { flex: 1; }
.userbox { display: flex; align-items: center; gap: .5rem; font-size: .95rem; }
.badge { display: inline-block; min-width: 1.3em; padding: 0 .4em; border-radius: 999px; background: var(--accent); color: var(--accent-fg); font-size: .8rem; text-align: center; }
main { max-width: var(--max); margin: 0 auto; padding: 1rem; }
main.narrow { max-width: 440px; margin-top: 4vh; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1rem; }
h1 { font-size: 1.5rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.25rem 0 .5rem; }
h1:first-child, h2:first-child { margin-top: 0; }
p.muted, .muted { color: var(--muted); }
label { display: block; font-weight: 600; margin: .75rem 0 .25rem; }
label.inline { display: inline-flex; align-items: center; gap: .5rem; font-weight: 400; margin: .5rem 0; }
input[type=text], input[type=password], input[type=email], input[type=url], input[type=search], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; padding: .55rem .65rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); color: var(--fg); font: inherit;
}
input[aria-invalid="true"] { border-color: var(--danger); }
.hint { font-size: .9rem; color: var(--muted); margin: .25rem 0 0; }
.error { color: var(--danger); font-size: .95rem; margin: .25rem 0 0; }
button, .btn { display: inline-block; padding: .55rem 1rem; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--accent); color: var(--accent-fg); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
button.secondary, .btn.secondary { background: var(--card); color: var(--fg); border-color: var(--border); }
button.danger, .btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button.link { background: none; border: none; color: var(--accent); padding: 0; font-weight: 400; text-decoration: underline; cursor: pointer; }
button.small, .btn.small { padding: .3rem .6rem; font-size: .9rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
form.inline { display: inline; }
.flash { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid var(--border); background: var(--card); }
.flash.ok { border-color: var(--ok); } .flash.error { border-color: var(--danger); } .flash.warn { border-color: var(--warn); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .5rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; text-transform: uppercase; letter-spacing: .02em; }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .95em; }
.secret { font-size: 1.15rem; padding: .75rem; background: var(--bg); border: 1px dashed var(--border); border-radius: var(--radius); word-break: break-all; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: .5rem .75rem; text-decoration: none; color: var(--fg); border-bottom: 3px solid transparent; }
.tabs a[aria-current="page"] { border-bottom-color: var(--accent); font-weight: 600; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stat { font-size: 1.8rem; font-weight: 700; }
.pill { display: inline-block; padding: .1rem .5rem; border-radius: .7rem; font-size: .8rem; border: 1px solid var(--border); color: var(--muted); }
.pill.ok { border-color: var(--ok); color: var(--ok); } .pill.warn { border-color: var(--warn); color: var(--warn); } .pill.danger { border-color: var(--danger); color: var(--danger); }
.qr { background: #fff; padding: .5rem; display: inline-block; border-radius: var(--radius); }
.qr svg { width: 200px; height: 200px; display: block; }
.codes { columns: 2; font-family: ui-monospace, monospace; font-size: 1.1rem; }
details summary { cursor: pointer; font-weight: 600; margin: .5rem 0; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.filters label { margin: 0; font-size: .85rem; }
.filters input, .filters select { width: auto; min-width: 10rem; }
footer { max-width: var(--max); margin: 2rem auto; padding: 0 1rem; color: var(--muted); font-size: .85rem; }
.login-head { text-align: center; margin-bottom: 1rem; }
.login-head .dot { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); display: inline-block; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
/* Links and accent text stay readable in dark mode whatever the branding accent is. */
:root { --link: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --link: color-mix(in srgb, var(--accent) 45%, #fff); --bg: #111215; } }
:root[data-theme="dark"] { --link: color-mix(in srgb, var(--accent) 45%, #fff); --bg: #111215; }
a, button.link { color: var(--link); }
.tabs a[aria-current="page"] { border-bottom-color: var(--link); }
button:hover, .btn:hover { filter: brightness(1.08); }
button.secondary:hover, .btn.secondary:hover { filter: none; background: var(--bg); }
button.danger:hover, .btn.danger:hover { filter: brightness(1.1); }
/* Layout helpers (templates use classes, never style attributes, so a strict CSP doesn't drop them). */
.span-all { grid-column: 1 / -1; }
input.w-sm { width: 6rem; display: inline-block; } input.w-md { width: 10rem; display: inline-block; } input.w-lg { max-width: 20rem; }
.sub { font-size: 1rem; font-weight: 400; } .small-text { font-size: .85rem; } .stack { margin: .75rem 0 0; }
.card.attention { border-left: 4px solid var(--link); }
.card > h2:first-child { margin-top: 0; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; color: var(--muted); font-weight: 600; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain > li { padding: .5rem 0; border-bottom: 1px solid var(--border); }
ul.plain > li:last-child { border-bottom: none; }
.tiles { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.tile { display: flex; gap: .75rem; align-items: flex-start; padding: .85rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); position: relative; transition: border-color .15s; }
.tile:hover, .tile:focus-within { border-color: var(--link); }
.tile-icon { flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; text-transform: uppercase; }
.tile img { flex: none; border-radius: 10px; }
.tile-body { flex: 1; min-width: 0; }
.tile-body strong a { text-decoration: none; color: var(--fg); }
.tile-body strong a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.tile form { position: relative; z-index: 1; }
.tile button.link { text-decoration: none; font-size: 1.2rem; line-height: 1; color: var(--muted); }
.tile .muted { font-size: .9rem; }
th { white-space: nowrap; }
td code, td .mono { word-break: break-all; }
details > summary { list-style-position: inside; }
@media (max-width: 720px) {
  /* Phone header: brand and user box on one line, navigation as one scrollable row. */
  header.top .bar { gap: .4rem .75rem; padding: .5rem .75rem; }
  header.top .spacer { display: none; }
  header.top .userbox { margin-left: auto; order: 2; }
  header.top .userbox > span { display: none; }
  nav.main { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -.75rem; padding: 0 .75rem .1rem; }
  nav.main a { white-space: nowrap; font-size: .95rem; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs a { white-space: nowrap; }
  h1 { font-size: 1.3rem; }
  table { font-size: .9rem; }
  th, td { padding: .45rem .35rem; }
  .filters > *, .filters input, .filters select { flex: 1 1 100%; min-width: 0; width: 100%; }
  .actions > button, .actions > .btn { flex: 1 1 auto; text-align: center; }
}
/* Pass 2: one-row header, home grid, readable audit rows, forms and phone tables. */
[hidden] { display: none !important; }
header.top .bar { flex-wrap: nowrap; gap: 1.25rem; min-height: 3.25rem; }
header.top .brand { flex: none; white-space: nowrap; }
header.top .brand .logo { display: block; }
nav.main { flex: 1; min-width: 0; flex-wrap: nowrap; }
nav.main a { white-space: nowrap; font-weight: 500; }
nav.main a[aria-current="page"] { color: var(--link); background: color-mix(in srgb, var(--link) 12%, transparent); }
.userbox { flex: none; gap: .25rem; margin-left: auto; }
.userbox .bell { position: relative; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 999px; color: var(--fg); }
.userbox .bell:hover, .userbox .bell[aria-current="page"] { background: var(--bg); }
.userbox .bell .badge { position: absolute; top: 2px; right: 0; font-size: .7rem; line-height: 1.35; }
details.usermenu { position: relative; }
details.usermenu > summary { list-style: none; display: flex; align-items: center; gap: .5rem; padding: .25rem .5rem .25rem .25rem; border-radius: 999px; font-weight: 500; margin: 0; }
details.usermenu > summary::-webkit-details-marker { display: none; }
details.usermenu > summary::after { content: ""; width: .4rem; height: .4rem; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-2px); }
details.usermenu > summary:hover, details.usermenu[open] > summary { background: var(--bg); }
.avatar { width: 2rem; height: 2rem; border-radius: 999px; background: color-mix(in srgb, var(--accent) 18%, var(--card)); color: var(--link); display: grid; place-items: center; font-weight: 700; text-transform: uppercase; }
.uname { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-panel { position: absolute; right: 0; top: calc(100% + .4rem); z-index: 20; min-width: 13rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgb(0 0 0 / .14); padding: .5rem; display: grid; gap: .1rem; }
.menu-panel p { margin: .25rem .5rem .4rem; }
.menu-panel a { padding: .45rem .5rem; border-radius: 6px; text-decoration: none; color: var(--fg); }
.menu-panel a:hover { background: var(--bg); }
.menu-panel form { border-top: 1px solid var(--border); margin-top: .35rem; padding-top: .5rem; }
.menu-panel button { width: 100%; }
footer { text-align: center; }
/* Home: apps wide, a side column for groups and notifications. */
.home { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr) 20rem; align-items: start; }
.home > .card { margin-bottom: 0; }
.home-apps { grid-column: 1; }
.home-side { grid-column: 2; display: grid; gap: 1rem; }
.home-side .card { margin: 0; }
.home-side ul { padding-left: 1.1rem; margin: .25rem 0; }
.linklist li { display: flex; justify-content: space-between; gap: .5rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.card-head h2 { margin: 0; }
.searchbar { display: flex; gap: .4rem; align-items: center; flex: 0 1 18rem; }
.searchbar input { min-width: 0; }
html.js .nojs-only { display: none; }
.empty { text-align: center; padding: 1.5rem .5rem; }
.empty p { margin: .35rem 0; }
.card-foot { margin: .75rem 0 0; font-size: .95rem; }
/* Audit events. */
.event { font-weight: 600; white-space: nowrap; }
.event.bad { color: var(--danger); }
:root[data-theme="dark"] .event.bad { color: #f97066; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .event.bad { color: #f97066; } }
td.details { min-width: 14rem; max-width: 28rem; overflow-wrap: anywhere; }
.home-side ul.plain { padding-left: 0; }
.home-side ul:not(.plain) > li { margin-bottom: .45rem; font-size: .95rem; }
.linklist a.muted { text-decoration: none; }
details.raw summary { font-weight: 400; font-size: .85rem; color: var(--muted); margin: .2rem 0 0; }
details.raw pre { margin: .35rem 0 0; font-size: .8rem; background: var(--bg); padding: .5rem; border-radius: 6px; white-space: pre-wrap; word-break: break-all; max-width: 32rem; }
.nowrap, time { white-space: nowrap; }
.regen-group { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .5rem 0 0; }
.regen-group label { margin: 0; font-weight: 400; }
.regen-group select { width: auto; max-width: 100%; margin: 0; }
td > p.muted:first-child { margin-top: 0; }
.meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; }
time[title] { text-decoration: underline dotted var(--border); text-underline-offset: 3px; cursor: help; }
pre.wrap { white-space: pre-wrap; } .scroll-box { max-height: 30rem; overflow: auto; }
pre.mono { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: .65rem .75rem; overflow-x: auto; }
.avatar-img { border-radius: 50%; object-fit: cover; }
li.unread { font-weight: 600; } li.unread .muted { font-weight: 400; } li.unread::marker { color: var(--accent); }
/* Forms. */
input, select, textarea { min-height: 2.5rem; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--focus); }
input[type=checkbox], input[type=radio] { min-height: 0; width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
label + .hint { margin-top: -.1rem; margin-bottom: .3rem; }
button.danger, .btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button.danger:hover, .btn.danger:hover { background: var(--danger); color: #fff; filter: none; }
:root[data-theme="dark"] button.danger, :root[data-theme="dark"] .btn.danger { color: #f97066; border-color: #f97066; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) button.danger, :root:not([data-theme="light"]) .btn.danger { color: #f97066; border-color: #f97066; } }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.card { min-width: 0; }
@media (max-width: 1100px) { .uname { display: none; } }
@media (max-width: 900px) { .home { grid-template-columns: 1fr; } .home-apps, .home-side { grid-column: 1; } }
@media (max-width: 720px) {
  header.top .bar { flex-wrap: wrap; }
  nav.main { flex: 1 0 100%; }
  input, select, textarea, button, .btn { min-height: 44px; }
  button.small, .btn.small { min-height: 40px; }
  input[type=checkbox], input[type=radio] { min-height: 0; }
  .searchbar { flex: 1 1 100%; }
  form.save-bar, .save-bar { position: sticky; bottom: 0; background: var(--card); padding: .6rem 0; border-top: 1px solid var(--border); }
  /* Wide tables scroll inside their card, never the page. */
  .card .table-wrap { margin: 0 -.85rem; padding: 0 .85rem; }
  td.details { min-width: 12rem; }
}
@media (max-width: 480px) { main { padding: .75rem; } .card { padding: .85rem; } .codes { columns: 1; } .tiles { grid-template-columns: 1fr; } }
/* Pass 3: helpers that replaced inline styles. */
.pill { max-width: 100%; overflow-wrap: anywhere; vertical-align: middle; }
a.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
input.w-inline { width: 14rem; max-width: 100%; display: inline-block; }
input.w-filter { min-width: 24rem; }
.pre-wrap { white-space: pre-wrap; }
.break, td.break { word-break: break-all; }
th.kv-key { width: 14rem; }
pre.cert { white-space: pre-wrap; font-size: .75rem; max-height: 12rem; overflow: auto; margin: 0; }
form.row-form { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
/* Identifiers never break mid-word; long ones wrap only at their own separators. */
code, .mono { overflow-wrap: anywhere; word-break: normal; hyphens: none; }
td { hyphens: none; overflow-wrap: break-word; word-break: normal; }
td code, td .mono { word-break: normal; overflow-wrap: anywhere; }
/* Status colours that keep 4.5:1 in dark mode. */
:root[data-theme="dark"] { --ok: #47cd89; --warn: #fdb022; --danger-text: #f97066; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ok: #47cd89; --warn: #fdb022; --danger-text: #f97066; } }
:root { --danger-text: var(--danger); }
.pill { background: color-mix(in srgb, var(--muted) 10%, transparent); }
.pill.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); }
.pill.warn { background: color-mix(in srgb, var(--warn) 12%, transparent); }
.pill.danger { border-color: var(--danger-text); color: var(--danger-text); background: color-mix(in srgb, var(--danger-text) 12%, transparent); }
.error { color: var(--danger-text); }
/* Hover and focus on every interactive element, both themes. */
a:hover { text-decoration-thickness: 2px; }
.tabs a:hover { border-bottom-color: var(--border); background: color-mix(in srgb, var(--link) 6%, transparent); }
.tabs a[aria-current="page"]:hover { border-bottom-color: var(--link); }
nav.main a:hover { background: color-mix(in srgb, var(--link) 8%, transparent); }
summary:hover { color: var(--link); }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
.menu-panel a:focus-visible, nav.main a:focus-visible, .tabs a:focus-visible, details.usermenu > summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
main:focus { outline: none; }
.skip:focus { left: 1rem; top: .5rem; padding: .6rem 1rem; border: 2px solid var(--focus); border-radius: var(--radius); font-weight: 600; color: var(--link); }
/* Button order: primary, secondary, then destructive pushed to the far end. */
.actions > .danger:first-of-type, .actions > form:has(> button.danger) { margin-left: auto; }
.actions > .danger:only-child, .actions > form:only-child { margin-left: 0; }
/* Long forms: sections with a heading and a one-line explanation, fields side by side. */
.form-section { border: 0; border-top: 1px solid var(--border); padding: 1rem 0 0; margin: 1rem 0 0; min-width: 0; }
.form-section:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.form-section > legend, .form-section > h2, .form-section > h3 { font-size: 1.05rem; font-weight: 600; color: var(--fg); padding: 0; margin: 0 0 .15rem; }
.form-section > legend + .hint, .form-section > h3 + .hint { margin: 0 0 .5rem; }
.field-row { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
details.advanced { border: 1px dashed var(--border); border-radius: var(--radius); padding: .25rem .85rem; margin: 1rem 0 0; }
details.advanced[open] { padding-bottom: .85rem; }
details.deleted-list > summary { cursor: pointer; font-weight: 600; }
details.deleted-list[open] > summary { margin-bottom: .5rem; }
/* Phones: every data table becomes a stack of small cards, each cell a "label: value" line. */
@media (max-width: 640px) {
  .card .table-wrap { margin: 0; padding: 0; overflow: visible; }
  table:has(> thead) { font-size: .95rem; }
  table:has(> thead) > thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table:has(> thead), table:has(> thead) > tbody, table:has(> thead) > tbody > tr, table:has(> thead) > tbody > tr > td { display: block; width: 100%; }
  table:has(> thead) > tbody > tr { border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem .75rem; margin: 0 0 .75rem; background: var(--card); }
  table:has(> thead) > tbody > tr:last-child { margin-bottom: 0; }
  /* The label floats into the cell's left padding; flow-root makes the cell at least as tall as a
     label that wraps to two or three lines, so labels never run into the next row. The negative
     margin and width are relative to the content box (62% of the cell): 61.29% of it = 38% of the cell. */
  table:has(> thead) > tbody > tr > td { border: 0; padding: .3rem 0 .3rem 38%; display: flow-root; min-width: 0; max-width: none; min-height: 1.9rem; }
  table:has(> thead) > tbody > tr > td::before { content: attr(data-label); float: left; margin: .15rem 0 0 -61.29%; width: calc(61.29% - .75rem); color: var(--muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; line-height: 1.3; overflow-wrap: break-word; }
  table:has(> thead) > tbody > tr > td:not([data-label]), table:has(> thead) > tbody > tr > td[data-label=""] { padding-left: 0; min-height: 0; }
  table:has(> thead) > tbody > tr > td:not([data-label])::before, table:has(> thead) > tbody > tr > td[data-label=""]::before { content: none; }
  table:has(> thead) > tbody > tr > td.cell-actions:last-child { border-top: 1px solid var(--border); margin-top: .35rem; padding-top: .6rem; }
  table:has(> thead) > tbody > tr > td.cell-actions:empty { display: none; }
  td.cell-actions form, td.cell-actions form.inline { display: flex; flex-wrap: wrap; gap: .5rem; width: 100%; }
  td.cell-actions button, td.cell-actions .btn, td.cell-actions input.w-inline, td.cell-actions input.w-sm { flex: 1 1 100%; width: 100%; }
  td.details { min-width: 0; max-width: none; }
  /* Stacked cells: padding counts inside the width, and badges ("config file", states)
     wrap inside the card instead of running off the screen. */
  table:has(> thead) > tbody > tr > td { box-sizing: border-box; overflow-wrap: anywhere; }
  table:has(> thead) > tbody > tr > td .pill { white-space: normal; max-width: 100%; text-align: left; }
  /* The selection checkbox sits on its own at the top of the card: no divider above it. */
  table:has(> thead) > tbody > tr > td.cell-select { border: 0; margin: 0; padding: 0 0 .2rem; min-height: 0; }
  table:has(> thead) > tbody > tr > td.cell-select::before { content: none; }
  th.kv-key { width: auto; }
  /* Key/value tables (row headers): long keys wrap instead of squeezing the value to a few characters. */
  table:not(:has(> thead)) th[scope=row] { white-space: normal; width: 38%; overflow-wrap: break-word; }
  table:not(:has(> thead)) td.mono { overflow-wrap: anywhere; }
  table:has(> thead) .event { white-space: normal; }
  input.w-filter { min-width: 0; }
  .field-row { grid-template-columns: 1fr; }
}
/* Sideways-scrolling strips on phones: the current item snaps into view (scroll-snap works
   without script; app.js also scrolls it into view) and a fade marks the cut-off edge. Without
   script the end edge always fades; with it, only the edges that hide items (.more-start/.more-end). */
@media (max-width: 720px) {
  .tabs, nav.main { scroll-snap-type: x proximity; scroll-padding-inline: 1.5rem; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent); }
  .tabs a, nav.main a { scroll-margin-inline: 1.5rem; }
  .tabs a[aria-current="page"], nav.main a[aria-current="page"] { scroll-snap-align: center; }
  .tabs.fade-js, nav.main.fade-js { -webkit-mask-image: none; mask-image: none; }
  .tabs.fade-js.more-end, nav.main.fade-js.more-end { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent); }
  .tabs.fade-js.more-start, nav.main.fade-js.more-start { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 2rem), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 2rem), transparent); }
  .tabs.fade-js.more-start.more-end, nav.main.fade-js.more-start.more-end { -webkit-mask-image: linear-gradient(to right, transparent, #000 2rem, #000 calc(100% - 2rem), transparent); mask-image: linear-gradient(to right, transparent, #000 2rem, #000 calc(100% - 2rem), transparent); }
}
/* Notifications: unread items bold with an accent dot; read items quieter. */
ul.notif-list { list-style: none; padding: 0; margin: .75rem 0 0; }
ul.notif-list > li { position: relative; padding: .55rem 0 .55rem 1.1rem; border-top: 1px solid var(--border); }
ul.notif-list > li:first-child { border-top: 0; }
ul.notif-list > li.unread { font-weight: 400; }
ul.notif-list > li.unread .notif-title { font-weight: 600; }
ul.notif-list > li.unread::before { content: ""; position: absolute; left: .1rem; top: 1.05rem; width: .5rem; height: .5rem; border-radius: 50%; background: var(--accent); }
ul.notif-list > li.read, ul.notif-list > li.read .notif-title { color: var(--muted); font-weight: 400; }
ul.notif-list .notif-meta { white-space: nowrap; }
@media (max-width: 640px) { ul.notif-list .notif-meta { display: block; margin-top: .15rem; } }
/* Checkbox lists: one choice per line, the same box size everywhere. */
label.check-line { display: flex; align-items: flex-start; gap: .5rem; margin: .45rem 0; }
label.check-line > input[type=checkbox] { flex: none; width: 1.1rem; height: 1.1rem; margin: .15rem 0 0; }
/* Badges and dates never break mid-word or at a hyphen. */
.badge { white-space: nowrap; }
.pill, table:has(> thead) > tbody > tr > td .pill { overflow-wrap: normal; word-break: normal; hyphens: none; }
td.nowrap, td.nowrap time, table:has(> thead) > tbody > tr > td.nowrap { white-space: nowrap; overflow-wrap: normal; }

/* Appearance (owner request 2026-10-06): theme.css sets --font, --card, the sign-in background
   and the admin's custom CSS; these are the hooks it and the templates use. */
.logo-dark { display: none !important; }
:root[data-theme="dark"] .logo-dark { display: block !important; }
:root[data-theme="dark"] .logo-light.has-dark { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-dark { display: block !important; }
  :root:not([data-theme="light"]) .logo-light.has-dark { display: none !important; }
}
.login-head .logo { display: inline-block; }
.login-head .login-logo { max-width: 100%; max-height: 120px; display: block; margin: 0 auto .5rem; }
.login-head.place-left { text-align: left; }
.login-head.place-left .login-logo { margin-left: 0; }
.welcome-headline { font-size: 1.15rem; margin: .25rem 0 0; color: var(--muted); }
footer .footer-text { margin: 0 0 .35rem; }
footer .footer-links { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-bottom: .35rem; }
footer .footer-meta { margin: 0; }
.appearance-preview { --pv-accent: var(--accent); --pv-card: var(--card); --pv-bg: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; background: var(--pv-bg); }
.appearance-preview .pv-header { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; background: var(--pv-card); border-radius: var(--radius); margin-bottom: 1rem; }
.appearance-preview .pv-dot { width: 20px; height: 20px; border-radius: 50%; background: var(--pv-accent); display: inline-block; }
.appearance-preview .pv-head { text-align: center; }
.appearance-preview.pv-left .pv-head { text-align: left; }
.appearance-preview .pv-card { background: var(--pv-card); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem 1rem; max-width: 22rem; margin: .5rem auto 0; }
.appearance-preview.pv-left .pv-card { margin-left: 0; }
.appearance-preview .pv-button { background: var(--pv-accent); color: #fff; border-radius: 6px; padding: .35rem .75rem; display: inline-block; }
.appearance-preview.pv-font-serif { font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif; }
.appearance-preview.pv-font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
input[readonly], textarea[readonly], select:disabled, input:disabled { background: color-mix(in srgb, var(--muted) 10%, var(--card)); color: var(--muted); cursor: not-allowed; }
form.stack .reason-label { display: block; margin: .5rem 0 .25rem; font-weight: 600; }
form.stack .reason-label + input + button, form.stack button.request-access { margin-top: .75rem; }
.appearance-preview .pv-head, .appearance-preview .pv-footer { color: var(--pv-fg, inherit); }
.appearance-preview .pv-head .welcome-headline, .appearance-preview .pv-footer { --muted: var(--pv-muted, var(--muted)); --link: var(--pv-link, var(--link)); }
.appearance-preview .pv-card { color: var(--pv-card-fg, inherit); }
.appearance-preview .pv-footer { text-align: center; color: var(--pv-muted, var(--muted)); font-size: .85rem; margin-top: 1rem; }
.appearance-preview .pv-footer .footer-text { margin: 0 0 .35rem; }
.appearance-preview .pv-footer .footer-links { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.appearance-preview .pv-footer .footer-links:empty, .appearance-preview .pv-footer .footer-text:empty { display: none; }
.appearance-preview.pv-font-sans { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif; }
textarea.css-box { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; min-height: 8rem; }
