﻿[data-label]::before {
    font-weight: 500 !important;
    text-transform: capitalize !important;
}

th:first-letter {
    text-transform: capitalize;
}

.mud-sm-table .mud-table-body {
    border-top: none !important;
}

.mud-xl-table .mud-table-body {
    border-top: none !important;
}

.mud-input > input.mud-input-root-outlined.mud-input-root-margin-dense, div.mud-input-slot.mud-input-root-outlined.mud-input-root-margin-dense {
    padding-top: 13px;
    padding-bottom: 13px;
}

.mud-input-label-outlined.mud-input-label-margin-dense {
    transform: translate(14px, 14px) scale(1);
}

.mud-dialog-width-full {
    width: calc(100% - 32px);
}

.mud-input-label-outlined {
    background-color: var(--mud-palette-background);
}

svg {
    width: 95%;
    height: 95%;
}

:root {
    --mud-typography-h4-weight: 500 !important;
    --font-sans: 'IBM Plex Sans', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
    /* Muted tenant line: enough blue to read as a category on scan,
       not enough to compete with warn/error states */
    --tenant-line: color-mix(in srgb, var(--mud-palette-info) 45%, var(--mud-palette-lines-default));
}

@media (max-width: 600px) {
    :root {
        --mud-typography-h4-size: 1.7rem !important;
        --mud-typography-h5-size: 1.3rem !important;
    }
}

/* Shared entrance animations */
.anim-fade-in {
    opacity: 0;
    animation: anim-fade-in 320ms ease forwards;
}
.anim-slide-up {
    opacity: 0;
    animation: anim-slide-up 320ms ease forwards;
}
.anim-slide-left {
    opacity: 0;
    animation: anim-slide-left 320ms ease forwards;
}

@keyframes anim-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes anim-slide-up {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes anim-slide-left {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Nav active-state override — left-border accent instead of filled background */
.mud-nav-link.active {
    background-color: color-mix(in srgb, var(--mud-palette-primary) 6%, transparent) !important;
    border-left: 3px solid var(--mud-palette-primary) !important;
    border-radius: 0 4px 4px 0 !important;
    padding-left: calc(1rem - 3px) !important;
}
.mud-nav-link.active .mud-nav-link-text {
    font-weight: 600 !important;
}

/* Nav section label */
.nav-section-label {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
    padding: 1.25rem 1rem 0.375rem;
    opacity: 0.7;
    display: block;
}

/* Manage page section cards */
/* Restricted-feature mark: the one superscript beside any title that belongs
   to a lab feature. Sized against its title, so it sits the same beside a
   page heading and a settings row; the primary colour is the only accent. */
.feature-mark {
    margin-left: 0.3em;
    font-family: var(--font-sans);
    font-size: 0.55em;
    font-weight: 600;
    line-height: 1;
    vertical-align: super;
    color: var(--mud-palette-primary);
    white-space: nowrap;
}
.mud-nav-link .feature-mark {
    font-size: 0.65em;
}
.section-card {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    background: var(--mud-palette-surface);
}
.section-card-heading {
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
    margin-bottom: 1rem;
}

/* Header action chips — icon-only circle at rest, expands to icon+label pill on hover/focus */
.header-action-chip {
    display: inline-flex;
    align-items: center;
    padding: 0 5px;
    border: 1px solid transparent;
    border-radius: 15px;
    background: transparent;
    cursor: pointer;
    color: var(--mud-palette-primary);
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    font-weight: 500;
}
.header-action-chip:hover,
.header-action-chip:focus-visible {
    background: color-mix(in srgb, var(--mud-palette-primary) 8%, transparent);
    border-color: color-mix(in srgb, var(--mud-palette-primary) 25%, transparent);
}
.header-action-chip .mud-icon-root {
    flex-shrink: 0;
}
.header-action-chip-label {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: max-width 250ms ease-out, opacity 200ms ease-out,
                padding 250ms ease-out;
}
.header-action-chip:hover .header-action-chip-label,
.header-action-chip:focus-visible .header-action-chip-label {
    max-width: 160px;
    opacity: 1;
    padding-left: 6px;
    padding-right: 4px;
}
/* Touch devices: stay icon-only, MudTooltip is the fallback */
@media (hover: none) {
    .header-action-chip:hover .header-action-chip-label {
        max-width: 0;
        opacity: 0;
        padding: 0;
    }
}
@media (prefers-reduced-motion: reduce) {
    .header-action-chip-label {
        transition: none;
    }
}

/* Compact bottom nav active state */
.mud-bottom-appbar .mud-nav-link.active {
    border-left: none !important;
    border-top: 3px solid var(--mud-palette-primary) !important;
    background-color: transparent !important;
    padding-left: 1rem !important;
}

/* LockManage tab active indicator */
.mud-tab-active {
    border-bottom: 3px solid var(--mud-palette-primary) !important;
    background-color: transparent !important;
}

/* Role selector cards */
.role-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}
@media (max-width: 600px) {
    .role-card-grid { grid-template-columns: 1fr; }
}
.role-card {
    position: relative;
    border: 1.5px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    padding: 1.125rem 1.25rem;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease;
    background: var(--mud-palette-background);
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    user-select: none;
}
.role-card:hover:not(.role-card--disabled) {
    border-color: var(--mud-palette-primary);
}
.role-card--selected {
    border-color: var(--mud-palette-primary) !important;
    background: color-mix(in srgb, var(--mud-palette-primary) 6%, var(--mud-palette-background));
}
.role-card--disabled {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}
.role-card-check {
    position: absolute;
    top: 0.875rem;
    right: 0.875rem;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    background: var(--mud-palette-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 160ms ease, transform 160ms ease;
    pointer-events: none;
}
.role-card--selected .role-card-check {
    opacity: 1;
    transform: scale(1);
}
.role-card-icon-wrap {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 8px;
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent);
    color: var(--mud-palette-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.375rem;
    flex-shrink: 0;
}
.role-card-name {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}
.role-card-desc {
    font-size: 0.775rem;
    color: var(--mud-palette-text-secondary);
    line-height: 1.45;
}

/* Lock permission rows */
.lock-permission-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 0.5rem;
}
.lock-row {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    padding: 0.625rem 0.875rem;
    transition: border-color 160ms ease;
    background: var(--mud-palette-background);
}
.lock-row--active {
    border-color: color-mix(in srgb, var(--mud-palette-primary) 40%, var(--mud-palette-lines-default));
}
.lock-row-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2rem;
    flex-wrap: wrap;
}
.lock-row-name {
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--font-mono);
    color: var(--mud-palette-text-primary);
    flex: 1;
    min-width: 0;
}
.lock-row-perms {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    padding-top: 0.625rem;
    margin-top: 0.375rem;
    border-top: 1px solid var(--mud-palette-lines-default);
}
.perm-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.625rem;
    border-radius: 5px;
    font-size: 0.725rem;
    font-weight: 500;
    font-family: var(--font-sans);
    border: 1.5px solid var(--mud-palette-lines-default);
    background: transparent;
    color: var(--mud-palette-text-secondary);
    cursor: pointer;
    transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
    user-select: none;
    line-height: 1.6;
    white-space: nowrap;
}
.perm-pill:hover {
    border-color: var(--mud-palette-primary);
    color: var(--mud-palette-primary);
}
.perm-pill--on {
    border-color: var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent);
    color: var(--mud-palette-primary);
}
.lock-user-detail {
    margin-top: 0.5rem;
    padding: 0.625rem 0.875rem;
    border-radius: 6px;
    background: var(--mud-palette-dark-hover);
}
.lock-user-detail-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8rem;
    padding: 0.2rem 0;
    color: var(--mud-palette-text-secondary);
}

/* Device status row (lock/bridge identity cards) */
.device-status-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.375rem 0 0.625rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}
.status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    flex-shrink: 0;
}
.status-dot--online {
    background: var(--mud-palette-success);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--mud-palette-success) 18%, transparent);
    animation: dot-pulse 2.2s ease infinite;
}
.status-dot--offline {
    background: var(--mud-palette-error);
}

@keyframes dot-pulse {
     0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--mud-palette-success) 50%, transparent); }
     60%  { box-shadow: 0 0 0 5px rgba(76, 175, 80, 0); }
     100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
 }

/* Stat cards for sparse identity cards (token, token group) */
.identity-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
    gap: 0.625rem;
    margin-top: 0.75rem;
}
.identity-stat {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: var(--mud-palette-background);
    border: 1px solid var(--mud-palette-lines-default);
    min-width: 0;
}
.identity-stat-value {
    font-size: clamp(0.7rem, 3.0vw, 1.4rem);
    font-weight: 700;
    font-family: var(--font-sans);
    color: var(--mud-palette-text-primary);
    line-height: 1.2;
    word-break: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}
.identity-stat-label {
    font-size: 0.725rem;
    color: var(--mud-palette-text-secondary);
    margin-top: 0.2rem;
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Compact identity stat tiles (bridge identity details) */
.identity-stat-grid--compact {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
}
.identity-stat--compact {
    padding: 0.375rem 0.625rem;
    border-radius: 6px;
}
.identity-stat--compact .identity-stat-value {
    font-size: 0.8125rem;
    font-weight: 600;
}
.identity-stat--compact .identity-stat-label {
    font-size: 0.65rem;
    margin-top: 0.1rem;
}

.identity-stat .identity-copy-btn {
    opacity: 0;
    transition: opacity 120ms ease;
}
.identity-stat:hover .identity-copy-btn,
.identity-stat .identity-copy-btn:focus-visible {
    opacity: 1;
}
@media (hover: none) {
    .identity-stat .identity-copy-btn {
        opacity: 1;
    }
}

/* User table avatar */
.user-avatar {
    width: 1.875rem;
    height: 1.875rem;
    border-radius: 50%;
    background: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent);
    color: var(--mud-palette-primary);
    font-size: 0.6875rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-sans);
    flex-shrink: 0;
    text-transform: uppercase;
}

/* ─── Splash Screen (ksp) ──────────────────────────────────────── */
.ksp {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.75rem;
    background: var(--mud-palette-background);
    color: var(--mud-palette-text-primary);
}

/* Enter — logo rises, body fades in with a short delay */
.ksp--entering .ksp-logo {
    animation: ksp-rise 680ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
.ksp--entering .ksp-body {
    animation: ksp-fade 480ms ease 380ms both;
}

/* Visible — already animated once this session; show immediately */
.ksp--visible .ksp-logo,
.ksp--visible .ksp-body {
    opacity: 1;
}

/* Exit — whole overlay fades to transparent */
.ksp--exiting {
    animation: ksp-out 480ms ease forwards;
    pointer-events: none;
}

@keyframes ksp-rise {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes ksp-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes ksp-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* Logo */
.ksp-svg {
    width: 10rem;
    height: 10rem;
    display: block;
}

/* Body — progress bar + tip */
.ksp-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.375rem;
    width: 200px;
}

/* Progress track */
.ksp-progress-track {
    width: 100%;
    height: 2px;
    background: color-mix(in srgb, var(--mud-palette-text-primary) 10%, transparent);
    border-radius: 1px;
    overflow: hidden;
}

.ksp-progress-fill {
    height: 100%;
    background: var(--mud-palette-primary);
    border-radius: 1px;
    transition: width 550ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Indeterminate shuttle */
.ksp-progress-fill--indeterminate {
    width: 38% !important;
    animation: ksp-shuttle 1.8s ease-in-out infinite;
}

@keyframes ksp-shuttle {
    0%   { transform: translateX(-200%); }
    100% { transform: translateX(390%); }
}

/* Tip text */
.ksp-tip {
    min-height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ksp-tip-text {
    font-size: 0.8rem;
    line-height: 1.55;
    color: var(--mud-palette-text-secondary);
    text-align: center;
    max-width: 230px;
    opacity: 0;
    transition: opacity 350ms ease;
}

.ksp-tip-text--visible {
    opacity: 1;
}

/* ── Activity Log Feed ──────────────────────────────────────── */
@keyframes al-shimmer {
    0%   { background-position: -800px 0; }
    100% { background-position: 800px 0; }
}
.al-skel {
    background: linear-gradient(
        90deg,
        var(--mud-palette-lines-default) 25%,
        color-mix(in srgb, var(--mud-palette-lines-default) 35%, var(--mud-palette-background)) 50%,
        var(--mud-palette-lines-default) 75%
    );
    background-size: 1600px 100%;
    animation: al-shimmer 1.6s ease-in-out infinite;
    border-radius: 4px;
}
.al-skel-icon {
    width: 2.125rem;
    height: 2.125rem;
    border-radius: 8px;
    flex-shrink: 0;
}
.al-header {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    flex-wrap: wrap;
}
.al-stat-chip {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.2rem 0.625rem;
    border-radius: 9999px;
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent);
    color: var(--mud-palette-text-secondary);
    border: 1px solid var(--mud-palette-lines-default);
    letter-spacing: 0.04em;
}
.al-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 960px) {
    .al-layout { grid-template-columns: 1fr; }
}
.al-filters {
    position: sticky;
    top: 1rem;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
    padding: 1.125rem 1rem;
    background: var(--mud-palette-surface);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1000;
}
.al-filters-title {
    font-family: var(--font-mono);
    font-size: 0.6375rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
    opacity: 0.7;
}
.al-filter-divider {
    height: 1px;
    background: var(--mud-palette-lines-default);
    margin: 0.125rem 0;
}
.al-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.125rem 0 0.375rem;
}
.al-feed {
    display: flex;
    flex-direction: column;
    min-height: 280px;
}
.al-date-separator {
    font-family: var(--font-mono);
    font-size: 0.6375rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
    opacity: 0.6;
    padding: 1.25rem 0.75rem 0.5rem;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    margin-bottom: 0.25rem;
}
.al-date-separator:first-child { padding-top: 0; }
.al-event-row {
    display: grid;
    grid-template-columns: 2.125rem 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: background 100ms ease;
}
.al-event-row:hover { background: var(--mud-palette-action-hover); }
.al-event-icon {
    width: 2.125rem;
    height: 2.125rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.al-ev-access  { background: color-mix(in srgb, #22c55e 14%, transparent); color: #22c55e; }
.al-ev-config  { background: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent); color: var(--mud-palette-primary); }
.al-ev-hardware { background: color-mix(in srgb, #f59e0b 12%, transparent); color: #f59e0b; }
.al-ev-remote  { background: color-mix(in srgb, #8FA5A2 18%, transparent); color: #8FA5A2; }
.al-ev-denied  { background: color-mix(in srgb, #ef4444 12%, transparent); color: #ef4444; }
.al-event-content {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}
.al-event-badge {
    font-family: var(--font-mono);
    font-size: 0.5875rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding: 0.1rem 0.375rem;
    border-radius: 4px;
    width: fit-content;
    line-height: 1.6;
}
.al-event-description {
    font-size: 0.875rem;
    color: var(--mud-palette-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.al-event-time {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: var(--mud-palette-text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
    opacity: 0.7;
}
.al-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    gap: 0.75rem;
    color: var(--mud-palette-text-secondary);
    text-align: center;
}
.al-pagination {
    padding: 1.5rem 0.75rem;
    display: flex;
    justify-content: center;
}

/* Timeout message */
.ksp-timeout {
    font-size: 0.8125rem;
    color: var(--mud-palette-error);
    text-align: center;
    margin: 0;
}

/* ── Entity table cells ──────────────────────────────────────── */
.entity-count-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-sans);
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent);
    color: var(--mud-palette-primary);
    line-height: 1.4;
}
.entity-count-pill--zero {
    background: var(--mud-palette-lines-default);
    color: var(--mud-palette-text-secondary);
}
.entity-count-pill--loading {
    background: color-mix(in srgb, var(--mud-palette-lines-default) 60%, transparent);
    animation: entity-count-pill-pulse 1.4s ease-in-out infinite;
}
@keyframes entity-count-pill-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) {
    .entity-count-pill--loading { animation: none; opacity: 0.6; }
}
.entity-count-pill--enter {
    animation: entity-count-pill-in 280ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes entity-count-pill-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .entity-count-pill--enter { animation: none; }
}
.cell-mono {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}
.cell-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.cell-badge--yes {
    background: color-mix(in srgb, var(--mud-palette-success) 12%, transparent);
    color: var(--mud-palette-success);
}
.cell-badge--no {
    background: color-mix(in srgb, var(--mud-palette-text-secondary) 8%, transparent);
    color: var(--mud-palette-text-secondary);
}
.cell-badge--warn {
    background: color-mix(in srgb, var(--mud-palette-warning) 12%, transparent);
    color: var(--mud-palette-warning);
}
.cell-badge--error {
    background: color-mix(in srgb, var(--mud-palette-error) 12%, transparent);
    color: var(--mud-palette-error);
}
/* Pending: something is in flight on the bridge. Info tint plus the status dot,
   pulsing like an online device, so a scan of the table shows where work is happening. */
.cell-badge--pending {
    background: color-mix(in srgb, var(--mud-palette-info) 12%, transparent);
    color: var(--mud-palette-info);
}
.cell-badge .status-dot {
    width: 0.375rem;
    height: 0.375rem;
    margin-right: 0.375rem;
    background: currentColor;
    animation: badge-dot-pulse 2.2s ease infinite;
}
@keyframes badge-dot-pulse {
    0%   { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 45%, transparent); }
    60%  { box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
    .cell-badge .status-dot { animation: none; }
}

/* ── Assigned-token rows: bordered row + folder tab ──────────── */
/* Bordered row = assigned to a user; info-blue = tenant; warn
   amber = incomplete Apple setup. The warn border wins over the
   category border while the state is active.
   Tabs live in a .row-tabs strip that straddles the row's top
   border like file-folder tabs, so an ownership tab and a state
   tab can sit side by side.
   The border is drawn on the cells, not as a tr outline — the
   cells' own MudBlazor border-bottom paints over a tr outline. */
.row-tabs {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    z-index: 1;
}
.row-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.1rem 0.55rem;
    border-radius: 4px;
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-surface);
    font-family: var(--font-sans);
    font-size: 0.68rem;
    line-height: 1.5;
    white-space: nowrap;
}
.row-tab--tenant {
    border-color: var(--tenant-line);
}
.row-tab--warn {
    border: 1.5px solid var(--mud-palette-warning);
}
.row-tab__label {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mud-palette-text-secondary);
}
.row-tab--tenant .row-tab__label {
    color: var(--mud-palette-info);
}
.row-tab--warn .row-tab__label {
    color: var(--mud-palette-warning);
}
.row-tab__email {
    display: inline-block;
    color: var(--mud-palette-text-secondary);
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}
@media (max-width: 600px) {
    .row-tab__email {
        max-width: 8rem;
    }
}
/* Bordered rows + straddling tabs are desktop-only (≥960px). Below
   that — including 600–959px where the table is still tabular and
   <600px where MudTable stacks cells (Breakpoint.Sm) — rows get no
   border and the tabs simply flow inline in the nickname cell. */
@media (min-width: 960px) {
    tr.assigned-row > td {
        position: relative;
        padding-top: 1.35rem;
        padding-bottom: 1.35rem;
        border-top: 1px solid var(--mud-palette-lines-default);
        border-bottom: 1px solid var(--mud-palette-lines-default);
    }
    tr.assigned-row > td:first-child {
        border-left: 1px solid var(--mud-palette-lines-default);
    }
    tr.assigned-row > td:last-child {
        border-right: 1px solid var(--mud-palette-lines-default);
    }
    tr.assigned-row--tenant > td {
        border-top: 1px solid var(--tenant-line);
        border-bottom: 1px solid var(--tenant-line) !important;
    }
    tr.assigned-row--tenant > td:first-child {
        border-left: 1px solid var(--tenant-line);
    }
    tr.assigned-row--tenant > td:last-child {
        border-right: 1px solid var(--tenant-line);
    }
    tr.assigned-row--warn > td {
        border-top: 1.5px solid var(--mud-palette-warning);
        border-bottom: 1.5px solid var(--mud-palette-warning) !important;
    }
    tr.assigned-row--warn > td:first-child {
        border-left: 1.5px solid var(--mud-palette-warning);
    }
    tr.assigned-row--warn > td:last-child {
        border-right: 1.5px solid var(--mud-palette-warning);
    }
    tr.assigned-row .row-tabs {
        position: absolute;
        top: 0;
        left: 0.5rem;
        transform: translateY(-50%);
    }
}
@media (max-width: 960px) {
    tr.assigned-row .row-tabs {
        margin-right: 0.4rem;
    }
}
/* Card variant: same tab strip on the dev-card border, all widths */
.dev-card > .row-tabs {
    position: absolute;
    top: 0;
    left: 0.75rem;
    transform: translateY(-50%);
}
/* Doubled class beats the later .dev-card:hover border-color, so
   tenant/warn cards keep their border on hover. */
.dev-card.dev-card--tenant,
.dev-card.dev-card--tenant:hover {
    border-color: var(--tenant-line);
}
.dev-card.dev-card--warn,
.dev-card.dev-card--warn:hover {
    border-color: var(--mud-palette-warning);
}

/* ── Developer dashboards ────────────────────────────────────── */
.method-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
}
.method-badge--get    { background: color-mix(in srgb, #22c55e 12%, transparent); color: #16a34a; }
.method-badge--post   { background: color-mix(in srgb, #3b82f6 12%, transparent); color: #2563eb; }
.method-badge--put    { background: color-mix(in srgb, #f59e0b 12%, transparent); color: #d97706; }
.method-badge--patch  { background: color-mix(in srgb, #8b5cf6 12%, transparent); color: #7c3aed; }
.method-badge--delete { background: color-mix(in srgb, #ef4444 12%, transparent); color: #dc2626; }
.view-toggle {
    display: inline-flex;
    border: 1.5px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    overflow: hidden;
}
.view-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--mud-palette-text-secondary);
    transition: background 120ms ease, color 120ms ease;
    padding: 0;
}
.view-toggle-btn:hover { background: var(--mud-palette-action-hover); }
.view-toggle-btn--active {
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent);
    color: var(--mud-palette-primary);
}
.connection-toggle {
    display: inline-flex;
    border: 1.5px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    overflow: hidden;
}
.connection-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    height: 2.25rem;
    padding: 0 0.875rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--mud-palette-text-secondary);
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background 120ms ease, color 120ms ease;
}
.connection-toggle-btn:hover { background: var(--mud-palette-action-hover); }
.connection-toggle-btn:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: -2px;
}
.connection-toggle-btn--active {
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent);
    color: var(--mud-palette-primary);
}

/* ── Connection toggle coach mark: one-time "this is new" callout ── */
.connection-toggle-anchor {
    position: relative;
    display: inline-flex;
}
.connection-toggle-coachmark-dot {
    position: absolute;
    top: -0.3rem;
    right: -0.3rem;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--mud-palette-primary);
    box-shadow: 0 0 0 2px var(--mud-palette-surface);
    animation: connection-toggle-coachmark-pulse 2.2s ease infinite;
    pointer-events: none;
}
@keyframes connection-toggle-coachmark-pulse {
    0%   { box-shadow: 0 0 0 2px var(--mud-palette-surface), 0 0 0 2px color-mix(in srgb, var(--mud-palette-primary) 55%, transparent); }
    60%  { box-shadow: 0 0 0 2px var(--mud-palette-surface), 0 0 0 7px color-mix(in srgb, var(--mud-palette-primary) 0%, transparent); }
    100% { box-shadow: 0 0 0 2px var(--mud-palette-surface), 0 0 0 7px color-mix(in srgb, var(--mud-palette-primary) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
    .connection-toggle-coachmark-dot { animation: none; }
}
.connection-toggle-coachmark {
    position: relative;
    width: 17.5rem;
    max-width: calc(100vw - 2rem);
    margin-top: 0.65rem;
    padding: 0.85rem 1rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--mud-palette-primary);
    background: var(--mud-palette-surface);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}
.connection-toggle-coachmark::before {
    content: "";
    position: absolute;
    top: -0.43rem;
    left: 1.1rem;
    width: 0.7rem;
    height: 0.7rem;
    background: var(--mud-palette-surface);
    border-left: 1px solid var(--mud-palette-primary);
    border-top: 1px solid var(--mud-palette-primary);
    transform: rotate(45deg);
}
.connection-toggle-coachmark__eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    font-family: var(--font-sans);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent);
}
.connection-toggle-coachmark__title {
    margin: 0 0 0.3rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--mud-palette-text-primary);
}
.connection-toggle-coachmark__body {
    margin: 0 0 0.75rem;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--mud-palette-text-secondary);
}
.connection-toggle-coachmark__dismiss {
    display: inline-flex;
    align-items: center;
    height: 1.85rem;
    padding: 0 0.75rem;
    border: none;
    border-radius: 6px;
    background: var(--mud-palette-primary);
    color: var(--mud-palette-white);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 120ms ease;
}
.connection-toggle-coachmark__dismiss:hover { opacity: 0.88; }
.connection-toggle-coachmark__dismiss:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}
.dev-card-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 0.5rem;
}
@media (min-width: 600px) {
    .dev-card-list {
        grid-template-columns: repeat(auto-fill, 1fr);
    }
}
@media (min-width: 960px) {
    .dev-card-list {
        grid-template-columns: repeat(2, minmax(200px, 1fr));
    }
}
.dev-card {
    position: relative;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    padding: 1.125rem 1.25rem;
    background: var(--mud-palette-surface);
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}
.dev-card:hover {
    border-color: color-mix(in srgb, var(--mud-palette-primary) 35%, var(--mud-palette-lines-default));
    box-shadow: 0 2px 8px color-mix(in srgb, var(--mud-palette-primary) 6%, transparent);
}
.dev-card-title {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: var(--font-sans);
    color: var(--mud-palette-text-primary);
}
.dev-card-key {
    font-family: var(--font-mono);
    font-size: 0.775rem;
    color: var(--mud-palette-text-secondary);
    letter-spacing: 0.02em;
    word-break: break-all;
}
.dev-card-stat {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}
.dev-card-stat-list{
    display: grid;
    grid-template-columns: auto auto auto auto;
    gap: 0.25rem;
}
.dev-card-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: auto;
    gap: 0.25rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--mud-palette-lines-default);
}

/* Timetable manage page */
.tt-day-row {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    padding: 0.875rem 1rem;
    background: var(--mud-palette-surface);
    transition: border-color 160ms ease, background 160ms ease;
    margin-bottom: 0.625rem;
}
.tt-day-row--active {
    border-color: color-mix(in srgb, var(--mud-palette-primary) 30%, var(--mud-palette-lines-default));
    background: color-mix(in srgb, var(--mud-palette-primary) 3%, var(--mud-palette-surface));
}
.tt-timeline__bar {
    display: flex;
    height: 8px;
    border-radius: 9999px;
    overflow: hidden;
}
.tt-timeline__segment {
    height: 100%;
    background: var(--mud-palette-lines-default);
}
.tt-timeline__segment--active {
    background: var(--mud-palette-primary);
}
.tt-timeline__segment--error {
    background: var(--mud-palette-error);
}
.tt-timeline__ticks {
    display: flex;
    justify-content: space-between;
    font-size: 0.6875rem;
    color: var(--mud-palette-text-secondary);
    margin-top: 0.25rem;
    padding: 0 1px;
    letter-spacing: 0.01em;
}
.tt-copy-shortcuts {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.tt-copy-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.875rem;
    border-radius: 9999px;
    border: 1.5px solid var(--mud-palette-lines-default);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--mud-palette-text-secondary);
    background: var(--mud-palette-surface);
    transition: border-color 120ms ease, color 120ms ease;
    cursor: pointer;
}
.tt-copy-pill:hover:not(:disabled) {
    border-color: var(--mud-palette-primary);
    color: var(--mud-palette-primary);
}
.tt-copy-pill:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.tt-copy-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--mud-palette-lines-default);
}
.tt-copy-day-btn {
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--mud-palette-lines-default);
    font-size: 0.75rem;
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease;
}
.tt-copy-day-btn:hover {
    border-color: var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 6%, var(--mud-palette-surface));
}

.tt-bulk-panel {
    background: color-mix(in srgb, var(--mud-palette-primary) 5%, var(--mud-palette-surface));
    border: 1px solid color-mix(in srgb, var(--mud-palette-primary) 25%, var(--mud-palette-lines-default));
    border-radius: 8px;
    padding: 12px 16px;
}

.tt-bulk-apply {
    align-self: flex-center;
}

.tt-copy-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.625rem;
    border-radius: 5px;
    font-size: 0.725rem;
    font-weight: 500;
    font-family: var(--font-sans);
    border: 1.5px solid var(--mud-palette-lines-default);
    background: transparent;
    color: var(--mud-palette-text-secondary);
    cursor: pointer;
    transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
    user-select: none;
    line-height: 1.6;
    white-space: nowrap;
}

.tt-copy-chip:hover {
    border-color: var(--mud-palette-primary);
    color: var(--mud-palette-primary);
}

.tt-copy-chip--selected {
    border-color: var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent);
    color: var(--mud-palette-primary);
}

/* ── Location card grid (SystemsDashboard) ─────────────────────────── */

.sl-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.sl-location-card {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
    overflow: hidden;
    background: var(--mud-palette-surface);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.sl-location-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
    border-color: var(--mud-palette-primary-lighten);
}

.sl-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 1rem 0.75rem 0.75rem 1rem;
}

.sl-card-identity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.sl-card-name {
    font-size: 0.9375rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--mud-palette-text-primary);
}

.sl-card-address {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0 1rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--mud-palette-text-secondary);
    min-height: 2.25rem;
    line-height: 1.4;
}

.sl-no-address {
    font-style: italic;
    opacity: 0.6;
}

.sl-card-metrics {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.625rem 1rem;
    border-top: 1px solid var(--mud-palette-lines-default);
    background: color-mix(in srgb, var(--mud-palette-background-grey) 40%, transparent);
}

.sl-metric {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8125rem;
    color: var(--mud-palette-text-secondary);
}

.sl-metric-skeleton {
    width: 2.5rem;
    height: 0.875rem;
    border-radius: 4px;
    background: var(--mud-palette-lines-default);
    animation: sl-pulse 1.4s ease-in-out infinite;
}

@keyframes sl-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.sl-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 4rem 1rem;
    text-align: center;
}

.settings-row-container{
    display: flex;
    align-items: center;
    justify-content: space-between;
}

@media (max-width: 600px) {
    .settings-row-container{
        flex-direction: column;
        justify-content: center;
    }
}

/* Device info status transition animations — cascading fade-slide on data refresh */
.anim-device-row {
    opacity: 0;
    animation: anim-device-fade-in 280ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: var(--anim-device-delay, 0ms);
}
@keyframes anim-device-fade-in {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Status dot variants */
.status-dot--refreshing {
    background: var(--mud-palette-text-secondary) !important;
    animation: anim-device-fade-in 280ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Subtle pulse on the status dot when data successfully loads */
.anim-device-flash {
    animation: anim-device-pulse 450ms ease-out forwards;
}
@keyframes anim-device-pulse {
    0%    { box-shadow: 0 0 0 0 rgba(var(--mud-palette-success-light-rgb), 0.5); }
    50%   { box-shadow: 0 0 0 4px rgba(var(--mud-palette-success-light-rgb), 0); }
    100% { box-shadow: 0 0 0 0 rgba(var(--mud-palette-success-light-rgb), 0); }
}

/* Branding Settings: Tab-Based Interface */
.branding-tabs :deep(.mud-tabs-toolbar) {
    border-bottom: 1px solid var(--mud-palette-lines-default);
    padding-bottom: 0 !important;
    gap: 0.5rem;
}

.branding-tabs :deep(.mud-tab) {
    font-weight: 500;
    text-transform: none !important;
    font-size: 0.875rem;
    letter-spacing: -0.3px;
    color: var(--mud-palette-text-secondary) !important;
    padding: 0.5rem 0 !important;
}

.branding-tabs :deep(.mud-tab-active) {
    color: var(--mud-palette-text-primary) !important;
    border-bottom: 2px solid var(--mud-palette-primary) !important;
}

.branding-tabs :deep(.mud-tabs-panel) {
    padding: 1rem 0 !important;
}

.branding-tab-content {
    animation: anim-fade-in 200ms ease-in-out forwards;
}

/* Token type selection cards */
.token-type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}
@media (max-width: 900px) {
    .token-type-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .token-type-grid { grid-template-columns: 1fr; }
}
.token-type-card {
    position: relative;
    border: 1.5px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    padding: 1.125rem 1.25rem;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease;
    background: var(--mud-palette-background);
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    user-select: none;
}
.token-type-card:hover:not(.token-type-card--disabled) {
    border-color: var(--mud-palette-primary);
}
.token-type-card--selected {
    border-color: var(--mud-palette-primary) !important;
    background: color-mix(in srgb, var(--mud-palette-primary) 6%, var(--mud-palette-background));
}
.token-type-card--disabled {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}
.token-type-card-check {
    position: absolute;
    top: 0.875rem;
    right: 0.875rem;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    background: var(--mud-palette-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 160ms ease, transform 160ms ease;
    pointer-events: none;
}
.token-type-card--selected .token-type-card-check {
    opacity: 1;
    transform: scale(1);
}
.token-type-card-icon-wrap {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 8px;
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent);
    color: var(--mud-palette-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.375rem;
    flex-shrink: 0;
}
.token-type-card-name {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}
.token-type-card-desc {
    font-size: 0.775rem;
    color: var(--mud-palette-text-secondary);
    line-height: 1.45;
}

/* Token variant selection cards (Apple token mode A/B selection) */
.token-variant-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}
@media (max-width: 600px) {
    .token-variant-grid { grid-template-columns: 1fr; }
}
.token-variant-card {
    position: relative;
    border: 1.5px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    padding: 1.125rem 1.25rem;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease;
    background: var(--mud-palette-background);
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    user-select: none;
}
.token-variant-card:hover:not(.token-variant-card--disabled) {
    border-color: var(--mud-palette-primary);
}
.token-variant-card--selected {
    border-color: var(--mud-palette-primary) !important;
    background: color-mix(in srgb, var(--mud-palette-primary) 6%, var(--mud-palette-background));
}
.token-variant-card--disabled {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}
.token-variant-card-check {
    position: absolute;
    top: 0.875rem;
    right: 0.875rem;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    background: var(--mud-palette-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 160ms ease, transform 160ms ease;
    pointer-events: none;
}
.token-variant-card--selected .token-variant-card-check {
    opacity: 1;
    transform: scale(1);
}
.token-variant-card-icon-wrap {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 8px;
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent);
    color: var(--mud-palette-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.375rem;
    flex-shrink: 0;
}
.token-variant-card-name {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}
.token-variant-card-desc {
    font-size: 0.775rem;
    color: var(--mud-palette-text-secondary);
    line-height: 1.45;
}

/* Token mode selection cards (Apple token modes) */
.token-mode-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}
@media (max-width: 600px) {
    .token-mode-grid { grid-template-columns: 1fr; }
}
.token-mode-card {
    position: relative;
    border: 1.5px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    padding: 1.125rem 1.25rem;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease;
    background: var(--mud-palette-background);
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    user-select: none;
}
.token-mode-card:hover:not(.token-mode-card--disabled) {
    border-color: var(--mud-palette-primary);
}
.token-mode-card--selected {
    border-color: var(--mud-palette-primary) !important;
    background: color-mix(in srgb, var(--mud-palette-primary) 6%, var(--mud-palette-background));
}
.token-mode-card--disabled {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}
.token-mode-card-check {
    position: absolute;
    top: 0.875rem;
    right: 0.875rem;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    background: var(--mud-palette-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 160ms ease, transform 160ms ease;
    pointer-events: none;
}
.token-mode-card--selected .token-mode-card-check {
    opacity: 1;
    transform: scale(1);
}
.token-mode-card-icon-wrap {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 8px;
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent);
    color: var(--mud-palette-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.375rem;
    flex-shrink: 0;
}
.token-mode-card-name {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}
.token-mode-card-desc {
    font-size: 0.775rem;
    color: var(--mud-palette-text-secondary);
    line-height: 1.45;
}

/* Branding Settings: Tab-Based Interface */
.branding-tabs :deep(.mud-tabs-toolbar) {
    border-bottom: 1px solid var(--mud-palette-lines-default);
    padding-bottom: 0 !important;
    gap: 0.5rem;
}

.branding-tabs :deep(.mud-tab) {
    font-weight: 500;
    text-transform: none !important;
    font-size: 0.875rem;
    letter-spacing: -0.3px;
    color: var(--mud-palette-text-secondary) !important;
    padding: 0.5rem 0 !important;
}

.branding-tabs :deep(.mud-tab-active) {
    color: var(--mud-palette-text-primary) !important;
    border-bottom: 2px solid var(--mud-palette-primary) !important;
}

.branding-tabs :deep(.mud-tabs-panel) {
    padding: 1rem 0 !important;
}

.branding-tab-content {
    animation: anim-fade-in 200ms ease-in-out forwards;
}

/* ─── Subscription Plan Cards ──────────────────────────────────────── */

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(0.75rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.plan-animate {
    animation: fade-up 400ms ease both;
}

.plan-animate:nth-child(1) {
    animation-delay: 50ms;
}

.plan-animate:nth-child(2) {
    animation-delay: 130ms;
}

.plan-animate:nth-child(3) {
    animation-delay: 210ms;
}

.plan-card-wrapper {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: 100%;
}

.plan-badge-wrap {
    position: absolute;
    top: -0.8125rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.plan-badge {
    display: inline-block;
    padding: 0.1875rem 0.875rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #fff;
    background: var(--mud-palette-primary);
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(139, 99, 67, 0.25);
}

.plan-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--mud-palette-lines-default) !important;
    border-radius: 0.75rem !important;
    background: var(--mud-palette-surface) !important;
    overflow: hidden;
    transition: all 250ms ease;
    height: 100%;
}

.plan-card.is-highlighted {
    border-color: color-mix(in srgb, var(--mud-palette-primary) 25%, var(--mud-palette-lines-default)) !important;
}

.plan-card-wrapper:hover .plan-card:not(.is-highlighted) {
    border-color: color-mix(in srgb, var(--mud-palette-primary) 40%, var(--mud-palette-lines-default)) !important;
}

.plan-icon-area {
    flex: none;
    height: 5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--mud-palette-primary) 5%, var(--mud-palette-background));
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.plan-icon-area svg {
    max-width: 3rem;
    max-height: 3rem;
    width: auto;
    height: auto;
}

.plan-header {
    flex: none;
    padding: 1rem 1.25rem 0.5rem;
    text-align: center;
}

.plan-name {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--mud-palette-text-primary);
    line-height: 1.2;
}

.plan-tooltip {
    display: block;
    margin-top: 0.1875rem;
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--mud-palette-text-secondary);
    line-height: 1.3;
}

.plan-price-area {
    flex: none;
    padding: 0.375rem 1.25rem 0.875rem;
    text-align: center;
}

.plan-price {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--mud-palette-primary);
}

.plan-divider {
    height: 1px;
    background: var(--mud-palette-lines-default);
    border: none;
    margin: 0;
}

.plan-features {
    flex: 1 1 auto;
    min-height: 3.75rem;
    padding: 0 1.25rem;
    margin: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.plan-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5625rem 0;
    border-bottom: 1px solid color-mix(in srgb, var(--mud-palette-lines-default) 60%, transparent);
}

.plan-feature-item:last-child {
    border-bottom: none;
}

.feature-check {
    flex: none;
    width: 0.3125rem;
    height: 0.3125rem;
    margin-top: 0.4375rem;
    background: var(--mud-palette-primary);
    border-radius: 50%;
}

.feature-text {
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--mud-palette-text-secondary);
}

.plan-action-area {
    flex: none;
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid var(--mud-palette-lines-default);
    background: color-mix(in srgb, var(--mud-palette-primary) 5%, var(--mud-palette-background));
}

@media (max-width: 959px) {
    .plans-grid {
        grid-template-columns: 1fr;
    }
}

/* Skeleton loading animations */
@keyframes skeleton-pulse {
    0%, 100% {
        opacity: 1;
        background-color: color-mix(in srgb, var(--mud-palette-lines-default) 40%, transparent);
    }
    50% {
        opacity: 0.75;
        background-color: color-mix(in srgb, var(--mud-palette-lines-default) 60%, transparent);
    }
}

.skeleton-pulse {
    animation: skeleton-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite !important;
}

.skeleton-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--mud-palette-lines-default) !important;
    border-radius: 0.75rem !important;
    background: var(--mud-palette-surface) !important;
    overflow: hidden;
    height: 100%;
}

.skeleton-icon-area {
    flex: none;
    height: 5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--mud-palette-primary) 5%, var(--mud-palette-background));
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.plan-header {
    flex: none;
    padding: 1rem 1.25rem 0.5rem;
    text-align: center;
}

.plan-price-area {
    flex: none;
    padding: 0.375rem 1.25rem 0.875rem;
    text-align: center;
}

.plan-features {
    flex: 1 1 auto;
    min-height: 3.75rem;
    padding: 0 1.25rem;
    margin: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.skeleton-feature {
    height: 14px;
}

.plan-divider {
    height: 1px;
    background: var(--mud-palette-lines-default);
    border: none;
    margin: 0;
}

.plan-action-area {
    flex: none;
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid var(--mud-palette-lines-default);
    background: color-mix(in srgb, var(--mud-palette-primary) 5%, var(--mud-palette-background));
}

/* Comparison table */
.comp-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.comp-table thead th {
    background: color-mix(in srgb, var(--mud-palette-primary) 5%, var(--mud-palette-background));
    border-bottom: 2px solid var(--mud-palette-primary);
    padding: 0.875rem 0.75rem;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    color: var(--mud-palette-primary);
    text-align: center;
}

.comp-table thead th:first-child {
    text-align: left;
    color: var(--mud-palette-text-primary);
    font-weight: 700;
    letter-spacing: -0.01em;
    background: transparent;
    border-bottom: 2px solid var(--mud-palette-primary);
}

.comp-table tbody tr:hover td {
    background-color: color-mix(in srgb, var(--mud-palette-primary) 5%, var(--mud-palette-background));
}

.comp-table tbody td {
    padding: 0.75rem 0.75rem;
    text-align: center;
    border-bottom: 1px solid color-mix(in srgb, var(--mud-palette-lines-default) 60%, transparent);
    vertical-align: middle;
    transition: background-color 150ms ease;
}

.comp-table tbody td:first-child {
    text-align: left;
    padding-left: 0;
}

.comp-table tbody tr:last-child td {
    border-bottom: none;
}

.comp-feature-name {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--mud-palette-text-secondary);
    line-height: 1.4;
}

.comp-feature-tooltip {
    cursor: help;
    border-bottom: 1px dashed color-mix(in srgb, var(--mud-palette-primary) 35%, transparent);
}

.comp-cell-value {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--mud-palette-text-primary);
}

.comp-check {
    color: var(--mud-palette-primary);
}

.comp-cross {
    color: var(--mud-palette-text-secondary);
}

@media (max-width: 767px) {
    .comp-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 0.5rem;
        border: 1px solid var(--mud-palette-lines-default);
    }

    .comp-table thead th,
    .comp-table tbody td {
        padding: 0.625rem 0.5rem;
        font-size: 0.8rem;
    }
}

/* Token type selection cards */
.token-type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}
@media (max-width: 900px) {
    .token-type-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .token-type-grid { grid-template-columns: 1fr; }
}
.token-type-card {
    position: relative;
    border: 1.5px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    padding: 1.125rem 1.25rem;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease;
    background: var(--mud-palette-background);
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    user-select: none;
}
.token-type-card:hover:not(.token-type-card--disabled) {
    border-color: var(--mud-palette-primary);
}
.token-type-card--selected {
    border-color: var(--mud-palette-primary) !important;
    background: color-mix(in srgb, var(--mud-palette-primary) 6%, var(--mud-palette-background));
}
.token-type-card--disabled {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}
.token-type-card-check {
    position: absolute;
    top: 0.875rem;
    right: 0.875rem;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    background: var(--mud-palette-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 160ms ease, transform 160ms ease;
    pointer-events: none;
}
.token-type-card--selected .token-type-card-check {
    opacity: 1;
    transform: scale(1);
}
.token-type-card-icon-wrap {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 8px;
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent);
    color: var(--mud-palette-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.375rem;
    flex-shrink: 0;
}
.token-type-card-name {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}
.token-type-card-desc {
    font-size: 0.775rem;
    color: var(--mud-palette-text-secondary);
    line-height: 1.45;
}

/* Token variant selection cards (Apple token mode A/B selection) */
.token-variant-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}
@media (max-width: 600px) {
    .token-variant-grid { grid-template-columns: 1fr; }
}
.token-variant-card {
    position: relative;
    border: 1.5px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    padding: 1.125rem 1.25rem;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease;
    background: var(--mud-palette-background);
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    user-select: none;
}
.token-variant-card:hover:not(.token-variant-card--disabled) {
    border-color: var(--mud-palette-primary);
}
.token-variant-card--selected {
    border-color: var(--mud-palette-primary) !important;
    background: color-mix(in srgb, var(--mud-palette-primary) 6%, var(--mud-palette-background));
}
.token-variant-card--disabled {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}
.token-variant-card-check {
    position: absolute;
    top: 0.875rem;
    right: 0.875rem;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    background: var(--mud-palette-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 160ms ease, transform 160ms ease;
    pointer-events: none;
}
.token-variant-card--selected .token-variant-card-check {
    opacity: 1;
    transform: scale(1);
}
.token-variant-card-icon-wrap {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 8px;
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent);
    color: var(--mud-palette-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.375rem;
    flex-shrink: 0;
}
.token-variant-card-name {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}
.token-variant-card-desc {
    font-size: 0.775rem;
    color: var(--mud-palette-text-secondary);
    line-height: 1.45;
}

/* Token mode selection cards (Apple token modes) */
.token-mode-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}
@media (max-width: 600px) {
    .token-mode-grid { grid-template-columns: 1fr; }
}
.token-mode-card {
    position: relative;
    border: 1.5px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    padding: 1.125rem 1.25rem;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease;
    background: var(--mud-palette-background);
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    user-select: none;
}
.token-mode-card:hover:not(.token-mode-card--disabled) {
    border-color: var(--mud-palette-primary);
}
.token-mode-card--selected {
    border-color: var(--mud-palette-primary) !important;
    background: color-mix(in srgb, var(--mud-palette-primary) 6%, var(--mud-palette-background));
}
.token-mode-card--disabled {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}
.token-mode-card-check {
    position: absolute;
    top: 0.875rem;
    right: 0.875rem;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    background: var(--mud-palette-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 160ms ease, transform 160ms ease;
    pointer-events: none;
}
.token-mode-card--selected .token-mode-card-check {
    opacity: 1;
    transform: scale(1);
}
.token-mode-card-icon-wrap {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 8px;
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent);
    color: var(--mud-palette-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.375rem;
    flex-shrink: 0;
}
.token-mode-card-name {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}
.token-mode-card-desc {
    font-size: 0.775rem;
    color: var(--mud-palette-text-secondary);
    line-height: 1.45;
}
/* ── Pin pad code editor ─────────────────────────────────────── */
/* Every pin is a compact unit: one keycap cell per digit with its
   two actions attached, laid out in a grid rather than table rows.
   State lives in the cells: primary tint = added but not yet saved
   to the device, dashed ghost = staged for removal (restorable). */
.pin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 20.5rem), 1fr));
    gap: 0.25rem 0.75rem;
    container-type: inline-size;
}
/* Status phrase and buttons travel together. In a single column the row
   spans the card, so the pair sits at the right edge and the free space
   falls between the cells and the pair; in two columns rows stay compact. */
.pin-row-trailing {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}
@container (max-width: 41.75rem) {
    .pin-row {
        justify-self: stretch;
    }
    .pin-row-trailing {
        margin-left: auto;
    }
    .pin-row-status {
        text-align: right;
    }
}
.pin-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    justify-self: start;
    padding: 0.25rem 0.25rem 0.25rem 0.375rem;
    border-radius: 8px;
    transition: background-color 120ms ease;
}
.pin-row:hover,
.pin-row:focus-within {
    background: color-mix(in srgb, var(--mud-palette-text-primary) 4%, transparent);
}
.pin-row-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
/* Delete stays quiet until the pin is hovered or focused, so a
   grid of pins does not become a grid of red icons. */
.pin-row-delete {
    color: var(--mud-palette-text-secondary) !important;
}
.pin-row:hover .pin-row-delete,
.pin-row-delete:focus-visible {
    color: var(--mud-palette-error) !important;
}
/* Cells never wrap: a pin is one unit, so the grid column and the
   narrow-screen sizes below are what keep an 8-digit pin on one line. */
.pin-digit-cells {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--pin-cell-gap, 0.25rem);
}
.pin-digit-cell {
    flex-shrink: 0;
    width: var(--pin-cell-width, 1.65rem);
    height: 1.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 6px;
    background: var(--mud-palette-background);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
    line-height: 1;
}
.pin-row--new .pin-digit-cell {
    background: color-mix(in srgb, var(--mud-palette-primary) 8%, transparent);
    border-color: color-mix(in srgb, var(--mud-palette-primary) 30%, transparent);
    color: var(--mud-palette-primary);
}
.pin-row--removed .pin-digit-cell,
.pin-digit-cells--empty .pin-digit-cell {
    border-style: dashed;
    background: transparent;
    color: var(--mud-palette-text-secondary);
    opacity: 0.6;
}
/* Row states, in the pad's own terms. Dashed = not real on the pad yet,
   solid = live. The phrase beside the cells is the only status the row
   carries: no icon, no tooltip, one accent colour. */
.pin-row--pending .pin-digit-cell {
    border-style: dashed;
    border-color: color-mix(in srgb, var(--mud-palette-warning) 60%, transparent);
    color: var(--mud-palette-text-secondary);
}
.pin-row-status {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.2;
    color: var(--mud-palette-warning);
    /* Long phrases (German) wrap to a second line instead of pushing the buttons off the card. */
    min-width: 0;
    text-wrap: balance;
}
.pin-row--removed .pin-row-status {
    color: var(--mud-palette-text-secondary);
}
/* A code on its way off the pad: struck through at the cell midline. */
.pin-row--removed .pin-digit-cells {
    position: relative;
}
.pin-row--removed .pin-digit-cells::after {
    content: "";
    position: absolute;
    left: 0.15rem;
    right: 0.15rem;
    top: 50%;
    height: 1px;
    background: var(--mud-palette-text-secondary);
    opacity: 0.55;
    pointer-events: none;
}

/* The one moving thing: the row being sent breathes its dashed border
   until the pad answers or the wait ends. */
.pin-row--busy {
    pointer-events: none;
}
.pin-row--busy .pin-row-status {
    color: var(--mud-palette-text-secondary);
}
.pin-row--busy .pin-digit-cell {
    border-style: dashed;
    animation: pin-row-sending 1.4s ease-in-out infinite;
}
@keyframes pin-row-sending {
    0%, 100% { border-color: color-mix(in srgb, var(--mud-palette-warning) 60%, transparent); }
    50% { border-color: color-mix(in srgb, var(--mud-palette-warning) 15%, transparent); }
}

.pin-row-busy {
    margin: 0 0.25rem;
}

.pin-unlinked-hint {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: var(--mud-palette-warning);
}
.pin-empty {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8125rem;
    color: var(--mud-palette-text-secondary);
}
/* Phones: 8 cells + two buttons must fit a ~280px card interior. */
@media (max-width: 480px) {
    .pin-grid {
        --pin-cell-width: 1.35rem;
        --pin-cell-gap: 0.2rem;
    }
    .pin-row {
        gap: 0.375rem;
        padding: 0.25rem;
    }
    .pin-row-actions .mud-icon-button {
        padding: 0.25rem;
    }
}

/* Add row: mono digits in the field, a labelled button at the same
   height as the dense outlined input. */
.pin-add {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}
/* Six entry boxes drawn as keycaps: typing a pin looks like the pin it becomes. */
.pin-entry {
    display: flex;
    gap: var(--pin-cell-gap, 0.25rem);
}
.pin-entry-cell {
    appearance: none;
    -webkit-appearance: none;
    width: 2rem;
    height: 2.25rem;
    padding: 0;
    text-align: center;
    font-size: 0.9375rem;
    caret-color: var(--mud-palette-primary);
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.pin-entry-cell:focus {
    outline: none;
    border-color: var(--mud-palette-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--mud-palette-primary) 18%, transparent);
}
.pin-entry--error .pin-entry-cell {
    border-color: var(--mud-palette-error);
}
.pin-entry-error {
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: var(--mud-palette-error);
}
.pin-limit-hint {
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: var(--mud-palette-text-secondary);
}
.pin-count {
    margin-left: auto;
    align-self: center;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    color: var(--mud-palette-text-secondary);
    white-space: nowrap;
}
.pin-count--full {
    color: var(--mud-palette-warning);
}
.pin-add-button {
    height: 2.5rem;
    flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
    .pin-row { transition: none; }
    .pin-row--busy .pin-digit-cell { animation: none; }
}

/* Pin pad pairing dialog. The passkey borrows the keycap cells the pin
   editor already uses, scaled up: the user is literally comparing these
   cells with the physical keypad, so they should look like one. */
.pairing-dialog {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.pairing-phase {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}
.passkey-cells {
    display: flex;
    justify-content: center;
    gap: 0.625rem;
    margin: 1.5rem 0 2.25rem;
}
.passkey-cell {
    width: 3.25rem;
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid color-mix(in srgb, var(--mud-palette-primary) 30%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--mud-palette-primary) 8%, transparent);
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 600;
    line-height: 1;
    color: var(--mud-palette-primary);
    animation: passkey-reveal 260ms ease-out both;
    animation-delay: calc(var(--passkey-index, 0) * 45ms);
}
@keyframes passkey-reveal {
    from { opacity: 0; transform: translateY(0.35rem); }
    to { opacity: 1; transform: none; }
}
@media (max-width: 600px) {
    .passkey-cells { gap: 0.375rem; }
    .passkey-cell { width: 2.25rem; height: 3rem; font-size: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) {
    .passkey-cell { animation: none; }
}

/* ── Always-open schedule: week calendar (wsc) ──────────────────────── */

.wsc {
    --wsc-gutter: 44px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    background: var(--mud-palette-surface);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}
.wsc-head,
.wsc-body {
    display: grid;
    grid-template-columns: var(--wsc-gutter) repeat(7, minmax(0, 1fr));
}
.wsc-head {
    border-bottom: 1px solid var(--mud-palette-lines-default);
    background: color-mix(in srgb, var(--mud-palette-primary) 3%, var(--mud-palette-surface));
}
.wsc-day-name {
    text-align: center;
    padding: 0.5rem 0;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
}
.wsc-body { position: relative; }
.wsc-gutter { position: relative; }
.wsc-hour-label {
    position: absolute;
    right: 6px;
    transform: translateY(-50%);
    font-size: 0.6875rem;
    font-variant-numeric: tabular-nums;
    color: var(--mud-palette-text-secondary);
}
.wsc-col {
    position: relative;
    border-left: 1px solid var(--mud-palette-lines-default);
    background-image: repeating-linear-gradient(to bottom,
        transparent 0, transparent calc(var(--wsc-hour) - 1px),
        color-mix(in srgb, var(--mud-palette-lines-default) 55%, transparent) calc(var(--wsc-hour) - 1px),
        color-mix(in srgb, var(--mud-palette-lines-default) 55%, transparent) var(--wsc-hour));
}
/* The hit layer takes every pointer event of its column; vertical panning stays with the browser on touch. */
.wsc-hit {
    position: absolute;
    inset: 0;
    z-index: 1;
    cursor: crosshair;
    touch-action: pan-y;
}
.wsc--disabled .wsc-hit { cursor: default; }
/* While a save is under way the spans are shown but not touchable: no hover, no grab, slightly faded. */
.wsc--disabled .wsc-block { pointer-events: none; opacity: 0.6; }
.wsc--dragging,
.wsc--dragging * { cursor: grabbing !important; }
/* While a gesture runs, every column's hit layer lies above the blocks so offsets stay column-relative. */
.wsc--dragging .wsc-hit { z-index: 3; }
.wsc-block {
    position: absolute;
    left: 3px;
    right: 3px;
    z-index: 2;
    min-height: 4px;
    border-radius: 6px;
    border: 1px solid color-mix(in srgb, var(--mud-palette-primary) 45%, transparent);
    border-left: 3px solid var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 16%, var(--mud-palette-surface));
    color: var(--mud-palette-primary);
    overflow: hidden;
    cursor: grab;
    touch-action: pan-y;
    transition: background 120ms ease, box-shadow 120ms ease;
}
.wsc-block > * { pointer-events: none; }
.wsc-block:hover { background: color-mix(in srgb, var(--mud-palette-primary) 24%, var(--mud-palette-surface)); }
.wsc-block:focus-visible { outline: 2px solid var(--mud-palette-primary); outline-offset: 1px; }
.wsc-block--selected {
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--mud-palette-primary) 25%, transparent);
}
.wsc-block--selected:hover { background: var(--mud-palette-primary); }
.wsc-block--preview {
    z-index: 4;
    opacity: 0.75;
    border-style: dashed;
    pointer-events: none;
}
.wsc-block-label {
    display: block;
    padding: 7px 5px 2px;
    font-size: 0.6875rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wsc-block-label > span { display: block; overflow: hidden; text-overflow: ellipsis; }
.wsc-block-label-end { font-weight: 500; opacity: 0.8; }
.wsc-handle {
    position: absolute;
    left: 0;
    right: 0;
    height: 7px;
    cursor: ns-resize;
    pointer-events: auto !important;
}
.wsc-handle--start { top: 0; }
.wsc-handle--end { bottom: 0; }
.wsc-handle::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 3px;
    width: 18px;
    height: 2px;
    margin-left: -9px;
    border-radius: 2px;
    background: currentColor;
    opacity: 0;
    transition: opacity 120ms ease;
}
.wsc-block:hover .wsc-handle::after,
.wsc-block--selected .wsc-handle::after { opacity: 0.6; }

@media (max-width: 600px) {
    /* Phone columns are ~32px wide: hours without minutes, blocks show their start only (the panel has the rest). */
    .wsc { --wsc-gutter: 24px; }
    .wsc-day-name { font-size: 0.625rem; letter-spacing: 0; }
    .wsc-hour-label { right: 4px; font-size: 0.625rem; }
    .wsc-hour-minutes { display: none; }
    .wsc-block { left: 2px; right: 2px; border-left-width: 2px; }
    .wsc-block-label { padding: 6px 1px 1px; font-size: 0.5625rem; letter-spacing: -0.01em; }
    .wsc-block-label-end { display: none !important; }
}

/* ── Always-open schedule page (ls) ─────────────────────────────────── */

.ls-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
}
.ls-status .mud-chip { margin: 0; }
.ls-counter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--mud-palette-text-secondary);
    font-variant-numeric: tabular-nums;
}
.ls-counter-bar {
    width: 72px;
    height: 6px;
    border-radius: 9999px;
    background: var(--mud-palette-lines-default);
    overflow: hidden;
}
.ls-counter-bar > div {
    height: 100%;
    background: var(--mud-palette-primary);
    transition: width 160ms ease;
}
.ls-counter--full { color: var(--mud-palette-warning); }
.ls-counter--full .ls-counter-bar > div { background: var(--mud-palette-warning); }
.ls-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 1rem;
    align-items: start;
}
.ls-panel {
    position: sticky;
    top: 1rem;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    padding: 1rem;
    background: var(--mud-palette-surface);
}
.ls-hint {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.ls-field-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--mud-palette-text-secondary);
    margin-bottom: 0.25rem;
}
.ls-field {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
@media (max-width: 960px) {
    .ls-layout { grid-template-columns: minmax(0, 1fr); }
    .ls-panel { position: static; }
}
.ls-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Schedule save bar: sticky, so it keeps the content column's width next to the nav drawer and pins to the
   bottom of the viewport while the calendar scrolls. On phones it clears the fixed bottom navigation. */
.ls-footer {
    position: sticky;
    bottom: 1rem;
    z-index: 5;
    /* A compact bar centred under the calendar on desktop; phones use the full width (below). */
    width: fit-content;
    min-width: min(100%, 26rem);
    max-width: 100%;
    margin: 1rem auto 0;
    padding: 0.625rem 0.75rem 0.625rem 1rem;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    background: var(--mud-palette-surface);
    box-shadow: 0 6px 24px -12px rgba(0, 0, 0, 0.25);
}
.ls-footer--compact {
    bottom: calc(84px + 0.5rem);
    width: auto;
    min-width: 0;
    margin: 1rem 0 0;
}
.ls-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    flex-wrap: wrap;
}
.ls-footer-text {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--mud-palette-text-secondary);
    min-width: 0;
}
.ls-unsaved::before {
    content: "";
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    margin-right: 0.4rem;
    border-radius: 9999px;
    background: var(--mud-palette-warning);
    vertical-align: middle;
}
/* While a save is under way the bar keeps its place and says what it is waiting for, beside a small spinner. */
.ls-footer-busy .ls-footer-spinner {
    width: 0.875rem;
    height: 0.875rem;
    margin-right: 0.25rem;
}
.ls-footer-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

/* ── Snackbars ───────────────────────────────────────────────────────────────────────────────────────────────────
   Configured once in SnackbarSettings (position, timing, icons). A severity-tinted card below the app bar, top right.
   Its one signal is the line along the top edge: in the severity colour, draining while the message is on its timer
   (--snackbar-visible-duration, from SnackbarSettings) and staying full on a message that waits to be closed
   (.snackbar-persistent). Everything else stays out of the way of the message. */
/* Top positions start below the dense app bar (3/4 of --mud-appbar-height) so they never cover its settings menu. */
#mud-snackbar-container[class*="mud-snackbar-location-top"] {
    top: calc(var(--mud-appbar-height, 64px) * 0.75 + 12px);
    width: min(420px, calc(100vw - 32px));
}

#mud-snackbar-container.mud-snackbar-location-top-right {
    right: 16px;
}

#mud-snackbar-container.mud-snackbar-location-top-left {
    left: 16px;
}

/* On a phone every top position is the same full-width strip. */
@media (max-width: 599.98px) {
    #mud-snackbar-container[class*="mud-snackbar-location-top"] {
        left: 16px;
        right: 16px;
        width: auto;
        transform: none;
    }
}

#mud-snackbar-container .mud-snackbar {
    --snackbar-accent: var(--mud-palette-info);
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    min-width: 0;
    max-width: none;
    margin-top: 8px;
    padding: 14px 8px 14px 16px;
    /* A wash and a border in the severity colour set the card apart from the white cards of the page beneath it. */
    border: 1px solid color-mix(in srgb, var(--snackbar-accent) 35%, var(--mud-palette-surface));
    border-radius: 12px;
    background: color-mix(in srgb, var(--snackbar-accent) 8%, var(--mud-palette-surface));
    color: var(--mud-palette-text-primary);
    font-family: Outfit, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.45;
    /* The inset line is the timer's track, so a half-drained line reads as time left, not a broken border. */
    box-shadow: inset 0 3px 0 color-mix(in srgb, var(--snackbar-accent) 22%, transparent),
        0 2px 4px rgb(39 39 47 / 0.08), 0 20px 44px -12px rgb(39 39 47 / 0.42);
    animation: snackbar-drop 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

#mud-snackbar-container .mud-snackbar::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: var(--snackbar-accent);
    transform-origin: left center;
    /* In step with MudBlazor's countdown: it starts after the show transition and does not pause on hover (the
       pointer only holds the final fade-out), so neither does the line. */
    animation: snackbar-drain var(--snackbar-visible-duration, 5000ms) linear var(--snackbar-show-duration, 180ms) both;
}

#mud-snackbar-container .mud-snackbar.snackbar-persistent::before {
    animation: none;
}

#mud-snackbar-container .mud-snackbar[class*="-success"] { --snackbar-accent: var(--mud-palette-success); }
#mud-snackbar-container .mud-snackbar[class*="-error"] { --snackbar-accent: var(--mud-palette-error); }
#mud-snackbar-container .mud-snackbar[class*="-warning"] { --snackbar-accent: var(--mud-palette-warning); }
#mud-snackbar-container .mud-snackbar[class*="-info"] { --snackbar-accent: var(--mud-palette-info); }

#mud-snackbar-container .mud-snackbar .mud-snackbar-icon {
    margin: 0;
    padding: 1px 0 0;
    opacity: 1;
    color: var(--snackbar-accent);
    font-size: 22px;
}

#mud-snackbar-container .mud-snackbar .snackbar-icon-svg {
    width: 22px;
    height: 22px;
}

#mud-snackbar-container .mud-snackbar .mud-snackbar-content-message {
    flex: 1;
    padding: 0;
    align-self: center;
    overflow-wrap: anywhere;
}

#mud-snackbar-container .mud-snackbar .mud-snackbar-content-action {
    align-self: flex-start;
    margin: -6px 0 -6px auto;
    padding: 0;
}

#mud-snackbar-container .mud-snackbar .mud-snackbar-content-action > button {
    color: var(--mud-palette-text-secondary);
    padding: 6px;
}

#mud-snackbar-container .mud-snackbar .mud-snackbar-content-action > button:hover {
    color: var(--mud-palette-text-primary);
    background: color-mix(in srgb, var(--mud-palette-text-primary) 7%, transparent);
}

#mud-snackbar-container .mud-snackbar .mud-snackbar-content-action > button:focus-visible {
    outline: 2px solid var(--snackbar-accent);
    outline-offset: 1px;
}

@keyframes snackbar-drop {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: none; }
}

@keyframes snackbar-drain {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

@media (prefers-reduced-motion: reduce) {
    #mud-snackbar-container .mud-snackbar { animation: none; }
    #mud-snackbar-container .mud-snackbar::before { animation: none; }
}
