/* ==========================================================================
   StarEmea.CloudServices — application chrome on top of the Star tokens.
   Provides page-level layout (title bar + sidebar + content) and the
   Dashboard grid. Component-level styling stays in *.razor.css files.
   ========================================================================== */

html, body {
    height: 100%;
    margin: 0;
    font-family: var(--font-sans);
    color: var(--fg-1);
    background: var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* FluentCard defaults to `height: var(--card-height, 100%)`, which stretches it
   to fill any definite-height ancestor (e.g. our .app-main grid cell). Default
   it to content height instead. Custom properties cascade into the web
   component's shadow DOM, so this covers both render variants. */
fluent-card, .fluent-card { --card-height: auto; }

.app-shell {
    display: grid;
    grid-template-rows: 48px 1fr;
    grid-template-columns: 260px 1fr;
    grid-template-areas:
        "header header"
        "sidebar main";
    height: 100vh;
    min-height: 100vh;
}

.app-titlebar {
    grid-area: header;
    background: var(--star-blue);
    color: var(--white);
    display: flex;
    align-items: center;
    padding: 0 var(--sp-4);
    gap: var(--sp-4);
    box-shadow: var(--shadow-1);
    z-index: 10;
}
.app-titlebar img.logo {
    height: 22px;
    width: auto;
}
.app-titlebar .product-name {
    font-weight: var(--fw-semibold);
    font-size: var(--fs-16);
    letter-spacing: -0.005em;
}
.app-titlebar .product-sub {
    color: rgba(255,255,255,0.78);
    font-size: var(--fs-13);
    margin-left: var(--sp-2);
}
.app-titlebar .spacer { flex: 1; }
.app-titlebar .user-pill {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    color: var(--white);
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: var(--r-pill);
    padding: 4px 12px 4px 4px;
    font-size: var(--fs-13);
}
.app-titlebar .user-pill .avatar {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--white);
    color: var(--star-blue);
    font-weight: var(--fw-semibold);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: var(--fs-12);
}
.app-titlebar .user-pill .org {
    color: rgba(255,255,255,0.70);
    margin-left: var(--sp-2);
    border-left: 1px solid rgba(255,255,255,0.20);
    padding-left: var(--sp-2);
}
.app-titlebar a.signout {
    color: rgba(255,255,255,0.85);
    font-size: var(--fs-13);
    margin-left: var(--sp-3);
}

.app-sidebar {
    grid-area: sidebar;
    background: var(--bg-subtle);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: var(--sp-3) 0;
}
.app-sidebar .group-title {
    font-size: var(--fs-12);
    text-transform: uppercase;
    letter-spacing: 0.10em;
    color: var(--fg-3);
    padding: var(--sp-3) var(--sp-4) var(--sp-2);
}

.app-main {
    grid-area: main;
    overflow: auto;
    padding: var(--sp-6) var(--sp-8);
    background: var(--bg);
}

.page-header {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-5);
}
.page-header h1 {
    margin: 0;
    font-size: var(--fs-30);
    line-height: var(--lh-30);
    font-weight: var(--fw-semibold);
    letter-spacing: -0.015em;
    color: var(--fg-1);
}
.page-header .subtitle {
    color: var(--fg-2);
    font-size: var(--fs-14);
}
.page-header-links {
    margin-left: auto;
    display: flex;
    gap: var(--sp-3);
    align-items: center;
}
.page-header-links a,
.page-header-links fluent-anchor::part(control) {
    color: var(--accent);
    text-decoration: none;
}
.page-header-links a:hover,
.page-header-links fluent-anchor:hover::part(control) {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Dashboard layout
   -------------------------------------------------------------------------- */
.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: var(--sp-5);
}
.dashboard-grid > .col-main { display: grid; gap: var(--sp-5); }
.dashboard-grid > .col-side { display: grid; gap: var(--sp-5); align-content: start; }

.section-title {
    font-size: var(--fs-18);
    line-height: var(--lh-18);
    font-weight: var(--fw-semibold);
    color: var(--fg-1);
    margin: 0 0 var(--sp-3);
}

.service-card {
    position: relative;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--r-md);
    padding: var(--sp-4);
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    box-shadow: var(--shadow-1);
    transition: box-shadow var(--dur-fast) var(--ease-standard);
}
.service-card:hover { box-shadow: var(--shadow-2); }
.service-card .title {
    font-size: var(--fs-16);
    font-weight: var(--fw-semibold);
    color: var(--fg-1);
    padding-right: 72px; /* keep clear of the floating Open button */
}
.service-card .description {
    color: var(--fg-2);
    font-size: var(--fs-14);
    line-height: var(--lh-14);
    flex: 1;
}
.service-card .card-open {
    color: var(--fg-1);
    position: absolute;
    top: var(--sp-2);
    right: var(--sp-2);
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--sp-4);
}

/* News feed */
.news-list { display: grid; gap: var(--sp-3); }
.news-item {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--r-md);
    padding: var(--sp-3) var(--sp-4);
}
.news-item .news-date {
    font-size: var(--fs-12);
    color: var(--fg-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.news-item .news-title {
    font-size: var(--fs-16);
    font-weight: var(--fw-semibold);
    margin: 4px 0;
    color: var(--fg-1);
}
.news-item .news-body {
    color: var(--fg-2);
    font-size: var(--fs-14);
    line-height: var(--lh-14);
}

/* Billing */
.billing-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-14);
}
.billing-table th, .billing-table td {
    text-align: left;
    padding: var(--sp-2) var(--sp-3);
    border-bottom: 1px solid var(--border-subtle);
}
.billing-table th {
    font-weight: var(--fw-medium);
    color: var(--fg-3);
    font-size: var(--fs-12);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.billing-table td.amount, .billing-table th.amount { text-align: right; font-variant-numeric: tabular-nums; }
.billing-table tr.total td {
    border-top: 2px solid var(--border-strong);
    border-bottom: none;
    font-weight: var(--fw-semibold);
    color: var(--fg-1);
    padding-top: var(--sp-3);
}

/* --------------------------------------------------------------------------
   Login screen
   -------------------------------------------------------------------------- */
.login-shell {
    display: grid;
    place-items: center;
    min-height: 100vh;
    background:
        radial-gradient(circle at 30% 20%, rgba(0,83,160,0.06), transparent 60%),
        var(--bg);
}
.login-card {
    width: min(420px, 92vw);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-3);
    padding: var(--sp-8);
    display: grid;
    gap: var(--sp-4);
}
.login-card .brand {
    display: flex; align-items: center; gap: var(--sp-3);
    margin-bottom: var(--sp-2);
}
.login-card .brand img { height: 28px; }
.login-card .brand .product {
    font-weight: var(--fw-semibold);
    color: var(--fg-1);
    font-size: var(--fs-16);
}
.login-card h1 {
    margin: 0;
    font-size: var(--fs-24);
    line-height: var(--lh-24);
    font-weight: var(--fw-semibold);
    letter-spacing: -0.01em;
    color: var(--fg-1);
}
.login-card label {
    display: block;
    font-size: var(--fs-13);
    font-weight: var(--fw-medium);
    margin-bottom: var(--sp-1);
    color: var(--fg-1);
}
.login-card input[type="email"],
.login-card input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font: inherit;
    background: var(--surface);
    color: var(--fg-1);
    box-sizing: border-box;
}
.login-card input:focus {
    outline: none;
    border-color: var(--star-blue);
    box-shadow: var(--focus-ring);
}
.login-card button.primary {
    background: var(--star-blue);
    color: var(--white);
    padding: 10px 16px;
    border: none;
    border-radius: var(--r-sm);
    font: inherit;
    font-weight: var(--fw-medium);
    cursor: pointer;
}
.login-card button.primary:hover { background: var(--star-blue-700); }
.login-card .error {
    background: var(--danger-soft);
    color: var(--danger);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--r-sm);
    font-size: var(--fs-13);
}
.login-card .hint {
    color: var(--fg-3);
    font-size: var(--fs-12);
    margin-top: var(--sp-2);
}

/* --------------------------------------------------------------------------
   Public share view (/share/{id})
   -------------------------------------------------------------------------- */
.share-shell {
    min-height: 100vh;
    background: var(--bg);
}
.share-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    padding: var(--sp-4) var(--sp-6);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.share-header .brand { display: flex; align-items: center; gap: var(--sp-3); }
.share-header .brand img { height: 26px; }
.share-header .brand .product { font-weight: var(--fw-semibold); color: var(--fg-1); font-size: var(--fs-16); }
.share-meta { display: flex; align-items: center; gap: var(--sp-3); }
.share-meta .share-name { font-weight: var(--fw-medium); color: var(--fg-1); }
.share-body { padding: var(--sp-6) var(--sp-8); }
.share-password-card {
    width: min(420px, 92vw);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-3);
    padding: var(--sp-6);
    margin: var(--sp-8) auto;
}
.share-password-card h1 {
    margin: 0 0 var(--sp-2);
    font-size: var(--fs-24);
    font-weight: var(--fw-semibold);
    color: var(--fg-1);
}
.share-password-card .error {
    background: var(--danger-soft);
    color: var(--danger);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--r-sm);
    font-size: var(--fs-13);
    margin-top: var(--sp-3);
}

/* Add/edit share dialog — inline labels, two-column grid to use width over height. */
.share-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--sp-3);
    align-items: center;
}
.share-form .span-2 { grid-column: 1 / -1; }
.share-row { display: flex; align-items: center; gap: var(--sp-3); }
.share-row > .row-label {
    flex: 0 0 110px;
    font-size: var(--fs-13);
    font-weight: var(--fw-medium);
    color: var(--fg-1);
}
.share-row > .ctl { flex: 1 1 auto; min-width: 0; }
.share-row-pair { display: flex; gap: var(--sp-5); align-items: center; }
.share-row-pair > .share-row { flex: 1 1 0; min-width: 0; }
/* Shorter labels in paired rows leave room for two controls side by side. */
.share-row-pair > .share-row > .row-label { flex-basis: 110px; }
/* Let FluentUI selects/fields shrink into their (half-width) column. */
.share-row .ctl fluent-select,
.share-row .ctl fluent-text-field { min-width: 0; }
.share-tabs { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); }

/* ==========================================================================
   Device Management — doughnut chart + overview grid + mini card
   ========================================================================== */

.device-doughnut {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-3);
}
.device-doughnut .doughnut-svg { display: block; }
.doughnut-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, max-content);
    column-gap: var(--sp-5);
    row-gap: 6px;
    font-size: var(--fs-13);
    color: var(--fg-2);
}
.doughnut-legend li { display: flex; align-items: center; gap: 8px; }
.doughnut-legend .dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
}

/* ---- Overview page ---- */
.device-overview-grid {
    display: grid;
    grid-template-columns: minmax(280px, 320px) 1fr;
    gap: var(--sp-6);
    align-items: start;
}
.device-overview-grid .chart-pane {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.page-header.device-header {
    align-items: flex-start;
    gap: var(--sp-3);
}
.device-header-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--r-md);
    background: var(--accent-soft);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.device-overview-card {
    background: #0E1217;
    color: var(--white);
    border-radius: var(--r-md);
    padding: var(--sp-5);
}
.device-overview-card .kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-4);
    align-items: end;
}
.device-overview-card .kpi {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}
.device-overview-card .kpi .num {
    font-size: 40px;
    line-height: 1;
    font-weight: var(--fw-semibold);
    color: var(--white);
    font-variant-numeric: tabular-nums;
}
.device-overview-card .kpi .num.blue   { color: #7EBDE7; }
.device-overview-card .kpi .num.orange { color: #FF9447; }
.device-overview-card .kpi .num.red    { color: #FF6B6B; }
.device-overview-card .kpi .lbl {
    font-size: var(--fs-12);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.70);
}
.device-overview-card .alert-row {
    display: grid;
    gap: var(--sp-3);
    margin-top: var(--sp-4);
    padding-top: var(--sp-4);
    border-top: 1px solid rgba(255, 255, 255, 0.10);
}
.device-overview-card .alert {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: start;
}
.device-overview-card .alert-title {
    font-weight: var(--fw-semibold);
    color: var(--white);
}
.device-overview-card .alert-body {
    color: rgba(255, 255, 255, 0.78);
    font-size: var(--fs-13);
}

.docs-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-5);
    margin-bottom: var(--sp-5);
}
.docs-row .kpi {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}
.docs-row .num {
    font-size: 30px;
    line-height: 1;
    font-weight: var(--fw-semibold);
    color: var(--fg-1);
    font-variant-numeric: tabular-nums;
}
.docs-row .num.orange { color: #C46A00; }
.docs-row .lbl {
    font-size: var(--fs-12);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fg-3);
}

.sub-usage-row {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: var(--sp-4);
}
.sub-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-4);
}
.sub-card h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 var(--sp-2);
    font-size: var(--fs-16);
    font-weight: var(--fw-semibold);
}
.sub-card p {
    margin: 0;
    color: var(--fg-2);
    font-size: var(--fs-14);
    line-height: var(--lh-14);
}
.usage-list {
    margin: 0 0 var(--sp-3);
    padding-left: var(--sp-5);
    color: var(--fg-1);
    font-size: var(--fs-14);
}

/* ---- Dashboard mini card ----
   Fits in a single track of the service grid (~260px on a typical 1080p
   layout). Chart + stats sit side-by-side; fonts are tuned smaller than
   the rest of the dashboard so the figures don't overflow. */
.service-card.device-card {
    gap: var(--sp-2);
}
.service-card.device-card .device-card-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.service-card.device-card .caption {
    font-size: var(--fs-12);
    color: var(--fg-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.service-card.device-card .device-card-body {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: var(--sp-3);
    align-items: center;
}
.device-mini-stats {
    margin: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 3px;
}
.device-mini-stats > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--sp-2);
}
.device-mini-stats dt {
    margin: 0;
    font-size: var(--fs-14);
    color: var(--fg-2);
}
.device-mini-stats dd {
    margin: 0;
    font-size: var(--fs-14);
    font-weight: var(--fw-semibold);
    color: var(--fg-1);
    font-variant-numeric: tabular-nums;
}
.device-mini-stats dd.blue   { color: var(--star-blue); }
.device-mini-stats dd.red    { color: var(--danger);    }
.device-mini-stats dd.orange { color: #C46A00;          }

/* ==========================================================================
   Device Groups — list table, row actions, settings/webhook layout
   ========================================================================== */

.groups-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-14);
}
.groups-table th,
.groups-table td {
    text-align: left;
    padding: var(--sp-3);
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}
.groups-table th {
    font-size: var(--fs-12);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--fg-3);
    font-weight: var(--fw-medium);
}
.groups-table tbody tr:hover { background: var(--bg-subtle); }
.groups-table .actions-col { text-align: right; white-space: nowrap; width: 1%; }
.group-actions { display: inline-flex; gap: 2px; align-items: center; }

/* Compact variant — tighter rows for dense list views */
.groups-table.compact th,
.groups-table.compact td {
    padding-top: var(--sp-1);
    padding-bottom: var(--sp-1);
}
.groups-table.compact .group-actions { gap: 0; }

.cloudprnt-url {
    font-family: var(--font-mono);
    font-size: var(--fs-13);
    color: var(--fg-2);
}

/* Path input with a fixed base-URL prefix */
.path-row { display: flex; align-items: stretch; }
.path-prefix {
    display: inline-flex;
    align-items: center;
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--r-sm) 0 0 var(--r-sm);
    padding: 6px 10px;
    color: var(--fg-2);
    font-size: var(--fs-13);
    white-space: nowrap;
}

.field { margin-bottom: var(--sp-3); }
.field-label {
    display: block;
    font-size: var(--fs-13);
    font-weight: var(--fw-medium);
    margin-bottom: 4px;
    color: var(--fg-1);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-3) var(--sp-5);
    align-items: end;
}
.subsection {
    font-size: var(--fs-16);
    font-weight: var(--fw-semibold);
    margin: var(--sp-4) 0 var(--sp-2);
    color: var(--fg-1);
}
.card-head-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-3);
}
.muted { color: var(--fg-3); font-size: var(--fs-14); }
.event-toggles {
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: 8px 24px;
    justify-content: start;
}

/* Content area inside a device-group settings tab */
.tab-panel { padding-top: var(--sp-4); }

/* ==========================================================================
   Devices view (DevicesPanel)
   ========================================================================== */

.devices-table .dev-cell {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}
.devices-table .dev-thumb {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-sm);
    padding: 2px;
    box-sizing: border-box;
}
.devices-table .dev-name { font-weight: var(--fw-semibold); color: var(--fg-1); }
.devices-table .dev-sub  { font-size: var(--fs-12); }

.muted-mono {
    font-family: var(--font-mono);
    font-size: var(--fs-12);
    color: var(--fg-3);
}
.small { font-size: var(--fs-12); }

.status-line.ok   { color: var(--success); font-weight: var(--fw-medium); }
.status-line.warn { color: #C46A00;        font-weight: var(--fw-medium); }
.status-line.bad  { color: var(--danger);  font-weight: var(--fw-medium); }
.devices-table .ok   { color: var(--success); }
.devices-table .warn { color: #C46A00; }
.devices-table .bad  { color: var(--danger); }

.devices-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--sp-3);
    padding-top: var(--sp-3);
    border-top: 1px solid var(--border-subtle);
    font-size: var(--fs-13);
}

/* ==========================================================================
   Device settings dialog
   ========================================================================== */

.device-dialog { display: grid; gap: var(--sp-4); }

/* The device name as the in-body title. (The FluentUI title bar shows the
   immutable MAC, since it doesn't refresh when the name is edited.) */
.device-dialog-title {
    font-size: var(--fs-18);
    font-weight: var(--fw-semibold);
    color: var(--fg-1);
    line-height: 1.2;
    word-break: break-word;
}

.device-dialog-body {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: var(--sp-5);
    align-items: start;
}

/* Left column: product image stacked over the Rename action.
   align-items: flex-start so the Rename button left-aligns to the image. */
.device-image-col {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-2);
}
.device-dialog-image {
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-md);
    height: 140px;
    width: 100%;
    display: grid;
    place-items: center;
    padding: var(--sp-2);
    box-sizing: border-box;
}
.device-dialog-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.device-properties {
    margin: 0;
    display: grid;
    gap: var(--sp-2);
}
.device-properties .prop {
    display: grid;
    grid-template-columns: 20px 160px 1fr auto auto;
    align-items: start;
    gap: var(--sp-2);
    padding: 1px 0;
    /*border-bottom: 1px dashed var(--border-subtle);*/
}
.device-properties .prop:last-child { border-bottom: none; }
.device-properties dt {
    margin: 0;
    color: var(--fg-3);
    font-size: var(--fs-12);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-top: 2px;
}
.device-properties dd { margin: 0; color: var(--fg-1); font-size: var(--fs-14); }
.device-properties .prop--notes { grid-template-columns: 20px 160px 1fr; }

/* Pill-styled emphasis for codey values (access ID, URL) inside the dialog. */
.device-properties .device-value {
    display: inline-block;
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-sm);
    padding: 1px 6px;
    font-family: var(--font-mono);
    font-size: var(--fs-13);
    color: var(--fg-1);
    word-break: break-all;
}

.device-dialog-footer {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding-top: var(--sp-3);
    border-top: 1px solid var(--border-subtle);
}

/* Danger-styled accent FluentButton — uses the brand --danger token so it
   reads as destructive without bringing in a new colour. */
.btn-danger::part(control) {
    background: var(--danger);
    border-color: var(--danger);
    color: var(--white);
}
.btn-danger:hover::part(control) {
    background: #95201A;
    border-color: #95201A;
}
/* The bin glyph carries its own inline fill (set by FluentIcon as a
   style="fill:…" attribute), so we need !important to override it and a
   broad selector that covers <svg> wherever it lives in the button. */
.btn-danger svg,
.btn-danger svg * {
    fill: var(--white) !important;
}

/* Suppress the FluentDialog built-in footer for our device-detail dialog —
   it provides its own footer (Delete · Cancel · Save) in the body slot, so
   FluentDialog's default footer would otherwise reserve a ~24px grid row
   below it. We target two ways for robustness:
     1. By the aria-label we set on the dialog (works in every browser).
     2. By :has(.device-dialog) (modern fallback; some confirmation dialogs
        could share the same aria-label if we ever set it).
   Confirmation dialogs and any other dialog without these markers keep
   their built-in footer. */
fluent-dialog[aria-label="device-detail-dialog"] .fluent-dialog-footer,
fluent-dialog:has(.device-dialog) .fluent-dialog-footer {
    display: none !important;
    padding: 0 !important;
    min-height: 0 !important;
}

/* Site-wide switch layout: toggle on the left, label on the right. FAST's
   fluent-switch renders the label before the toggle by default; reorder via its
   exposed parts so every switch reads consistently (Options, Enabled, dialogs). */
fluent-switch::part(switch) { order: -1; }
fluent-switch::part(label) {
    margin-inline-start: 8px;
    margin-inline-end: 0;
}

/* Field rows (text + number): FluentTextField/FluentNumberField render their
   label as a separate grid item (.fluent-input-label), so pin the label column
   to a fixed width and let the field take the rest. */
.settings-grid.fields-grid {
    grid-template-columns: 210px 1fr;
    align-items: center;
}
