/* Components and pages, on the theme's tokens only (static/css/theme.css holds
   every colour). Red text is always --red-ink and amber text --amber-ink;
   --red and --amber are for dots, fills and borders. */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
a { color: var(--ink); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Icons: symbols in /static/img/icons.svg carry no stroke of their own; these
   rules reach into the external <use> because fill and stroke inherit. */
svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; flex: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--line-strong);
       background: var(--surface); color: var(--ink); border-radius: var(--radius); cursor: pointer;
       font-size: 13px; font-weight: 500; text-decoration: none; overflow-wrap: normal; }
/* The chooser's buttons carry an organisation's name, which wraps wherever it must. */
.btn.org-choice { overflow-wrap: anywhere; min-width: 0; text-align: left; }
.btn:hover { border-color: var(--control-line); background: var(--surface-2); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--inv-bg); border-color: var(--inv-bg); color: var(--inv-ink); }
.btn-primary:hover { background: var(--inv-hover); border-color: var(--inv-hover); }
.btn-danger { background: var(--surface); border-color: var(--red-line); color: var(--red-ink); }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-full { width: 100%; justify-content: center; padding: 11px; }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
/* A group of radios or checkboxes is a fieldset: its legend reads as the label of the other groups, not as a title cut into a border. */
fieldset.form-group { border: 0; min-width: 0; }
fieldset.form-group legend { display: block; padding: 0; font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
.form-input { width: 100%; padding: 9px 11px; background: var(--surface); border: 1px solid var(--control-line);
              border-radius: var(--radius); color: var(--ink); font-size: 14px; }
.form-input:focus { border-color: var(--ink); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ink); }

/* Layout */
main { padding: 26px 32px 56px; max-width: 1240px; margin: 0 auto; }
.page-container { }
.page-header { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-header h1 { flex: 1 1 8em; min-width: 0; font-size: 24px; font-weight: 600; letter-spacing: -.01em; line-height: 1.15; overflow-wrap: anywhere; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
        box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; min-width: 0; }
.card h2 { font-size: 15px; font-weight: 600; margin-bottom: 14px; color: var(--ink); }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
             box-shadow: var(--shadow); padding: 16px; text-align: center; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; overflow-wrap: anywhere; }

.device-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Status: online and active read as ink, an offline controller as red,
   a suspended organisation as amber, off or unknown as muted. The text beside
   a dot says the same thing. */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.status-dot.status-online, .status-dot.status-active { background: var(--ink); }
.status-dot.status-offline { background: var(--red); }
.status-dot.status-suspended { background: var(--amber); }
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px;
                font-size: 11.5px; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
                background: var(--surface-2); color: var(--ink-2); }
.status-badge.status-online { background: var(--surface-2); color: var(--ink); }
.status-badge.status-offline { background: var(--red-soft); color: var(--red-ink); }
.status-badge.status-off { background: var(--surface-2); color: var(--ink-3); }

/* Role and plan badges: neutral chips, the text says which */
.role-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px;
                           font-weight: 600; letter-spacing: .02em; background: var(--surface-2); color: var(--ink-2); }

/* Table */
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line-strong); color: var(--ink-3);
                 font-size: 12px; font-weight: 600; }
.data-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table th, .data-table td { overflow-wrap: anywhere; min-width: 7em; }
.data-table .btn, .data-table .role-badge, .data-table .status-badge { white-space: nowrap; }
.data-table tr:hover { background: var(--surface-2); }

/* Info table */
.info-table { width: 100%; font-size: 13.5px; }
.info-table td { padding: 5px 6px; vertical-align: top; overflow-wrap: anywhere; }
.info-table td:first-child { color: var(--ink-3); width: 130px; }

/* Scripts */
.script-group { margin-bottom: 12px; }
.script-group strong { font-size: 13px; }
.script-group-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.script-group-head .script-actions { display: flex; gap: 4px; margin-left: auto; }
.script-group-head .btn { padding: 1px 6px; font-size: 11px; }
.script-job { font-size: 11px; }
.script-row { display: flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 3px 0; }
.script-row .script-state { margin-right: 4px; }
.script-row .btn { padding: 1px 6px; font-size: 11px; }

/* The terms text sits below the page title */
.terms-text h2 { font-size: 16px; font-weight: 600; line-height: 1.3; margin: 20px 0 6px; color: var(--ink); }
.terms-text ul { padding-left: 20px; }
.terms-text ol { padding-left: 20px; }

/* Card footer lines */
.login-footer { text-align: center; color: var(--ink-3); font-size: 12.5px; margin-top: 16px; }
.login-footer a { color: var(--ink-2); }
.sidebar-legal { margin: 8px 0 0; font-size: 12px; }
.sidebar-legal a { color: var(--ink-3); }

/* Dialogs: native <dialog>; a closed one is not rendered, so .modal sets no display. */
.modal::backdrop { background: var(--overlay); }
.modal { margin: auto; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-lg);
         box-shadow: var(--shadow); padding: 24px; width: 500px; max-width: calc(100% - 32px); max-height: 90vh; overflow: auto; }
.modal h2 { margin-bottom: 16px; font-size: 18px; font-weight: 600; }
/* The lock dialog is in every page's top bar, before the page's h1, so its title is not a heading. */
.modal-title { margin-bottom: 16px; font-size: 18px; font-weight: 600; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }

/* Messages: banners. An error is red, a success is plain, a note is amber. */
.error-msg { color: var(--red-ink); font-size: 13.5px; padding: 12px 14px; background: var(--red-soft);
             border: 1px solid var(--red-line); border-radius: var(--radius); margin-bottom: 12px; }
.success-msg { color: var(--ink); font-size: 13.5px; padding: 12px 14px; background: var(--surface-2);
               border: 1px solid var(--line-strong); border-radius: var(--radius); margin-bottom: 12px; }
.loading { color: var(--ink-3); font-size: 13px; }
.text-secondary { color: var(--ink-3); }
.empty-state { text-align: center; padding: 40px; color: var(--ink-3); }

/* Section title */
.section-title { font-size: 15px; font-weight: 600; color: var(--ink); margin: 22px 0 12px; }

/* Stat online highlight: a plain ink number, no colour */
.stat-online { color: var(--ink); }

/* Tree view (sites hierarchy) */
.tree-building { margin-bottom: 12px; }
.tree-header { display: flex; align-items: center; gap: 8px; padding: 6px 0; overflow-wrap: anywhere; }
.tree-actions { margin-left: auto; display: flex; gap: 4px; }
.tree-indent-1 { padding-left: 24px; }
.tree-indent-2 { padding-left: 48px; }
.tree-floor { border-top: 1px solid var(--line); }
.tree-room { border-top: 1px solid var(--line); }
.tree-device { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px;
               padding: 2px 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
               text-decoration: none; color: var(--ink); }
.tree-device:hover { background: var(--inv-bg); border-color: var(--inv-bg); color: var(--inv-ink); }

/* The Sites page: filter tiles above the tree, the state chip of a room */
.filter-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.filter-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow);
               padding: 16px; text-align: center; color: inherit; font: inherit; cursor: pointer; min-width: 0; }
.filter-tile:hover { border-color: var(--control-line); }
.filter-tile[aria-pressed="true"] { border-color: var(--ink); background: var(--surface-2); }
.filter-tile .stat-value, .filter-tile .stat-label { display: block; }
.sites-page .tree-header { flex-wrap: wrap; }
.room-name { font-weight: 600; }

/* Audit action badge */
.audit-action { display: inline-block; padding: 1px 6px; background: var(--surface-2);
                border-radius: 4px; font-size: 12px; font-family: var(--font-data); }

/* Metrics list */
.metrics-list { max-height: 300px; overflow-y: auto; }
.metric-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 4px 0;
              border-bottom: 1px solid var(--line); }

/* The room page: banners of the fleet's problems, the state line and the cards */
.room-page { max-width: 1100px; }
.room-back { margin-bottom: 8px; font-size: 13px; }
.room-back a { color: var(--ink-2); }
.room-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.room-state { margin: 4px 0 16px; font-size: 14px; color: var(--ink-2); }
.room-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.room-banner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 12px;
               border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2);
               color: var(--ink); font-size: 13.5px; }
.room-banner-text { flex: 1; min-width: 200px; overflow-wrap: anywhere; }
.room-banner-notice { border-color: var(--line-strong); }
.room-banner-warning { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber-ink); }
.room-banner-error { background: var(--red-soft); border-color: var(--red-line); color: var(--red-ink); }
.room-subtitle { font-size: 13px; font-weight: 600; margin: 16px 0 8px; color: var(--ink); }
.room-people { list-style: none; display: grid; gap: 10px; }
.room-checklist { margin: 4px 0 8px 18px; }
.room-people li { overflow-wrap: anywhere; }

/* The dashboard: the caller's scope, the problems worst first with a stripe of their level, the state bar of a building */
.dashboard-page { max-width: 1100px; }
.dashboard-scope { margin-bottom: 16px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.stat-error .stat-value { color: var(--red-ink); }
.stat-warning .stat-value { color: var(--amber-ink); }
.attention-list { list-style: none; display: grid; gap: 10px; }
.attention-item { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px 14px; font-size: 13.5px;
                  border: 1px solid var(--line-strong); border-left-width: 4px; border-radius: var(--radius); background: var(--surface-2); }
.attention-error { border-left-color: var(--red); }
.attention-warning { border-left-color: var(--amber); }
.attention-notice { border-left-color: var(--control-line); }
.attention-main { flex: 1; min-width: 200px; overflow-wrap: anywhere; }
.attention-where { font-size: 13.5px; }
.attention-text { margin-top: 2px; }
.attention-age { margin-top: 2px; font-size: 12.5px; }
/* The marks of a silence and an acknowledgement on a problem, and the buttons that make them */
.alert-controls:empty { display: none; }
.alert-marks { margin-top: 4px; font-size: 12.5px; }
.alert-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.building-list { list-style: none; display: grid; gap: 14px; }
.building-row { overflow-wrap: anywhere; }
.building-head { margin-bottom: 6px; }
.state-bar { display: flex; gap: 2px; height: 8px; border-radius: 999px; overflow: hidden; background: var(--line); }
.state-seg { display: block; flex: 1 1 0; min-width: 4px; }
.state-seg-online { background: var(--ink); }
.state-seg-offline { background: var(--red); }
.building-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 12.5px; }
.metric-end { margin-left: auto; white-space: nowrap; }
.event-where { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dashboard-page .stats-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* Responsive */
@media (max-width: 768px) {
    .device-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    main { padding: 16px 12px 40px; }
    .tree-indent-1 { padding-left: 12px; }
    .tree-indent-2 { padding-left: 24px; }
}

/* Structure moved out of inline styles (a strict CSP forbids the style attribute) */
.hidden { display: none !important; }
.page-narrow { max-width: 500px; margin: 40px auto; }
.input-narrow { width: 200px; }
.pagination { margin-top: 12px; display: flex; gap: 8px; align-items: center; }
.page-info { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.text-center { text-align: center; }
.cell-empty { padding: 20px; }
.details-cell { font-size: 12.5px; max-width: 400px; overflow: hidden; text-overflow: ellipsis; }
.tree-empty { padding: 4px 0; font-size: 12.5px; }

/* Two-factor sign-in: the code step and the set-up */
.form-hint { font-size: 13px; color: var(--ink-3); margin-bottom: 12px; overflow-wrap: anywhere; }
.code-input { font-family: var(--font-data); font-size: 16px; letter-spacing: 2px; text-align: center; }
.qr-box { display: flex; justify-content: center; margin: 4px 0 16px; }
.qr-image { background: var(--qr-bg); border-radius: 4px; }
.key-label { text-align: center; font-size: 13px; margin-bottom: 4px; }
.key-text { text-align: center; font-family: var(--font-data); font-size: 15px; letter-spacing: 1px;
            word-break: break-word; margin-bottom: 16px; }
.recovery-title { font-size: 16px; margin-bottom: 8px; }
.recovery-codes { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px;
                  font-family: var(--font-data); font-size: 14px; text-align: center; margin: 0 0 16px; padding: 0; }

@media (max-width: 900px) {
    .account-page .data-table .nowrap { white-space: normal; }
}

/* My account */
.account-page { max-width: 760px; }
.account-email { margin: 20px 0 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.account-label { font-size: 12.5px; color: var(--ink-3); margin-bottom: 4px; }
.account-value { font-size: 14px; margin-bottom: 8px; word-break: break-all; }
.account-facts { margin-bottom: 12px; }
.account-facts td:first-child { width: 180px; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.account-device-action { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
/* VEYCA's Packages page: one column for each package, the newest version's features and limits in it. */
.packages-page { max-width: 1480px; }
.packages-matrix th, .packages-matrix td { min-width: 9em; }
.packages-matrix tbody th { text-align: left; font-weight: 400; min-width: 14em; }
.packages-matrix .pk-col { min-width: 13em; vertical-align: top; }
.packages-matrix .pk-col .form-group { margin: 8px 0; }
.packages-matrix .pk-col .btn { white-space: normal; }
.packages-matrix .input-narrow { width: 100%; max-width: 9em; }
.packages-page details.card summary { cursor: pointer; }

.this-device { font-size: 12.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
/* A table wider than its box shows a shade at the edge where more lies beyond it:
   the covers scroll with the content and hide the fixed shades at the ends. */
.table-scroll {
    --scroll-cover: var(--bg);
    --scroll-shade: var(--control-line);
    overflow-x: auto;
    background:
        linear-gradient(to right, var(--scroll-cover), var(--scroll-cover)) left center / 24px 100% no-repeat local,
        linear-gradient(to left, var(--scroll-cover), var(--scroll-cover)) right center / 24px 100% no-repeat local,
        radial-gradient(farthest-side at 0 50%, var(--scroll-shade), transparent) left center / 10px 100% no-repeat scroll,
        radial-gradient(farthest-side at 100% 50%, var(--scroll-shade), transparent) right center / 10px 100% no-repeat scroll;
}
.card .table-scroll { --scroll-cover: var(--surface); }

/* The organisation's SSO page */
.sso-page { max-width: 760px; }
.sso-item { padding: 12px 0; border-top: 1px solid var(--line); }
.sso-item:first-of-type { border-top: none; padding-top: 0; }
.sso-item-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.sso-item-head h3 { font-size: 15px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.sso-value { font-family: var(--font-data); font-size: 13px; overflow-wrap: anywhere; margin-bottom: 8px; }
.sso-facts { margin-bottom: 8px; table-layout: fixed; }

/* A new API key's token, shown once. */
.token-value { font-family: var(--font-data); font-size: 14px; overflow-wrap: anywhere; user-select: all;
               padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line-strong);
               border-radius: var(--radius); margin-bottom: 12px; }
.token-warning { color: var(--amber-ink); font-size: 13.5px; padding: 12px 14px; background: var(--amber-soft);
                 border: 1px solid var(--amber-line); border-radius: var(--radius); margin-bottom: 12px; }
.sso-facts td { overflow-wrap: anywhere; vertical-align: top; }
.sso-facts td:first-child { width: 40%; }
.sso-mfa { margin: 8px 0; }
.sso-mfa-state { font-size: 13px; margin-bottom: 8px; }
.sso-note { margin: 12px 0 0; color: var(--amber-ink); }
.sso-provider-form { margin-top: 12px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.checkbox-label input { width: auto; }

/* The sign-in card: the providers for the address's domain */
.sso-choices { margin-bottom: 12px; }
.sso-choices .btn { margin-bottom: 8px; }

/* The sign-up CAPTCHA widget (static/vendor/altcha, loaded after this file). Its stylesheet declares every
   --altcha-* variable on :root and builds many of them from others there, so setting only the base colours on
   a wrapper would leave the derived ones at the vendor's grey: the wrapper sets each colour variable itself.
   The shadow stays the vendor's (a translucent black that suits both themes). */
.altcha-host {
    --altcha-color-base: var(--surface);
    --altcha-color-base-content: var(--ink);
    --altcha-color-neutral: var(--control-line);
    --altcha-color-neutral-content: var(--ink-2);
    --altcha-color-primary: var(--inv-bg);
    --altcha-color-primary-content: var(--inv-ink);
    --altcha-color-error: var(--red);
    --altcha-color-error-content: var(--inv-ink);
    --altcha-color-success: var(--ink-2);
    --altcha-color-success-content: var(--surface);
    --altcha-border-color: var(--control-line);
    --altcha-checkbox-border-color: var(--control-line);
    --altcha-checkbox-outline-color: var(--focus);
    --altcha-checkbox-outline: 2px solid var(--focus);
    --altcha-input-background-color: var(--surface);
    --altcha-input-color: var(--ink);
    --altcha-popover-color: var(--control-line);
    --altcha-spinner-color: var(--ink);
    --altcha-switch-background-color: var(--control-line);
    --altcha-switch-toggle-color: var(--ink-2);
    --altcha-border-radius: var(--radius);
    --altcha-max-width: 100%;
}

/* The widget resets every property of its elements to the browser's own, so the page's focus ring does not reach
   its checkbox and the vendor's outline variable serves only its other controls. */
.altcha-host .altcha-checkbox input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* The Subscription page: the state card, the plans, the features and the limits. */
.subscription-page { max-width: 1040px; }
.organisation-page { max-width: 1040px; }
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 20px; }
.plan-grid .card { margin-bottom: 0; display: flex; flex-direction: column; gap: 10px; overflow-wrap: anywhere; }
.plan-grid .card > .btn { margin-top: auto; justify-content: center; }
.plan-current { border-color: var(--ink); }
.plan-pending { border-color: var(--amber-line); background: var(--amber-soft); }
.plan-price { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.plan-features { list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.plan-features li { display: flex; align-items: flex-start; gap: 6px; }
.plan-limits { font-size: 12.5px; }
.plan-bar { display: block; width: 100%; height: 8px; margin-top: 8px; accent-color: var(--ink); }
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
        background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.chip-ok { background: var(--surface); color: var(--ink); border-color: var(--control-line); }
.chip-info { background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); }

/* The Users page: members and guests as rows, the row menu, the scope picker. */
.users-page { max-width: 1040px; }
.page-title { flex: 1 1 14em; min-width: 0; }
.page-title h1 { margin-bottom: 4px; }
.page-title p { font-size: 13.5px; overflow-wrap: anywhere; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin-bottom: 0; }
.card-sub { font-size: 15px; font-weight: 600; margin: 18px 0 8px; }
.user-list { list-style: none; }
/* "Choose who stays": one line a member, the name, then the role and last sign-in beside it. */
.stays-list { display: flex; flex-direction: column; gap: 10px; margin: 14px 0 10px; max-height: 50vh; overflow-y: auto; }
.stays-row { flex-wrap: wrap; overflow-wrap: anywhere; }
.user-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: 0; }
.user-avatar { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
               border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line-strong); font-weight: 600; }
.user-main { flex: 1 1 0; min-width: 0; }
.user-name { font-weight: 600; overflow-wrap: anywhere; }
.user-meta { font-size: 13px; overflow-wrap: anywhere; }
.user-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.user-chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.chip-warn { background: var(--amber-soft); color: var(--amber-ink); border-color: var(--amber-line); }
.chip-bad { background: var(--red-soft); color: var(--red-ink); border-color: var(--red-line); }
.row-menu { position: relative; }
.row-menu summary { list-style: none; cursor: pointer; }
.row-menu summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; min-width: 220px; display: flex; flex-direction: column;
             padding: 4px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
             box-shadow: var(--shadow); }
.menu-item { display: block; width: 100%; padding: 8px 10px; text-align: left; background: none; border: 0; border-radius: var(--radius);
             color: var(--ink); font-size: 13.5px; cursor: pointer; }
.menu-item:hover { background: var(--surface-2); }
.menu-danger { color: var(--red-ink); }
.scope-hint { margin-top: 8px; }
.scope-programs { margin-top: 10px; }
.scope-program-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; max-height: 220px; overflow-y: auto; }
.roles-help summary { cursor: pointer; font-weight: 600; }
.roles-help .table-scroll { margin-top: 12px; }
@media (max-width: 640px) {
    .user-row { flex-wrap: wrap; }
    .user-side { flex: 1 1 100%; flex-direction: row; justify-content: space-between; align-items: center; }
}

/* Windows high-contrast and other forced-colour modes drop backgrounds:
   keep the focus ring and give chips and fields a border they can show. */
@media (forced-colors: active) {
    :focus-visible { outline: 2px solid Highlight; }
    .status-badge, .role-badge, .audit-action, .error-msg, .success-msg, .chip, .plan-chip, .plan-banner { border: 1px solid CanvasText; }
    .status-dot { border: 1px solid CanvasText; }
    .form-input { border: 1px solid CanvasText; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* The audit log's filters: one row of fields that wraps, the buttons at its end. */
.log-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 14px;
               align-items: end; margin-bottom: 10px; }
.log-filters .form-group { margin-bottom: 0; min-width: 0; }
.log-filter-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* The staff page's list of organisations to assign: long, so it scrolls inside the dialog. */
.staff-orgs { max-height: 12em; overflow-y: auto; margin-top: 6px; }
