/* Organisers' page (/admin/) only. Colours come from the site.css tokens. */

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.nowrap { white-space: nowrap; }
.stack-sm { display: grid; gap: 10px; align-content: start; min-width: 0; }

.admin { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 28px; }
.admin-head { display: grid; gap: 6px; }
.admin-head h1 { margin-top: 2px; }

/* ---------- storage note ---------- */
.storage-note { grid-template-columns: 1fr auto; align-items: center; gap: 12px 24px; }
.storage-text { display: grid; gap: 4px; min-width: 0; }
.storage-error { color: var(--danger); font-weight: 600; }
.storage-actions { justify-content: flex-end; }
@media (max-width: 720px) {
  .storage-note { grid-template-columns: 1fr; }
  .storage-actions { justify-content: flex-start; }
}
.example-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; }

/* ---------- tabs and panels ---------- */
.admin-tabs { justify-self: start; scroll-margin-top: 76px; }
.tab-count { font-family: var(--mono); font-size: 0.72rem; font-weight: 600; margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: var(--line); color: var(--muted); vertical-align: 1px; }
.admin-tabs [aria-current="true"] .tab-count { background: var(--accent-soft); color: var(--accent); }
@media (max-width: 440px) {
  .admin-tabs { justify-self: stretch; display: flex; }
  .admin-tabs a { flex: 1 1 auto; text-align: center; padding: 7px 8px; font-size: 0.88rem; }
  .admin-tabs .tab-count { display: none; }
}
.panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
#overview-body, #people-body, #rooms-body, #expenses-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px 20px; }
.panel-head h2 { margin-bottom: 2px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.toolbar .field { flex: 0 1 200px; }
.toolbar .field.grow { flex: 1 1 260px; }
.toolbar .rate-field { flex: 0 1 300px; }
.filter-note { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.linkish { font: inherit; background: none; border: 0; padding: 0; color: var(--sea); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- empty states ---------- */
.empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 36px 24px; border-style: dashed; border-color: var(--line-strong); }
.empty p { max-width: 54ch; }
.empty-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty-icon svg { width: 28px; height: 28px; }
.empty-actions { justify-content: center; margin-top: 4px; }
.empty-slim { padding: 22px; }
.empty-hero { padding: 44px 24px; }
.steps { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 10px; width: 100%; max-width: 760px; text-align: left; counter-reset: step; }
.steps li { counter-increment: step; display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 0.9rem; }
.steps li strong::before { content: counter(step) ". "; font-family: var(--mono); color: var(--accent); }
.steps li span { color: var(--muted); }

/* ---------- overview ---------- */
.stat-link { color: var(--fg); text-decoration: none; }
.stat-link:hover { border-color: var(--line-strong); background: color-mix(in srgb, var(--surface-2) 40%, var(--surface)); }
.stat-link.warn .v { color: var(--warn); }
.stat .of { font-size: 1.2rem; color: var(--muted); font-weight: 700; }
.overview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; align-items: start; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin-bottom: 12px; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bars li { display: grid; grid-template-columns: minmax(0, 11rem) 1fr 2.2rem; align-items: center; gap: 10px; font-size: 0.92rem; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-code { font-size: 0.8rem; color: var(--muted); display: inline-block; min-width: 2.6em; }
.bar-track { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.bar-n { text-align: right; font-weight: 600; }
@media (max-width: 420px) { .bars li { grid-template-columns: minmax(0, 8rem) 1fr 1.8rem; } }
.todo { margin: 0; padding-left: 1.1em; display: grid; gap: 6px; }
.todo + p { margin-top: 12px; }

/* ---------- tables ---------- */
/* Keeps visually hidden header labels inside the scroll box, so wide tables
   scroll on their own instead of widening the page. */
.admin .table-wrap { position: relative; }
.cell-main { display: block; }
.cell-sub { display: block; color: var(--muted); font-size: 0.84rem; margin-top: 1px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 32ch; }
.person-name { font-weight: 600; white-space: nowrap; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
a.badge { text-decoration: none; }
table.t td.actions { white-space: nowrap; text-align: right; padding-top: 7px; padding-bottom: 7px; }
.danger-text { color: var(--danger); }
.danger-text:hover { color: var(--danger); background: var(--danger-soft); }
.people-table td:nth-child(3), .people-table td:nth-child(4) { min-width: 11rem; }
.expense-table td:nth-child(2) { min-width: 12rem; }
table.t tfoot th, table.t tfoot td { padding: 11px 14px; border-top: 1px solid var(--line-strong); background: var(--surface-2); font-weight: 700; text-align: left; }
table.t tfoot td.num { text-align: right; }
table.t tr.row-warn td { background: var(--warn-soft); }
.net-pos { color: var(--accent); font-weight: 600; }
.net-neg { color: var(--danger); font-weight: 600; }

/* ---------- rooms ---------- */
.unassigned .card-head { margin-bottom: 10px; }
.chip-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.unassigned .chip-list + p { margin-top: 10px; }
.chip { max-width: 100%; }
.rooms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; align-items: start; }
.room-card { position: relative; display: grid; gap: 14px; min-width: 0; }
.room-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.room-head h3 { overflow-wrap: anywhere; }
.occupants { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.occupant { padding-right: 4px; white-space: normal; }
.chip-x { font: inherit; font-size: 1rem; line-height: 1; width: 24px; height: 24px; border-radius: 999px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: inline-grid; place-items: center; }
.chip-x:hover { background: var(--line); color: var(--fg); }
.bed-empty { font-size: 0.85rem; padding: 3px 10px; border-radius: 999px; border: 1px dashed var(--line-strong); color: var(--muted); }
.assign { display: flex; gap: 8px; }
.assign select { flex: 1 1 auto; }
.room-meta { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.room-meta dt { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.room-meta dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.room-notes { margin-top: -4px; }
.room-foot { display: flex; justify-content: flex-end; gap: 4px; margin: -6px -8px -8px 0; }

/* ---------- expenses ---------- */
.cat-list .num { color: var(--muted); font-size: 0.8rem; }
.money-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
@media (max-width: 820px) { .money-grid { grid-template-columns: minmax(0, 1fr); } }
.settle { display: grid; gap: 12px; }
.transfers { margin: 0; padding: 0; list-style: none; display: grid; gap: 0; }
.transfers li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.transfers li:last-child { border-bottom: 0; }
.transfers .num { font-weight: 600; white-space: nowrap; }

/* ---------- forms and dialogs ---------- */
.err { margin: 0; color: var(--danger); font-size: 0.84rem; font-weight: 600; }
.form-err { margin-bottom: 12px; }
[aria-invalid="true"] { border-color: var(--danger) !important; }
.span-all { grid-column: 1 / -1; }
.field label .hint { margin-left: 4px; }

.modal { width: min(620px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--fg); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); overflow: hidden; }
.modal-sm { width: min(460px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(10, 16, 13, 0.55); }
.modal[open] { display: flex; flex-direction: column; }
.modal-form { display: flex; flex-direction: column; min-height: 0; max-height: calc(100dvh - 26px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 1.5rem; overflow-wrap: anywhere; }
.modal-x { font-size: 1rem; }
.modal-body { padding: 16px 20px 20px; overflow-y: auto; display: grid; gap: 16px; min-height: 0; }
.modal-body > p { max-width: none; }
.modal-sm .modal-body { gap: 8px; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
@media (max-width: 480px) {
  .modal-head, .modal-body, .modal-foot { padding-left: 16px; padding-right: 16px; }
  .modal-foot .btn { flex: 1 1 auto; }
}

.split-fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px 14px; margin: 0; display: grid; gap: 10px; min-width: 0; }
.split-fieldset legend { font-weight: 600; font-size: 0.9rem; padding: 0 4px; }
.split-quick { gap: 6px; }
.split-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 6px 14px; max-height: 240px; overflow-y: auto; padding: 2px; }
.split-list .check { align-items: flex-start; }
.split-list .check input { margin-top: 3px; flex: none; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 16px); z-index: 50; max-width: min(520px, calc(100vw - 32px)); width: max-content; padding: 10px 16px; border-radius: var(--radius-sm); background: var(--fg); color: var(--bg); font-weight: 600; font-size: 0.92rem; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity 0.18s, transform 0.18s; }
.toast:empty { display: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--danger); color: var(--surface); }
