Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

62.5 KB
Raw Blame
// ============================================================
// REDESIGN DESIGN-SYSTEM PRIMITIVES  (see docs/REDESIGN_MAP.md §3)
// ============================================================
// Shared, reusable building blocks for the new "infra console" look.
// Namespaced with `sk-` so they NEVER collide with the live app's existing
// generic classes (.card/.input/.switch/.tag/.modal/.empty/.row/.col …).
// Consumers use the React components in src/components/ds/*, not raw classes.
// All colors come from the var()-backed tokens in _theme-variables.scss.
// ============================================================

// ---- semantic tone helper map (used by Pill/MetricCard/Gauge tints) ----
$sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet');

// ------------------------------------------------------------
// Pill — status badge (dot + label)
// ------------------------------------------------------------
.sk-pill {
    // Badge spec: 20px tall, 4px radius, 12px/500, tinted fill, flat dot.
    display: inline-flex;
    align-items: center;
    height: 20px; // geometry: badge height (20px badge spec)
    gap: $space-tight;
    padding: 0 $space-tight;
    border-radius: $radius-badge;
    font-size: $text-xs;
    font-weight: $font-weight-medium;
    white-space: nowrap;

    &__dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

    &--green { background: var(--green-bg); color: var(--green); .sk-pill__dot { background: var(--green); } }
    &--amber { background: var(--amber-bg); color: var(--amber); .sk-pill__dot { background: var(--amber); } }
    &--red   { background: var(--red-bg);   color: var(--red);   .sk-pill__dot { background: var(--red); } }
    &--cyan  { background: var(--cyan-bg);  color: var(--cyan);  .sk-pill__dot { background: var(--cyan); } }
    &--violet{ background: var(--violet-bg);color: var(--violet);.sk-pill__dot { background: var(--violet); } }
    &--gray  { background: var(--surface-3); color: var(--text-faint); .sk-pill__dot { background: var(--text-faint); } }
}

// ------------------------------------------------------------
// State chip — small semibold label on a semantic wash
// (alert/incident states, severities, kind/type tags). One source of
// truth for the shape: page-local chip classes (.mon-state, .sec-state,
// .inc-state/.inc-impact, .git-chip, .bk-type) keep their names and
// `@extend %sk-state;`, layering their own tone modifiers / sizing
// deviations on top. New consumers use `.sk-state` directly (style
// class like .sk-dtable, no ds/ component).
// ------------------------------------------------------------
%sk-state {
    display: inline-flex;
    align-items: center;
    height: 20px; // geometry: badge height (20px badge spec)
    padding: 0 $space-tight;
    border-radius: $radius-badge;
    font-size: $text-xs;
    font-weight: $font-weight-medium;
    white-space: nowrap;
    flex-shrink: 0;
}

.sk-state {
    @extend %sk-state;

    &--red    { color: var(--red);    background: var(--red-bg); }
    &--amber  { color: var(--amber);  background: var(--amber-bg); }
    &--green  { color: var(--green);  background: var(--green-bg); }
    &--cyan   { color: var(--cyan);   background: var(--cyan-bg); }
    &--violet { color: var(--violet); background: var(--violet-bg); }
    &--accent { color: var(--accent-bright); background: var(--accent-bg); }
    &--gray   { color: var(--text-faint);    background: var(--surface-3); }
}

// ------------------------------------------------------------
// EnvTag — environment / category tag (PROD / DEV / STAGING …)
// ------------------------------------------------------------
.sk-tag {
    display: inline-flex;
    align-items: center;
    height: 20px; // geometry: badge height (20px badge spec)
    padding: 0 $space-tight;
    border-radius: $radius-badge;
    font-size: $text-xs;
    font-weight: $font-weight-medium;
    border: 1px solid var(--border-strong);
    color: var(--text-dim);
    background: var(--surface-2);

    &--prod    { color: var(--green);  border-color: rgba(61, 220, 151, 0.3); background: var(--green-bg); }
    &--dev     { color: var(--cyan);   border-color: rgba(73, 199, 240, 0.3); background: var(--cyan-bg); }
    &--staging { color: var(--amber);  border-color: rgba(245, 185, 69, 0.3); background: var(--amber-bg); }
}

// ------------------------------------------------------------
// SegControl — segmented toggle (replaces native <select>/filter chips)
// Items are $control-sm (28); a 1px inset + 1px border makes the whole
// control $control-md (32), so it lines up with the inputs beside it.
// ------------------------------------------------------------
.sk-seg {
    display: inline-flex;
    gap: $space-hair;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: $radius-control;
    padding: 1px;

    &__btn {
        display: inline-flex;
        align-items: center;
        gap: $space-2;
        height: $control-sm;
        padding: 0 $space-3;
        border-radius: $radius-control;
        font-size: $text-sm;
        color: var(--text-faint);
        font-weight: $font-weight-medium;
        font-family: inherit;
        background: none;
        border: none;
        cursor: pointer;
        transition: 0.14s;

        &:hover { color: var(--text-dim); }
        &.is-on { background: var(--surface-3); color: var(--text); box-shadow: none; }

        .sk-seg__count { font-size: $text-xs; opacity: 0.7; }
    }
}

// ------------------------------------------------------------
// MetricCard / KPI tile
// ------------------------------------------------------------
// Row layout: [icon] [value + label] [trend], with an optional spark bleeding
// along the bottom. Stacking the icon above the value cost ~46px per tile for
// no information — a summary strip ate a fifth of the page before the content
// it summarises. See the note in MetricCard.jsx.
.sk-kpi {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: $radius-card;
    padding: $space-3 $space-3;
    position: relative;
    overflow: hidden;
    transition: border-color 0.15s;

    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: $space-3;
    // The spark spans the full width on its own line under the row.
    grid-template-areas: "icon body trend" "spark spark spark";

    &:hover { border-color: var(--border-strong); }

    // A bare glyph. Tinted icon squares in a rainbow of tones read as
    // decoration; only "act on this" tones keep a colour, on the glyph alone.
    &__icon {
        grid-area: icon;
        display: grid; place-items: center;
        color: var(--text-faint);

        svg { width: 16px; height: 16px; } // geometry: icon size

        &--amber  { color: var(--amber); }
        &--red    { color: var(--red); }
    }
    // Grid areas need a single child to own the text column; a tile with no
    // icon simply leaves the first track at zero width.
    &__body { grid-area: body; min-width: 0; }
    &__val {
 font-size: $text-xl; font-weight: $font-weight-semibold;
        letter-spacing: -0.02em; line-height: 1.1;
        // Explicit theme colour — don't inherit, or a host with a stray text
        // colour (e.g. a non-tabgroup page shell) renders the value near-black.
        color: var(--text);
        // Even columns of digits, and a truncation guard so an un-migrated
        // 6-digit value degrades to an ellipsis instead of bursting the tile.
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        small { font-size: $text-sm; color: var(--text-faint); font-weight: $font-weight-medium; }
    }
    &__label {
        font-size: $text-xs; color: var(--text-dim); margin-top: 1px;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    // Optional mono detail row beneath the label (e.g. "Total 32 · Cached 4").
    &__sub {
        font-size: $text-xs;
        color: var(--text-faint);
        margin-top: $space-1;
        display: flex;
        gap: $space-3;
        flex-wrap: wrap;
    }
    &__trend {
        grid-area: trend;
        align-self: start;
 font-size: $text-xs;
        display: flex; align-items: center; gap: 4px;
        &--up { color: var(--green); }
        &--down { color: var(--red); }
        &--flat { color: var(--text-faint); }
    }
    // Trend chart along the bottom edge. The negative margins cancel the tile's
    // padding so the series bleeds to the corners instead of floating in a box
    // — the design mock's `.kpi-spark`.
    &__spark {
        grid-area: spark;
        margin: $space-2 -13px -11px;
        line-height: 0;
        opacity: 0.9;

        svg { display: block; width: 100%; }
    }

    // A tile whose metric is over its configured limit. Amber, not red: it is
    // an "act soon", and the value itself already carries the number.
    &.is-alerting { border-color: rgba(245, 185, 69, 0.35); }
}

// ------------------------------------------------------------
// KpiBand — the one responsive grid wrapper for MetricCard tiles.
// `--kpi-cols` is set inline by the component; tiles collapse to fewer columns
// as the viewport narrows so every summary strip shares one collapse behaviour.
// ------------------------------------------------------------
.sk-kpiband-wrap {
    display: flex;
    flex-direction: column;
    gap: $space-3;
 margin-bottom: $space-5;
}

.sk-kpiband {
    display: grid;
    grid-template-columns: repeat(var(--kpi-cols, 4), minmax(0, 1fr));
    gap: $space-4;

    &--dense { gap: 10px; }

    @media (max-width: 1100px) {
        grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    }
    @media (max-width: 560px) {
        grid-template-columns: 1fr 1fr;
    }

    // Skeleton tile — same geometry as .sk-kpi so content doesn't jump on load.
    &__skel {
        height: 64px;
        border-radius: var(--radius);
        border: 1px solid var(--border-soft);
        background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%);
        background-size: 400% 100%;
        animation: sk-kpiband-shimmer 1.4s ease infinite;
    }

    // "More stats" disclosure toggle + the folded compact strip.
    &__more {
        align-self: flex-start;
        background: none;
        border: none;
        padding: $space-hair $space-tight;
        font-size: $text-xs;
        color: var(--accent-bright);
        cursor: pointer;

        &:hover { text-decoration: underline; }
    }

    &__strip {
        display: flex;
        flex-wrap: wrap;
        gap: $space-2 $space-5;
        padding: $space-3 $space-3;
        border: 1px solid var(--border-soft);
        border-radius: var(--radius);
        background: var(--surface);
    }

    &__stripitem { display: flex; flex-direction: column; gap: 2px; }
    &__stripval {
        font-size: $text-base;
        font-weight: $font-weight-semibold;
        color: var(--text);
        small { font-size: $text-xs; color: var(--text-faint); font-weight: $font-weight-medium; }
    }
    &__striplabel { font-size: $text-xs; color: var(--text-faint); }
}

@keyframes sk-kpiband-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

// ------------------------------------------------------------
// Gauge — thin inline meter bar (threshold-colored fill)
// ------------------------------------------------------------
.sk-gauge {
    height: 5px;
    border-radius: $radius-badge;
    background: var(--surface-3);
    overflow: hidden;

    &__fill { display: block; height: 100%; border-radius: 3px; transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); }
}

// ------------------------------------------------------------
// ServiceTile — gradient initial avatar
// ------------------------------------------------------------
.sk-tile {
    border-radius: $radius-control;
    display: grid;
    place-items: center;
    font-weight: $font-weight-medium;
    background: var(--surface-3);
    color: var(--text-dim);
    flex-shrink: 0;
}

// ------------------------------------------------------------
// Sparkline / AreaChart — sizing wrappers (geometry is in the SVG)
// ------------------------------------------------------------
.sk-spark { display: block; overflow: visible; }
.sk-area  { display: block; width: 100%; }

// ------------------------------------------------------------
// ScoreGauge — SVG ring (security / reputation posture)
// ------------------------------------------------------------
.sk-score {
    position: relative;
    display: inline-grid;
    place-items: center;

    &__svg { transform: rotate(-90deg); }
    &__center { position: absolute; text-align: center; }
    &__num { font-weight: $font-weight-semibold; line-height: 1; }
    &__label { font-size: $text-xs; color: var(--text-faint); margin-top: 3px; }
}

// ------------------------------------------------------------
// Feed — activity list (colored dot + html text + time)
// ------------------------------------------------------------
.sk-feed {
    &__item {
        display: flex; gap: $space-3; padding: $space-3 0; position: relative;
        & + .sk-feed__item { border-top: 1px solid var(--border-soft); }
    }
    &__dot {
        width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
        display: grid; place-items: center; background: var(--surface-2);
    }
    &__body { flex: 1; min-width: 0; }
    &__txt  { font-size: $text-sm; line-height: 1.45; b { font-weight: $font-weight-semibold; color: var(--text); } }
    &__time { font-size: $text-xs; color: var(--text-faint); margin-top: 2px; }
}

// ------------------------------------------------------------
// DataTable — dense list table. Apply `.sk-dtable` to a <table>.
// (kept as a style class, not a component, so pages stay flexible)
// ------------------------------------------------------------
.sk-dtable {
    width: 100%;
    border-collapse: collapse;
    font-size: $text-sm;

    thead th {
        position: relative;
        text-align: left;
        font-size: $text-xs;
        color: var(--text-faint);
        font-weight: $font-weight-medium;
        height: $control-md; // table header spec: 32
        padding: 0 $space-3;
        white-space: nowrap; // a wrapped label would grow the 32px header
        border-bottom: 1px solid var(--border);

        // Outer edges get $space-4; must precede .has-menu so its lane wins.
        &:first-child { padding-inline-start: $space-4; }
        &:last-child { padding-inline-end: $space-4; }

        // Header cells that carry a "⋮" reserve its lane, so the label never
        // reflows when the button appears on hover.
        &.has-menu { padding-right: 28px; }
        &.is-filtered { color: var(--accent-bright); }
        &:hover .sk-colmenu-btn { opacity: 1; }
        &.is-filtered .sk-colmenu-btn { opacity: 1; color: var(--accent-bright); }
    }


    &__filter-mark { color: var(--accent-bright); flex-shrink: 0; }

    // Filtered-to-nothing: the header stays, because the control that undoes it
    // lives in the header menu.
    &__nomatch td {
        padding: $space-8 $space-4 !important;
        text-align: center;
        color: var(--text-faint);
        font-size: $text-sm;

        button {
            margin-left: $space-3;
            padding: $space-tight $space-3;
            border: 1px solid var(--border);
            border-radius: $radius-control;
            background: var(--surface-2);
            color: var(--text-dim);
            font-size: $text-xs;
            font-family: inherit;
            cursor: pointer;

            &:hover { border-color: var(--accent-dim); color: var(--accent-bright); }
        }
    }
    // Rows: min 40 (height on a cell acts as a minimum, so two-line rows grow).
    tbody td { height: $control-lg; padding: $space-2 $space-3; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
    tbody td:first-child { padding-inline-start: $space-4; }
    tbody td:last-child { padding-inline-end: $space-4; }
    tbody tr { transition: background 0.12s; }
    tbody tr.is-clickable { cursor: pointer; }
    tbody tr.is-clickable:focus-visible { outline: 2px solid var(--accent-dim); outline-offset: -2px; }
    tbody tr:hover { background: var(--surface-2); }
    tbody tr:last-child td { border-bottom: none; }
    tbody tr.is-selected { background: var(--accent-bg-soft); &:hover { background: var(--accent-bg); } }

    .sk-cell-name { font-weight: $font-weight-semibold; display: flex; align-items: center; gap: 11px; }
    // sk-cell-mono is for machine values only (hosts, IPs, ports, versions,
    // paths, IDs, hashes). Dates, counts, types and other words use sk-cell-dim.
    .sk-cell-mono { font-family: var(--mono); font-size: $text-xs; color: var(--text-dim); }
    .sk-cell-dim  { font-size: $text-sm; color: var(--text-dim); }
    .sk-cell-sub  { font-size: $text-xs; color: var(--text-faint); margin-top: 3px; }

    // Sortable column headers (used by the DataTable component).
    .is-sortable { cursor: pointer; user-select: none; }
    .is-sortable:hover { color: var(--text-dim); }
    .is-sorted { color: var(--accent-bright); }
    &__head-inner { display: inline-flex; align-items: center; gap: 5px; }
    &__sort { display: inline-flex; align-items: center; gap: 2px; color: var(--accent-bright); }
    &__sort-placeholder { color: var(--text-faint); opacity: 0.35; }
    // Priority number shown next to the direction chevron when more than one
    // sort level is active (shift+click stacking).
    &__sort-priority {
        font-size: $text-xs;
        font-weight: $font-weight-semibold;
        line-height: 1;
        color: var(--accent-bright);
        opacity: 0.85;
        transform: translateY(-3px);
    }

    // Native selection column (selectable tables).
    &__check { width: 36px; padding-right: 0 !important; }

    // Keyboard-nav cursor row (j/k). Distinct from hover: it follows the keys,
    // not the mouse.
    tbody tr.is-cursor {
        background: var(--accent-bg-soft);
        box-shadow: inset 2px 0 0 var(--accent-bright); // geometry: inset edge drawn as a border (cursor row marker)
    }

    // Group header row (groupBy). Click collapses/expands the group.
    &__group {
        cursor: pointer;
        user-select: none;

        td {
            height: $control-md !important; // group header row: compact 32
            padding: $space-1 $space-4 !important;
            background: var(--surface-2);
            border-bottom: 1px solid var(--border-soft);
        }

        &:hover td { background: var(--surface-3); }
    }

    &__group-inner { display: inline-flex; align-items: center; gap: 7px; }

    &__group-chev {
        color: var(--text-faint);
        transition: transform 0.14s;
        transform: rotate(90deg);

        .is-collapsed & { transform: rotate(0deg); }
    }

    &__group-label {
        font-size: $text-xs;
        font-weight: $font-weight-semibold;
        color: var(--text-dim);
    }

    &__group-count {
        font-size: $text-xs;
        color: var(--text-faint);
        background: var(--surface);
        border: 1px solid var(--border-soft);
        border-radius: $radius-full;
        padding: 1px $space-2;
    }
}

// THE table frame. Every list table in the panel (Databases studio aside)
// sits in exactly this: one surface, one hairline, one radius, no padding.
// Pages never wrap it in another card or re-skin the cells; size columns
// through the column definition's `width`, not page CSS. Held by
// scripts/check-tables.mjs.
.sk-dtable-wrap {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: $radius-card;
}

// A table that is one section of a titled card/panel runs flush inside it:
// two frames a pixel apart is the seam this rule removes. A page-specific
// panel that frames its own header + table opts in with --flush.
:is(.card, .ui-card, .settings-card, .app-panel, .modal-body, .sk-drawer, .sk-sheet, .skw-card) .sk-dtable-wrap,
.sk-dtable-wrap--flush {
    background: none;
    border: 0;
    border-radius: 0;
}
// Opt-in sticky header for tall tables: cap the wrap and pin the thead.
.sk-dtable-wrap--sticky {
    max-height: var(--dtable-max-height, 60vh);
    overflow-y: auto;

    .sk-dtable thead th {
        position: sticky;
        top: 0;
        z-index: 2;
        background: var(--surface);
    }
}
.sk-dtable__loading {
    display: flex; align-items: center; justify-content: center;
    min-height: 180px; color: var(--text-faint);
}

// ------------------------------------------------------------
// DataTableFooter — one standard "how much / show more" bar under tables.
// Replaces the ad-hoc pagers (Prev/Next labels, bare Load more, nothing).
// ------------------------------------------------------------
.sk-dtable-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: $space-3;
    padding: $space-2 $space-4;
    border-top: 1px solid var(--border-soft);

    &__count {
        font-size: $text-xs;
        color: var(--text-faint);
        white-space: nowrap;
    }

    &__controls { display: inline-flex; align-items: center; gap: 10px; }

    &__sizes .sk-seg__btn { padding: 0 $space-2; font-size: $text-xs; }

    &__pager { display: inline-flex; align-items: center; gap: 8px; }
    &__page {
        font-size: $text-xs;
        color: var(--text-dim);
        min-width: 44px;
        text-align: center;
    }
}

// ------------------------------------------------------------
// SortMenu / ColumnsMenu — compact toolbar popovers (Frappe/Twenty style).
// Rendered inside the shared .ui-popover-panel surface.
// ------------------------------------------------------------
.sk-tablemenu {
    width: 15rem;
    padding: $space-3;
    display: flex;
    flex-direction: column;
    gap: $space-1;

    &__title {
        font-size: $text-xs;
        color: var(--text-faint);
        font-weight: $font-weight-semibold;
        padding: $space-hair $space-tight $space-tight;
    }

    &__section {
        font-size: $text-xs;
        color: var(--text-ghost);
        padding: $space-2 $space-tight $space-1;
        border-top: 1px solid var(--border-soft);
        margin-top: $space-1;
    }

    &__empty {
        font-size: $text-xs;
        color: var(--text-faint);
        padding: $space-tight;
    }

    &__list { display: flex; flex-direction: column; gap: 1px; }

    &__item {
        display: flex;
        align-items: center;
        gap: $space-2;
        width: 100%;
        padding: $space-tight $space-2;
        border: none;
        border-radius: $radius-control;
        background: transparent;
        color: var(--text-dim);
        font-size: $text-sm;
        font-family: inherit;
        text-align: left;
        cursor: pointer;
        transition: 0.12s;

        &:hover { background: var(--surface-2); color: var(--text); }

        &.is-on { color: var(--accent-bright); font-weight: $font-weight-semibold; }

        &--toggle svg { color: var(--text-faint); flex-shrink: 0; }
        &--toggle.is-off { color: var(--text-faint); }
    }

    // An active sort row: [priority] field [dir] [x]
    &__row {
        display: flex;
        align-items: center;
        gap: $space-tight;
        padding: $space-1 $space-tight;
        border-radius: $radius-control;
        background: var(--surface-2);
    }

    &__priority {
        font-size: $text-xs;
        font-weight: $font-weight-semibold;
        color: var(--accent-bright);
        min-width: 12px;
        text-align: center;
    }

    &__field {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: $text-sm;
        color: var(--text);
        font-weight: $font-weight-semibold;
    }

    &__dir,
    &__remove {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: $control-sm;
        height: $control-sm;
        border: none;
        border-radius: $radius-control;
        background: transparent;
        color: var(--text-faint);
        cursor: pointer;
        transition: 0.12s;

        &:hover { background: var(--surface); color: var(--text); }
    }

    &__dir { color: var(--accent-bright); }

    &__footer {
        display: flex;
        justify-content: flex-end;
        gap: $space-2;
        padding-top: $space-2;
        margin-top: $space-1;
        border-top: 1px solid var(--border-soft);
    }
}

// ------------------------------------------------------------
// SortChipBar — active-sort chips above the table (Twenty style). Renders
// nothing when no sort is active, so the bar never sits empty.
// ------------------------------------------------------------
.sk-sortchips {
    display: flex;
    align-items: center;
    gap: $space-2;
    flex-wrap: wrap;
    padding: $space-2 $space-hair 0;

    &__chip {
        display: inline-flex;
        align-items: center;
        gap: $space-hair;
        height: 20px; // geometry: chip height (20px badge/chip spec)
        padding-left: $space-tight;
        border-radius: $radius-badge;
        background: var(--accent-bg-soft);
        border: 1px solid var(--accent-dim);
        color: var(--accent-bright);
        font-size: $text-xs;
        user-select: none;
        white-space: nowrap;
    }

    &__priority {
        font-size: $text-xs;
        font-weight: $font-weight-semibold;
        opacity: 0.8;
        margin-right: $space-hair;
    }

    &__body {
        display: inline-flex;
        align-items: center;
        gap: $space-tight;
        height: 100%;
        padding: 0 $space-1 0 0;
        border: none;
        background: none;
        color: inherit;
        font-size: inherit;
        font-family: inherit;
        cursor: pointer;
    }

    &__label { font-weight: $font-weight-semibold; }

    &__remove {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 16px;
        height: 16px;
        margin-right: $space-hair;
        border: none;
        border-radius: $radius-badge;
        background: transparent;
        color: inherit;
        opacity: 0.7;
        cursor: pointer;
        transition: 0.12s;

        &:hover { opacity: 1; background: var(--accent-bg); }
    }

    &__reset {
        border: none;
        background: none;
        padding: 0 $space-1;
        color: var(--text-faint);
        font-size: $text-xs;
        font-family: inherit;
        cursor: pointer;
        transition: color 0.12s;

        &:hover { color: var(--text); }
    }
}

// ------------------------------------------------------------
// ViewMenu — saved-view picker. Reuses the .sk-tablemenu popover chrome and
// adds view rows (apply / default-star / delete) plus the save-current form.
// ------------------------------------------------------------
.sk-viewmenu {
    // "Modified" dot on the trigger when the live state differs from the view.
    &__dot {
        width: 7px;
        height: 7px;
        border-radius: $radius-full;
        background: var(--amber);
        margin-left: $space-hair;
        flex-shrink: 0;
    }

    &__row {
        display: flex;
        align-items: center;
        gap: $space-hair;
        border-radius: $radius-control;
        padding-right: $space-1;
        transition: background 0.12s;

        &:hover { background: var(--surface-2); }
        &.is-active { background: var(--accent-bg-soft); }
    }

    &__apply {
        flex: 1;
        min-width: 0;
        display: flex;
        align-items: center;
        gap: $space-2;
        padding: $space-tight $space-2;
        border: none;
        background: none;
        color: var(--text-dim);
        font-size: $text-sm;
        font-family: inherit;
        text-align: left;
        cursor: pointer;

        .is-active & { color: var(--accent-bright); font-weight: $font-weight-semibold; }
        svg { flex-shrink: 0; }
    }

    &__name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    &__star,
    &__delete {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: $control-sm;
        height: $control-sm;
        border: none;
        border-radius: $radius-control;
        background: transparent;
        color: var(--text-faint);
        cursor: pointer;
        opacity: 0;
        transition: 0.12s;

        .sk-viewmenu__row:hover & { opacity: 1; }
        &:hover { background: var(--surface); color: var(--text); }
    }

    // The default star stays visible even when the row isn't hovered.
    &__star.is-on {
        opacity: 1;
        color: var(--amber);
        fill: var(--amber);
    }

    &__update {
        display: flex;
        justify-content: flex-end;
        gap: $space-1;
        padding: $space-tight $space-hair $space-hair;
        border-top: 1px solid var(--border-soft);
        margin-top: $space-1;
    }

    &__save {
        display: flex;
        gap: $space-2;
        padding-top: $space-2;
        margin-top: $space-1;
        border-top: 1px solid var(--border-soft);

        input {
            flex: 1;
            min-width: 0;
            height: $control-md;
            padding: 0 $space-3;
            background: var(--surface-2);
            border: 1px solid var(--border-soft);
            border-radius: $radius-control;
            color: var(--text);
            font-size: $text-sm;
            font-family: inherit;
            outline: none;
            transition: border-color 0.14s;

            &::placeholder { color: var(--text-faint); }
            &:focus { border-color: var(--accent-dim); }
        }
    }
}

// ------------------------------------------------------------
// Floating bulk-actions pill — appears only while rows are selected
// (Frappe ListSelectBanner style), instead of a permanent toolbar row.
// ------------------------------------------------------------
.sk-bulkbar {
    position: fixed;
    // Clear the fixed global statusbar (it is taller than the old 22px offset
    // and painted over the pill), on the shell's layer so it stays above the
    // bar but below modals.
    bottom: calc(var(--sk-statusbar-height, 0px) + #{$space-3});
    left: 50%;
    transform: translateX(-50%);
    z-index: $z-shell-statusbar;
    display: flex;
    align-items: center;
    gap: $space-3;
    padding: $space-2 $space-2 $space-2 $space-4;
    // It floats over a dark page in a dark pill, so at --surface with a hairline
    // border it read as a smudge rather than a control. Lifted one step to
    // --surface-2, given an accent-tinted rim and a deeper, wider shadow: the
    // shadow is what actually separates it from the background, since two dark
    // greys a few percent apart never will.
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: $radius-full;
    box-shadow: $shadow-raised;
    animation: sk-bulkbar-in 0.16s ease-out;

    &__count {
        font-size: $text-xs;
        font-weight: $font-weight-semibold;
        color: var(--text);
        white-space: nowrap;
    }

    // Callers pass either shared <Button>s or plain <button>s — GridBulkBar's
    // documented API is the latter, and an unstyled bare button renders as a
    // white OS-default control sitting in a dark pill. Style them here so both
    // shapes land the same, and scroll horizontally rather than letting a page
    // with five bulk actions stretch the pill off both edges of the viewport.
    &__actions {
        display: inline-flex;
        align-items: center;
        gap: $space-1;
        min-width: 0;
        overflow-x: auto;
        scrollbar-width: none;

        &::-webkit-scrollbar { display: none; }

        > button:not(.ui-button) {
            flex-shrink: 0;
            display: inline-flex;
            align-items: center;
            gap: $space-2;
            height: $control-sm;
            padding: 0 $space-3;
            border: none;
            border-radius: $radius-control;
            background: transparent;
            font-size: $text-sm;
            color: var(--text-dim);
            cursor: pointer;
            white-space: nowrap;
            transition: 0.12s;

            &:hover { background: var(--surface-3); color: var(--text); }
            &:focus-visible { outline: 2px solid var(--accent-dim); outline-offset: -2px; }
            &.is-danger:hover { @include status-variant(var(--red), var(--red-bg)); }
        }
    }

    &__clear {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: $control-sm;
        height: $control-sm;
        border: none;
        border-radius: $radius-full;
        background: var(--surface-2);
        color: var(--text-faint);
        cursor: pointer;
        transition: 0.12s;

        &:hover { color: var(--text); }
    }
}

@keyframes sk-bulkbar-in {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

// ------------------------------------------------------------
// ListToolbar (.sk-listhead) — the one list-page toolbar row. Replaces the
// per-page listheads (.dom-listhead, .cron-listhead, .servers-listhead…).
// [title] [filters] [extras]                  [count] [tools]
// ------------------------------------------------------------
.sk-listhead {
    display: flex;
    align-items: center;
    gap: $space-3;
    flex-wrap: wrap;
    margin-bottom: $space-3;

    &__title {
        margin: 0;
        font-size: $text-base;
        font-weight: $font-weight-semibold;
        letter-spacing: -0.01em;
        color: var(--text);
    }

    &__right {
        display: flex;
        align-items: center;
        gap: $space-2;
        margin-left: auto;
    }

    &__count {
        display: inline-flex;
        align-items: center;
        gap: $space-tight;
        font-size: $text-xs;
        color: var(--text-faint);
        white-space: nowrap;

        b { color: var(--text-dim); font-weight: $font-weight-semibold; }
    }

    // Secondary pickers (server/group selects) that live in the toolbar.
    &__select {
        height: $control-md;
        padding: 0 $space-3;
        border: 1px solid var(--border);
        border-radius: $radius-control;
        background: var(--surface-2);
        color: var(--text-dim);
        font-size: $text-sm;
        font-family: inherit;
    }

    @media (max-width: $breakpoint-md) {
        &__right { width: 100%; margin-left: 0; }
    }
}

// ------------------------------------------------------------
// wp-list chrome — the ResourceListPage list scaffold (status seg + search
// toolbar, table card, optional card grid). Restores the canonical layout
// these hooks had before the WordPress styles moved into the extension, plus
// the new sort/columns menus slot.
// ------------------------------------------------------------
.wp-list {
    display: flex;
    flex-direction: column;

    > .empty-state--loading:has(.sk-page-wrap) {
        padding: 0;
    }

    // The toolbar row is the shared .sk-listhead (ResourceListPage renders
    // ListToolbar); only the search fallback and the layout switch stay here.

    // In-page search fallback — used when a page does NOT publish its search
    // into the shared topbar (extensions outside a tab group).
    &__search {
        display: inline-flex;
        align-items: center;
        gap: $space-2;
        padding: 0 $space-3;
        width: 240px;
        max-width: 100%;
        height: $control-md;
        background: var(--surface-2);
        border: 1px solid var(--border-soft);
        border-radius: $radius-control;
        color: var(--text-faint);
        transition: border-color 0.14s;

        &:focus-within { border-color: var(--accent-dim); }

        svg { flex-shrink: 0; }

        input {
            flex: 1;
            min-width: 0;
            border: none;
            background: none;
            color: var(--text);
            font-size: $text-sm;

            &::placeholder { color: var(--text-faint); }
            &:focus { outline: none; }
        }
    }

    // Table/cards switch — only rendered by pages that pass a card renderer.
    // Lives in the ListToolbar tools slot.
    &__viewswitch {
        display: flex;
        gap: $space-hair;
        flex-shrink: 0;
        padding: 1px; // segmented: 28px items + 1px inset + border = 32
        background: var(--surface-2);
        border: 1px solid var(--border);
        border-radius: $radius-control;

        button {
            display: grid;
            place-items: center;
            height: $control-sm;
            padding: 0 $space-2;
            background: none;
            border: none;
            border-radius: $radius-control;
            color: var(--text-faint);
            cursor: pointer;
            transition: background 0.14s, color 0.14s;

            &:hover { color: var(--text); }
            &.is-active { background: var(--surface-3); color: var(--text); }
        }
    }

    // The frame is the table wrap's own (.sk-dtable-wrap); this only holds
    // the table and its footer together.
    &__card { min-width: 0; }

    // Cell helpers every list uses. These lived only in the WordPress
    // extension's copy of this block, so core lists were styled by whichever
    // extension happened to be installed.
    &__dash { color: var(--text-ghost); }
    &__links { display: inline-flex; align-items: center; gap: $space-hair; }
    .sk-tag + .sk-tag { margin-inline-start: $space-1; }

    // Card layout for the same rows the table shows.
    &__cards {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: $space-4;
    }

    &__cardtile {
        display: flex;
        flex-direction: column;
        padding: $space-4;
        background: var(--surface);
        border: 1px solid var(--border-soft);
        border-radius: $radius-card;
        cursor: pointer;
        transition: border-color 0.14s, transform 0.14s;

        &:hover { border-color: var(--border-strong); transform: translateY(-2px); }
        &:focus-visible { outline: 2px solid var(--accent-dim); outline-offset: 2px; }
        &.is-selected { border-color: var(--accent-dim); background: var(--accent-bg-soft); }
    }
}

// ------------------------------------------------------------
// PageTopbar — the demo's per-page top bar (icon + title + routed sub-nav +
// actions). Replaces sidebar sub-menus for infra pages.
// ------------------------------------------------------------
.sk-topbar {
    display: flex;
    align-items: center;
    gap: $space-4;
    min-height: 60px;
    padding: $space-3 $space-1;
    margin-bottom: $space-1;
    // Its own surface, so the bar reads as chrome rather than as the first row
    // of the content — and the same surface as the sidebar, so the two frame
    // the page together. Solid rather than the design mock's translucent fill:
    // the content scrolls in its own box below this bar, never under it, so
    // alpha + backdrop-blur would cost a compositing layer to composite against
    // a backdrop that never moves.
    // Same surface and edge as the sidebar (--surface + --border), which
    // separates from the canvas; --bg-sidebar sat ~2% off it and blended in.
    background: var(--surface);
    border-bottom: 1px solid var(--border);

    &__ico { color: var(--accent-bright); display: inline-flex; flex-shrink: 0; }
    &__titles { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
    &__title { margin: 0; font-size: $text-md; font-weight: $font-weight-semibold; letter-spacing: -0.01em; color: var(--text); }
    &__meta { font-size: $text-xs; color: var(--text-faint); }
    &__spacer { flex: 1; }
    &__actions {
        display: inline-flex;
        align-items: center;
        gap: $space-2;
        flex-shrink: 0;

        // House rule: the top bar has FIXED SLOTS, not a publication order.
        // Whatever order a page happens to render its actions in, they land in
        // the same places on every page:
        //
        //     [ page actions ] [ search ] [ filter · overflow ]
        //
        // Enforced here rather than by convention at each call site so it
        // cannot drift and new pages get it for free. The point is muscle
        // memory: the search box must sit in the same pixels on /domains as on
        // /services, and must not move when a page gains or loses a button.
        // Half of what lands here is portaled in through .sk-topbar__chrome
        // (see useTopbarChrome), which `display: contents` erases from layout —
        // its children are flex items of THIS box, but they are grandchildren
        // in the selector, so every slot rule has to name both depths. Miss
        // that and the portaled icons default to order 0 and jump ahead of the
        // search box the page rendered itself.
        > *,
        > .sk-topbar__chrome > * { order: 0; }
        > .sk-searchfield,
        > .sk-topbar__chrome > .sk-searchfield { order: 1; }
        > .sk-gridicon,
        > .sk-topbar__chrome > .sk-gridicon { order: 2; }
    }

    // The portal target a table's chrome renders into. It must not become a box
    // of its own, or the whole chrome would be one order:0 blob.
    &__chrome { display: contents; }

    // Routed sub-nav (the ex-sidebar sub-items). The nav is the flex-fill
    // measurement region for PageTopbar's overflow logic; it is right-aligned so
    // the changing page title on the left can grow/shrink WITHOUT shoving the
    // tabs sideways (the old jump). overflow:hidden suppresses any pre-measure
    // flash.
    &__tabs {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        margin-left: $space-tight;
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
    }
    // The visible segmented bar that actually holds the tabs — gives the sub-nav
    // real presence against the page background, matching the detail-page tab
    // bar instead of floating as bare text.
    &__tabs-inner {
        display: inline-flex;
        align-items: center;
        gap: $space-hair;
        max-width: 100%;
        padding: 1px; // segmented: 28px tabs + 1px inset + border = 32
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: $radius-control;
    }

    // Title-less group header: the tabs lead the bar from the left edge and
    // carry no enclosing segmented box — they read as the page's own heading
    // row rather than a control parked beside a heading.
    &--titleless {
        .sk-topbar__tabs {
            justify-content: flex-start;
            margin-left: 0;
        }
        .sk-topbar__tabs-inner {
            gap: $space-1;
            padding: 0;
            background: none;
            border: none;
            border-radius: 0;
        }
        // Page tabs: 40 tall (tab spec).
        .sk-topbar__tab {
            height: $control-lg;
            padding: 0 $space-3;
            border-radius: $radius-control;
            color: var(--text-faint);
            &:hover { background: var(--surface-2); color: var(--text); }
            &.is-active { background: var(--accent-bg); color: var(--text); font-weight: $font-weight-semibold; }
            &.is-active svg { color: var(--accent-bright); }
        }
    }
    &__tab {
        display: inline-flex;
        align-items: center;
        gap: $space-tight;
        height: $control-sm;
        padding: 0 $space-3;
        border-radius: $radius-control;
        font-size: $text-sm;
        // Uniform weight across states so activating a tab never re-flows its
        // neighbours; the active tab is set apart by fill + colour, not weight.
        font-weight: $font-weight-medium;
        color: var(--text-dim);
        text-decoration: none;
        white-space: nowrap;
        transition: background 0.14s, color 0.14s;

        svg { width: 15px; height: 15px; }
        &:hover { background: var(--surface-hover); color: var(--text); }
        &.is-active { @include status-variant(var(--accent-bright), var(--accent-bg)); }
        // Overflowed tab — moved into the "More" popover, not rendered inline.
        &.is-hidden { display: none; }
    }
    // Overflow ("More") trigger — a tab-styled button that never collapses.
    &__more {
        flex-shrink: 0;
        appearance: none;
        background: transparent;
        border: none;
        color: inherit;
        font: inherit;
        cursor: pointer;
        &[data-state="open"] { background: var(--surface-hover); color: var(--text); }
    }

    @media (max-width: 768px) {
        flex-wrap: wrap;
        &__actions {
            order: 2;
            width: 100%;
            min-width: 0;
            justify-content: flex-start;
            overflow-x: auto;
            overflow-y: hidden;
            scrollbar-width: none;
            -webkit-mask-image: linear-gradient(to right, black 0, black calc(100% - 28px), transparent 100%);
            mask-image: linear-gradient(to right, black 0, black calc(100% - 28px), transparent 100%);

            > *,
            > .sk-topbar__chrome > * { flex-shrink: 0; }

            &::-webkit-scrollbar { display: none; }
        }
        &__tabs { order: 3; width: 100%; margin-left: 0; justify-content: flex-start; }
    }
}

// SSL-style pill with day count is just a Pill; provide the spec-card + ssl
// helpers the domain drawer uses.
.sk-spec-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: $radius-card;
    padding: $space-4 $space-4;

    &__label { font-size: $text-xs; color: var(--text-faint); }
    &__value { font-size: $text-base; font-weight: $font-weight-semibold; color: var(--text); margin-top: 8px; }
    &__sub { font-size: $text-xs; color: var(--text-faint); margin-top: 6px; }
}

// Key/value info row (drawer nameservers, details).
.sk-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: $space-4;
    padding: $space-3 0;
    border-top: 1px solid var(--border-soft);
    font-size: $text-sm;
    &:first-child { border-top: none; }
    .k { color: var(--text-faint); font-size: $text-xs; }
    .v { font-family: var(--mono); color: var(--text); text-align: right; font-size: $text-sm; overflow-wrap: anywhere; }
}

// ------------------------------------------------------------
// Drawer — right-side slide-over header chrome (panel comes from ui/sheet).
// ------------------------------------------------------------
.sk-drawer {
    max-width: 95vw;
    // Cancel the sheet's own padding/gap/scroll. This element owns three
    // full-height regions — head, body, foot — that each manage their own
    // padding, so the panel's must be zero or every one of them is inset:
    // the header's divider stops short of both edges, and the footer floats
    // above a band of dead space instead of sitting on the bottom edge.
    // Scrolling belongs to __body alone, or the panel scrolls as a whole and
    // the footer cannot stay put.
    padding: 0;
    gap: 0;
    overflow: hidden;

    &__head {
        display: flex; align-items: center; gap: 12px;
        padding: $space-4 $space-5; border-bottom: 1px solid var(--border-soft); flex-shrink: 0;

        // Title+subtitle column; min-width 0 lets long titles ellipsis
        // instead of pushing the header extra off the panel.
        > div:first-child { flex: 1; min-width: 0; }
    }
    &__ico { width: 32px; height: 32px; border-radius: $radius-control; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-2); color: var(--text-dim); }
    &__title { font-weight: $font-weight-semibold; font-size: $text-base; }
    &__sub { font-size: $text-xs; color: var(--text-faint); margin-top: 1px; }
    // Padded by default, to the header's own 18px side inset, so a drawer body
    // never renders flush against the panel edge just because its author forgot
    // to pad it. Bodies that own their internal regions (a form with a pinned
    // footer, a two-pane catalog, an editor, a log tail) opt out with `flush`.
    &__body {
        flex: 1;
        overflow: auto;
        min-height: 0;
        padding: $space-5 $space-5 $space-8;

        &--flush { padding: 0; }
    }
}

// ------------------------------------------------------------
// SearchField — icon + debounced input. Reusable across tables.
// ------------------------------------------------------------
.sk-searchfield {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 1 1 240px;
    min-width: 180px;
    max-width: 420px;

    &__icon {
        position: absolute;
        left: 11px;
        width: 15px;
        height: 15px;
        color: var(--text-faint);
        pointer-events: none;
    }

    &__input {
        width: 100%;
        height: $control-md;
        padding: 0 $space-3 0 $space-8;
        border-radius: $radius-control;
        border: 1px solid var(--border);
        background: var(--surface-2);
        color: var(--text);
        font-size: $text-sm;
        font-family: inherit;
        transition: border-color 0.14s, box-shadow 0.14s;

        &::placeholder { color: var(--text-faint); }
        &:focus {
            outline: none;
            border-color: var(--violet);
            box-shadow: $focus-ring;
        }
        // Hide the native search clear affordance for a consistent look.
        &::-webkit-search-cancel-button { -webkit-appearance: none; }
    }
}

// ------------------------------------------------------------
// FilterButton + FilterDrawer — schema-driven advanced filters.
// ------------------------------------------------------------
.sk-filter-btn {
    position: relative;

    &__badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        // Counter bubble: 16px round.
        min-width: 16px;
        height: 16px;
        padding: 0 $space-1;
        margin-left: $space-hair;
        border-radius: $radius-full;
        background: var(--violet);
        color: #fff;
        font-size: $text-xs;
        font-weight: $font-weight-semibold;
        line-height: 1;
    }
}

.sk-filter {
    display: flex;
    flex-direction: column;
    gap: $space-6;

    &__group { display: flex; flex-direction: column; gap: 10px; }

    &__label {
        font-size: $text-xs;
        color: var(--text-faint);
    }

    &__chips { display: flex; flex-wrap: wrap; gap: 7px; }

    // Host-supplied fields for filters that aren't a pick-from-a-list
    // (free text, date bounds). Sits below the chip groups.
    &__extra {
        display: flex;
        flex-direction: column;
        gap: $space-4;
        padding-top: $space-1;
        border-top: 1px solid var(--border-soft);
    }

    &__chip {
        display: inline-flex;
        align-items: center;
        gap: $space-tight;
        height: $control-sm;
        padding: 0 $space-3;
        border-radius: $radius-control;
        border: 1px solid var(--border);
        background: var(--surface-2);
        color: var(--text-dim);
        font-size: $text-sm;
        font-family: inherit;
        cursor: pointer;
        transition: 0.14s;

        &:hover { color: var(--text); border-color: var(--border-strong, var(--border)); }
        &.is-on {
            background: var(--violet-bg);
            border-color: var(--violet);
            color: var(--violet);
            font-weight: $font-weight-semibold;
        }
    }

    // Optional per-option match count; quieter than the label it trails.
    &__chip-count {
        font-size: $text-xs;
        color: var(--text-ghost);
    }

    &__chip.is-on &__chip-count { color: inherit; opacity: 0.7; }

    &__footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: $space-3;
        padding-top: $space-tight;
        margin-top: $space-1;
        border-top: 1px solid var(--border-soft);
    }
}

// ------------------------------------------------------------
// ResourceCard / ResourceList — consistent list item for servers,
// apps, domains, containers, and other named resources.
// ------------------------------------------------------------
.sk-resource-list {
    display: flex; flex-direction: column;
    border: 1px solid var(--border-soft);
    border-radius: $radius-card;
    background: var(--surface);
    overflow: hidden;
}

.sk-resource-card {
    display: flex; align-items: center; gap: 12px;
    padding: $space-3 $space-4;
    border-bottom: 1px solid var(--border-soft);
    background: var(--surface);
    transition: background 0.12s;

    &:last-child { border-bottom: none; }
    &.is-clickable { cursor: pointer; }
    &.is-clickable:hover { background: var(--surface-2); }
    &.is-selected { background: var(--accent-bg-soft); }

    &__select { display: inline-flex; align-items: center; }
    &__icon { color: var(--accent-bright); display: inline-flex; flex-shrink: 0; }
    &__identity { min-width: 0; flex: 1 1 auto; }
    &__title-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
    &__title { font-weight: $font-weight-semibold; font-size: $text-sm; color: var(--text); }
    &__subtitle { font-family: var(--mono); font-size: $text-xs; color: var(--text-faint); }
    &__meta { display: flex; align-items: center; gap: 12px; margin-top: 4px; flex-wrap: wrap; }
    &__meta-item { display: inline-flex; align-items: center; gap: 4px; }
    &__meta-label { font-size: $text-xs; color: var(--text-faint); }
    &__meta-value { font-family: var(--mono); font-size: $text-xs; color: var(--text-dim); }
    &__status { flex-shrink: 0; }
    &__actions { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
    &__chevron { color: var(--text-faint); flex-shrink: 0; margin-left: 4px; }
}

// ------------------------------------------------------------
// CatalogCard / CatalogGrid — the one card for installable or deployable
// things (extensions, templates, engines). Flat surface, one tag in plain
// text, one action. Operated resources are tables, never these.
// ------------------------------------------------------------
.sk-catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: $space-3;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sk-catalog-card {
    display: flex; flex-direction: column; gap: 10px;
    min-width: 0;
    padding: $space-4;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: $radius-card;
    transition: border-color 0.12s, background 0.12s;

    &.is-clickable { cursor: pointer; }
    &.is-clickable:hover { border-color: var(--border); background: var(--surface-2); }
    &.is-clickable:focus-within { border-color: var(--border); }

    &__head { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
    &__icon {
        display: inline-flex; align-items: center; justify-content: center;
        flex-shrink: 0;
        width: 36px; height: 36px;
        border-radius: var(--radius-sm);
        background: var(--surface-2);
        color: var(--text-dim);
        overflow: hidden;

        img, svg:not(.lucide) { width: 24px; height: 24px; object-fit: contain; }
    }
    &__id { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
    &__title {
        display: inline-flex; align-items: center; gap: 6px;
        font-weight: $font-weight-semibold; font-size: $text-sm; color: var(--text);
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    &__open {
        max-width: 100%;
        padding: 0;
        border: 0;
        background: none;
        font-family: inherit;
        text-align: start;
        cursor: pointer;

        &:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
    }
    &__featured { flex-shrink: 0; color: var(--text-faint); fill: currentColor; }
    &__sub {
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    &__tag { flex-shrink: 0; font-size: $text-xs; color: var(--text-faint); white-space: nowrap; }
    &__desc {
        margin: 0;
        font-size: $text-sm; line-height: 1.45; color: var(--text-dim);
        display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
        overflow: hidden;
    }
    &__foot {
        display: flex; align-items: center; justify-content: space-between; gap: 8px;
        margin-top: auto;
    }
    &__facts {
        min-width: 0;
 font-size: $text-xs; color: var(--text-faint);
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    &__action { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
}

// ------------------------------------------------------------
// ErrorState — consistent empty error panel.
// ------------------------------------------------------------
.sk-error-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 220px; padding: $space-8; text-align: center;
    border: 1px dashed var(--border); border-radius: $radius-card;
    background: var(--surface);

    &__icon { color: var(--red); margin-bottom: 14px; }
    &__title { font-size: $text-base; font-weight: $font-weight-semibold; color: var(--text); margin: 0 0 6px; }
    &__message { font-size: $text-sm; color: var(--text-dim); max-width: 420px; margin: 0 0 16px; }
}

// ------------------------------------------------------------
// CopyButton — copy-to-clipboard with feedback.
// ------------------------------------------------------------
.copy-button {
    &.is-copied { color: var(--green); }
    &__label { margin-left: 6px; }
}

// ============================================
// FORM DRAWER  (shared right slide-over that collects a form)
// Name → domain → placement → the rest, in that order: everything the action
// commits you to, visible before you commit to it. Shared rather than
// page-scoped because drawers render in a portal — styles nested under a
// page class simply never reach them.
// ============================================
.sk-formdrawer {
    &__form {
        display: flex;
        flex-direction: column;
        min-height: 0;
        height: 100%;
    }

    &__body {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        padding: $space-4 $space-5 $space-6;
    }

    &__desc {
        margin: 0 0 $space-4;
        color: $text-tertiary;
        font-size: $text-xs;
        line-height: 1.5;
    }

    &__field {
        margin-bottom: $space-4;

        &:last-child { margin-bottom: 0; }
    }

    label,
    &__label {
        display: block;
        margin-bottom: $space-2;
        color: $text-secondary;
        font-size: $text-xs;
        font-weight: $font-weight-medium;
    }

    // Bare <select> and <input type=checkbox> inside a drawer would otherwise
    // render with the browser's own chrome — a white box on a dark panel. Styled
    // here rather than at each call site so any form moved into a drawer looks
    // like the rest of it without the page having to remember.
    select {
        width: 100%;
        height: $control-md;
        padding: 0 $space-3;
        background: var(--surface-2);
        border: 1px solid var(--border);
        border-radius: $radius-control;
        color: $text-primary;
        font-family: inherit;
        font-size: $text-xs;
        cursor: pointer;
        transition: border-color $transition-fast, box-shadow $transition-fast;

        &:focus {
            outline: none;
            border-color: $accent-primary;
            box-shadow: $focus-ring;
        }

        &:disabled { opacity: 0.6; cursor: default; }
    }

    // A checkbox row reads as one control: the box and its wording sit on a
    // line together, and the label is not indented away from the field above.
    .checkbox-label {
        display: flex;
        align-items: center;
        gap: $space-2;
        margin-bottom: 0;
        color: $text-primary;
        font-size: $text-xs;
        cursor: pointer;

        input[type='checkbox'] {
            width: 16px;
            height: 16px;
            flex-shrink: 0;
            accent-color: var(--accent-primary);
            cursor: pointer;
        }
    }

    code {
        padding: 1px $space-tight;
        border-radius: $radius-badge;
        background: var(--surface-3);
        font-family: var(--mono);
        font-size: $text-xs;
        color: $text-primary;
    }

    &__input {
        display: flex;
        align-items: center;
        gap: $space-2;
        min-height: $control-md;
        padding: 0 $space-3;
        background: var(--surface-2);
        border: 1px solid var(--border);
        border-radius: $radius-control;
        transition: border-color $transition-fast, box-shadow $transition-fast;

        &:focus-within {
            border-color: $accent-primary;
            box-shadow: $focus-ring;
        }

        // The domain is derived from the service name + base domain, so it is
        // shown rather than typed — editing it here would silently diverge from
        // what the finalizer actually publishes.
        &--readonly {
            background: $bg-elevated;
            &:focus-within { border-color: var(--border); box-shadow: none; }
        }

        svg { flex-shrink: 0; color: $text-tertiary; }

        input {
            flex: 1;
            min-width: 0;
            background: none;
            border: none;
            outline: none;
            color: $text-primary;
            font-size: $text-xs;

            &::placeholder { color: $text-tertiary; }
        }
    }

    &__domain {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        color: $text-primary;
        font-family: var(--mono);
        font-size: $text-sm;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    &__hint {
        display: block;
        margin-top: $space-tight;
        color: $text-tertiary;
        font-size: $text-xs;
    }

    &__foot {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: $space-2;
        flex-shrink: 0;
        padding: $space-3 $space-5;
        border-top: 1px solid $border-subtle;
        background: $bg-elevated;
    }

    // Lead callout ("this will create ..."). Lives here, not under a page
    // class: a portalled drawer is not a descendant of the page that opened it.
    &__callout {
        display: flex;
        gap: $space-3;
        margin-bottom: $space-4;
        padding: $space-3 $space-4;
        background: rgba($warning-raw, 0.08);
        border: 1px solid rgba($warning-raw, 0.2);
        border-radius: $radius-control;

        > svg { flex-shrink: 0; margin-top: 2px; color: $warning; }

        strong {
            display: block;
            margin-bottom: $space-2;
            color: $text-primary;
            font-size: $text-xs;
        }

        ul {
            margin: 0;
            padding-left: $space-4;
            color: $text-secondary;
            font-size: $text-xs;
            line-height: 1.6;
        }
    }
}