/* rdpgw portal: page layout on top of the d2d UI kit.
   Colours, type, sizes and the components (titlebar, tabs, panel, table,
   buttons, inputs, badges, alerts, modal, stat, statusbar) come from
   /assets/d2d/d2d.css, which `make ui-kit` compiles from the kit. Use the
   kit's tokens here (--color-*, --d2d-*, --radius-*), never one-off colours.

   This file is not layered, so its rules beat every kit rule: keep it to
   layout and to the elements the kit has no class for. */

/* The kit gives .alert, .btn, .badge, .d2d-kv, ... a display value, which
   would beat the UA's [hidden] rule. */
[hidden] {
    display: none !important;
}

/* ---------- Shell: top bar · sidebar · page · status bar (FTEL-159) ---------- */
body.app {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    background: var(--color-base-100);
    color: var(--color-base-content);
}

.skip-link {
    position: absolute;
    left: 8px;
    top: -40px;
    z-index: 100;
    padding: 6px 10px;
    border-radius: var(--radius-field);
    background: var(--color-base-100);
    color: var(--color-base-content);
}

.skip-link:focus {
    top: 8px;
}

/* Top bar: the brand colour in light, a dark tint of it in dark. */
.app-topbar {
    --tb-bg: var(--color-primary);
    --tb-ink: var(--color-primary-content);
    --tb-field: color-mix(in oklab, var(--tb-ink) 14%, transparent);
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 52px;
    padding: 0 12px 0 16px;
    background: var(--tb-bg);
    color: var(--tb-ink);
}

[data-theme="d2d-dark"] .app-topbar {
    --tb-bg: color-mix(in oklab, var(--color-primary) 16%, var(--color-base-200));
    --tb-ink: var(--color-base-content);
}

.app-topbar :focus-visible {
    outline: 2px solid var(--tb-ink);
    outline-offset: 2px;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    margin-right: 8px;
    color: inherit;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.app-brand img {
    width: 22px;
    height: 26px;
}

.app-brand span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.cluster-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: var(--radius-box);
    background: var(--tb-field);
    color: inherit;
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
}

.cluster-pill:hover {
    background: color-mix(in oklab, var(--tb-ink) 22%, transparent);
}

.cluster-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-success);
    box-shadow: 0 0 0 2px var(--tb-ink);
}

.cluster-pill[data-level="warn"] .cluster-dot {
    background: var(--color-warning);
}

.cluster-pill[data-level="down"] .cluster-dot {
    background: var(--color-error);
}

.tb-spacer {
    flex: 1;
}

.tb-btn {
    position: relative;
    display: grid;
    place-items: center;
    flex: none;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-box);
    background: none;
    color: inherit;
    cursor: pointer;
}

.tb-btn:hover,
.account-button:hover,
.account-button[aria-expanded="true"] {
    background: var(--tb-field);
}

.tb-btn .d2d-icon {
    width: 18px;
    height: 18px;
}

.tb-pip {
    position: absolute;
    top: 1px;
    right: -2px;
    display: grid;
    place-items: center;
    min-width: 18px;
    height: 16px;
    padding: 0 4px;
    border: 2px solid var(--tb-bg);
    border-radius: 9px;
    background: var(--color-warning);
    color: var(--color-warning-content);
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

.account {
    position: relative;
}

.account-button {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 240px;
    padding: 4px 8px;
    border: 0;
    border-radius: var(--radius-box);
    background: none;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.account-button .d2d-avatar {
    width: 28px;
    height: 28px;
    background: var(--color-warning);
    color: var(--color-warning-content);
    font-size: 11px;
}

.account-name {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}

.account-name > span,
.account-name small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-name small {
    font-size: 11px;
    opacity: 0.85;
}

.account-chevron {
    flex: none;
    width: 14px;
    height: 14px;
}

.account-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 260px;
    padding: 12px 14px;
    border: 1px solid var(--d2d-border);
    border-radius: var(--radius-box);
    background: var(--color-base-100);
    color: var(--color-base-content);
    box-shadow: 0 8px 24px color-mix(in oklab, var(--color-neutral) 25%, transparent);
}

.account-menu-head {
    display: flex;
    flex-direction: column;
    overflow-wrap: anywhere;
}

.account-menu-perms ul {
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
    font-size: 12px;
}

/* Body: sidebar · page. data-sidebar is expanded, collapsed or hidden
   (Portal.sidebarMode: icons only below 900px, a drawer below 640px). */
.app-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
}

.app-body[data-sidebar="collapsed"] {
    grid-template-columns: 64px minmax(0, 1fr);
}

.app-body[data-sidebar="hidden"] {
    grid-template-columns: minmax(0, 1fr);
}

.app-side {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    background: var(--color-base-100);
    border-right: 1px solid var(--d2d-border);
}

.side-head {
    padding: 14px 16px 10px;
    font-size: 17px;
    font-weight: 700;
}

.side-switch {
    display: flex;
    gap: 2px;
    margin: 0 12px 6px;
    padding: 2px;
    border: 1px solid var(--d2d-border);
    border-radius: var(--radius-box);
    background: var(--color-base-200);
}

.side-switch a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 6px;
    border-radius: var(--radius-field);
    color: var(--d2d-muted);
    font-size: 12.5px;
    text-decoration: none;
}

.side-switch a:hover {
    color: var(--color-base-content);
}

.side-switch a[aria-current] {
    background: var(--color-base-100);
    color: var(--color-base-content);
    font-weight: 600;
    box-shadow: 0 0 0 1px var(--d2d-border);
}

.side-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 0 12px;
}

.side-group-title {
    padding: 14px 20px 6px;
    color: var(--d2d-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.side-group {
    margin: 0;
    padding: 0;
    list-style: none;
}

.side-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 36px;
    padding: 0 16px 0 17px;
    border-left: 3px solid transparent;
    color: var(--color-base-content);
    font-size: 13.5px;
    text-decoration: none;
}

.side-item:hover {
    background: var(--d2d-hover);
}

.side-item:focus-visible,
.side-switch a:focus-visible,
.side-collapse:focus-visible {
    outline-offset: -2px;
}

.side-item[aria-current="page"] {
    border-left-color: var(--color-primary);
    background: var(--d2d-selected);
    color: var(--color-primary);
    font-weight: 600;
}

[data-theme="d2d-light"] .side-item[aria-current="page"] {
    color: color-mix(in oklab, var(--color-primary) 85%, black);
}

.side-item .d2d-icon {
    flex: none;
    width: 16px;
    height: 16px;
}

.side-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.side-count {
    margin-left: auto;
    padding: 0 7px;
    border-radius: 9px;
    background: var(--color-base-200);
    color: var(--d2d-muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
}

.side-count.is-warn {
    background: color-mix(in oklab, var(--color-warning) 20%, transparent);
    color: var(--color-warning);
}

.side-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-top: 1px solid var(--d2d-border);
}

.side-collapse {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: var(--radius-field);
    background: none;
    color: var(--d2d-muted);
    cursor: pointer;
}

.side-collapse:hover {
    background: var(--d2d-hover);
    color: var(--color-base-content);
}

/* Collapsed: icons only. The labels stay in the accessibility tree (and
   each link has a title for the tooltip). */
.app-body[data-sidebar="collapsed"] .side-head,
.app-body[data-sidebar="collapsed"] .side-group-title {
    display: none;
}

.app-body[data-sidebar="collapsed"] .side-group + .side-group-title + .side-group {
    border-top: 1px solid var(--d2d-border);
    margin-top: 6px;
    padding-top: 6px;
}

.app-body[data-sidebar="collapsed"] .side-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.app-body[data-sidebar="collapsed"] .side-list {
    padding-top: 6px;
}

.app-body[data-sidebar="collapsed"] .side-item {
    justify-content: center;
    padding: 0;
}

.app-body[data-sidebar="collapsed"] .side-count {
    position: absolute;
    top: 3px;
    right: 8px;
    padding: 0 4px;
    font-size: 9.5px;
    line-height: 14px;
}

.app-body[data-sidebar="collapsed"] .side-switch {
    flex-direction: column;
    margin: 10px 8px 6px;
}

.app-body[data-sidebar="collapsed"] .side-switch a {
    padding: 6px 0;
}

.app-body[data-sidebar="collapsed"] .side-foot {
    justify-content: center;
    padding: 8px 0;
}

/* Hidden (below 640px): the menu button opens the sidebar over the page. */
.app-menu-button {
    margin-left: -6px;
}

.app-body[data-sidebar="hidden"] .app-side {
    position: fixed;
    top: 52px;
    bottom: 0;
    left: 0;
    z-index: 30;
    width: min(280px, 85vw);
    transform: translateX(-100%);
    visibility: hidden;
}

.app-body.is-drawer-open .app-side {
    transform: none;
    visibility: visible;
    box-shadow: 0 8px 24px color-mix(in oklab, var(--color-neutral) 35%, transparent);
}

.side-scrim {
    position: fixed;
    inset: 52px 0 0;
    z-index: 29;
    background: color-mix(in oklab, var(--color-neutral) 45%, transparent);
}

@media (prefers-reduced-motion: no-preference) {
    /* visible at once on open (so focus can move in), hidden after the
       slide on close */
    .app-side {
        transition: transform 0.15s ease, visibility 0s linear 0.15s;
    }

    .app-body.is-drawer-open .app-side {
        transition: transform 0.15s ease, visibility 0s;
    }

    .side-item,
    .side-switch a {
        transition: background 0.12s, color 0.12s;
    }
}

@media (max-width: 640px) {
    .app-topbar {
        padding: 0 8px 0 12px;
    }

    .app-brand span,
    .cluster-pill,
    .account-name {
        display: none;
    }
}

.app-main {
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow: auto;
    padding: 12px 16px 24px;
}

.app-main:focus {
    outline: none;
}

.app-page {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.view {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.view h1:focus {
    outline: none;
}

.d2d-page-header {
    margin-bottom: 0;
}

.app-statusbar {
    flex: none;
    height: 22px;
}

.app-statusbar .status-warn {
    color: var(--color-warning);
    font-weight: 600;
}

.app-statusbar .status-warn.is-critical {
    color: var(--color-error);
}

.app-toasts {
    z-index: 50;
    bottom: 28px;
}

/* ---------- Toolbars ---------- */
.view-toolbar {
    padding: 0;
}

.quick-filter {
    width: 18rem;
    max-width: 100%;
}

.quick-filter .d2d-icon,
.admin-filter .d2d-icon {
    color: var(--d2d-muted);
}

.icon-button.spinning svg {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- Tables ---------- */
.d2d-table td {
    max-width: 18rem;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.d2d-table .col-action {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}

.mono {
    font-family: var(--font-mono);
    font-size: 12px;
}

.cell-system {
    font-weight: 500;
}

.cell-system-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    min-width: 0;
}

/* the name keeps its width; badges wrap under it when the cell is narrow */
.cell-system-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cell-system-inner .badge {
    flex-shrink: 0;
}

.cell-sub {
    color: var(--d2d-muted);
    font-weight: 400;
}

.cell-empty {
    color: var(--d2d-muted);
}

.cell-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-badge .d2d-icon {
    width: 12px;
    height: 12px;
}

.status-spinner {
    width: 12px;
}

/* Loading, empty, no-match and error rows (same look as the kit's .d2d-empty) */
.d2d-table .table-message td {
    height: auto;
    padding: 28px 16px;
    text-align: center;
    white-space: normal;
    max-width: none;
    color: var(--d2d-muted);
}

.d2d-table tbody tr.table-message:hover,
.d2d-table tbody tr.skeleton-row:hover {
    background: none;
}

.table-message .is-error {
    color: var(--color-error);
}

.skeleton-line {
    height: 12px;
    width: 80%;
}

.row-ended td {
    color: var(--d2d-muted);
}

.timeleft {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 120px;
}

.timeleft .progress {
    height: 4px;
}

.timeleft-clock.is-urgent {
    color: var(--color-warning);
    font-weight: 600;
}

.timeleft-clock.is-critical {
    color: var(--color-error);
}

/* Last good data while the session store is down */
.is-stale {
    opacity: 0.6;
}

.empty-title {
    color: var(--color-base-content);
    font-size: 14px;
    font-weight: 600;
}

.empty-text {
    max-width: 28rem;
}

.d2d-empty .btn {
    margin-top: 8px;
}

.guard-empty {
    padding-block: 64px;
}

/* ---------- All sessions ---------- */
.admin-tiles {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.admin-tiles .stat-value.is-urgent {
    color: var(--color-warning);
}

.admin-filters {
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
}

.admin-filter {
    width: 14rem;
    max-width: 100%;
}

.admin-select {
    width: 11rem;
}

.auto-refresh {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.admin-footer-end {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ---------- Dialogs ---------- */
/* Connect (FTEL-139 v2): a compact dialog sized to its content, centred
   from 640px up and full width below. Its body scrolls only when the
   viewport is shorter than the content. */
.modal.connect-dialog > .modal-box {
    display: flex;
    flex-direction: column;
    width: min(30rem, calc(100vw - 2rem));
    max-width: none;
    max-height: calc(100dvh - 2rem);
    padding: 0;
    overflow: hidden;
}

.connect-dialog .access-body {
    flex: 0 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.connect-dialog .access-actions {
    flex: none;
}

.actions-spacer {
    flex: 1;
}

.connect-host {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.connect-host .host-text {
    flex: 1;
}

.connect-host .host-addr {
    font-family: var(--font-sans);
}

.presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.presets .btn {
    min-width: 64px;
}

.presets .btn[aria-pressed="true"] {
    background: var(--d2d-selected);
    border-color: var(--color-primary);
    color: var(--color-base-content);
}

.custom-length {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-top: 10px;
}

.custom-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.custom-field label {
    color: var(--d2d-muted);
    font-size: 12px;
}

.custom-field .input {
    width: 5rem;
    font-variant-numeric: tabular-nums;
}

.field-error {
    margin-top: 6px;
    color: var(--color-error);
    font-size: 12px;
}

.summary-line {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-box);
    background: var(--color-base-200);
    font-size: 12px;
}

.summary-line .d2d-icon {
    flex: none;
}

.ready-steps {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.ready-steps li {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.ready-steps li::before {
    counter-increment: step;
    content: counter(step);
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: var(--d2d-selected);
    color: var(--color-primary);
    font-size: 11px;
    font-weight: 700;
}

.ready-note {
    color: var(--d2d-muted);
    font-size: 12px;
}

.confirm-box {
    width: min(28rem, calc(100vw - 2rem));
    max-width: none;
}

.access-title {
    overflow-wrap: anywhere;
}

.access-body,
.confirm-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wake-section {
    grid-template-columns: minmax(0, 1fr) auto;
    border-color: var(--d2d-border);
    background: var(--color-base-200);
}

.session-lifetime {
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 0;
}

.session-lifetime-title {
    padding: 0;
    margin-bottom: 6px;
    font-weight: 500;
}

/* Days / hours / minutes fields (the JIT request and policy sheets) */
.duration-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
}

.duration-field label {
    display: block;
    margin-bottom: 4px;
    color: var(--d2d-muted);
    font-size: 12px;
}

.label-muted {
    color: var(--d2d-muted);
    font-weight: 400;
}

.loading-panel {
    color: var(--d2d-muted);
}

.loading-panel .progress {
    height: 3px;
    margin-top: 6px;
}

.session-banner .btn {
    margin-left: auto;
}

/* ---------- Hosts: cards and list (FTEL-139 v2) ---------- */
/* Neither view scrolls sideways: cards wrap at 260px, and the list has
   fixed column widths with an ellipsis (the full value is in title). */
.hosts-results {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.group-title {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 4px 0 0;
    color: var(--d2d-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.host-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}

.host-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border: 1px solid var(--d2d-border);
    border-radius: var(--radius-box);
    background: var(--color-base-200);
}

.host-card:hover {
    border-color: var(--d2d-field-border);
}

.host-card.is-live {
    border-color: color-mix(in srgb, var(--color-info) 55%, transparent);
}

.host-card.is-request {
    border-style: dashed;
    background: var(--color-base-100);
}

.host-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    padding: 12px 12px 8px;
}

.host-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--d2d-selected);
    color: var(--color-primary);
}

.host-icon .d2d-icon {
    width: 18px;
    height: 18px;
}

.is-request .host-icon {
    background: var(--d2d-hover);
    color: var(--d2d-muted);
}

.host-text {
    flex: 1;
    min-width: 0;
}

.host-name {
    overflow: hidden;
    color: var(--color-base-content);
    font-size: 14px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.host-addr {
    overflow: hidden;
    color: var(--d2d-muted);
    font-family: var(--font-mono);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.host-addr.is-text {
    font-family: var(--font-sans);
}

.host-head > .badge {
    flex: none;
}

.host-desc {
    overflow: hidden;
    padding: 0 12px 8px 56px;
    color: var(--d2d-muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.host-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 44px;
    margin-top: auto;
    padding: 8px 12px;
    border-top: 1px solid var(--d2d-border);
}

.host-meta {
    min-width: 0;
    line-height: 1.3;
}

.host-meta .badge,
.host-list .cell-badges .badge {
    display: inline-flex;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.host-meta-text {
    color: var(--d2d-muted);
    font-size: 12px;
}

.host-foot .row-actions {
    flex: none;
    margin-left: auto;
}

.host-card.is-skeleton .host-icon {
    background: none;
}

.skeleton-line.is-short {
    width: 50%;
    margin-top: 6px;
}

.hosts-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 12px;
    color: var(--d2d-muted);
    font-size: 12px;
}

.hosts-message {
    gap: 8px;
}

.hosts-view-switch .btn[aria-pressed="true"] {
    color: var(--color-base-content);
}

.host-list {
    width: 100%;
    table-layout: fixed;
}

.host-list .col-desc {
    width: 28%;
}

.host-list .col-status {
    width: 220px;
}

.host-list .col-act {
    width: 170px;
}

.host-list td {
    overflow: hidden;
    text-overflow: ellipsis;
}

.host-list .cell-name {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding-block: 6px;
    line-height: 1.25;
}

.host-list .cell-status .cell-badges {
    flex-wrap: nowrap;
    max-width: 100%;
    overflow: hidden;
}

.host-list .col-action .row-actions {
    max-width: 100%;
}

.host-list .col-action .btn {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.host-list .cell-status-sm {
    display: none;
}

.host-list tr.is-request .host-name,
.cell-muted {
    color: var(--d2d-muted);
}

/* ---------- My sessions: cards (FTEL-139 v2) ---------- */
/* Severity shows four ways: the left edge, a tint, the badge and the
   "Save your work" sentence; never colour alone. */
.sessions-cards,
.session-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.session-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 16px;
    padding: 14px 16px;
    border: 1px solid var(--d2d-border);
    border-left: 4px solid var(--color-success);
    border-radius: var(--radius-box);
    background: var(--color-base-200);
}

.session-card.is-warn {
    border-left-color: var(--color-warning);
    background: color-mix(in srgb, var(--color-warning) 7%, var(--color-base-200));
}

.session-card.is-crit {
    border-left-color: var(--color-error);
    background: color-mix(in srgb, var(--color-error) 8%, var(--color-base-200));
}

.session-card.is-ending {
    border-left-color: var(--d2d-border);
}

.session-main {
    min-width: 0;
}

.session-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    min-width: 0;
}

.session-title h3 {
    max-width: 100%;
    overflow: hidden;
    font-size: 15px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-warn {
    margin-top: 4px;
    color: var(--color-warning);
}

.is-crit .session-warn {
    color: var(--color-error);
}

.session-right {
    text-align: right;
}

.session-clock {
    font-size: 28px;
    font-weight: 650;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.session-clock small {
    margin-left: 4px;
    color: var(--d2d-muted);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0;
}

.session-clock.is-nolimit,
.session-clock.is-muted {
    color: var(--d2d-muted);
    font-size: 16px;
}

.is-warn .session-clock {
    color: var(--color-warning);
}

.is-crit .session-clock {
    color: var(--color-error);
}

.session-bar {
    display: flex;
    flex-direction: column;
    grid-column: 1 / -1;
    gap: 4px;
}

.session-bar .progress {
    height: 6px;
}

/* the kit has progress-primary / -warning; red for the last 2 minutes */
.session-bar .progress-error {
    color: var(--color-error);
}

.session-scale {
    display: flex;
    justify-content: space-between;
    color: var(--d2d-muted);
    font-size: 11px;
}

.session-actions {
    display: flex;
    flex-wrap: wrap;
    grid-column: 1 / -1;
    align-items: center;
    gap: 6px;
}

.session-actions:empty {
    display: none;
}

.session-end {
    color: var(--color-error);
}

.session-card.is-skeleton {
    display: flex;
    flex-direction: column;
    border-left-color: var(--d2d-border);
}

.ended-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ended-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 8px 12px;
    border-top: 1px solid var(--d2d-border);
    color: var(--d2d-muted);
}

.ended-list li:first-child {
    border-top: 0;
}

.ended-list li > .d2d-icon {
    flex: none;
}

.ended-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ended-name {
    color: var(--color-base-content);
}

.ended-list .badge {
    flex: none;
}

/* ---------- Status dots (Wake-on-LAN) ---------- */
.host-status.is-waking .status-spinner {
    animation-duration: 1.2s;
}

/* ---------- Admin pages: a little wider than the Workspace ---------- */
.app-main.is-admin .app-page {
    max-width: 1280px;
}

/* ---------- Admin › Hosts (FTEL-160: tabs, rule tree, bulk bar) ---------- */
.ah-tabs {
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--d2d-border);
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
}

.ah-tabs .tab {
    flex: none;
    gap: 0.375rem;
    white-space: nowrap;
}

.ah-tabs .tab .d2d-icon {
    width: 1rem;
    height: 1rem;
}

.ah-tabs .tab[aria-current="page"] {
    border-bottom: 2px solid var(--color-primary);
    color: var(--color-base-content);
    font-weight: 600;
}

.ah-tab-count {
    color: var(--d2d-muted);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

/* amber text that keeps AA contrast on the base colour, light and dark */
.ah-key,
.ah-no-rule,
.ah-tree-item.is-warn,
.ah-chip.is-warn {
    color: color-mix(in oklab, var(--color-warning) 55%, var(--color-base-content));
}

.ah-summary {
    margin-bottom: 0.75rem;
    align-items: flex-start;
}

.ah-summary-body {
    flex: 1 1 auto;
    min-width: 0;
}

.ah-summary-list {
    margin: 0.25rem 0 0;
    padding-left: 1.25rem;
    overflow-wrap: anywhere;
}

.ah-layout {
    display: grid;
    grid-template-columns: 13.5rem minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.ah-tree-panel {
    padding: 0.5rem 0 0.75rem;
}

.ah-tree-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.25rem 0.875rem 0.5rem;
    border-bottom: 1px solid var(--d2d-border);
    font-size: 0.875rem;
    font-weight: 600;
}

.ah-tree {
    margin: 0.375rem 0 0;
    padding: 0;
    list-style: none;
}

.ah-tree-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 32px;
    padding: 0.25rem 0.875rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.ah-tree-item.is-child {
    padding-left: 1.75rem;
}

.ah-tree-item:hover {
    background: var(--d2d-hover);
}

.ah-tree-item.is-active {
    background: var(--d2d-selected);
    font-weight: 600;
}

.ah-tree-item:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
}

.ah-tree-item .d2d-icon {
    flex: none;
    width: 1rem;
    height: 1rem;
}

.ah-tree-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ah-tree-count {
    color: var(--d2d-muted);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.ah-tree-note {
    margin: 0.5rem 0 0;
    padding: 0 0.875rem;
    color: var(--d2d-muted);
    font-size: 0.75rem;
}

.ah-panel {
    min-width: 0;
}

.ah-toolbar,
.ah-bulk {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    min-height: 3rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--d2d-border);
}

.ah-bulk {
    background: var(--d2d-selected);
}

.ah-bulk-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-left: auto;
}

.ah-bulk-progress {
    color: var(--d2d-muted);
    font-size: 0.8125rem;
}

.ah-rule-select {
    display: none;
    width: auto;
    max-width: 14rem;
}

.ah-chips {
    display: inline-flex;
    gap: 0.25rem;
}

.ah-search {
    margin-left: auto;
    width: 18rem;
    max-width: 100%;
}

/* the Actions column stays pinned on the right while the table scrolls */
.ah-table {
    table-layout: auto;
}

.ah-table th,
.ah-table td {
    white-space: nowrap;
}

.ah-table .col-check {
    width: 2.25rem;
}

.ah-table .col-pinned {
    position: sticky;
    right: 0;
    z-index: 1;
    background: var(--color-base-100);
    box-shadow: -1px 0 0 var(--d2d-border);
}

.ah-table tr.is-selected td {
    background: var(--d2d-selected);
}

.ah-table tr.is-selected .col-pinned {
    background: color-mix(in oklab, var(--d2d-selected), var(--color-base-100));
}

.ah-table .col-name {
    max-width: 16rem;
}

.ah-table .col-address {
    max-width: 10rem;
}

.ah-table .col-desc {
    max-width: 14rem;
}

.ah-cut {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ah-table .cell-system-inner {
    flex-wrap: nowrap;
    min-width: 0;
}

.ah-name-link {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: none;
}

.ah-name-link:hover {
    text-decoration: underline;
}

.ah-name-link:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

.ah-host-icon {
    flex: none;
    width: 0.875rem;
    height: 0.875rem;
    color: var(--d2d-muted);
}

.ah-key {
    display: inline-flex;
}

.ah-key .d2d-icon {
    width: 0.875rem;
    height: 0.875rem;
}

.ah-rules {
    display: inline-flex;
    gap: 0.25rem;
}

.ah-rule {
    max-width: 7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    justify-content: flex-start;
}

.ah-no-rule,
.ah-wol-on {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
}

.ah-no-rule .d2d-icon,
.ah-wol-on .d2d-icon {
    width: 0.875rem;
    height: 0.875rem;
}

.ah-wol-on .d2d-icon {
    color: var(--color-success);
}

.ah-nomatch td {
    white-space: normal;
    max-width: none;
}

.ah-nomatch-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.ah-menu {
    position: fixed;
    z-index: 40;
    min-width: 13rem;
    padding: 0.25rem;
    border: 1px solid var(--d2d-border);
    border-radius: var(--radius-box);
    background: var(--color-base-100);
    box-shadow: 0 8px 24px rgb(0 0 0 / 0.16);
}

.ah-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 32px;
    padding: 0.25rem 0.625rem;
    border: 0;
    border-radius: var(--radius-field);
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
}

.ah-menu-item:hover,
.ah-menu-item:focus-visible {
    background: var(--d2d-hover);
    outline: none;
}

.ah-menu-item:focus-visible {
    box-shadow: inset 0 0 0 2px var(--color-primary);
}

.ah-menu-item[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.ah-menu-item.is-danger {
    color: var(--color-error);
}

.ah-menu-item .d2d-icon {
    width: 1rem;
    height: 1rem;
}

.ah-menu-sep {
    height: 1px;
    margin: 0.25rem 0;
    background: var(--d2d-border);
}

.ah-delete-list {
    max-height: 12rem;
    margin: 0.5rem 0 0.75rem;
    padding-left: 1.25rem;
    overflow-y: auto;
    overflow-wrap: anywhere;
}

.ah-delete-list .status-badge {
    margin-left: 0.375rem;
}

.ah-delete-list li + li {
    margin-top: 0.25rem;
}

/* under 1400px the description and the WoL column go (Wake-on-LAN has
   its tab); under 1180px the tree becomes a select in the toolbar */
@media (max-width: 1400px) {
    .ah-table .hide-lg,
    .ah-table .col-wol {
        display: none;
    }
}

@media (max-width: 1180px) {
    .ah-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .ah-tree-panel {
        display: none;
    }

    .ah-rule-select {
        display: inline-flex;
    }
}

.row-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cell-badges {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.d2d-table .row-detail td {
    max-width: none;
    white-space: normal;
    background: var(--color-base-200);
    color: var(--color-base-content);
}

.row-detail p {
    margin: 0;
    max-width: 60rem;
}

.show-md {
    display: none;
}

/* the kit sizes .d2d-empty icons for the illustration, not for buttons */
.d2d-empty .btn .d2d-icon {
    width: 14px;
    height: 14px;
    margin: 0;
}

/* ---------- Sheet: right-side panel for detail and editing ---------- */
.sheet {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(520px, 100vw);
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    padding: 0;
    border: 0;
    border-left: 1px solid var(--d2d-border);
    background: var(--color-base-100);
    color: var(--color-base-content);
    box-shadow: -8px 0 24px rgb(0 0 0 / 0.35);
}

.sheet::backdrop {
    background: rgb(0 0 0 / 0.4);
}

.sheet-form {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sheet-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--d2d-border);
}

.sheet-head h2 {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.sheet-body {
    flex: 1;
    overflow: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sheet-foot {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    padding: 10px 14px;
    border-top: 1px solid var(--d2d-border);
}

.sheet-delete {
    margin-right: auto;
}

.sheet-input {
    width: 100%;
}

.mac-input {
    width: 14rem;
    max-width: 100%;
}

.ip-input {
    width: 10rem;
}

.port-input {
    width: 5rem;
}

.via-select {
    width: 20rem;
    max-width: 100%;
}

.sheet-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 12px 0 0;
    border: 0;
    border-top: 1px solid var(--d2d-border);
}

.sheet-group legend {
    padding: 12px 0 0;
    font-size: 13px;
    font-weight: 600;
}

.sheet-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px;
}

.sheet-toggle {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--d2d-border);
}

.test-wake {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.req {
    color: var(--color-error);
}

.preview-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.preview-row {
    display: flex;
    gap: 8px;
}

.preview-user {
    flex: 1;
}

.preview-user .d2d-icon {
    color: var(--d2d-muted);
}

/* ---------- Admin › Hosts: the Add / Edit drawer (FTEL-161) ---------- */
.sheet.host-drawer {
    width: min(560px, 100vw);
}

.drawer-head {
    align-items: flex-start;
    padding: 14px 16px 12px;
}

.drawer-titles {
    flex: 1;
    min-width: 0;
}

.drawer-sub {
    margin-top: 2px;
    font-size: 12px;
    color: var(--d2d-muted);
    overflow-wrap: anywhere;
}

.host-drawer .sheet-body {
    gap: 0;
    padding: 0 16px 16px;
}

.drawer-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    margin: 0;
    padding: 0 0 16px;
    border: 0;
    border-bottom: 1px solid var(--d2d-border);
}

.drawer-section:last-of-type {
    border-bottom: 0;
}

.drawer-section legend {
    float: left;
    width: 100%;
    padding: 16px 0 2px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--d2d-muted);
}

.drawer-section legend .label-muted {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}

.drawer-row2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.drawer-row2 > .d2d-field {
    min-width: 0;
}

.drawer-preview {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    font-size: 12.5px;
    border: 1px solid var(--d2d-border);
    border-radius: var(--radius-box, 8px);
    background: var(--color-base-200);
}

.drawer-preview-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.drawer-preview-row .preview-user {
    flex: 1 1 14rem;
    min-width: 0;
}

.drawer-preview-out {
    padding: 1px 6px;
    border: 1px solid var(--d2d-border);
    border-radius: 4px;
    background: var(--color-base-100);
    font-family: var(--font-mono, ui-monospace, monospace);
    overflow-wrap: anywhere;
}

.drawer-preview-check {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.drawer-reach-note {
    font-size: 12.5px;
}

.drawer-reach-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid var(--d2d-border);
    border-radius: 6px;
}

.drawer-reach-item > span {
    flex: 1 1 12rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

.drawer-reach-item.is-warning {
    border-color: var(--color-warning);
    color: var(--color-warning);
    background: color-mix(in oklab, var(--color-warning) 8%, transparent);
}

.drawer-reach-link {
    margin-left: auto;
    font-size: 12px;
    white-space: nowrap;
}

.drawer-toggle {
    align-items: flex-start;
    flex-wrap: nowrap;
    padding-top: 0;
    border-top: 0;
}

.drawer-toggle > span {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.drawer-switch {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* an invalid field stays red while it has focus (Save moves focus there) */
.host-drawer .input.input-error,
.host-drawer .input.input-error:focus,
.host-drawer .input.input-error:focus-visible {
    border-color: var(--color-error);
    outline-color: var(--color-error);
}

@media (max-width: 640px) {
    .drawer-row2 {
        grid-template-columns: 1fr;
    }
}

/* 412: their value against yours */
.conflict-box {
    width: min(32rem, calc(100vw - 2rem));
}

.diff-table td,
.diff-table th {
    white-space: normal;
    max-width: 12rem;
    overflow-wrap: anywhere;
}

.diff-table .diff-theirs {
    background: color-mix(in oklab, var(--color-error) 14%, transparent);
    text-decoration: line-through;
}

.diff-table .diff-mine {
    background: color-mix(in oklab, var(--color-success) 16%, transparent);
}

/* ---------- Utility ---------- */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.show-sm {
    display: none;
}

/* ---------- 1000px and below: the description goes first ---------- */
@media (max-width: 1000px) {
    .hide-md {
        display: none;
    }
}

/* ---------- 760px and below: sheets take the full width ---------- */
@media (max-width: 760px) {
    .sheet {
        width: 100vw;
        border-left: 0;
    }
}

/* ---------- 640px and below: name, address and Connect only ---------- */
@media (max-width: 640px) {
    .app-main {
        padding: 10px 8px 16px;
    }

    .hide-sm {
        display: none;
    }

    .show-sm {
        display: block;
        font-family: var(--font-mono);
        font-size: 12px;
    }

    .view-toolbar,
    .quick-filter,
    .admin-filter,
    .admin-select {
        flex: 1 1 auto;
        width: auto;
    }

    .d2d-table td {
        max-width: 12rem;
    }

    .admin-tiles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .access-actions .btn {
        flex: 1;
    }

    .access-actions .actions-spacer {
        display: none;
    }

    /* Connect: full width at the bottom */
    .modal.connect-dialog {
        place-items: end stretch;
    }

    .modal.connect-dialog > .modal-box {
        width: 100vw;
        max-height: calc(100dvh - 1rem);
        border-radius: var(--radius-box) var(--radius-box) 0 0;
    }

    .host-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    /* the list becomes rows of name + action: no column can push the
       action off screen; the status badges sit under the name */
    .host-list,
    .host-list tbody {
        display: block;
    }

    .host-list thead,
    .host-list colgroup,
    .host-list .cell-status {
        display: none;
    }

    .host-list tr {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 0 10px;
        border-top: 1px solid var(--d2d-border);
    }

    .host-list tr:first-child {
        border-top: 0;
    }

    .host-list td {
        height: auto;
        max-width: none;
        padding: 0;
        border: 0;
    }

    .host-list td:first-child {
        flex: 1;
        min-width: 0;
    }

    .host-list td.col-action {
        flex: none;
        width: auto;
        max-width: 55%;
    }

    .host-list .cell-status-sm {
        display: flex;
        margin-top: 2px;
    }

    .session-card {
        grid-template-columns: minmax(0, 1fr);
    }

    .session-right {
        text-align: left;
    }

    .hosts-view-switch {
        flex: none;
    }

    #view-hosts .view-toolbar {
        flex-wrap: nowrap;
    }

    #view-hosts .quick-filter {
        min-width: 0;
    }

    #view-hosts .quick-filter input {
        min-width: 0;
        width: 100%;
    }

    /* Admin › Hosts keeps its actions on screen: name, status and the
       pinned actions only. */
    .ah-table .row-actions {
        flex-wrap: nowrap;
    }

    .ah-table .row-action-label {
        display: none;
    }

    .ah-table .cell-system {
        max-width: 9.5rem;
    }

    .ah-toolbar .ah-search,
    .ah-toolbar .ah-rule-select {
        flex: 1 1 100%;
        max-width: none;
        margin-left: 0;
    }

    .ah-bulk-actions {
        margin-left: 0;
    }
}

/* ---------- Touch: row actions at least 24px (the kit's btn-xs is 17px) ---------- */
@media (pointer: coarse) {
    .side-item,
    .side-switch a {
        min-height: 40px;
    }

    .tb-btn {
        width: 40px;
        height: 40px;
    }

    /* card and dialog buttons: btn-sm (28px) grows to 32px on touch */
    .host-card .btn-sm,
    .session-card .btn-sm,
    .presets .btn-sm {
        --size: 32px;
    }
}

/* ---------- Reduced motion: no spin or pulse; the text still updates ---------- */
@media (prefers-reduced-motion: reduce) {
    .icon-button.spinning svg,
    .loading,
    .skeleton {
        animation: none !important;
    }

}

/* ---------- Sign-in page (templates/login.html) ---------- */
.login-card .login-text,
.login-card .login-help {
    margin: 0;
    text-align: center;
    color: var(--d2d-muted);
}

.login-card .login-help {
    font-size: 13px;
}

.login-card .btn {
    width: 100%;
}

.login-card .btn-disabled {
    pointer-events: none;
}

.d2d-auth .login-foot {
    /* the card sets --d2d-muted for itself; the page behind it is always dark */
    color: #b9c2cc;
    font-size: 13px;
    text-align: center;
}

/* ---------- Admin › Overview, Session history, Audit log (FTEL-152) ---------- */
.ov-updated {
    color: var(--d2d-muted);
    font-size: 12px;
}

.ov-tiles .stat[hidden] {
    display: none;
}

.admin-tiles.ov-tiles {
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}

.stat-value.is-error {
    color: var(--color-error);
}

.stat-value.is-warning {
    color: var(--color-warning);
}

.ov-tiles .stat-desc {
    white-space: normal;
}

.stat.is-muted .stat-value,
.stat.is-muted .stat-desc {
    color: var(--d2d-muted);
}

.ov-grid {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 8px;
    align-items: start;
}

.ov-grid.is-single {
    grid-template-columns: minmax(0, 1fr);
}

.ov-note {
    color: var(--d2d-muted);
}

.d2d-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--d2d-border);
}

.panel-title {
    margin: 0;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.d2d-panel-footer a,
.stat-desc a,
.health-main a {
    color: inherit;
    text-decoration: underline;
}

/* health: a dot plus words, never colour alone */
.health-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.health-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-bottom: 1px solid var(--d2d-border);
    font-size: 13px;
}

.health-row:last-child {
    border-bottom: 0;
}

.health-row.is-muted {
    color: var(--d2d-muted);
}

.health-dot {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--d2d-muted);
}

.health-row.is-ok .health-dot { background: var(--color-success); }
.health-row.is-warn .health-dot { background: var(--color-warning); }
.health-row.is-down .health-dot { background: var(--color-error); }

.health-main {
    flex: 1;
    min-width: 0;
}

.health-main strong {
    font-weight: 600;
}

.health-aside {
    color: var(--d2d-muted);
    font-size: 12px;
    white-space: nowrap;
}

/* a setting (Audit failure mode) shows as plain text, not a status badge */
.health-value {
    font-size: 12px;
    white-space: nowrap;
}

/* charts: bars are focusable and carry their value (aria-label and a tip) */
.chart-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.chart-pair[hidden] {
    display: none;
}

.chart-toggle .btn[aria-pressed="true"] {
    background: var(--color-base-content);
    color: var(--color-base-100);
}

.chart-body {
    padding: 10px 10px 4px;
    min-height: 168px;
}

.chart {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px;
    height: 150px;
}

.chart-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-bottom: 18px;
    color: var(--d2d-muted);
    font-size: 11px;
    text-align: right;
}

.chart-bars {
    display: grid;
    grid-template-columns: repeat(var(--bars), minmax(0, 1fr));
    gap: 3px;
    margin: 0;
    padding: 0;
    list-style: none;
    border-bottom: 1px solid var(--d2d-border);
}

.chart-bars li {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-width: 0;
    padding-bottom: 18px;
}

.chart-bar {
    position: relative;
    display: block;
    min-height: 1px;
    border-radius: 2px 2px 0 0;
    background: var(--color-primary);
}

.chart-error .chart-bar {
    background: color-mix(in oklab, var(--color-error) 75%, var(--color-base-100));
}

.chart-bar:hover,
.chart-bar:focus-visible {
    outline: 2px solid var(--color-base-content);
    outline-offset: 1px;
}

/* the exact value on hover or focus */
.chart-bar:hover::after,
.chart-bar:focus-visible::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    padding: 3px 6px;
    border: 1px solid var(--d2d-border);
    border-radius: var(--radius-field);
    background: var(--color-base-200);
    color: var(--color-base-content);
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
}

.chart-label {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    color: var(--d2d-muted);
    font-size: 11px;
    white-space: nowrap;
}

.chart-table {
    max-height: 168px;
    overflow: auto;
}

.chart-skeleton {
    height: 150px;
}

.chart-note {
    margin: 0;
    color: var(--d2d-muted);
    font-size: 12px;
}

/* filters */
.period-field {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.period-custom {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}

.period-custom[hidden] {
    display: none;
}

.period-field .d2d-field-error {
    flex-basis: 100%;
}

.check-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

#alFilters .admin-filter,
#shFilters .admin-filter {
    width: 10rem;
}

#alFilters .admin-select,
#shFilters .admin-select {
    width: 9.5rem;
}

.copy-inline {
    margin-left: 4px;
}

/* tables */
.row-click {
    cursor: pointer;
}

.row-click:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
}

.d2d-table tr.is-selected td {
    background: var(--d2d-selected);
}

.cell-reason {
    max-width: 18rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cell-sub-inline,
.cell-muted {
    color: var(--d2d-muted);
}

.nowrap {
    white-space: nowrap;
}

.col-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.row-live td:first-child {
    box-shadow: inset 2px 0 0 var(--color-info);
}

.empty-inline {
    margin-right: 6px;
}

.page-state[hidden] {
    display: none;
}

/* event sheet */
.icon-up {
    transform: rotate(180deg);
}

.event-fields {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 6px 14px;
    margin: 0;
    font-size: 13px;
}

.event-fields dt {
    color: var(--d2d-muted);
}

.event-fields dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.event-fields .btn-square {
    vertical-align: middle;
}

.quick-filter-link {
    height: auto;
    min-height: 0;
    padding: 0 2px;
    text-decoration: underline;
}

.event-details-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.event-details-head h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.event-json {
    margin: 0;
    padding: 10px 12px;
    overflow: auto;
    border: 1px solid var(--d2d-border);
    border-radius: var(--radius-box);
    background: var(--color-base-200);
    font-family: var(--font-mono);
    font-size: 12px;
    white-space: pre;
}

.event-json:focus-visible {
    outline: 2px solid var(--color-primary);
}

.event-hint {
    margin: 0;
    color: var(--d2d-muted);
    font-size: 12px;
}

#eventSheet .sheet-head h2 {
    font-size: 14px;
}

/* export dialog */
.export-facts {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 4px 16px;
    margin: 0 0 10px;
}

/* "Preparing file…" while the server builds the CSV; announced politely */
.export-preparing {
    margin: 0 0 10px;
    color: var(--d2d-muted);
}

.export-preparing:empty {
    margin: 0;
}

.export-facts dt {
    color: var(--d2d-muted);
}

.export-facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

@media (max-width: 1000px) {
    .ov-grid,
    .chart-pair {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 640px) {
    .admin-tiles.ov-tiles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #alFilters .admin-filter,
    #shFilters .admin-filter,
    #alFilters .admin-select,
    #shFilters .admin-select {
        width: auto;
    }

    .period-field,
    .period-custom,
    .period-field select {
        flex: 1 1 100%;
    }

    .health-aside {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton,
    .skeleton-line,
    .chart-skeleton {
        animation: none;
    }
}

/* ---------- Admin › Access rules, Access test, Changes, Permissions (FTEL-153) ---------- */
.group-badge,
.pattern-chip {
    font-family: var(--font-mono);
    overflow-wrap: anywhere;
}

.pattern-chip {
    padding: 0 0.35rem;
    border-radius: var(--radius-field);
    background: var(--color-base-200);
    font-size: 0.8125rem;
}

.rules-table td {
    vertical-align: top;
}

.side-count {
    margin-left: auto;
}

/* the rule sheet needs room for Groups → Host patterns = Matched hosts */
.sheet.sheet-wide {
    width: min(760px, 100vw);
}

.rule-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 0.5rem;
    align-items: start;
}

.rule-col {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.rule-col legend,
.rule-matches h3 {
    padding: 0;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--d2d-muted);
}

.rule-op {
    padding-top: 1.75rem;
    color: var(--d2d-muted);
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    max-width: 100%;
    padding: 0.0625rem 0.125rem 0.0625rem 0.5rem;
    border: 1px solid var(--d2d-border);
    border-radius: var(--radius-field);
    background: var(--color-base-200);
    font-size: 0.8125rem;
    overflow-wrap: anywhere;
}

.chip.is-invalid {
    border-color: var(--color-error);
}

.chip-note {
    color: var(--color-warning);
    font-size: 0.75rem;
}

.chip-remove {
    display: inline-grid;
    place-items: center;
    min-width: 24px;
    min-height: 24px;
    border: 0;
    border-radius: var(--radius-field);
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.chip-remove:hover {
    background: var(--d2d-selected);
}

.chip-remove:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

.chip-remove .d2d-icon {
    width: 0.75rem;
    height: 0.75rem;
}

.match-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-wrap: anywhere;
}

.match-list[aria-busy="true"] {
    opacity: 0.6;
}

/* Access test */
.access-test-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.75rem 1rem;
    align-items: end;
}

.access-test-groups {
    grid-column: 1 / 2;
}

.access-test-run {
    align-self: start;
    padding-top: 1.5rem;
}

.access-result {
    margin-top: 0.75rem;
    align-items: flex-start;
}

.access-result > .d2d-icon {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.125rem;
}

.access-kv {
    margin-top: 0.5rem;
}

.access-kv dd {
    overflow-wrap: anywhere;
}

/* Changes */
.changes-tabs {
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--d2d-border);
}

.changes-tabs .tab[aria-current="page"] {
    border-bottom: 2px solid var(--color-primary);
    color: var(--color-base-content);
    font-weight: 600;
}

.rules-table .cell-sub,
.changes-table .cell-sub {
    display: block;
}

.changes-tabs .tab {
    gap: 0.375rem;
}

.row-click {
    cursor: pointer;
}

.row-click:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
}

.diff-table th[scope="row"] {
    font-weight: 500;
    white-space: nowrap;
}

.diff-table tr.is-changed th[scope="row"],
.diff-table tr.is-changed td {
    background: color-mix(in oklab, var(--color-warning) 10%, transparent);
}

.diff-table .is-before {
    text-decoration: line-through;
    background: color-mix(in oklab, var(--color-error) 14%, transparent);
}

.diff-table .is-after {
    background: color-mix(in oklab, var(--color-success) 16%, transparent);
}

.diff-flag {
    display: inline-flex;
    margin-left: 0.25rem;
    color: var(--color-warning);
    vertical-align: middle;
}

.diff-flag .d2d-icon {
    width: 0.75rem;
    height: 0.75rem;
}

.diff-mark {
    display: block;
    width: fit-content;
    margin-top: 0.125rem;
    padding: 0 0.25rem;
    border-radius: var(--radius-field);
}

.diff-mark.is-added {
    background: color-mix(in oklab, var(--color-success) 16%, transparent);
}

.diff-mark.is-removed {
    background: color-mix(in oklab, var(--color-error) 14%, transparent);
    text-decoration: line-through;
}

.sheet-links {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
}

.approvals {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.approval-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--d2d-border);
}

.approval-head h2 {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.approval-head h2 strong {
    text-transform: none;
}

.approval-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.approval-impact {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    margin: 0;
}

.approval-impact .d2d-icon {
    flex: none;
    margin-top: 0.125rem;
    color: var(--color-warning);
}

.approval-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.approval-note {
    flex: 1 1 16rem;
}

.approval-own {
    flex: 1 1 16rem;
}

@media (max-width: 760px) {
    .rule-columns {
        grid-template-columns: minmax(0, 1fr);
    }

    .rule-op {
        display: none;
    }

    .access-test-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .access-test-run {
        padding-top: 0;
    }

    .approval-head {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ==================== Just-in-time access (FTEL-156) ==================== */

/* Hosts: the Access column (badge + one line of help) */
.cell-access {
    white-space: nowrap;
}

/* My access and Access grants: the second line of a cell */
.jit-table .cell-system-name,
.jit-table .cell-sub,
.jit-grants-table .cell-sub {
    display: block;
}

.jit-grants-table .cell-sub {
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* My access */
.jit-group + .jit-group {
    margin-top: 0.75rem;
}

.jit-group .d2d-panel-title h2 {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cell-timer {
    min-width: 9rem;
}

.jit-clock {
    display: block;
    font-weight: 600;
}

.jit-bar {
    display: block;
    width: 100%;
    max-width: 16rem;
    height: 4px;
}

.cell-reason {
    max-width: 22rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-details {
    min-width: 12rem;
    white-space: normal;
}

/* Approvals */
.jit-card.is-self {
    border-left: 3px solid var(--color-info);
    background: color-mix(in oklab, var(--color-info) 6%, var(--color-base-100));
}

.jit-card.is-closed {
    opacity: 0.75;
}

.jit-card.is-closed .approval-head h2 {
    color: var(--d2d-muted);
}

.jit-card .approval-head h2 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.jit-card .approval-head h2:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.jit-quote {
    margin: 0;
    padding: 0.5rem 0.75rem;
    border-left: 3px solid var(--d2d-border);
    background: var(--color-base-200);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.approval-facts dd .cell-badges {
    flex-wrap: wrap;
}

.recent-badge.is-mine {
    font-weight: 600;
}

.approval-own {
    display: flex;
    gap: 0.375rem;
    align-items: flex-start;
    margin: 0;
}

.approval-own .d2d-icon {
    flex: none;
    margin-top: 0.125rem;
    color: var(--color-info);
}

.approval-error {
    align-items: center;
}

.jit-card .approval-actions {
    justify-content: flex-end;
}

/* Approve on your own request: aria-disabled, so it stays focusable and
   its reason is read; it looks disabled. */
.btn.btn-disabled-soft {
    opacity: 0.5;
    cursor: not-allowed;
}

.jit-foot-note {
    margin: 0.75rem 0 0;
}

/* Request sheet */
.jit-duration .d2d-field-help,
.jit-duration .d2d-field-error {
    display: block;
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--d2d-muted);
}

.jit-duration .d2d-field-error {
    color: var(--color-error);
}

.jit-duration .d2d-field-error[hidden] {
    display: none;
}

.jit-duration .input:disabled.input-error {
    border-color: var(--d2d-border);
}

.jit-reason-meta > .tabular-nums {
    flex: none;
    white-space: nowrap;
}

.jit-duration .duration-field .input {
    width: 4.5rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.jit-reason {
    width: 100%;
    min-height: 5rem;
}

.jit-reason-meta {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
}

.jit-who {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--d2d-border);
    border-radius: var(--radius-box, 4px);
}

.jit-who p {
    margin: 0;
}

.jit-who .d2d-icon {
    flex: none;
    margin-top: 0.125rem;
    color: var(--d2d-muted);
}

/* JIT policies list: requesters → hosts */
.jit-arrow {
    color: var(--d2d-muted);
}

/* Policy sheet */
.jit-policy-columns {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

.jit-approvers {
    max-width: 24rem;
}

.jit-ack {
    margin-top: -0.25rem;
}

/* Host sheet: the grant-only error keeps its Add a policy button inline */
#hsJitError {
    grid-template-columns: auto minmax(0, 1fr) auto;
}

.cell-access-sm {
    display: none;
}

.jit-duration .duration-field .input::-webkit-outer-spin-button,
.jit-duration .duration-field .input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.jit-duration .duration-field .input {
    -moz-appearance: textfield;
    appearance: textfield;
}

@media (max-width: 760px) {
    .jit-card .approval-actions .btn {
        flex: 1 1 100%;
    }

    .jit-policy-columns {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 640px) {
    .cell-access-sm {
        display: block;
        margin-top: 4px;
    }

    .cell-access-sm .badge {
        height: auto;
        max-width: 100%;
        white-space: normal;
        text-align: left;
    }

    .jit-table .row-actions {
        flex-direction: column;
        align-items: flex-end;
    }

    .cell-details {
        min-width: 0;
    }

    .cell-timer {
        min-width: 6rem;
    }
}

@media (pointer: coarse) {
    .jit-duration .duration-field .input,
    .jit-card .approval-actions .btn {
        min-height: 32px;
    }
}

/* ---------- Console › Hosts › one host (FTEL-162) ---------- */
.hp-head {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.hp-title {
    min-width: 0;
}

.hp-title h1 {
    overflow-wrap: anywhere;
}

.hp-icon {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-box);
    background: color-mix(in oklab, var(--color-primary) 10%, var(--color-base-100));
    color: var(--color-primary);
}

.hp-icon .d2d-icon {
    width: 1.375rem;
    height: 1.375rem;
}

.hp-sub {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 2px 0 0;
}

.hp-address,
.hp-break {
    overflow-wrap: anywhere;
}

.hp-body {
    display: grid;
    gap: 8px;
}

.hp-tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hp-tiles[data-count="2"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hp-tiles[data-count="1"] {
    grid-template-columns: minmax(0, 1fr);
}

.hp-tiles .stat[hidden],
.hp-col > [hidden] {
    display: none;
}

.hp-tiles .stat-desc {
    white-space: normal;
}

.hp-grid {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 8px;
    align-items: start;
}

.hp-grid.is-single {
    grid-template-columns: minmax(0, 1fr);
}

.hp-col {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.hp-details {
    display: grid;
    grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr);
    margin: 0;
    padding: 4px 16px 8px;
    font-size: 13px;
}

.hp-details dt,
.hp-details dd {
    margin: 0;
    padding: 9px 0;
    border-bottom: 1px solid var(--d2d-border);
}

.hp-details dt {
    padding-right: 16px;
    color: var(--d2d-muted);
}

.hp-details dt:nth-last-child(2),
.hp-details dd:last-child {
    border-bottom: 0;
}

.hp-panel-body {
    display: grid;
    gap: 8px;
    padding: 4px 16px 14px;
    font-size: 13px;
}

.hp-panel-body p {
    margin: 0;
}

.hp-list {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hp-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--d2d-border);
    border-radius: var(--radius-field);
}

.hp-list li > .d2d-icon {
    flex: none;
    color: var(--d2d-muted);
}

.hp-list-main {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.hp-list-meta {
    flex: none;
    max-width: 55%;
    color: var(--d2d-muted);
    font-size: 12px;
    text-align: right;
}

.hp-activity li {
    border: 0;
    border-bottom: 1px solid var(--d2d-border);
    border-radius: 0;
    padding: 8px 0;
}

.hp-activity li:last-child {
    border-bottom: 0;
}

.hp-dot {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--d2d-muted);
}

.hp-dot.is-allow {
    background: var(--color-success);
}

.hp-dot.is-deny {
    background: var(--color-error);
}

.hp-note {
    color: var(--d2d-muted);
}

.hp-warn {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    color: color-mix(in oklab, var(--color-warning) 55%, var(--color-base-content));
}

.hp-card-error {
    color: var(--color-error);
}

.hp-more {
    font-size: 13px;
    white-space: nowrap;
}

.hp-state {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.hp-end {
    margin-left: auto;
}

@media (max-width: 1000px) {
    .hp-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* below 640px the page is one column: tiles, details, sessions, who, activity */
@media (max-width: 640px) {
    .hp-tiles,
    .hp-tiles[data-count="2"] {
        grid-template-columns: minmax(0, 1fr);
    }

    .hp-header {
        flex-direction: column;
        align-items: stretch;
    }

    .hp-header .d2d-actions {
        justify-content: flex-start;
    }

    .hp-icon {
        display: none;
    }

    .hp-details {
        grid-template-columns: minmax(0, 1fr);
    }

    .hp-details dt {
        padding-bottom: 0;
        border-bottom: 0;
    }

    .hp-details dd {
        padding-top: 2px;
    }

    .hp-list-meta {
        max-width: 50%;
    }
}
