/* admin: page styles. Tokens only; see docs/design-system.md. */

/* ---------- tab navigation: compact underline tabs, three quiet groups ---------- */
.adm-tabs {
  position: relative; display: flex; align-items: stretch; gap: 0; margin: 0 0 var(--s5);
  box-shadow: inset 0 -1px 0 var(--border); overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
}
.adm-tabs::-webkit-scrollbar { display: none; }
.adm-tabs a {
  position: relative; flex: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 8px;
  color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; text-decoration: none; border-radius: var(--r-sm) var(--r-sm) 0 0;
  transition: color var(--ease), background var(--ease);
}
.adm-tabs a:hover { color: var(--text); background: var(--surface-3); text-decoration: none; }
.adm-tabs a.active { color: var(--text); }
.adm-tabs a.active::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: var(--teal); }
.adm-tabs a:first-child { margin-left: -8px; }
.adm-tabs .count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--warning-soft); color: var(--warning); font: 600 11px/18px var(--font); text-align: center; font-variant-numeric: tabular-nums; }
.adm-tabs-sep { flex: none; width: 1px; margin: 12px 4px; background: var(--border); }

/* ---------- shared bits ---------- */
.adm-body { min-width: 0; }
.adm-gap { margin-top: var(--s4); }
.adm-notice { margin-bottom: var(--s3); }
.adm-notice > span { flex: 1; min-width: 0; }
.adm-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-bottom: var(--s3); }
.adm-toolbar .search-input { flex: 1 1 260px; max-width: 480px; }
.adm-toolbar select { width: auto; flex: 0 1 200px; min-width: 140px; }
.adm-of { color: var(--faint); font-weight: 400; }
.kpi .adm-of { font-size: 15px; font-weight: 500; }
.adm-st { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font-size: var(--fs-sm); color: var(--text-2); }
.adm-st .dot { box-shadow: none; width: 7px; height: 7px; }
.adm-sub { display: block; color: var(--muted); font-size: var(--fs-xs); font-weight: 400; line-height: 1.45; }
.adm-sub.warn { color: var(--warning); }
.adm-sub.bad { color: var(--danger); }
.adm-plan { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--text); white-space: nowrap; }
.adm-plan.free { color: var(--text-2); font-weight: 400; }
.adm-plan svg { width: 14px; height: 14px; color: var(--teal-text); }
.adm-empty { display: grid; justify-items: center; gap: 4px; padding: var(--s8) var(--s5); text-align: center; }
.adm-empty b { font-size: var(--fs); font-weight: 600; }
.adm-empty span { color: var(--muted); font-size: var(--fs-sm); max-width: 52ch; }
.adm-err { margin-top: 4px; color: var(--danger); font-size: var(--fs-xs); line-height: 1.45; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.adm-warnline { margin-top: var(--s3); color: var(--warning); font-size: var(--fs-sm); }
.adm-stack { display: grid; gap: var(--s3); align-content: start; }
.adm-pager { color: var(--muted); font-size: var(--fs-sm); }
.adm-rowacts { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.panel-head .dot { flex: none; }
.panel-head > div > .sub { margin-top: 2px; }

/* KPI strip: 4 per row, aligned. */
.adm-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.adm-kpis .kpi:nth-child(4n) { border-right: 0; }
.adm-kpis .kpi:nth-child(n + 5) { border-top: 1px solid var(--border); }
.adm-kpis .kpi-note { min-height: 18px; }
.adm-kpis a.kpi:focus-visible { border-radius: 0; }

/* ---------- overview ---------- */
.adm-dash { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: var(--s4); margin-top: var(--s4); align-items: start; }
.adm-col { display: grid; gap: var(--s4); min-width: 0; align-content: start; }
.adm-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }

.adm-att-list { list-style: none; margin: 0; padding: 4px 0; }
.adm-att-item {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: var(--s3); width: 100%; min-height: 48px;
  padding: 8px var(--s5); border: 0; background: none; color: inherit; font: inherit; text-align: left; text-decoration: none; transition: background var(--ease);
}
.adm-att-item:hover { background: var(--surface-2); text-decoration: none; }
.adm-att-item .ic { width: 28px; height: 28px; border-radius: var(--r); background: var(--surface-3); color: var(--text-2); display: grid; place-items: center; }
.adm-att-item .ic svg { width: 15px; height: 15px; }
.adm-att-item.warn .ic { background: var(--warning-soft); color: var(--warning); }
.adm-att-item.bad .ic { background: var(--danger-soft); color: var(--danger); }
.adm-att-item .tx { display: grid; min-width: 0; }
.adm-att-item .tx b { font-size: var(--fs-sm); font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-att-item .tx > span { font-size: var(--fs-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-att-item .side { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.adm-att-group { padding: 12px var(--s5) 4px; margin-top: 4px; border-top: 1px solid var(--border); color: var(--muted); font-size: var(--fs-xs); font-weight: 500; }
.adm-att-list > .adm-att-group:first-child { border-top: 0; margin-top: 0; padding-top: 6px; }
.adm-allgood { display: flex; align-items: center; gap: 10px; padding: var(--s4) var(--s5); color: var(--text-2); font-size: var(--fs-sm); }

/* Bar charts (real data). Columns are full height so the tip works on hover, focus and tap. */
.adm-chart-total { display: flex; align-items: baseline; gap: var(--s2); margin-bottom: var(--s3); min-width: 0; }
.adm-chart-total b { font-size: var(--fs-lg); font-weight: 600; color: var(--text); white-space: nowrap; }
.adm-chart-total span { color: var(--muted); font-size: var(--fs-xs); }
.adm-chart-total .more { white-space: nowrap; }
.adm-chart { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: var(--s2); }
.adm-chart-scale { display: flex; flex-direction: column; justify-content: space-between; height: 120px; color: var(--faint); font-size: 11px; line-height: 1; text-align: right; white-space: nowrap; }
.adm-chart-scale span:first-child { transform: translateY(-1px); }
.adm-chart-scale span:last-child { transform: translateY(1px); }
.adm-bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; border-top: 1px dashed var(--border); border-bottom: 1px solid var(--border-strong); }
.adm-bcol { position: relative; flex: 1; min-width: 0; height: 100%; display: flex; align-items: flex-end; border-radius: 2px 2px 0 0; outline: none; cursor: default; }
.adm-bcol:hover, .adm-bcol:focus-visible { background: var(--surface-3); box-shadow: none; }
.adm-bcol i { display: block; width: 100%; background: var(--teal); border-radius: 2px 2px 0 0; opacity: 0.85; transition: opacity var(--ease); }
.adm-bcol:hover i, .adm-bcol:focus-visible i { opacity: 1; }
.adm-bcol:hover::after, .adm-bcol:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 3;
  padding: 4px 8px; border-radius: var(--r-sm); background: var(--navy); color: var(--surface); font-size: var(--fs-xs); white-space: nowrap; pointer-events: none;
}
.adm-bcol:nth-child(-n + 3)::after { left: 0 !important; transform: none !important; }
.adm-bcol:nth-last-child(-n + 3)::after { left: auto !important; right: 0; transform: none !important; }
.adm-bar-labels { grid-column: 2; display: flex; gap: 3px; margin-top: 6px; }
.adm-bar-labels span { flex: 1; min-width: 0; text-align: center; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: visible; }

.adm-hbars { display: grid; gap: 2px; }
.adm-hbars .hbar { grid-template-columns: minmax(70px, 32%) minmax(0, 1fr) 36px; }
.adm-hbars .hbar > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.adm-hbars .hbar b { text-align: right; font-weight: 600; }

.adm-ulist { list-style: none; margin: 0; padding: 4px 0; }
.adm-urow { display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 48px; padding: 6px var(--s5); border: 0; background: none; color: inherit; font: inherit; text-align: left; transition: background var(--ease); }
.adm-urow:hover { background: var(--surface-2); }
.adm-urow .ucell { flex: 1; }
.adm-urow .avatar { width: 28px; height: 28px; font-size: 11px; }
.adm-urow .ucell b { font-size: var(--fs-sm); }
.adm-urow-v { flex: none; color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }

/* ---------- users ---------- */
.adm-chips { margin: 0 0 var(--s3); }
.adm-table th, .adm-table td { padding: 10px var(--s3); }
.adm-table th:first-child, .adm-table td:first-child { padding-left: var(--s4); }
.adm-table th:last-child, .adm-table td:last-child { padding-right: var(--s4); }
.adm-table th.r, .adm-table td.r { text-align: right; }
.adm-table th button { height: 20px; }
.adm-table th button.on { color: var(--text); }
.adm-arrow { display: inline-block; min-width: 8px; color: var(--teal-text); }
.adm-table tr.picked td { background: var(--teal-soft); }
.adm-table td.c-sel, .adm-table th.c-sel { width: 48px; padding: 0 0 0 var(--s2) !important; }
.adm-check { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-sm); cursor: pointer; }
.adm-check:hover { background: var(--surface-3); }
.adm-users td.c-main { max-width: 320px; }
.adm-who { display: grid; min-width: 0; }
.ucell .adm-who-n { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text); font-size: var(--fs-sm); }
.adm-who-n b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-who-n .tag { height: 18px; padding: 0 6px; font-size: 11px; flex: none; color: var(--text-2); }
.ucell .adm-who-s { color: var(--muted); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Bulk actions bar: sticks under the top bar while users are ticked. */
.adm-bulk {
  position: sticky; top: calc(var(--top-h) + 8px); z-index: 15; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2);
  padding: 8px 8px 8px var(--s4); margin-bottom: var(--s3); background: var(--surface); border: 1px solid var(--teal); border-radius: var(--r-lg); box-shadow: var(--shadow-xs);
}
.adm-bulk-n { font-size: var(--fs-sm); font-weight: 600; margin-right: var(--s2); white-space: nowrap; }
.adm-bulk-acts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.adm-bulk > .btn.ghost { margin-left: auto; }
.adm-more { position: relative; }
.adm-more > summary { list-style: none; cursor: pointer; }
.adm-more > summary::-webkit-details-marker { display: none; }
.adm-more[open] > summary { background: var(--surface-3); }
.adm-menu { position: absolute; left: 0; top: calc(100% + 6px); z-index: 30; display: grid; min-width: 200px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); animation: pop-in var(--ease-pop); }
.adm-menu.to-left { left: auto; right: 0; }
.adm-menu .mi { display: flex; align-items: center; height: 34px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text); font-size: var(--fs-sm); text-align: left; white-space: nowrap; }
.adm-menu .mi:hover { background: var(--surface-3); }
.adm-menu .mi.danger { color: var(--danger); }
.adm-menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px -6px; }

/* ---------- user detail panel ---------- */
.drawer-panel.adm-ud { display: flex; flex-direction: column; overflow: hidden; }
.adm-ud-head { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: var(--s3); align-items: start; padding: var(--s4) var(--s3) var(--s3) var(--s6); }
.adm-ud-head .avatar { width: 40px; height: 40px; font-size: 14px; }
.adm-ud-id { min-width: 0; }
.adm-ud-id h2 { font-size: 17px; line-height: 1.35; overflow-wrap: anywhere; }
.adm-ud-contact { color: var(--text-2); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.adm-ud-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px var(--s3); margin-top: var(--s2); font-size: var(--fs-sm); }
.adm-ud-plan { display: inline-flex; align-items: baseline; gap: 6px; }
.adm-ud-plan .adm-sub { display: inline; }
.adm-subtabs { flex: none; display: flex; gap: 2px; padding: 0 var(--s4); box-shadow: inset 0 -1px 0 var(--border); overflow-x: auto; scrollbar-width: none; }
.adm-subtabs::-webkit-scrollbar { display: none; }
.adm-subtabs button { position: relative; flex: none; height: 40px; padding: 0 10px; border: 0; background: none; color: var(--text-2); font: 500 var(--fs-sm) / 1 var(--font); white-space: nowrap; }
.adm-subtabs button:hover { color: var(--text); }
.adm-subtabs button[aria-selected='true'] { color: var(--text); }
.adm-subtabs button[aria-selected='true']::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: var(--teal); }
.adm-ud-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--s5) var(--s6) var(--s8); }
.adm-ud-body > * + * { margin-top: var(--s4); }
.adm-ud-body > .adm-h + * { margin-top: var(--s2); }
.adm-h { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.adm-ud-body > .adm-h { margin-top: var(--s6); }
.adm-ud-body > .adm-h:first-child { margin-top: 0; }
.adm-h.danger { color: var(--danger); }
.adm-meters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4) var(--s6); padding: var(--s3) var(--s4); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); }
.adm-kv { grid-template-columns: minmax(130px, 32%) minmax(0, 1fr); }
.adm-notes { display: grid; gap: 2px; padding: 10px var(--s3); border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); }
.adm-notes p { font-size: var(--fs-sm); white-space: pre-wrap; overflow-wrap: anywhere; }
.adm-acts { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--r-lg); }
.adm-acts.danger { border-color: var(--danger-line); }
.adm-act { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); }
.adm-act + .adm-act { border-top: 1px solid var(--border); }
.adm-acts.danger .adm-act + .adm-act { border-top-color: var(--danger-line); }
.adm-act .ic { display: grid; place-items: center; color: var(--muted); }
.adm-act .ic svg { width: 16px; height: 16px; }
.adm-act .tx { display: grid; gap: 1px; min-width: 0; }
.adm-act .tx b { font-size: var(--fs-sm); font-weight: 500; }
.adm-act .tx span { color: var(--muted); font-size: var(--fs-xs); line-height: 1.45; }
.adm-act .bt { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.adm-form { display: grid; gap: var(--s4); }
.adm-form .grid-2 { gap: var(--s3); }
.adm-span { grid-column: 1 / -1; }
.adm-form-foot { display: flex; justify-content: flex-end; gap: var(--s2); }
.adm-sec { display: grid; gap: var(--s3); }
.adm-sec + .adm-sec, .adm-form-foot + .adm-sec { padding-top: var(--s4); border-top: 1px solid var(--border); }
.adm-sec > .hint { margin-top: -6px; }
.adm-fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--s3); }
.adm-fgrid > .field { grid-template-rows: 1fr auto; }
.adm-inline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.adm-mini { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--r-lg); }
.adm-mini li { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 10px var(--s4); font-size: var(--fs-sm); }
.adm-mini li + li { border-top: 1px solid var(--border); }
.adm-mini li > span:first-child { min-width: 0; }
.adm-mini .hint { display: block; }
.adm-slist { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--r-lg); }
.adm-slist li { display: grid; gap: 4px; padding: var(--s3) var(--s4); }
.adm-slist li + li { border-top: 1px solid var(--border); }
.adm-slist-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.adm-slist-top b { font-weight: 600; font-size: var(--fs-sm); min-width: 0; overflow-wrap: anywhere; }
.adm-slist .adm-inline { margin-top: 4px; }

/* Timelines: sign-ins and admin history. */
.adm-tl { list-style: none; margin: 0; padding: 0; }
.adm-tl li { position: relative; display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 2px var(--s4); padding: 7px 0 7px 20px; font-size: var(--fs-sm); }
.adm-tl li::before { content: ''; position: absolute; left: 0; top: 14px; width: 7px; height: 7px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--faint); box-sizing: border-box; }
.adm-tl li::after { content: ''; position: absolute; left: 3px; top: 23px; bottom: -14px; width: 1px; background: var(--border); }
.adm-tl li:last-child::after { display: none; }
.adm-tl li:first-child::before { border-color: var(--teal); background: var(--teal); }
.adm-tl time { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; padding-top: 2px; }
.adm-tl span { overflow-wrap: anywhere; }

/* ---------- upgrade requests ---------- */
.adm-reqs { list-style: none; margin: 0; padding: 0; }
.adm-req { display: grid; grid-template-columns: minmax(200px, 1.3fr) minmax(170px, 1fr) minmax(150px, auto) auto; align-items: center; gap: var(--s3) var(--s6); padding: 14px var(--s5); }
.adm-req + .adm-req { border-top: 1px solid var(--border); }
.adm-req-what, .adm-req-amt { display: grid; gap: 2px; min-width: 0; }
.adm-req-what b { font-size: var(--fs-sm); font-weight: 500; }
.adm-req-amt b { font-size: 15px; font-weight: 600; white-space: nowrap; }
.adm-ref { color: var(--text); font-weight: 500; }
.adm-req-act { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s2); }
.adm-req:not(.pending) { color: var(--text-2); }

/* ---------- plans editor ---------- */
.adm-plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: var(--s4); align-items: start; }
.adm-plan-ed .panel-head { flex-wrap: wrap; }
.adm-plan-ed .panel-head .actions { font-size: var(--fs-sm); }
.adm-plan-ed .switch { font-size: var(--fs-sm); }
.adm-plan-ed .panel-body { display: grid; gap: var(--s3); }
.adm-plan-ed .adm-fgrid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.adm-feats { display: grid; gap: 6px; padding-top: var(--s3); border-top: 1px solid var(--border); }
.adm-feats > div { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); }
.adm-feats .check { font-size: var(--fs-sm); min-height: 28px; }
.adm-savebar {
  position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: var(--s2); margin-top: var(--s4); padding: var(--s3) 0;
  background: var(--bg); border-top: 1px solid var(--border);
}

/* ---------- site settings ---------- */
.adm-set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); align-items: start; }
.adm-narrow { max-width: 180px; }

/* ---------- audit ---------- */
.adm-audit td { vertical-align: top; }
.adm-audit-time { width: 1%; color: var(--muted); }
.adm-audit-who { width: 28%; color: var(--text-2); overflow-wrap: anywhere; }
.adm-audit-to { display: block; color: var(--muted); }

/* ---------- searches, payments, promos ---------- */
.adm-searches td.c-main { max-width: 380px; }
.adm-searches .mon-name span { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.adm-searches .linklike, .adm-pays .linklike { font-weight: 500; color: var(--text); text-align: left; }
.adm-searches .linklike:hover, .adm-pays .linklike:hover { color: var(--teal-text); }
.adm-pays tr.refunded td { color: var(--muted); }
.adm-pays tr.refunded .adm-amt b { text-decoration: line-through; text-decoration-color: var(--faint); }
.adm-amt { text-align: right; white-space: nowrap; }
.adm-pay-date { color: var(--text-2); }
.adm-promos { display: grid; gap: var(--s4); }
.adm-promo-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s3); align-items: start; }
.adm-promo-foot { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s3) var(--s5); padding-top: var(--s3); border-top: 1px solid var(--border); }
.adm-promo-foot .adm-fieldset { flex: 1 1 320px; }
.adm-fieldset { display: grid; gap: var(--s2); min-width: 0; margin: 0; padding: 0; border: 0; }
.adm-fieldset legend { padding: 0; margin-bottom: 6px; color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; }
.adm-checks { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); }
.adm-checks .check { font-size: var(--fs-sm); min-height: 28px; }
.adm-upper { text-transform: uppercase; }
.adm-promo-code { font-weight: 600; letter-spacing: 0.03em; }
.adm-promo-t td.c-main { white-space: nowrap; }

/* ---------- system ---------- */
.adm-sys { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: var(--s4); margin-top: var(--s4); }
.adm-sys > .panel { display: flex; flex-direction: column; }
.adm-sys > .panel > .panel-body { flex: 1; }
.adm-sys .panel-foot { flex-wrap: wrap; }
.adm-sys .kv { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.adm-sys .panel-head .sub { margin-left: auto; }
.adm-maint form { display: flex; flex-direction: column; flex: 1; }
.adm-maint form .panel-body { flex: 1; }
.adm-maint.on { border-color: var(--warning-line); }
.adm-smshead { flex-wrap: wrap; }
.adm-smshead .actions { flex-wrap: wrap; }
.adm-smshead .search-input { min-width: 220px; }
.adm-smshead .search-input input { height: 32px; }
.adm-sms td { vertical-align: top; }
.adm-sms-time { width: 1%; color: var(--text-2); }
.adm-sms .c-main { white-space: nowrap; }
.adm-sms-text { min-width: 260px; color: var(--text-2); overflow-wrap: anywhere; }
.adm-sms tr.failed .adm-sms-text { color: var(--text); }

/* ---------- dialogs ---------- */
dialog.adm-dlg .sheet-body { gap: var(--s3); padding: var(--s5) var(--s6); }
.adm-dlg-head { display: flex; align-items: center; gap: var(--s2); margin: -4px -10px 0 0; }
.adm-dlg-head h2 { flex: 1; min-width: 0; font-size: 17px; line-height: 1.35; }
dialog.adm-dlg .sheet-body > p.muted { margin-top: -6px; }
.adm-dlg-fields { display: grid; gap: var(--s3); }
.adm-dlg-fields .grid-2 { gap: var(--s3); }
dialog.adm-dlg .sheet-foot { margin: var(--s1) calc(-1 * var(--s6)) 0; padding: var(--s4) var(--s6) 0; border-top: 1px solid var(--border); }
.adm-lbl { display: flex; justify-content: space-between; gap: var(--s2); }

/* ---------- responsive ---------- */
@media (min-width: 761px) {
  .adm-users { min-width: 820px; }
  .adm-pays { min-width: 900px; }
  .adm-searches { min-width: 820px; }
  .adm-promo-t { min-width: 640px; }
  .adm-sms { min-width: 720px; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .adm-table .c-wide { display: none; }
}
@media (max-width: 1180px) {
  .adm-dash { grid-template-columns: minmax(0, 1fr); }
  .adm-dash > .adm-col:last-child { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); align-items: start; }
  .adm-req { grid-template-columns: minmax(0, 1fr) auto; }
  .adm-req-who { grid-column: 1; grid-row: 1; }
  .adm-req-amt { grid-column: 2; grid-row: 1; text-align: right; }
  .adm-req-what { grid-column: 1 / -1; }
  .adm-req-act { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 1100px) {
  .adm-set-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .adm-tabs { margin-left: calc(-1 * var(--s4)); margin-right: calc(-1 * var(--s4)); padding: 0 var(--s4); margin-bottom: var(--s4); }
  .adm-tabs a { height: 44px; }
  .adm-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-kpis .kpi:nth-child(n + 5) { border-top: 0; }
  .adm-kpis .kpi:nth-last-child(-n + 2) { border-bottom: 0; }
  .adm-kpis .kpi { padding: var(--s3) var(--s4); }
  .adm-kpis .kpi .kpi-value { font-size: 19px; }
  .adm-body .btn.sm, .adm-ud .btn.sm, .adm-bulk .btn.sm { height: 40px; padding: 0 12px; }
  .adm-body .btn.sm.icon, .adm-ud .btn.sm.icon { width: 40px; padding: 0; }
  .adm-body .seg > button { height: 34px; }
  .adm-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: calc(-1 * var(--s4)); margin-right: calc(-1 * var(--s4)); padding: 0 var(--s4); }
  .adm-chips::-webkit-scrollbar { display: none; }
  .adm-chips .chip { height: 40px; padding: 0 14px; flex: none; }
  .adm-bulk { top: 60px; padding: 8px; }
  .adm-bulk-n { width: 100%; padding-left: 4px; }
  .adm-menu .mi { height: 42px; }
  .adm-savebar { bottom: calc(57px + env(safe-area-inset-bottom)); }
  .adm-ud-head { padding: var(--s3) var(--s2) var(--s3) var(--s4); }
  .adm-subtabs { padding: 0 var(--s2); }
  .adm-subtabs button { height: 44px; }
  .adm-ud-body { padding: var(--s4) var(--s4) var(--s8); }
  .adm-ud-head .btn.icon { width: 40px; height: 40px; }
  .adm-dlg-head .btn.icon { width: 40px; height: 40px; }
  dialog.adm-dlg .sheet-body { padding: var(--s4); }
  dialog.adm-dlg .sheet-foot { margin: var(--s1) calc(-1 * var(--s4)) 0; padding: var(--s3) var(--s4) 0; }
  .adm-check { width: 40px; height: 40px; }
  /* Keep pager and panel actions inline (another page's phone rule makes them full width). */
  .adm-body .panel-foot { flex-wrap: wrap; }
  .adm-body .panel-foot .spacer { display: block; }
  .adm-body .panel-foot .btn { width: auto; }
}
@media (max-width: 760px) {
  .adm-toolbar .search-input { flex-basis: 100%; max-width: none; }
  .adm-toolbar select { flex: 1 1 140px; }
  .adm-toolbar > .seg { max-width: 100%; }
  .adm-charts { grid-template-columns: minmax(0, 1fr); }
  .adm-att-item { padding: 8px var(--s4); }
  .adm-att-group { padding-left: var(--s4); padding-right: var(--s4); }
  .adm-urow { padding: 6px var(--s4); }
  .adm-allgood { padding: var(--s4); }
  .adm-meters { grid-template-columns: minmax(0, 1fr); }
  .adm-kv { grid-template-columns: minmax(100px, 38%) minmax(0, 1fr); }
  .adm-act { grid-template-columns: 18px minmax(0, 1fr); }
  .adm-act .bt { grid-column: 2; justify-content: flex-start; }
  .adm-tl li { grid-template-columns: minmax(0, 1fr); }
  .adm-req { padding: var(--s3) var(--s4); gap: var(--s2) var(--s3); }
  .adm-req-act .btn { flex: 1 1 auto; }
  .adm-smshead .actions { width: 100%; margin-left: 0; }
  .adm-smshead .search-input { flex: 1 1 100%; min-width: 0; }
  .adm-smshead .search-input input { height: 40px; }
  .adm-sys { grid-template-columns: minmax(0, 1fr); }

  /* Tables become stacked rows: main line (name + status), facts, then actions. */
  .adm-table { display: block; width: 100%; }
  .adm-table td.nowrap, .adm-sms .c-main, .adm-promo-t td.c-main { white-space: normal; }
  .adm-bar-labels span:nth-child(even) { visibility: hidden; }
  .adm-table thead { display: none; }
  .adm-table tbody { display: block; }
  .adm-table tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); }
  .adm-table tbody tr:last-child { border-bottom: 0; }
  .adm-table tbody tr::after { content: ''; order: 3; flex-basis: 100%; height: 0; }
  .adm-table td { display: block; padding: 0 !important; border: 0; min-width: 0; max-width: none !important; background: none !important; }
  .adm-table tr.picked { background: var(--teal-soft); }
  .adm-table td.c-sel { order: 0; flex: none; width: auto; margin: -6px -4px -6px -8px; }
  .adm-table td.c-main { order: 1; flex: 1 1 0; }
  .adm-table td.c-side { order: 2; flex: none; margin-left: auto; text-align: right; }
  .adm-table td.c-meta { order: 4; color: var(--text-2); font-size: var(--fs-xs); text-align: left !important; }
  .adm-table td.c-meta[data-l]::before { content: attr(data-l) ': '; color: var(--muted); }
  .adm-table td.c-full { order: 5; flex-basis: 100%; font-size: var(--fs-sm); }
  .adm-table td.c-act { order: 6; flex-basis: 100%; margin-top: 6px; }
  .adm-table td.c-act:empty { display: none; }
  .adm-table .adm-sub { display: inline; margin-left: 4px; }
  .adm-table td.c-main .adm-sub { display: block; margin-left: 0; }
  .adm-table .adm-plan { display: inline; }
  .adm-table .adm-plan svg { display: none; }
  .adm-rowacts { justify-content: flex-start; flex-wrap: wrap; }
  .adm-sms .c-main { white-space: normal; }
  .adm-sms-text { min-width: 0; }
  .adm-audit-time, .adm-audit-who { width: auto; }
  .adm-audit-to { display: inline; margin-left: 4px; }
  .adm-amt { text-align: right; }
}
@media (max-width: 430px) {
  .adm-kpis .kpi .kpi-value { font-size: 17px; }
  .adm-dlg-fields .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

/* Wide screens: all tabs visible, wrapping to a second line if needed (no hidden tabs). */
@media (min-width: 861px) {
  .adm-tabs { flex-wrap: wrap; overflow: visible; }
}
