:root {
    --background: oklch(0.985 0.002 155);
    --foreground: oklch(0.16 0.02 155);
    --card: oklch(1 0 0);
    --card-foreground: oklch(0.16 0.02 155);
    --primary: oklch(0.765 0.168 131);
    --primary-foreground: oklch(0 0 0);
    --secondary: oklch(0.95 0.01 155);
    --secondary-foreground: oklch(0.25 0.03 155);
    --muted: oklch(0.95 0.008 155);
    --muted-foreground: oklch(0.50 0.02 155);
    --accent: oklch(0.92 0.025 155);
    --accent-foreground: oklch(0.25 0.04 155);
    --destructive: oklch(0.577 0.245 27.325);
    --border: oklch(0.90 0.015 155);
    --radius: 0.625rem;
    --sidebar-bg: oklch(0.765 0.168 131 / 0.10);
    --sidebar-border: oklch(0.765 0.168 131 / 0.20);
    --sidebar-accent: oklch(0.765 0.168 131 / 0.15);
    --sidebar-accent-hover: oklch(0.765 0.168 131 / 0.12);
    --font-sans: 'Plus Jakarta Sans', Helvetica, Arial, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

body {
    font-family: var(--font-sans);
    color: var(--foreground);
    background: var(--background);
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.app-shell {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

.sidebar {
    display: flex;
    flex-direction: column;
    width: 240px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    transition: width 200ms ease;
    flex-shrink: 0;
}

.sidebar__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    border-bottom: 1px solid var(--sidebar-border);
    min-height: 56px;
}

.sidebar--collapsed {
    width: 80px;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    min-width: 0;
}

.sidebar--collapsed .sidebar__header {
    padding: 12px;
    gap: 4px;
}

.sidebar__logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.sidebar__brand {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar__title {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
}

.sidebar__subtitle {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    line-height: 1.2;
}

.sidebar__toggle {
    margin-left: auto !important;
    color: var(--muted-foreground) !important;
}

.sidebar--collapsed .sidebar__toggle {
    margin-left: 0 !important;
}

.sidebar__nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.sidebar__group {
    margin-bottom: 16px;
}

.sidebar__group-label {
    display: block;
    padding: 0 8px;
    margin-bottom: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--muted-foreground);
    text-decoration: none;
    position: relative;
    transition: background 150ms ease, color 150ms ease;
}

.sidebar--collapsed .sidebar__link {
    justify-content: center;
}

.sidebar__link:hover {
    background: var(--sidebar-accent-hover);
    color: var(--foreground);
    text-decoration: none;
}

.sidebar__link--active {
    background: var(--sidebar-accent);
    color: var(--foreground);
    font-weight: 500;
}

.sidebar__link--active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 20px;
    width: 3px;
    border-radius: 0 9999px 9999px 0;
    background: var(--primary);
}

.sidebar__footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--sidebar-border);
    margin-top: auto !important;
}

.sidebar__user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--sidebar-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 500;
    flex-shrink: 0;
}

.sidebar__user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar__user-name {
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.2;
}

.sidebar__user-role {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    line-height: 1.2;
}

.sidebar--collapsed .sidebar__footer {
    justify-content: center;
}

.sidebar__version {
    padding: 0 12px 12px;
    font-size: 0.6875rem;
    color: var(--muted-foreground);
    text-align: center;
}

/* Settings dialog: match the app's main background instead of white surface */
.settings-dialog.mud-paper,
.settings-dialog {
    background-color: var(--background) !important;
}

/* Rounded card containers for settings sections (dashboard .waste-card look) */
.settings-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    padding: 24px;
}

/* Users table: readable, modern look inside the white settings card */
.users-table {
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.users-table th {
    background: #f4f7fa !important;
    color: var(--muted-foreground) !important;
    font-size: 0.6875rem !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border) !important;
}

.users-table th,
.users-table td {
    padding: 12px 16px !important;
}

.users-table tbody td {
    border-bottom: 1px solid var(--border) !important;
}

.users-table tbody tr:last-child td {
    border-bottom: none !important;
}

.users-table tbody tr:hover {
    background: var(--accent) !important;
}

/* Profile menu: custom dropdown opened from the sidebar footer */
.sidebar__footer-wrap {
    position: relative;
    margin-top: auto;
}

.sidebar__footer-wrap .sidebar__footer {
    margin-top: 0 !important;
}

.profile-menu__backdrop {
    position: fixed;
    inset: 0;
    z-index: 49;
}

.profile-menu {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 8px;
    right: auto;
    width: 264px;
    max-width: calc(100vw - 32px);
    z-index: 50;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    padding: 6px;
    overflow: hidden;
}

.profile-menu__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin: -6px -6px 0;
    background: #f4f7fa;
}

.profile-menu__avatar {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--sidebar-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9375rem;
    font-weight: 600;
    flex-shrink: 0;
}

.profile-menu__identity {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.profile-menu__name {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-menu__email {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-menu__sep {
    height: 1px;
    background: var(--border);
    margin: 0 -6px;
    opacity: 0.5;
}

.profile-menu__version {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    font-size: 0.6875rem;
    color: var(--muted-foreground);
    text-align: center;
}

.profile-menu__item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    margin: 2px 0;
    padding: 8px 10px;
    border: none;
    border-radius: 8px;
    background: none;
    cursor: pointer;
    font-family: inherit;
    color: inherit;
    text-align: left;
}

/* The first item sits just below the header divider — give it a little breathing room. */
.profile-menu__sep + .profile-menu__item {
    margin-top: 6px;
}

.profile-menu__item:hover {
    background: oklch(0.97 0.008 155);
}

.profile-menu__item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--accent);
    color: var(--muted-foreground);
    flex-shrink: 0;
}

.profile-menu__item:hover .profile-menu__item-icon {
    background: var(--card);
}

.profile-menu__item-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.profile-menu__item-title {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25;
}

.profile-menu__item-sub {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    line-height: 1.2;
}

@media (max-width: 768px) {
    .sidebar {
        width: 64px;
    }

    .sidebar__header {
        justify-content: center;
        padding: 12px;
    }

    .sidebar__brand,
    .sidebar__group-label,
    .sidebar__link span,
    .sidebar__user-info,
    .sidebar__toggle {
        display: none;
    }

    .sidebar__link,
    .sidebar__footer {
        justify-content: center;
    }
}

/* Page header */
.page-header {
    margin-bottom: 24px;
}

.page-header__title {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.3;
    margin: 0;
}

.page-header__subtitle {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin: 4px 0 0;
    max-width: 36rem;
}

.page-header__subtitle--wide {
    max-width: 42rem;
}

.page-header__step-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin-bottom: 12px;
}

.page-header__badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px 10px;
    border-radius: 6px;
}

.page-header__badge--secondary {
    background: rgba(0, 0, 0, 0.06);
    color: var(--foreground);
}

.page-header__badge--amber {
    color: #b45309;
    border: 1px solid #fde68a;
    background: #fffbeb;
}

.page-header__badge--red {
    color: #dc2626;
    border: 1px solid #fecaca;
    background: #fef2f2;
}

/* ── Waste table grid ────────────────────────────────────────────────────── */

.waste-table {
    display: grid;
    grid-template-columns: 24px minmax(70px, 1fr) 40px minmax(80px, 1.2fr) minmax(100px, 2fr) minmax(60px, 1fr) minmax(60px, 1fr) minmax(60px, 1fr) max-content;
    gap: 8px 12px;
}

.waste-table-row {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    align-items: center;
    padding-inline: 16px;
}

.waste-table__header {
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
}

.waste-table__header--right {
    text-align: right;
}

/* ── Reset MudBlazor's p margin inside our components ───────────────────── */

.waste-card p,
.rg-page p,
.re-page p,
.rs-page p,
.rs-confirmed p {
    margin-bottom: 0;
}

/* ── Waste card ──────────────────────────────────────────────────────────── */

.waste-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    padding: 24px 0;
}

.waste-card--dashed {
    border-style: dashed;
}

.waste-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 0 24px 12px;
}

.waste-card__title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.waste-card__title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
}

.waste-card__title--sm {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.waste-card__description {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin: 6px 0 0;
}

.waste-card__description--sm {
    font-size: 0.75rem;
}

.waste-card__content {
    padding: 0 24px;
}

.waste-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 4px 0;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

/* ── Outline badge (shared) ──────────────────────────────────────────────── */

.badge-outline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    white-space: nowrap;
    line-height: 1.4;
}

.badge-outline--lg {
    padding: 4px 10px;
}

.badge-outline--mono {
    font-family: var(--font-mono);
    justify-content: center;
}

.badge-outline--emerald {
    color: #047857;
    border-color: #a7f3d0;
    background: #ecfdf5;
}

.badge-outline--red {
    color: #b91c1c;
    border-color: #fecaca;
    background: #fef2f2;
}

.badge-outline--amber {
    color: #b45309;
    border-color: #fde68a;
    background: #fffbeb;
}

.badge-outline--amber-border {
    color: #b45309;
    border-color: #fcd34d;
}

.badge-outline--orange {
    color: #c2410c;
    border-color: #fed7aa;
    background: #fff7ed;
}

.badge-outline--done {
    color: oklch(0.45 0.13 150);
    border-color: oklch(0.78 0.13 150 / 0.42);
    background: oklch(0.96 0.035 150);
    font-size: 0.625rem;
    padding: 1px 7px;
}

.badge-outline--planned {
    color: oklch(0.50 0.02 155 / 0.50);
    border-color: oklch(0.50 0.02 155 / 0.20);
    font-size: 0.625rem;
    padding: 1px 6px;
    margin-left: auto;
}

/* ── Waste record row ────────────────────────────────────────────────────── */

.waste-record {
    display: contents;
}

.waste-record__trigger {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    align-items: center;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: none;
    cursor: pointer;
    text-align: left;
    width: 100%;
    font-family: inherit;
    transition: background 150ms ease;
}

.waste-record__trigger:hover {
    background: oklch(0.95 0.008 155 / 0.30);
}

.waste-record__trigger--expanded {
    border-color: oklch(0.765 0.168 131 / 0.20);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.waste-record__chevron {
    width: 16px;
    height: 16px;
    transition: transform 200ms ease;
    opacity: 0.5;
}

.waste-record__chevron--open {
    transform: rotate(180deg);
}

.waste-record__text {
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.waste-record__text--dim {
    opacity: 0.4;
}

.waste-record__text--dimmer {
    opacity: 0.5;
}

.waste-record__mass {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--foreground);
    text-align: right;
}

.waste-record__mass--right {
    text-align: right;
}

.waste-record__mass--missing {
    color: var(--destructive);
}

/* ── Waste detail (expanded section) ─────────────────────────────────────── */

.waste-detail {
    grid-column: 1 / -1;
    padding: 4px 16px 16px;
    border: 1px solid oklch(0.765 0.168 131 / 0.20);
    border-top: 1px solid var(--border);
    background: oklch(0.95 0.008 155 / 0.20);
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.waste-detail__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px 24px;
    margin-top: 8px;
}

@media (min-width: 1024px) {
    .waste-detail__grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.waste-detail__actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* ── Detail field ────────────────────────────────────────────────────────── */

.detail-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-field__label {
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
}

.detail-field__value {
    font-size: 0.875rem;
}

.detail-field__value--mono {
    font-family: var(--font-mono);
}

.detail-field__value--missing {
    color: var(--destructive);
}

/* ── Permit meter ────────────────────────────────────────────────────────── */

.permit-meter--compact {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.permit-meter__track {
    width: 100%;
    height: 6px;
    border-radius: 9999px;
    background: var(--muted);
    overflow: hidden;
}

.permit-meter__track--lg {
    height: 8px;
}

.permit-meter__fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 300ms ease;
}

.permit-meter__fill--ok {
    background: #10b981;
}

.permit-meter__fill--near {
    background: #f59e0b;
}

.permit-meter__fill--exceeded {
    background: var(--destructive);
}

.permit-meter__label {
    font-size: 0.625rem;
    font-weight: 500;
    line-height: 1;
}

.permit-meter__label--ok {
    color: #15803d;
}

.permit-meter__label--near {
    color: #b45309;
}

.permit-meter__label--exceeded {
    color: var(--destructive);
}

.permit-meter__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
}

.permit-meter__header-label {
    color: var(--muted-foreground);
}

.permit-meter__header-value {
    font-weight: 600;
}

.permit-meter__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.625rem;
    color: var(--muted-foreground);
}

.permit-meter__expanded {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.permit-meter__alert {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
}

.permit-meter__alert--exceeded {
    background: oklch(0.577 0.245 27.325 / 0.10);
    border: 1px solid oklch(0.577 0.245 27.325 / 0.20);
    color: var(--destructive);
}

.permit-meter__alert--near {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #b45309;
}

/* ── Wizard stepper ──────────────────────────────────────────────────────── */

.wizard {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 32px;
}

.wizard__steps {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    flex: 1;
    padding-bottom: 2px;
}

.wizard__step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.875rem;
    white-space: nowrap;
    flex-shrink: 0;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 150ms ease;
}

.wizard__step:hover {
    opacity: 0.8;
}

.wizard__step--active {
    background: var(--primary);
    color: var(--primary-foreground);
    font-weight: 500;
}

.wizard__step--completed {
    background: var(--accent);
    color: var(--accent-foreground);
}

.wizard__step--future {
    background: var(--muted);
    color: var(--muted-foreground);
}

.wizard__step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid currentColor;
    font-size: 0.625rem;
}

.wizard__separator {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.4;
}

.wizard__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ── Buttons (ghost / outline / primary / sm) ────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0 12px;
    height: 28px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 150ms ease, color 150ms ease;
}

.btn--md {
    height: 32px;
    padding: 0 14px;
    font-size: 0.875rem;
}

.btn--default {
    height: 36px;
    padding: 0 16px;
    font-size: 0.875rem;
    gap: 8px;
}

.btn--xs {
    height: 24px;
    padding: 0 8px;
    gap: 4px;
}

.btn--ghost {
    background: transparent;
    color: var(--muted-foreground);
}

.btn--ghost:hover {
    background: var(--accent);
    color: var(--foreground);
}

.btn--outline {
    background: var(--background);
    color: var(--foreground);
    border: 1px solid var(--border);
}

.btn--outline:hover {
    background: var(--accent);
}

.btn--primary {
    background: var(--primary);
    color: var(--primary-foreground);
}

.btn--primary:hover {
    background: oklch(0.72 0.168 131);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.btn__icon--spin {
    animation: kpo-spin 0.8s linear infinite;
}

@keyframes kpo-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── MudBlazor snackbar overrides ───────────────────────────────────────── */

.mud-snackbar.mud-snackbar {
    position: relative;
    min-width: min(420px, calc(100vw - 32px));
    max-width: min(520px, calc(100vw - 32px));
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    background-color: var(--card);
    color: var(--foreground);
    box-shadow: 0 12px 32px oklch(0.16 0.02 155 / 0.12);
    font-family: var(--font-sans);
    letter-spacing: -0.01em;
    overflow: hidden;
}

.mud-snackbar.mud-snackbar-filled-success,
.mud-snackbar.mud-snackbar-filled-error,
.mud-snackbar.mud-snackbar-filled-warning,
.mud-snackbar.mud-snackbar-filled-info,
.mud-snackbar.mud-snackbar-filled-normal,
.mud-snackbar.mud-alert-filled-success,
.mud-snackbar.mud-alert-filled-error,
.mud-snackbar.mud-alert-filled-warning,
.mud-snackbar.mud-alert-filled-info,
.mud-snackbar.mud-alert-filled-normal {
    background: var(--card);
    background-color: var(--card);
    color: var(--foreground);
}

.mud-snackbar.mud-snackbar::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--primary);
}

.mud-snackbar.mud-snackbar .mud-snackbar-content-message {
    font-size: 0.875rem;
    line-height: 1.45;
    padding: 0 4px;
    color: var(--foreground);
}

.mud-snackbar.mud-snackbar .mud-snackbar-icon {
    color: var(--primary);
}

.mud-snackbar.mud-snackbar-success::before,
.mud-snackbar.mud-snackbar-filled-success::before,
.mud-snackbar.mud-alert-filled-success::before {
    background: var(--primary);
}

.mud-snackbar.mud-snackbar-error::before,
.mud-snackbar.mud-snackbar-filled-error::before,
.mud-snackbar.mud-alert-filled-error::before {
    background: var(--destructive);
}

.mud-snackbar.mud-snackbar-error .mud-snackbar-icon,
.mud-snackbar.mud-snackbar-filled-error .mud-snackbar-icon,
.mud-snackbar.mud-alert-filled-error .mud-snackbar-icon {
    color: var(--destructive);
}

.mud-snackbar.mud-snackbar-warning::before,
.mud-snackbar.mud-snackbar-filled-warning::before,
.mud-snackbar.mud-alert-filled-warning::before {
    background: oklch(0.75 0.183 55);
}

.mud-snackbar.mud-snackbar-warning .mud-snackbar-icon,
.mud-snackbar.mud-snackbar-filled-warning .mud-snackbar-icon,
.mud-snackbar.mud-alert-filled-warning .mud-snackbar-icon {
    color: oklch(0.75 0.183 55);
}

.mud-snackbar.mud-snackbar .mud-snackbar-close-icon {
    color: var(--muted-foreground);
}

.mud-snackbar.mud-snackbar .mud-snackbar-close-icon:hover {
    color: var(--foreground);
}

@media (max-width: 640px) {
    .mud-snackbar.mud-snackbar {
        min-width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        border-radius: 8px;
    }
}

/* ── Planned module items ────────────────────────────────────────────────── */

.planned-modules {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.planned-module {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px dashed oklch(0.50 0.02 155 / 0.20);
    color: oklch(0.50 0.02 155 / 0.60);
    font-size: 0.875rem;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */

.waste-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 32px 0;
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--muted-foreground);
}

.waste-empty__icon {
    width: 32px;
    height: 32px;
    margin: 0 auto 8px;
    opacity: 0.3;
}

.waste-empty__title {
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0;
}

.waste-empty__text {
    font-size: 0.75rem;
    margin: 4px 0 0;
}

/* ── Waste page sections gap ─────────────────────────────────────────────── */

.waste-sections {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Report Generator page ──────────────────────────────────────────────── */

.rg-page {
    padding: 24px;
}

.rg-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.rg-header__title {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.3;
    margin: 0;
}

.rg-header__subtitle {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin: 4px 0 0;
    max-width: 36rem;
}

.rg-header__badges {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Year selector ──────────────────────────────────────────────────────── */

.rg-year-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    margin-bottom: 32px;
}

.rg-year-selector__label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted-foreground);
}

.rg-dropdown {
    position: relative;
}

.rg-dropdown__trigger {
    font-weight: 600;
}

.rg-dropdown__value {
    min-width: 2.5rem;
    text-align: center;
}

.rg-dropdown__chevron {
    opacity: 0.6;
}

.rg-dropdown__backdrop {
    position: fixed;
    inset: 0;
    z-index: 49;
}

.rg-dropdown__menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 50;
    min-width: 140px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.rg-dropdown__item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    background: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--foreground);
    transition: background 150ms ease;
}

.rg-dropdown__item:hover {
    background: var(--accent);
}

.rg-dropdown__badge {
    font-size: 0.625rem;
    font-weight: 500;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--secondary);
    color: var(--secondary-foreground);
}

/* ── 3-column grid ──────────────────────────────────────────────────────── */

.rg-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 1024px) {
    .rg-grid {
        grid-template-columns: 2fr 1fr;
    }
}

.rg-grid__main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.rg-grid__sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── CTA card ───────────────────────────────────────────────────────────── */

.rg-cta-card {
    border-color: oklch(0.765 0.168 131 / 0.20);
    background: oklch(0.765 0.168 131 / 0.02);
}

.rg-cta-card .waste-card__header {
    padding-bottom: 16px;
}

.rg-cta-card__title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.rg-cta-card__icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: oklch(0.765 0.168 131 / 0.10);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rg-cta-card__year {
    font-weight: 500;
    color: var(--foreground);
}

.rg-cta-card__desc {
    font-size: 0.875rem;
    line-height: 1.625;
}

.rg-cta-card__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ── Previous reports table ─────────────────────────────────────────────── */

.rg-table-wrap {
    overflow-x: auto;
}

.rg-table {
    width: 100%;
    border-collapse: collapse;
}

.rg-table__th {
    padding: 8px 12px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    color: var(--muted-foreground);
    border-bottom: 1px solid var(--border);
}

.rg-table__th--right {
    text-align: right;
}

.rg-table__row {
    border-bottom: 1px solid var(--border);
    transition: background 150ms ease;
}

.rg-table__row:last-child {
    border-bottom: none;
}

.rg-table__row:hover {
    background: oklch(0.95 0.008 155 / 0.30);
}

.rg-table__td {
    padding: 12px;
    font-size: 0.875rem;
}

.rg-table__td--muted {
    color: var(--muted-foreground);
}

.rg-table__td--actions {
    text-align: right;
}

.rg-table__action {
    display: inline-flex;
    padding: 0 8px;
    gap: 4px;
}

.rg-table__year {
    font-weight: 600;
}

/* ── Blue badge variant (Wyeksportowane) ────────────────────────────────── */

.badge-outline--blue {
    color: #1d4ed8;
    border-color: #bfdbfe;
    background: #eff6ff;
}

/* ── Scope list ─────────────────────────────────────────────────────────── */

.rg-scope-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rg-scope-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
}

.rg-scope-item__icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.rg-scope-item__icon--planned {
    opacity: 0.5;
}

.rg-scope-item__label {
    font-size: 0.875rem;
    color: var(--foreground);
}

.rg-scope-item__label--muted {
    color: var(--muted-foreground);
}

/* ── How it works card ──────────────────────────────────────────────────── */

.rg-howto-card {
    background: oklch(0.95 0.008 155 / 0.30);
    border-color: var(--muted);
}

.rg-howto {
    padding-top: 20px;
}

.rg-howto__title {
    font-size: 0.75rem;
    font-weight: 500;
    margin: 0 0 10px;
}

.rg-howto__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rg-howto__item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.rg-howto__number {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 500;
    color: var(--foreground);
    flex-shrink: 0;
    margin-top: 1px;
}

/* ── Report Entity page (step 2) ────────────────────────────────────────── */

.re-page {
    padding: 24px;
}

.re-cards {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.re-card-header {
    align-items: center;
}

.re-card-header__left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.re-card-header__icon {
    opacity: 0.5;
}

.re-entity-desc {
    margin-top: 0;
}

/* ── Entity data fields ─────────────────────────────────────────────────── */

.re-entity-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 16px;
}

@media (min-width: 640px) {
    .re-entity-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.re-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.re-field__label {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    color: var(--muted-foreground);
    margin: 0;
}

.re-field__value {
    font-size: 0.875rem;
    color: var(--foreground);
    margin: 0;
}

.re-field__value--mono {
    font-family: var(--font-mono);
    word-break: break-all;
}

.re-field__row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.re-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* ── Waste activity profile ─────────────────────────────────────────────── */

.re-activities-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

@media (min-width: 640px) {
    .re-activities-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.re-activity {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid;
    font-size: 0.875rem;
    transition: background 150ms ease;
}

.re-activity--active {
    border-color: oklch(0.765 0.168 131 / 0.20);
    background: oklch(0.765 0.168 131 / 0.05);
    color: var(--foreground);
}

.re-activity--inactive {
    border-color: var(--border);
    background: oklch(0.95 0.008 155 / 0.30);
    color: var(--muted-foreground);
}

.re-activity__check {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 2px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.re-activity__check--on {
    border-color: var(--primary);
    background: var(--primary);
}

.re-activity__check--off {
    border-color: oklch(0.50 0.02 155 / 0.30);
    background: transparent;
}

.re-activity__tick {
    width: 10px;
    height: 8px;
}

/* ── Installation list ──────────────────────────────────────────────────── */

.re-installations {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.re-installation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: background 150ms ease;
}

.re-installation:hover {
    background: oklch(0.95 0.008 155 / 0.30);
}

.re-installation__left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.re-installation__icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.re-installation__info {
    min-width: 0;
}

.re-installation__name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.re-installation__relation {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin: 0;
}

.re-installation__right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ── Installation emerald badge uses filled bg ──────────────────────────── */

.badge-outline--emerald-filled {
    color: #065f46;
    border-color: #a7f3d0;
    background: #d1fae5;
}

/* ── Slate badge variant (planned) ──────────────────────────────────────── */

.badge-outline--slate {
    color: #64748b;
    border-color: #e2e8f0;
    background: #f8fafc;
}

/* ── Red badge variant ──────────────────────────────────────────────────── */

.badge-outline--red-light {
    color: #dc2626;
    border-color: #fecaca;
    background: #fef2f2;
}

/* ── Report Summary page (step 4) ───────────────────────────────────────── */

.rs-page {
    padding: 24px;
}

/* ── 3-column grid ──────────────────────────────────────────────────────── */

.rs-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 1024px) {
    .rs-grid {
        grid-template-columns: 2fr 1fr;
    }
}

.rs-grid__main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.rs-grid__sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Status strip (6 stat cards) ────────────────────────────────────────── */

.rs-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 640px) {
    .rs-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .rs-stats {
        grid-template-columns: repeat(6, 1fr);
    }
}

.rs-stat {
    text-align: center;
}

.rs-stat__inner {
    padding: 12px 8px 10px;
}

.rs-stat__value {
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.25;
    margin: 0;
    color: var(--foreground);
}

.rs-stat__value--red {
    color: var(--destructive);
}

.rs-stat__value--amber {
    color: #b45309;
}

.rs-stat__label {
    font-size: 0.625rem;
    color: var(--muted-foreground);
    margin: 2px 0 0;
    line-height: 1.25;
}

/* ── Status banner ──────────────────────────────────────────────────────── */

.rs-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid;
    font-size: 0.875rem;
}

.rs-banner--error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.rs-banner--warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.rs-banner__icon {
    flex-shrink: 0;
}

.rs-banner__text {
    font-weight: 500;
}

/* ── Overview title ─────────────────────────────────────────────────────── */

.rs-overview-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 12px;
}

.rs-sections {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── Summary section card ───────────────────────────────────────────────── */

.rs-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 16px 24px 8px;
}

.rs-section__header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rs-section__icon {
    color: var(--muted-foreground);
    display: flex;
    opacity: 0.5;
}

.rs-section__title {
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0;
}

.rs-section__edit {
    color: var(--primary);
    flex-shrink: 0;
    gap: 4px;
}

.rs-section__content {
    padding: 0 24px 16px;
}

.rs-section__content > .rs-row + .rs-row {
    border-top: 1px solid oklch(0.90 0.015 155 / 0.50);
}

/* ── Summary row ────────────────────────────────────────────────────────── */

.rs-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 4px 0;
}

.rs-row__label {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    flex-shrink: 0;
}

.rs-row__value {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--foreground);
    text-align: right;
}

.rs-row-grid {
    display: grid;
    gap: 4px 16px;
    margin-bottom: 8px;
}

.rs-row-grid--3 {
    grid-template-columns: repeat(2, 1fr);
}

.rs-row-grid--4 {
    grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 640px) {
    .rs-row-grid--3 {
        grid-template-columns: repeat(3, 1fr);
    }
    .rs-row-grid--4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ── Badges row ─────────────────────────────────────────────────────────── */

.rs-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 4px;
}

.rs-badges__more {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    align-self: center;
}

/* ── Planned sections ───────────────────────────────────────────────────── */

.rs-planned-card {
    opacity: 0.6;
}

.rs-planned-card .waste-card__content {
    padding-bottom: 16px;
}

.rs-planned__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 16px 24px 8px;
}

.rs-planned__title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    margin: 0;
}

.rs-planned__desc {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin: 2px 0 0;
}

.rs-planned__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.rs-planned__tag {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px dashed oklch(0.50 0.02 155 / 0.20);
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

/* ── Issues panel (sidebar) ─────────────────────────────────────────────── */

.rs-issues__content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.rs-counters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.rs-counter {
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid;
}

.rs-counter--red {
    background: #fef2f2;
    border-color: #fee2e2;
}

.rs-counter--amber {
    background: #fffbeb;
    border-color: #fef3c7;
}

.rs-counter--blue {
    background: #eff6ff;
    border-color: #dbeafe;
}

.rs-counter__value {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0;
}

.rs-counter--red .rs-counter__value {
    color: #b91c1c;
}

.rs-counter--amber .rs-counter__value {
    color: #b45309;
}

.rs-counter--blue .rs-counter__value {
    color: #1d4ed8;
}

.rs-counter__label {
    font-size: 0.75rem;
    margin: 0;
}

.rs-counter--red .rs-counter__label {
    color: #dc2626;
}

.rs-counter--amber .rs-counter__label {
    color: #d97706;
}

.rs-counter--blue .rs-counter__label {
    color: #2563eb;
}

/* ── Issue list ─────────────────────────────────────────────────────────── */

.rs-issue-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rs-issue {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    width: 100%;
    transition: background 150ms ease;
}

.rs-issue:hover {
    background: oklch(0.95 0.008 155 / 0.50);
}

.rs-issue__icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.rs-issue__text {
    min-width: 0;
    flex: 1;
}

.rs-issue__message {
    font-size: 0.75rem;
    color: var(--foreground);
    margin: 0;
    line-height: 1.4;
}

.rs-issue:hover .rs-issue__message {
    text-decoration: underline;
}

.rs-issue__section {
    font-size: 0.625rem;
    color: var(--muted-foreground);
    margin: 0;
}

.rs-issue__arrow {
    flex-shrink: 0;
    margin-top: 2px;
    opacity: 0;
    transition: opacity 150ms ease;
}

.rs-issue:hover .rs-issue__arrow {
    opacity: 0.5;
}

/* ── Quick nav ──────────────────────────────────────────────────────────── */

.rs-quicknav {
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.rs-quicknav__title {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--muted-foreground);
    margin: 0 0 8px;
}

.rs-quicknav__links {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rs-quicknav__link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--primary);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
    text-align: left;
}

.rs-quicknav__link:hover {
    text-decoration: underline;
}

/* ── Final actions ──────────────────────────────────────────────────────── */

.rs-final {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rs-final__title {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--muted-foreground);
    margin: 0;
}

.rs-final__btn {
    width: 100%;
}

.rs-final__note {
    font-size: 0.625rem;
    text-align: center;
    margin: 0;
}

.rs-final__note--red {
    color: var(--destructive);
}

.rs-final__note--amber {
    color: #b45309;
}

/* ── Confirmed state ────────────────────────────────────────────────────── */

.rs-confirmed {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 24px;
}

.rs-confirmed__inner {
    max-width: 28rem;
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.rs-confirmed__icon-wrap {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #d1fae5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rs-confirmed__title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 0;
}

.rs-confirmed__desc {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin: 8px 0 0;
}

.rs-confirmed__actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.rs-confirmed__back {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
}

.rs-confirmed__back:hover {
    text-decoration: underline;
}

/* ── Dashboard page ─────────────────────────────────────────────────────── */

.db-page {
    padding: 24px;
}

.db-page p {
    margin-bottom: 0;
}

.db-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.db-header__title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 0;
}

.db-header__subtitle {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin: 4px 0 0;
}

/* ── KPI strip ──────────────────────────────────────────────────────────── */

.db-kpi-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.db-kpi__inner {
    padding: 16px 20px;
}

.db-kpi__label {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin: 0 0 4px;
}

.db-kpi__value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--foreground);
    margin: 0;
    font-variant-numeric: tabular-nums;
}

.db-kpi__value--destructive {
    color: var(--destructive);
}

.db-kpi__value--warning {
    color: #b45309;
}

.db-kpi__delta {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin: 4px 0 0;
}

.db-kpi__delta--primary {
    color: var(--primary);
}

.db-kpi__delta--destructive {
    color: var(--destructive);
}

.db-kpi__delta--warning {
    color: #b45309;
}

/* ── Widget grid 2×2 ────────────────────────────────────────────────────── */

.db-widgets {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

.db-widget--interactive {
    cursor: pointer;
    transition: border-color 150ms ease;
}

.db-widget--interactive:hover {
    border-color: var(--primary);
}

.db-widget--editing {
    border-style: dashed;
    border-color: oklch(0.765 0.168 131 / 0.50);
    cursor: grab;
    user-select: none;
}

.db-widget--editing:active {
    cursor: grabbing;
}

.db-widget--dragging {
    opacity: 0.4;
    transform: scale(0.95);
}

/* ── Widget edit placeholder ────────────────────────────────────────────── */

.db-widget__edit-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px;
    user-select: none;
}

.db-widget__grip {
    opacity: 0.3;
}

.db-widget__edit-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 500;
}

.db-widget__edit-icon {
    filter: brightness(0) saturate(100%) invert(52%) sepia(81%) saturate(412%) hue-rotate(52deg) brightness(95%) contrast(89%);
}

/* ── Widget content ─────────────────────────────────────────────────────── */

.db-widget__content {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 24px;
    width: 100%;
}

.db-widget__section-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

/* ── Quick actions ──────────────────────────────────────────────────────── */

.db-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
}

.db-action {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.db-action:hover {
    background: var(--primary);
    border-color: oklch(0.765 0.168 131 / 0.20);
}

.db-action__icon {
    flex-shrink: 0;
    transition: filter 150ms ease;
}

.db-action:hover .db-action__icon {
    filter: brightness(0) invert(1);
}

.db-action__label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--foreground);
    transition: color 150ms ease;
}

.db-action:hover .db-action__label {
    color: var(--primary-foreground);
}

/* ── Alerts list ────────────────────────────────────────────────────────── */

.db-alerts {
    display: flex;
    flex-direction: column;
}

.db-alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 4px;
    border-bottom: 1px solid var(--border);
    border-radius: 6px;
    transition: background 150ms ease;
}

.db-alert:last-child {
    border-bottom: none;
}

.db-alert:hover {
    background: oklch(0.95 0.008 155 / 0.50);
}

.db-alert__icon-wrap {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.db-alert__icon-wrap--high {
    background: oklch(0.577 0.245 27.325 / 0.10);
}

.db-alert__icon-wrap--medium {
    background: oklch(0.75 0.183 55 / 0.10);
}

.db-alert__icon-wrap--low {
    background: var(--muted);
}

.db-alert__title {
    font-size: 0.875rem;
    color: var(--foreground);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.db-alert__title--unread {
    font-weight: 600;
}

.db-alert__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

.db-alert__time {
    font-size: 0.75rem;
    color: oklch(0.50 0.02 155 / 0.60);
    flex-shrink: 0;
}

/* ── Dashboard table (KPO/KEO) ──────────────────────────────────────────── */

.db-table {
    width: 100%;
    border-collapse: collapse;
}

.db-table__th {
    padding-bottom: 6px;
    text-align: left;
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    color: var(--muted-foreground);
    border-bottom: 1px solid var(--border);
}

.db-table__row {
    transition: background 150ms ease;
}

.db-table__row:hover {
    background: oklch(0.95 0.008 155 / 0.30);
}

.db-table__td {
    padding: 6px 12px 6px 0;
    font-size: 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.db-table__row:last-child .db-table__td {
    border-bottom: none;
}

.db-table__td--muted {
    color: var(--muted-foreground);
}

.db-table__td--medium {
    font-weight: 500;
}

.db-table__td--truncate {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--foreground);
}

.db-table__id {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--foreground);
}

.db-table__alert-icon {
    filter: brightness(0) saturate(100%) invert(27%) sepia(94%) saturate(4233%) hue-rotate(353deg) brightness(91%) contrast(97%);
}

.db-table__code {
    font-size: 0.625rem;
    padding: 0 6px;
}

.db-table__status {
    font-size: 0.625rem;
    padding: 0 6px;
    border-radius: 6px;
}

/* ── KEO progress bar ───────────────────────────────────────────────────── */

.db-progress {
    display: flex;
    align-items: center;
    gap: 6px;
}

.db-progress__track {
    width: 48px;
    height: 6px;
    border-radius: 9999px;
    background: var(--muted);
    overflow: hidden;
}

.db-progress__fill {
    height: 100%;
    border-radius: 9999px;
}

.db-progress__fill--ok {
    background: var(--primary);
}

.db-progress__fill--warn {
    background: #f59e0b;
}

.db-progress__fill--bad {
    background: var(--destructive);
}

.db-progress__label {
    font-size: 0.625rem;
    color: var(--muted-foreground);
}

/* ── Charts row ─────────────────────────────────────────────────────────── */

.db-charts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.db-chart-card {
    cursor: pointer;
    transition: border-color 150ms ease;
}

.db-chart-card:hover {
    border-color: var(--primary);
}

.db-chart__header {
    padding: 0 24px 8px;
}

.db-chart__title {
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0;
}

.db-chart__content {
    padding: 0 24px;
}

/* ── Entities page ──────────────────────────────────────────────────────── */

.ent-page {
    padding: 24px;
}

.ent-page p {
    margin-bottom: 0;
}

.ent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 32px;
}

.ent-header__title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 0;
}

.ent-header__subtitle {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin: 4px 0 0;
}

.ent-search {
    margin-bottom: 16px;
}

.ent-search__inner {
    position: relative;
    padding: 16px 24px;
}

.ent-search__icon {
    position: absolute;
    left: 36px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.4;
}

.ent-search__input {
    width: 100%;
    background: var(--muted);
    border: none;
    border-radius: 6px;
    padding: 8px 12px 8px 36px;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    color: var(--foreground);
    outline: none;
}

.ent-search__input::placeholder {
    color: var(--muted-foreground);
}

.ent-search__input:focus {
    box-shadow: 0 0 0 1px var(--primary);
}

/* ── Tabs ───────────────────────────────────────────────────────────────── */

.ent-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 16px;
    background: var(--muted);
    border-radius: 8px;
    padding: 4px;
}

.ent-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--muted-foreground);
    transition: background 150ms ease, color 150ms ease;
}

.ent-tab:hover {
    color: var(--foreground);
}

.ent-tab--active {
    background: var(--card);
    color: var(--foreground);
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.ent-tab__count {
    font-size: 0.625rem;
    font-weight: 500;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--secondary);
    color: var(--secondary-foreground);
}

/* ── Entity list ────────────────────────────────────────────────────────── */

.ent-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ent-entity {
    cursor: pointer;
    transition: border-color 150ms ease;
}

.ent-entity:hover {
    border-color: var(--primary);
}

.ent-entity__inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 24px;
}

.ent-entity__left {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}

.ent-entity__avatar {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ent-entity__info {
    min-width: 0;
}

.ent-entity__name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ent-entity__name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
}

.ent-entity__meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.ent-entity__meta--error {
    color: var(--destructive);
}

.ent-empty {
    text-align: center;
    padding: 32px 0;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

/* ── Permits page ───────────────────────────────────────────────────────── */

.pm-page {
    padding: 24px;
}

.pm-page p {
    margin-bottom: 0;
}

.pm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 32px;
}

.pm-header__title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 0;
}

.pm-header__subtitle {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin: 4px 0 0;
}

/* ── Permit stats ───────────────────────────────────────────────────────── */

.pm-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

@media (min-width: 1024px) {
    .pm-stats {
        grid-template-columns: repeat(4, 1fr);
    }
}

.pm-stat__inner {
    padding: 16px 20px 12px;
}

.pm-stat--danger-border {
    border-color: oklch(0.577 0.245 27.325 / 0.40);
}

.pm-stat__label-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.pm-stat__label {
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.pm-stat__value {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.pm-stat__value--destructive {
    color: var(--destructive);
}

.pm-stat__value--warning {
    color: #b45309;
}

.pm-stat__sub {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin: 2px 0 0;
}

/* ── Permits table ──────────────────────────────────────────────────────── */

.pm-table-card {
    padding: 0;
}

.pm-table-wrap {
    overflow-x: auto;
}

.pm-table {
    width: 100%;
    border-collapse: collapse;
}

.pm-table__th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    color: var(--muted-foreground);
    border-bottom: 1px solid var(--border);
}

.pm-table__row {
    border-bottom: 1px solid var(--border);
    transition: background 150ms ease;
}

.pm-table__row:last-child {
    border-bottom: none;
}

.pm-table__row:hover {
    background: oklch(0.95 0.008 155 / 0.30);
}

.pm-table__td {
    padding: 12px 16px;
    font-size: 0.875rem;
    vertical-align: middle;
}

.pm-table__td--muted {
    color: var(--muted-foreground);
}

.pm-table__id {
    font-weight: 500;
    font-family: var(--font-mono);
}

/* ── Usage bar ──────────────────────────────────────────────────────────── */

.pm-usage {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}

.pm-usage__track {
    flex: 1;
    height: 6px;
    border-radius: 9999px;
    background: var(--muted);
    overflow: hidden;
}

.pm-usage__fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 300ms ease;
}

.pm-usage__fill--ok {
    background: var(--primary);
}

.pm-usage__fill--near {
    background: #f59e0b;
}

.pm-usage__fill--over {
    background: var(--destructive);
}

.pm-usage__label {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--muted-foreground);
    white-space: nowrap;
}

.pm-usage__label--over {
    color: var(--destructive);
    font-weight: 600;
}

/* ── Attachment link ────────────────────────────────────────────────────── */

.pm-attachment {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--primary);
    cursor: pointer;
}

.pm-attachment:hover {
    text-decoration: underline;
}

.pm-attachment__name {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pm-attachment__dl {
    opacity: 0.5;
}

/* ── Slate badge ────────────────────────────────────────────────────────── */

.badge-outline--slate {
    color: #64748b;
    border-color: #e2e8f0;
    background: #f8fafc;
}

/* ── List page (shared: KPO, KEO) ───────────────────────────────────────── */

.list-page {
    padding: 24px;
}

.list-page p {
    margin-bottom: 0;
}

.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 32px;
}

.list-header__title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 0;
}

.list-header__subtitle {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin: 4px 0 0;
}

.list-header__actions {
    display: flex;
    gap: 8px;
}

.list-filters {
    margin-bottom: 16px;
}

.list-filters__inner {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 24px 0;
}

.list-filters__search {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.list-filters__search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.4;
    pointer-events: none;
}

.list-filters__search-input {
    width: 100%;
    background: var(--muted);
    border: none;
    border-radius: 6px;
    padding: 8px 12px 8px 36px;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    color: var(--foreground);
    outline: none;
}

.list-filters__search-input::placeholder {
    color: var(--muted-foreground);
}

.list-filters__search-input:focus {
    box-shadow: 0 0 0 1px var(--primary);
}

.list-filters__select {
    background: var(--muted);
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    color: var(--foreground);
    outline: none;
    cursor: pointer;
}

.list-filters__select:focus {
    box-shadow: 0 0 0 1px var(--primary);
}

/* KPO status multi-select (MudSelect) — match the muted, borderless look of the
   native filter controls instead of MudBlazor's default outlined field. The fixed
   wrapper width keeps the control from stretching to MudBlazor's default 100%. */
.kpo-status-filter {
    width: 280px;
    flex: 0 0 auto;
}

/* Kill the top margin MudBlazor reserves for a floating label (there is none here).
   Our rule ties on specificity with .mud-input-control-margin-dense, so force it. */
.kpo-status-filter .mud-input-control,
.kpo-status-filter .mud-input-control.mud-input-control-margin-dense,
.kpo-status-filter .mud-input-control.mud-input-control-margin-normal {
    width: 100%;
    margin-top: 0 !important;
}

/* Remove the reserved helper/validation text row beneath the field. */
.kpo-status-filter .mud-input-control .mud-input-helper-text {
    display: none;
}

.kpo-status-filter .mud-input.mud-input-outlined {
    background: var(--muted);
    border-radius: 6px;
    min-height: 20px;
}

/* Drop MudBlazor's outline fieldset; we use the muted background instead. */
.kpo-status-filter .mud-input.mud-input-outlined > .mud-input-outlined-border {
    border: none !important;
}

.kpo-status-filter .mud-input.mud-input-outlined.mud-focused {
    box-shadow: 0 0 0 1px var(--primary);
}

.kpo-status-filter .mud-select-input,
.kpo-status-filter .mud-input-slot,
.kpo-status-filter input.mud-input-root {
    font-family: var(--font-sans);
    font-size: 0.875rem;
    color: var(--foreground);
}

/* A touch taller so it reads as a comfortable filter control. */
.kpo-status-filter .mud-input.mud-input-outlined .mud-input-slot {
    padding-top: 9px;
    padding-bottom: 9px;
}

/* Status dropdown items (rendered in a detached popover, hence PopoverClass) —
   pull the coloured label closer to the checkbox. */
.kpo-status-popover .mud-list-item-icon {
    min-width: 35px;
}

.list-table-wrap {
    overflow-x: auto;
}

.list-table {
    width: 100%;
    border-collapse: collapse;
}

.list-table__th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    color: var(--muted-foreground);
    border-bottom: 1px solid var(--border);
}

.list-table__th--checkbox {
    width: 40px;
}

.list-table__th--actions,
.list-table__td--actions {
    width: 72px;
    text-align: right;
}

.list-table__row {
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 150ms ease;
}

.list-table__row:last-child {
    border-bottom: none;
}

.list-table__row:hover {
    background: oklch(0.95 0.008 155 / 0.30);
}

.list-table__td {
    padding: 12px 16px;
    font-size: 0.875rem;
    vertical-align: middle;
}

.list-table__td--muted {
    color: var(--muted-foreground);
}

.list-table__td--medium {
    font-weight: 500;
}

.list-table__td--truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kpo-row-actions__menu .mud-button-root {
    min-width: 32px;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 8px;
    color: var(--muted-foreground);
}

.kpo-row-actions__menu .mud-button-root:hover {
    color: var(--foreground);
    background: oklch(0.96 0.006 155);
}

/* ── KPO-specific ───────────────────────────────────────────────────────── */

.kpo-mass-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 16px;
    background: var(--accent);
    border-radius: 8px;
}

.kpo-mass-actions__count {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--accent-foreground);
}

.kpo-mass-actions__buttons {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.kpo-checkbox {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    accent-color: var(--primary);
    cursor: pointer;
}

.kpo-table__id-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kpo-table__id {
    font-weight: 500;
}

.kpo-table__alert-icon {
    filter: brightness(0) saturate(100%) invert(27%) sepia(94%) saturate(4233%) hue-rotate(353deg) brightness(91%) contrast(97%);
}

/* ── KPO details page ───────────────────────────────────────────────────── */

.kd-page {
    padding: 24px;
}

.kd-page p {
    margin-bottom: 0;
}

.kd-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}

.kd-back {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--muted-foreground);
    transition: color 150ms ease;
    display: flex;
    align-items: center;
}

.kd-back:hover {
    color: var(--foreground);
}

.kd-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.kd-title__muted {
    color: var(--muted-foreground);
    font-weight: 400;
}

.kd-title__sep {
    color: var(--muted-foreground);
    font-weight: 400;
}

/* ── 2x2 grid ───────────────────────────────────────────────────────────── */

.kd-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 1024px) {
    .kd-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ── Fields list ────────────────────────────────────────────────────────── */

.kd-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 32px;
}

.kd-field__label {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin: 0 0 2px;
}

.kd-field__value {
    font-size: 0.875rem;
    color: var(--foreground);
    margin: 0;
}

/* ── Timeline ───────────────────────────────────────────────────────────── */

.kd-timeline {
    display: flex;
    flex-direction: column;
}

.kd-timeline__item {
    display: flex;
    gap: 16px;
}

.kd-timeline__marker {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.kd-timeline__dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    background: var(--card);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kd-timeline__line {
    width: 1px;
    flex: 1;
    background: oklch(0.765 0.168 131 / 0.30);
    margin: 4px 0;
}

.kd-timeline__content {
    display: flex;
    flex: 1;
    align-items: flex-start;
    justify-content: space-between;
    padding-bottom: 20px;
}

.kd-timeline__label {
    font-size: 0.875rem;
    color: var(--foreground);
    margin: 0;
}

.kd-timeline__date {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin: 2px 0 0;
}

/* ── Status actions ─────────────────────────────────────────────────────── */

.kd-status-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.kd-status-btn {
    width: 100%;
    justify-content: flex-start;
}

.kd-status-card {
    align-self: start;
}

.kd-status-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.kd-status-current {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid oklch(0.765 0.168 131 / 0.24);
    background: oklch(0.985 0.012 155);
}

.kd-status-current__label,
.kd-status-section__eyebrow {
    margin: 0;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-foreground);
}

.kd-status-current__title {
    margin: 4px 0 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--foreground);
}

.kd-status-current__description,
.kd-status-section__hint {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--muted-foreground);
}

.kd-status-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kd-status-section__header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kd-card-action-tooltip-target {
    display: inline-flex;
    min-width: 0;
}

.kd-card-action {
    display: inline-flex;
    height: 30px;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    cursor: pointer;
    transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.kd-card-action:not(:disabled):hover {
    transform: translateY(-1px);
}

.kd-card-action--primary {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--primary-foreground);
}

.kd-card-action--primary:not(:disabled):hover {
    background: oklch(0.72 0.168 131);
    border-color: oklch(0.72 0.168 131);
}

.kd-card-action--secondary {
    background: var(--card);
    color: var(--foreground);
}

.kd-card-action--secondary:not(:disabled):hover {
    border-color: oklch(0.765 0.168 131 / 0.42);
    background: oklch(0.985 0.012 155);
}

.kd-card-action:disabled,
.kd-card-action--disabled {
    cursor: not-allowed;
    border-color: var(--border);
    background: oklch(0.965 0.006 155);
    color: var(--muted-foreground);
}

.kd-status-map {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.kd-status-step {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: oklch(0.985 0.004 155);
    color: var(--muted-foreground);
}

.kd-status-step__dot {
    width: 10px;
    height: 10px;
    border-radius: 9999px;
    margin-top: 4px;
    background: oklch(0.78 0.012 155);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kd-status-step__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.kd-status-step__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.kd-withdraw-form {
    display: grid;
    gap: 8px;
    margin-top: 10px;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: oklch(0.99 0.003 155);
}

.kd-withdraw-form__label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--foreground);
}

.kd-withdraw-form__input {
    width: 100%;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    color: var(--foreground);
    background: var(--card);
    font: inherit;
    font-size: 0.8125rem;
    line-height: 1.4;
}

.kd-withdraw-form__input:focus-visible {
    outline: none;
    border-color: oklch(0.765 0.168 131 / 0.55);
    box-shadow: 0 0 0 3px oklch(0.765 0.168 131 / 0.12);
}

.kd-withdraw-form__error {
    margin: 0;
    color: var(--destructive);
    font-size: 0.75rem;
}

.kd-withdraw-form__hint {
    margin: -4px 0 0;
    color: var(--muted-foreground);
    font-size: 0.75rem;
}

.kd-action-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--foreground);
    font-size: 0.8125rem;
    font-weight: 700;
}

.kd-withdraw-form__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.kd-status-step__label {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--foreground);
}

.kd-status-step__description {
    margin: 2px 0 0;
    font-size: 0.75rem;
    line-height: 1.35;
    color: var(--muted-foreground);
}

.kd-status-step--done {
    border-color: oklch(0.78 0.13 150 / 0.36);
    background: oklch(0.975 0.018 150);
}

.kd-status-step--done .kd-status-step__dot {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    background: oklch(0.62 0.18 150);
    color: oklch(0.99 0.004 150);
    font-size: 0.625rem;
    font-weight: 800;
}

.kd-status-step--done .kd-status-step__dot::after {
    content: "\2713";
}

.kd-status-step--done .kd-status-step__description {
    color: oklch(0.43 0.035 155 / 0.78);
}

.kd-status-step--current {
    border-color: oklch(0.765 0.168 131 / 0.48);
    background: oklch(0.965 0.03 155);
}

.kd-status-step--current .kd-status-step__dot {
    background: var(--primary);
    box-shadow: 0 0 0 4px oklch(0.765 0.168 131 / 0.14);
}

.kd-status-step--current.kd-status-step--rejected {
    border-color: oklch(0.577 0.245 27.325 / 0.36);
    background: oklch(0.97 0.018 27.325);
}

.kd-status-step--current.kd-status-step--rejected .kd-status-step__dot {
    background: oklch(0.577 0.245 27.325);
    box-shadow: 0 0 0 4px oklch(0.577 0.245 27.325 / 0.12);
}

.kd-status-step--current.kd-status-step--withdrawn {
    border-color: oklch(0.68 0.018 155 / 0.42);
    background: oklch(0.96 0.006 155);
}

.kd-status-step--current.kd-status-step--withdrawn .kd-status-step__dot {
    background: oklch(0.52 0.018 155);
    box-shadow: 0 0 0 4px oklch(0.52 0.018 155 / 0.12);
}

.kd-status-step--terminal:not(.kd-status-step--current) {
    background: oklch(0.97 0.006 155);
}

.kd-status-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding-top: 4px;
}

@media (min-width: 640px) {
    .kd-status-meta {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .kd-page {
        padding: 16px;
    }

    .kd-breadcrumb {
        align-items: flex-start;
    }

    .kd-title {
        flex-wrap: wrap;
        font-size: 1.125rem;
        line-height: 1.25;
    }

    .kd-fields {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .kd-timeline__content {
        flex-direction: column;
        gap: 6px;
    }

    .kd-status-current {
        flex-direction: column;
    }

    .kd-status-current,
    .kd-status-section__header {
        align-items: flex-start;
    }

    .kd-status-map {
        gap: 10px;
    }

    .kd-status-step__header {
        align-items: flex-start;
        flex-direction: column;
    }

    .kd-status-step__actions {
        justify-content: flex-start;
    }
}

/* ── KEO section ────────────────────────────────────────────────────────── */

.kd-keo {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.kd-keo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.kd-keo__installation {
    padding: 12px;
    border-radius: 8px;
    background: oklch(0.95 0.008 155 / 0.60);
}

.kd-keo__installation-label {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted-foreground);
    margin: 0 0 4px;
}

.kd-keo__installation-name {
    font-size: 0.875rem;
    color: var(--foreground);
    margin: 0;
}

.kd-keo__metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.kd-keo__activities {
    display: flex;
    gap: 12px;
}

.kd-alert {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid oklch(0.577 0.245 27.325 / 0.30);
    background: oklch(0.577 0.245 27.325 / 0.05);
    font-size: 0.875rem;
    color: var(--destructive);
}

.kd-alert__icon {
    flex-shrink: 0;
}

/* ── Primary filled badge (for KEO connected) ───────────────────────────── */

.badge-outline--primary-filled {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

/* ── KPO creation page ──────────────────────────────────────────────────── */

.kc-page {
    padding: 24px;
}

.kc-page p {
    margin-bottom: 0;
}

.kc-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}

.kc-back {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--muted-foreground);
    transition: color 150ms ease;
    display: flex;
    align-items: center;
}

.kc-back:hover {
    color: var(--foreground);
}

.kc-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.kc-title__muted,
.kc-title__sep {
    color: var(--muted-foreground);
    font-weight: 400;
}

/* ── Form card override ─────────────────────────────────────────────────── */

.kc-form {
    padding: 32px !important;
}

.kc-form__heading {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 32px;
}

.kc-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px 40px;
}

.kc-grid--compact {
    gap: 16px 24px;
}

@media (min-width: 900px) {
    .kc-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.kc-extra {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.kc-extra__summary {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0;
    cursor: pointer;
    list-style: none;
}

.kc-extra__summary::-webkit-details-marker {
    display: none;
}

.kc-extra__summary::after {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 1.5px solid var(--muted-foreground);
    border-bottom: 1.5px solid var(--muted-foreground);
    transform: rotate(45deg);
    transition: transform 150ms ease;
    flex-shrink: 0;
}

.kc-extra[open] .kc-extra__summary::after {
    transform: rotate(225deg);
}

.kc-extra__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--foreground);
}

.kc-extra__body {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-top: 24px;
}

.kc-extra__toggles {
    max-width: 720px;
}

.kc-extra__generated {
    display: grid;
    gap: 12px;
}

.kc-field__label {
    font-size: 0.875rem;
    color: var(--foreground);
    margin: 0 0 8px;
}

.kc-field--full {
    grid-column: 1 / -1;
}

.kc-field__row {
    display: flex;
    gap: 8px;
}

.kc-field__combo-wrap {
    flex: 1;
    min-width: 0;
}

.kc-autocomplete {
    width: 100%;
    margin: 0 !important;
}

.kc-autocomplete .mud-input-control-input-container,
.kc-autocomplete .mud-input {
    min-height: 80px;
}

.kc-autocomplete .mud-input {
    align-items: center;
    background: oklch(0.995 0.003 155) !important;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--foreground) !important;
    font-family: var(--font-sans) !important;
    font-size: 0.875rem !important;
    padding: 0 16px !important;
    transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.kc-autocomplete .mud-input:hover {
    background: oklch(0.985 0.006 155) !important;
}

.kc-autocomplete .mud-input:focus-within {
    background: var(--card) !important;
    border-color: oklch(0.765 0.168 131 / 0.55);
    box-shadow: 0 0 0 3px oklch(0.765 0.168 131 / 0.12);
}

.kc-autocomplete .mud-input::before,
.kc-autocomplete .mud-input::after,
.kc-autocomplete .mud-input-underline::before,
.kc-autocomplete .mud-input-underline::after {
    display: none !important;
    border: none !important;
}

.kc-autocomplete .mud-input-slot {
    background: transparent !important;
    padding: 0 !important;
}

.kc-autocomplete .mud-input input {
    padding: 0 !important;
    color: var(--foreground) !important;
    font-size: 0.875rem !important;
}

.kc-autocomplete .mud-input input::placeholder {
    color: var(--muted-foreground) !important;
    opacity: 1;
}

.kc-autocomplete .mud-input-adornment .mud-icon-root,
.kc-autocomplete .mud-progress-circular {
    color: var(--muted-foreground) !important;
    opacity: 0.5;
}

/* ── Combobox ───────────────────────────────────────────────────────────── */

.kc-combo {
    position: relative;
    width: 100%;
}

.kc-combo__tooltip-target {
    display: block;
    width: 100%;
}

.kc-combo > .mud-tooltip-root {
    display: block;
    width: 100%;
}

.kc-combo__trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: oklch(0.995 0.003 155);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    min-height: 80px;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
    transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.kc-combo__trigger:hover {
    background: oklch(0.985 0.006 155);
}

.kc-combo__trigger:focus-visible {
    outline: none;
    background: var(--card);
    border-color: oklch(0.765 0.168 131 / 0.55);
    box-shadow: 0 0 0 3px oklch(0.765 0.168 131 / 0.12);
}

.kc-combo--disabled {
    cursor: help;
}

.kc-combo--disabled .kc-combo__trigger,
.kc-combo--disabled .kc-combo__trigger:hover {
    background: var(--muted);
    border-color: var(--border);
    cursor: not-allowed;
    box-shadow: none;
    opacity: 1;
}

.kc-combo--disabled .kc-combo__placeholder,
.kc-combo--disabled .kc-combo__chevron {
    color: var(--muted-foreground);
    opacity: 0.65;
}

.kc-combo__value {
    font-size: 0.875rem;
    color: var(--foreground);
}

.kc-combo__value--row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.kc-combo__value--bold {
    font-weight: 500;
}

.kc-combo__value-icon {
    flex-shrink: 0;
    opacity: 0.6;
}

.kc-combo__value-stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kc-combo__value-stack-name {
    font-size: 0.875rem;
    color: var(--foreground);
}

.kc-combo__value-sub {
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.kc-combo__placeholder {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.kc-combo__chevron {
    flex-shrink: 0;
    margin-left: 12px;
    opacity: 0.5;
}

.kc-combo__backdrop {
    position: fixed;
    inset: 0;
    z-index: 49;
}

.kc-combo__menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 50;
    max-width: calc(100vw - 48px);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.kc-combo__search-wrap {
    padding: 8px;
    border-bottom: 1px solid var(--border);
}

.kc-combo__search {
    width: 100%;
    border: none;
    padding: 6px 8px;
    font-family: inherit;
    font-size: 0.875rem;
    background: transparent;
    color: var(--foreground);
    outline: none;
}

.kc-combo__search::placeholder {
    color: var(--muted-foreground);
}

.kc-combo__list {
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
}

.kc-combo__empty {
    padding: 24px 12px;
    text-align: center;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.kc-combo__item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    background: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    text-align: left;
    transition: background 150ms ease;
}

.kc-combo__item:hover {
    background: var(--accent);
}

.kc-combo__item--primary {
    color: var(--primary);
}

.kc-combo__check {
    flex-shrink: 0;
}

.kc-combo__check--hidden {
    visibility: hidden;
}

.kc-combo__item-code {
    font-weight: 500;
    margin-right: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.kc-combo__item-name {
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

.kc-combo__item-icon {
    flex-shrink: 0;
    opacity: 0.6;
}

.kc-combo__action-icon {
    flex-shrink: 0;
}

.kc-combo__separator {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* ── AI button ──────────────────────────────────────────────────────────── */

.kc-ai-btn {
    flex-shrink: 0;
    width: 48px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: oklch(0.995 0.003 155);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
}

.kc-ai-btn:hover {
    background: oklch(0.765 0.168 131 / 0.10);
    border-color: oklch(0.765 0.168 131 / 0.28);
}

.kc-ai-btn:hover img {
    filter: brightness(0) saturate(100%) invert(52%) sepia(81%) saturate(412%) hue-rotate(52deg) brightness(95%) contrast(89%);
}

/* ── Mass input ─────────────────────────────────────────────────────────── */

.kc-mass {
    display: flex;
    align-items: center;
    gap: 12px;
    background: oklch(0.995 0.003 155);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 16px;
    min-height: 80px;
    transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.kc-mass:hover {
    background: oklch(0.985 0.006 155);
}

.kc-mass:focus-within {
    background: var(--card);
    border-color: oklch(0.765 0.168 131 / 0.55);
    box-shadow: 0 0 0 3px oklch(0.765 0.168 131 / 0.12);
}

.kc-mass__input {
    flex: 1;
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--foreground);
    outline: none;
    appearance: textfield;
    -moz-appearance: textfield;
}

.kc-mass__input::-webkit-outer-spin-button,
.kc-mass__input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.kc-mass__unit {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    flex-shrink: 0;
    border-left: 1px solid var(--border);
    padding-left: 12px;
}

/* ── Static info (logged-in company) ────────────────────────────────────── */

.kc-static {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: oklch(0.995 0.003 155);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    min-height: 80px;
}

.kc-static__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kc-static__name {
    font-size: 0.875rem;
    color: var(--foreground);
}

.kc-static__nip {
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.kc-static__badge {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    flex-shrink: 0;
    margin-left: 12px;
}

/* ── Date picker ────────────────────────────────────────────────────────── */

.kc-date {
    display: flex;
    align-items: center;
    background: oklch(0.995 0.003 155);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 16px;
    min-height: 80px;
    transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.kc-date:hover {
    background: oklch(0.985 0.006 155);
}

.kc-date:focus-within {
    background: var(--card);
    border-color: oklch(0.765 0.168 131 / 0.55);
    box-shadow: 0 0 0 3px oklch(0.765 0.168 131 / 0.12);
}

.kc-date__picker {
    width: 100%;
    margin: 0 !important;
}

.kc-date__picker .mud-input {
    font-family: var(--font-sans) !important;
    font-size: 0.875rem !important;
    color: var(--foreground) !important;
    background: transparent !important;
}

.kc-date__picker .mud-input-slot {
    background: transparent !important;
    padding: 0 !important;
}

.kc-date__picker .mud-input::before,
.kc-date__picker .mud-input::after,
.kc-date__picker .mud-input-underline::before,
.kc-date__picker .mud-input-underline::after {
    display: none !important;
    border: none !important;
}

.kc-date__picker .mud-input input {
    padding: 0 !important;
    cursor: pointer;
    color: var(--foreground) !important;
}

.kc-date__picker .mud-input-adornment .mud-icon-root {
    color: var(--muted-foreground);
    opacity: 0.5;
    font-size: 1rem !important;
}

/* ── Validation ─────────────────────────────────────────────────────────── */

.kc-field--invalid .kc-field__label {
    color: var(--destructive);
}

.kc-field--invalid .kc-autocomplete .mud-input,
.kc-field--invalid .kc-combo__trigger,
.kc-field--invalid .kc-combo__trigger:hover,
.kc-field--invalid .kc-mass,
.kc-field--invalid .kc-mass:hover,
.kc-field--invalid .kc-date,
.kc-field--invalid .kc-date:hover,
.kc-field--invalid .kec-conditional__input,
.kc-field--invalid .kec-flag {
    background: oklch(0.98 0.018 28);
    border-color: var(--destructive);
    box-shadow: 0 0 0 3px oklch(0.63 0.22 25 / 0.12);
}

.kc-field--invalid .kc-autocomplete .mud-input,
.kc-field--invalid .kc-autocomplete .mud-input:hover,
.kc-field--invalid .kc-autocomplete .mud-input:focus-within {
    background: oklch(0.98 0.018 28) !important;
    border-color: var(--destructive);
    box-shadow: 0 0 0 3px oklch(0.63 0.22 25 / 0.12);
}

.kc-field--invalid .kec-conditional__input {
    border: 1px solid var(--destructive);
}

.kc-field--invalid .kc-combo__placeholder,
.kc-field--invalid .kc-mass__input::placeholder,
.kc-field--invalid .kec-conditional__input::placeholder,
.kc-field--invalid .kec-hint,
.kc-field--invalid .kec-conditional__label {
    color: oklch(0.5 0.16 25);
}

/* ── Submit ─────────────────────────────────────────────────────────────── */

.kc-submit {
    display: flex;
    justify-content: flex-end;
    margin-top: 40px;
}

.kc-submit__btn {
    border-color: oklch(0.16 0.02 155 / 0.30);
    gap: 8px;
}

.kc-submit__btn:hover {
    border-color: var(--primary);
}

/* ── Dialog ─────────────────────────────────────────────────────────────── */

.kc-dialog-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.30);
    /* Above MudBlazor dialogs (1400) but below the snackbar (1500), so overlays such
       as the AI waste-code assistant work when hosted inside a MudDialog. */
    z-index: 1450;
}

.kc-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1451;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.kc-dialog--ai {
    width: 28rem;
    max-width: calc(100vw - 32px);
}

.kc-dialog--address {
    width: 24rem;
    max-width: calc(100vw - 32px);
    padding: 24px;
    gap: 16px;
}

.kc-dialog__header {
    padding: 20px 20px 12px;
    border-bottom: 1px solid var(--border);
}

.kc-dialog--address .kc-dialog__header {
    padding: 0;
    border-bottom: none;
}

.kc-dialog__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 600;
}

.kc-dialog__body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 8px 0;
}

.kc-dialog__footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ── AI chat ────────────────────────────────────────────────────────────── */

.kc-ai__messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 20px;
    overflow-y: auto;
    max-height: 320px;
    min-height: 160px;
}

.kc-ai__message {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kc-ai__message--user {
    align-items: flex-end;
}

.kc-ai__message--assistant {
    align-items: flex-start;
}

.kc-ai__bubble {
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 0.875rem;
    max-width: 85%;
}

.kc-ai__bubble--user {
    background: var(--primary);
    color: var(--primary-foreground);
}

.kc-ai__bubble--assistant {
    background: var(--muted);
    color: var(--foreground);
}

.kc-ai__thinking {
    display: flex;
    gap: 4px;
    color: var(--muted-foreground);
}

.kc-ai__thinking span {
    animation: kc-bounce 1s infinite;
}

.kc-ai__thinking span:nth-child(2) { animation-delay: 150ms; }
.kc-ai__thinking span:nth-child(3) { animation-delay: 300ms; }

@keyframes kc-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.kc-ai__suggestions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.kc-ai__suggestion {
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
    border: 1px solid var(--border);
    background: var(--background);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-family: inherit;
    transition: background 150ms ease, border-color 150ms ease;
}

.kc-ai__suggestion:hover {
    border-color: var(--primary);
    background: oklch(0.765 0.168 131 / 0.05);
}

.kc-ai__suggestion-code {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    flex-shrink: 0;
}

.kc-ai__suggestion-name {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    transition: color 150ms ease;
}

.kc-ai__suggestion:hover .kc-ai__suggestion-name {
    color: var(--foreground);
}

.kc-ai__input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.kc-ai__input {
    flex: 1;
    background: var(--muted);
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--foreground);
    outline: none;
}

.kc-ai__input::placeholder {
    color: var(--muted-foreground);
}

.kc-ai__send {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 150ms ease;
}

.kc-ai__send:hover:not(:disabled) {
    opacity: 0.8;
}

.kc-ai__send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.kc-ai__send img {
    filter: brightness(0) invert(1);
}

/* ── Add address dialog ─────────────────────────────────────────────────── */

.kc-addr-row {
    display: flex;
    gap: 12px;
}

.kc-addr-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kc-addr-field__label {
    font-size: 0.875rem;
    color: var(--foreground);
}

.kc-addr-input {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--foreground);
    outline: none;
    transition: border-color 150ms ease;
}

.kc-addr-input::placeholder {
    color: var(--muted-foreground);
}

.kc-addr-input:focus {
    border-color: var(--primary);
}

/* ── KEO-specific ───────────────────────────────────────────────────────── */

.keo-code {
    background: var(--background);
    font-size: 0.875rem;
}

.keo-install {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--foreground);
}

.keo-install__icon {
    flex-shrink: 0;
    opacity: 0.5;
}

.keo-install__name {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.keo-permit {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.keo-empty {
    font-size: 0.75rem;
    color: oklch(0.50 0.02 155 / 0.60);
    font-style: italic;
}

.keo-progress {
    display: flex;
    align-items: center;
    gap: 8px;
}

.keo-progress__track {
    width: 64px;
    height: 6px;
    border-radius: 9999px;
    background: var(--muted);
    overflow: hidden;
}

.keo-progress__fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 300ms ease;
}

.keo-progress__fill--ok {
    background: var(--primary);
}

.keo-progress__fill--warn {
    background: #f59e0b;
}

.keo-progress__fill--bad {
    background: var(--destructive);
}

.keo-progress__label {
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

/* ── KEO creation form ──────────────────────────────────────────────────── */

.kc-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.kc-col--gap-lg {
    gap: 20px;
}

.kec-hint {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin: 0 0 12px;
}

/* ── FlagToggle grid ────────────────────────────────────────────────────── */

.kec-flags {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.kec-flag {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: oklch(0.95 0.008 155 / 0.40);
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    color: var(--muted-foreground);
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.kec-flag:hover {
    border-color: oklch(0.50 0.02 155 / 0.40);
}

.kec-flag--active {
    background: oklch(0.765 0.168 131 / 0.10);
    color: var(--primary);
}

.kec-flag__code {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    color: oklch(0.50 0.02 155 / 0.30);
}

.kec-flag--active .kec-flag__code {
    color: var(--primary);
}

.kec-flag__label {
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 2px;
}

.kec-flag__desc {
    font-size: 0.625rem;
    line-height: 1.4;
    opacity: 0.7;
}

/* ── Bool toggles ───────────────────────────────────────────────────────── */

.kec-bools {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 4px;
}

.kec-bool-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kec-bool-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.kec-bool-row__label {
    font-size: 0.875rem;
    color: var(--foreground);
}

.kec-toggle {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.kec-toggle__btn {
    padding: 6px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    transition: background 150ms ease, color 150ms ease;
}

.kec-toggle__btn:hover {
    background: oklch(0.95 0.008 155 / 0.50);
}

.kec-toggle__btn--active-no {
    background: var(--muted);
    color: var(--foreground);
    font-weight: 500;
}

.kec-toggle__btn--active-yes {
    background: oklch(0.765 0.168 131 / 0.10);
    color: var(--primary);
    font-weight: 500;
}

.kec-toggle__sep {
    width: 1px;
    background: var(--border);
}

/* ── Conditional input ──────────────────────────────────────────────────── */

.kec-conditional {
    padding-left: 16px;
    border-left: 2px solid;
}

.kec-conditional--primary {
    border-left-color: oklch(0.765 0.168 131 / 0.30);
}

.kec-conditional--warning {
    border-left-color: oklch(0.75 0.183 55 / 0.40);
}

.kec-conditional__label {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin: 0 0 6px;
}

.kec-conditional__input {
    width: 100%;
    background: var(--muted);
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--foreground);
    outline: none;
}

.kec-conditional__input::placeholder {
    color: var(--muted-foreground);
}

.kec-conditional__input:focus {
    box-shadow: 0 0 0 1px var(--primary);
}

/* ── Submit row with top border ─────────────────────────────────────────── */

.kec-submit {
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--border);
    padding-top: 24px;
    margin-top: 32px;
}

/* ── KEO details page ───────────────────────────────────────────────────── */

.ked-page {
    padding: 24px;
}

.ked-page p {
    margin-bottom: 0;
}

.ked-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-height: calc(100vh - 48px);
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

.ked-empty p {
    margin: 0;
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.ked-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.ked-header__sep {
    width: 1px;
    height: 16px;
    background: var(--border);
}

.ked-header__id {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    font-family: var(--font-mono);
}

.ked-header__code {
    font-size: 0.875rem;
    padding: 4px 12px;
}

.ked-header__slash {
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

.ked-header__year {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
}

/* ── Grid ───────────────────────────────────────────────────────────────── */

.ked-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 1024px) {
    .ked-grid {
        grid-template-columns: 1fr 2fr;
    }
}

.ked-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Card content spacing ───────────────────────────────────────────────── */

.ked-card-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ked-section-label {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin: 0 0 6px;
}

/* ── Progress bar ───────────────────────────────────────────────────────── */

.ked-progress {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ked-progress__track {
    width: 96px;
    height: 8px;
    border-radius: 9999px;
    background: var(--muted);
    overflow: hidden;
}

.ked-progress__fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 300ms ease;
}

.ked-progress__fill--ok {
    background: var(--primary);
}

.ked-progress__fill--warn {
    background: #f59e0b;
}

.ked-progress__fill--bad {
    background: var(--destructive);
}

.ked-progress__label {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

/* ── Detail list ────────────────────────────────────────────────────────── */

.ked-detail-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.ked-detail-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.ked-detail-row__label {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    flex-shrink: 0;
    padding-top: 2px;
}

.ked-detail-row__value {
    font-size: 0.875rem;
    color: var(--foreground);
    text-align: right;
}

.ked-detail-row__value--row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ked-detail-row__value--waste-code {
    flex: 1;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    text-align: left;
}

.ked-detail-row__value--waste-code .ked-code-badge {
    flex-shrink: 0;
}

.ked-detail-row__description {
    line-height: 1.35;
}

.ked-detail-row__value--medium {
    font-weight: 500;
}

.ked-detail-row__value--install {
    display: inline-flex;
    align-items: flex-start;
    gap: 6px;
    max-width: 180px;
    text-align: right;
    line-height: 1.4;
}

.ked-detail-row__value--primary {
    color: var(--primary);
}

.ked-detail-row__value--destructive {
    font-size: 0.75rem;
    color: var(--destructive);
}

.ked-detail-row__icon {
    opacity: 0.5;
    flex-shrink: 0;
    margin-top: 2px;
}

.ked-code-badge {
    font-size: 0.875rem;
}

/* ── Flags grid ─────────────────────────────────────────────────────────── */

.ked-flags {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.ked-flag {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: oklch(0.95 0.008 155 / 0.30);
    font-size: 0.75rem;
    color: var(--muted-foreground);
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.ked-flag--active {
    background: oklch(0.765 0.168 131 / 0.10);
    border-color: oklch(0.765 0.168 131 / 0.30);
    color: var(--primary);
}

.ked-flag__code {
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1;
    color: oklch(0.50 0.02 155 / 0.40);
    flex-shrink: 0;
}

.ked-flag--active .ked-flag__code {
    color: var(--primary);
}

/* ── Subsection with top border ─────────────────────────────────────────── */

.ked-subsection {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.ked-bool-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.ked-bool-row__label {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    line-height: 1.4;
}

.ked-note {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    background: oklch(0.95 0.008 155 / 0.40);
    border-radius: 6px;
    padding: 8px 10px;
    line-height: 1.5;
    margin: 0;
}

/* ── Badge variants for bool row ────────────────────────────────────────── */

.badge-outline--primary-soft {
    background: oklch(0.765 0.168 131 / 0.10);
    color: var(--primary);
    border-color: oklch(0.765 0.168 131 / 0.30);
}

.badge-outline--warning-soft {
    background: oklch(0.75 0.183 55 / 0.10);
    color: #b45309;
    border-color: oklch(0.75 0.183 55 / 0.20);
}

.badge-outline--muted {
    color: var(--muted-foreground);
}

.badge-outline--secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
    border-color: transparent;
}

/* ── Summary card ───────────────────────────────────────────────────────── */

.ked-summary {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 16px;
    padding-bottom: 12px;
}

.ked-summary__title {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin: 0 0 4px;
}

.ked-summary__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ked-summary__label {
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.ked-summary__value {
    font-size: 0.875rem;
    font-weight: 600;
}

.ked-summary__icons {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ked-summary__dash {
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

/* ── Timeline ───────────────────────────────────────────────────────────── */

.ked-timeline__title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ked-timeline__empty {
    padding: 48px 0;
    text-align: center;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.ked-timeline {
    position: relative;
}

.ked-timeline__line {
    position: absolute;
    left: 17px;
    top: 16px;
    bottom: 16px;
    width: 1px;
    background: var(--border);
}

.ked-timeline__items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ked-timeline__item {
    display: flex;
    gap: 16px;
}

.ked-timeline__dot {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid;
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--muted-foreground);
}

.ked-timeline__dot--ok {
    border-color: var(--primary);
}

.ked-timeline__dot--issue {
    border-color: var(--destructive);
}

.ked-timeline__dot--pending {
    border-color: #f59e0b;
}

.ked-timeline__card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    background: oklch(0.95 0.008 155 / 0.30);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: background 150ms ease;
}

.ked-timeline__card:hover {
    background: oklch(0.95 0.008 155 / 0.60);
}

.ked-timeline__card--static {
    cursor: default;
}

.ked-timeline__card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.ked-timeline__card-id {
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--foreground);
    margin: 0;
}

.ked-timeline__card-meta {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin: 2px 0 0;
}

.ked-timeline__card-footer {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.ked-timeline__card-key {
    font-weight: 500;
    color: var(--foreground);
}

/* ===== EUP context selector (top bar) ===== */
.eup-context {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--card, #fff);
    border-bottom: 1px solid var(--border, #e5e7eb);
    min-height: 52px;
}

.eup-context__label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--muted-foreground, #6b7280);
    white-space: nowrap;
}

.eup-context__loading,
.eup-context__empty {
    font-size: 0.8125rem;
    color: var(--muted-foreground, #6b7280);
    font-style: italic;
}

.eup-context__trigger {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    line-height: 1.2;
    min-width: 0;
}

.eup-context__item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    line-height: 1.25;
}

.eup-context__name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--foreground, #111827);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}

.eup-context__address {
    font-size: 0.75rem;
    color: var(--muted-foreground, #6b7280);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}

/* Make the combobox trigger inside the top bar a touch more compact */
.eup-context .kc-combo__trigger {
    min-height: 36px;
    padding: 4px 12px;
}

/* ── Onboarding page ───────────────────────────────────────────────────── */

.ob-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding: 24px;
    overflow: hidden;
}

.ob-page p {
    margin-bottom: 0;
}

.ob-header {
    margin-bottom: 24px;
}

.ob-header__title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 0;
}

.ob-header__subtitle {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin: 4px 0 0;
}

.ob-layout {
    display: flex;
    flex: 1;
    gap: 24px;
    min-height: 0;
    overflow: hidden;
}

.ob-chat {
    flex: 3;
    min-width: 0;
    overflow: hidden;
    padding: 0;
    gap: 0;
}

.ob-chat__messages {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
}

.ob-chat__message {
    max-width: 85%;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.875rem;
    line-height: 1.55;
}

.ob-chat__message--assistant {
    align-self: flex-start;
    background: var(--muted);
    color: var(--foreground);
}

.ob-chat__message--user {
    align-self: flex-end;
    background: var(--foreground);
    color: var(--background);
}

.ob-chat__composer {
    border-top: 1px solid var(--border);
    padding: 16px;
}

.ob-chat__input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ob-chat__input {
    flex: 1;
    min-width: 0;
    height: 36px;
    border: none;
    border-radius: 6px;
    background: var(--muted);
    color: var(--foreground);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    outline: none;
    padding: 0 12px;
}

.ob-chat__input::placeholder {
    color: var(--muted-foreground);
}

.ob-chat__input:focus {
    box-shadow: 0 0 0 1px var(--primary);
}

.ob-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.ob-file {
    cursor: pointer;
}

.ob-profile {
    flex: 1;
    min-width: 280px;
    overflow: hidden;
    padding: 0;
    gap: 0;
}

.ob-profile__header {
    padding-top: 24px;
    padding-bottom: 8px;
}

.ob-profile__badge {
    font-weight: 600;
}

.ob-progress {
    height: 8px;
    border-radius: 9999px;
    background: var(--muted);
    margin: 0 24px 12px;
    overflow: hidden;
}

.ob-progress__bar {
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
}

.ob-profile__content {
    display: flex;
    flex: 1;
    flex-direction: column;
    overflow-y: auto;
    padding-bottom: 24px;
}

.ob-field {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}

.ob-field:last-of-type {
    border-bottom: none;
}

.ob-field__text {
    min-width: 0;
}

.ob-field__label {
    color: var(--muted-foreground);
    font-size: 0.75rem;
    margin-bottom: 2px;
}

.ob-field__value {
    color: var(--foreground);
    font-size: 0.875rem;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.ob-field__value--missing {
    color: var(--muted-foreground);
}

.ob-field__icon {
    flex-shrink: 0;
    margin-top: 4px;
    opacity: 0.6;
}

.ob-profile__actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 12px;
}

.ob-profile__action {
    justify-content: flex-start;
    width: 100%;
}

/* ── BDO integration page ───────────────────────────────────────────────── */

.bdo-page {
    padding: 24px;
}

.bdo-page p {
    margin-bottom: 0;
}

.bdo-header {
    margin-bottom: 24px;
}

.bdo-header__title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 0;
}

.bdo-header__subtitle {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    margin: 4px 0 0;
}

.bdo-steps {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 32px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.bdo-step-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bdo-step {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    padding: 0 12px;
    white-space: nowrap;
    transition: background 150ms ease, color 150ms ease;
}

.bdo-step--current {
    background: var(--primary);
    color: var(--primary-foreground);
    font-weight: 500;
}

.bdo-step--complete {
    background: var(--accent);
    color: var(--accent-foreground);
}

.bdo-step--upcoming {
    background: var(--muted);
    color: var(--muted-foreground);
}

.bdo-step__number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 1px solid currentColor;
    border-radius: 9999px;
    font-size: 0.75rem;
}

.bdo-step__line {
    width: 32px;
    height: 1px;
    background: var(--border);
}

.bdo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.bdo-card {
    gap: 0;
}

.bdo-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bdo-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bdo-field__label {
    color: var(--foreground);
    font-size: 0.875rem;
    font-weight: 500;
}

.bdo-input {
    width: 100%;
    min-height: 36px;
    border: none;
    border-radius: 6px;
    background: var(--muted);
    color: var(--foreground);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    outline: none;
    padding: 8px 12px;
}

.bdo-input:focus {
    box-shadow: 0 0 0 1px var(--primary);
}

.bdo-input--mono {
    font-family: var(--font-mono);
}

.bdo-token-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bdo-icon-btn {
    width: 36px;
    height: 36px;
    justify-content: center;
    padding: 0;
}

.bdo-checks {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 2px;
}

.bdo-check {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--foreground);
    cursor: pointer;
    font-size: 0.875rem;
}

.bdo-check input {
    accent-color: var(--primary);
}

.bdo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.bdo-result {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px;
    padding: 12px;
}

.bdo-result--success {
    background: var(--accent);
}

.bdo-result--error {
    background: oklch(0.577 0.245 27.325 / 0.10);
}

.bdo-result__title {
    color: var(--foreground);
    font-size: 0.875rem;
    font-weight: 500;
}

.bdo-result__desc {
    color: var(--muted-foreground);
    font-size: 0.75rem;
    margin-top: 2px;
}

.bdo-sync {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

.bdo-sync__button {
    align-self: flex-start;
}

/* ── MudButtons ────────────────────────────────────────────────────────── */

/* Drop MudBlazor's default uppercase transform on all buttons. !important is
   needed because MudBlazor's own .mud-button-root rule loads after app.css. */
.mud-button-root {
    text-transform: none !important;
}

/* Filled (solid) primary buttons use the app's primary foreground for the label.
   Text/outlined primary keep their primary-coloured label so they stay visible. */
.mud-button-root.mud-button-filled-primary {
    color: var(--primary-foreground) !important;
}

/* ── Notifications page ────────────────────────────────────────────────── */

.nt-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding: 24px;
}

.nt-page p {
    margin-bottom: 0;
}

.nt-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.nt-header__title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 0;
}

.nt-header__subtitle {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    margin: 4px 0 0;
}

.nt-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.nt-layout {
    display: flex;
    flex: 1;
    gap: 16px;
    min-height: 0;
    overflow: hidden;
}

.nt-list-card {
    width: 50%;
    min-width: 0;
    overflow: hidden;
    padding: 0;
}

.nt-list {
    flex: 1;
    overflow-y: auto;
}

.nt-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--foreground);
    cursor: pointer;
    font-family: var(--font-sans);
    padding: 16px;
    text-align: left;
    transition: background 150ms ease;
}

.nt-item:last-child {
    border-bottom: none;
}

.nt-item:hover {
    background: oklch(0.95 0.008 155 / 0.50);
}

.nt-item--selected {
    background: var(--accent);
}

.nt-item--unread {
    background: oklch(0.765 0.168 131 / 0.05);
}

.nt-item__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9999px;
    flex-shrink: 0;
    margin-top: 2px;
}

.nt-item__icon--high {
    background: oklch(0.577 0.245 27.325 / 0.10);
}

.nt-item__icon--medium {
    background: #fffbeb;
}

.nt-item__icon--low {
    background: var(--muted);
}

.nt-item__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.nt-item__title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.nt-item__title {
    color: var(--foreground);
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nt-item--unread .nt-item__title {
    font-weight: 600;
}

.nt-item__dot {
    width: 8px;
    height: 8px;
    border-radius: 9999px;
    background: var(--primary);
    flex-shrink: 0;
}

.nt-item__desc {
    color: var(--muted-foreground);
    font-size: 0.75rem;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nt-item__time {
    color: oklch(0.50 0.02 155 / 0.60);
    font-size: 0.75rem;
    margin-top: 4px;
}

.nt-detail {
    width: 50%;
    min-width: 0;
    overflow: hidden;
    padding: 0;
    gap: 0;
}

.nt-detail__header {
    padding-top: 24px;
}

.nt-detail__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted-foreground);
    font-size: 0.75rem;
    margin-bottom: 8px;
}

.nt-detail__title {
    margin-top: 8px;
}

.nt-detail__content {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    padding-bottom: 24px;
}

.nt-detail__desc {
    color: var(--foreground);
    font-size: 0.875rem;
    line-height: 1.6;
}

.nt-related {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    border: none;
    border-radius: 8px;
    color: var(--foreground);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    padding: 12px;
    text-align: left;
    transition: background 150ms ease;
}

.nt-related--kpo {
    background: oklch(0.95 0.008 155 / 0.50);
}

.nt-related--kpo:hover {
    background: var(--muted);
}

.nt-related--permit {
    border: 1px solid oklch(0.577 0.245 27.325 / 0.20);
    background: oklch(0.577 0.245 27.325 / 0.05);
}

.nt-related--permit:hover {
    background: oklch(0.577 0.245 27.325 / 0.10);
}

.nt-related__arrow {
    margin-left: auto;
    opacity: 0.6;
}

.nt-actions,
.nt-notes {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.nt-section-label {
    color: var(--muted-foreground);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.nt-actions__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.nt-notes__input {
    width: 100%;
    border: none;
    border-radius: 6px;
    resize: none;
    background: var(--muted);
    color: var(--foreground);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    outline: none;
    padding: 8px 12px;
}

.nt-notes__input::placeholder {
    color: var(--muted-foreground);
}

.nt-notes__input:focus {
    box-shadow: 0 0 0 1px var(--primary);
}

.nt-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

@media (max-width: 1024px) {
    .ob-layout,
    .nt-layout {
        flex-direction: column;
        overflow-y: auto;
    }

    .ob-page,
    .nt-page {
        overflow-y: auto;
    }

    .ob-chat,
    .ob-profile,
    .nt-list-card,
    .nt-detail {
        width: 100%;
        min-height: 360px;
    }

    .bdo-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .ob-chat__input-row,
    .bdo-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .ob-chat__input-row .btn,
    .bdo-actions .btn {
        justify-content: center;
        width: 100%;
    }
}
