/* === DESIGN TOKENS — Stitch Design System === */
:root {
    color-scheme: light;
    --app-bg: #f7f9fb;
    --app-bg-soft: #eef1f5;
    --app-surface: #ffffff;
    --app-surface-strong: #f0f3f8;
    --app-panel: #ffffff;
    --app-border: #e0e3e5;
    --app-border-strong: #bfc2c6;
    --app-text: #1a1b23;
    --app-text-muted: #747686;
    --app-primary: #00a957;
    --app-primary-strong: #008a49;
    --app-accent: #00b45f;
    --app-green: #00b45f;
    --app-green-strong: #008a49;
    --app-nav-hover: #e9edf5;
    --app-nav-open: #e4e9f3;
    --app-danger-soft: #ffdad6;
    --app-success-soft: #d8f5ee;
    --app-shadow-lg: 0 4px 24px rgba(0, 55, 177, 0.10);
    --app-shadow-md: 0 1px 4px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--app-bg);
    color: var(--app-text);
    font-family: 'BCASans', 'Inter', sans-serif;
}

body {
    min-height: 100vh;
}

a {
    text-decoration: none;
}

.app-shell {
    background: transparent;
}

/* === APPBAR === */

.app-shell__appbar {
    background: #ffffff !important;
    color: var(--app-text) !important;
    border-bottom: 1px solid var(--app-border) !important;
    box-shadow: none !important;
}

.app-shell__menu-button {
    margin-right: .5rem;
    color: var(--app-text-muted) !important;
}

.app-shell__headline {
    min-width: 0;
}

.app-shell__eyebrow {
    color: var(--app-text-muted);
}

.app-shell__role {
    margin-right: .75rem;
}

.app-shell__user-button {
    color: var(--app-text) !important;
}

.app-shell__logout {
    padding: .25rem .75rem .5rem;
}

/* === DRAWER === */

.app-shell__drawer {
    border-right: 1px solid var(--app-border);
    background: #ffffff;
    color: var(--app-text);
}

.app-shell__main {
    padding-top: 1.25rem;
    background: var(--app-bg);
}

.app-shell__content {
    padding: clamp(1rem, 2vw, 1.5rem);
}

/* === SIDEBAR === */

.app-sidebar {
    min-height: 100%;
    padding: 1.2rem;
}

.app-sidebar__brand,
.app-sidebar__note {
    border: 1px solid var(--app-border);
    background: var(--app-bg-soft);
    box-shadow: none;
    border-radius: 8px;
    padding: 1rem;
}

.app-sidebar__eyebrow,
.app-sidebar__group {
    color: var(--app-text-muted);
    letter-spacing: .1em;
}

.app-sidebar__brand .mud-typography,
.app-sidebar__note .mud-typography {
    color: var(--app-text);
}

.app-sidebar__brand .mud-typography-h4 {
    color: var(--app-primary-strong);
    line-height: 1.15;
    margin-top: .2rem;
}

.app-sidebar__description {
    color: var(--app-text-muted);
}

/* === CARDS === */

.app-card,
.app-stat-card {
    border: 1px solid var(--app-border);
    border-radius: 12px;
    background: var(--app-surface);
    box-shadow: var(--app-shadow-md);
}

.app-card {
    padding: clamp(1rem, 2vw, 1.5rem);
}

.app-card__header,
.app-page-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.app-card__header {
    margin-bottom: 1rem;
}

.app-card__heading,
.app-page-header__copy {
    display: grid;
    gap: .4rem;
}

.app-card__section,
.app-page-header__section {
    color: var(--app-primary-strong);
}

.app-page-header {
    padding: 0 0 .25rem;
}

.app-page-header__actions {
    display: flex;
    align-items: center;
    gap: .75rem;
}

/* === TOOLBAR === */

.app-toolbar {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: .85rem;
    align-items: end;
}

.app-toolbar>* {
    min-width: 0;
}

/* === EMPTY / STATE === */

.app-empty-state {
    display: grid;
    gap: .6rem;
    justify-items: start;
}

.app-empty-state__icon {
    color: var(--app-primary);
}

.app-empty-state__actions,
.app-state-card__actions {
    margin-top: .75rem;
}

.app-state-card {
    min-height: 12rem;
}

/* === STAT CARDS === */

.app-stat-card {
    min-height: 100%;
    padding: 1.25rem;
    display: grid;
    gap: .45rem;
    position: relative;
    overflow: hidden;
}

.app-stat-card__icon {
    width: 2.6rem;
    height: 2.6rem;
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
    color: var(--app-primary);
    background: color-mix(in srgb, var(--app-primary) 12%, white 88%);
}

.app-stat-card__label {
    color: var(--app-primary-strong);
}

.app-stat-card--featured {
    background: linear-gradient(140deg, var(--app-primary), var(--app-primary-strong));
    border-color: var(--app-primary);
    color: white;
    box-shadow: 0 8px 24px rgba(0, 169, 87, 0.25);
}

.app-stat-card--featured .app-stat-card__icon {
    background: rgba(255, 255, 255, 0.18);
    color: white;
}

.app-stat-card--featured .app-stat-card__label,
.app-stat-card--featured .app-text-muted,
.app-stat-card--featured .mud-typography {
    color: white !important;
}

/* === DATA GRID / TABLE === */

.app-data-grid__footer,
.app-pagination,
.app-confirm-panel__content {
    margin-top: 1rem;
}

.app-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
}

.app-data-table .mud-table-container,
.app-data-grid__table .mud-table-container {
    background: transparent;
    border-radius: 10px;
    overflow-x: auto;
}

.app-data-grid__table {
    margin-top: 1rem;
}

.app-data-grid__table .mud-table-root {
    border-collapse: separate;
    border-spacing: 0;
}

.app-data-table .mud-table-head th,
.app-data-grid__table .mud-table-head th {
    color: var(--app-text-muted);
    font-size: .9rem;
    font-weight: 700;
    color: var(--app-text);
    padding-top: .875rem;
    padding-bottom: .875rem;
    background: transparent;
    border-bottom: 1px solid var(--app-border);
}

.app-data-grid__table .mud-table-head th:first-child {
    border-top-left-radius: 10px;
}

.app-data-grid__table .mud-table-head th:last-child {
    border-top-right-radius: 10px;
}

.app-data-grid__table .mud-table-body td {
    padding-top: .875rem;
    padding-bottom: .875rem;
    vertical-align: top;
    border-bottom: 1px solid var(--app-border);
}

.app-data-grid__table .mud-table-body tr:last-child td {
    border-bottom: none;
}

.app-data-grid__table .mud-table-body td[data-label="Title"] {
    min-width: 22rem;
}

.app-data-grid__table .mud-table-body td[data-label="Views"] {
    white-space: nowrap;
    font-weight: 700;
}

.app-data-grid__table .mud-table-body td[data-label="Actions"] {
    white-space: nowrap;
}

.app-data-grid__table .mud-table-body .mud-link {
    color: var(--app-primary);
    font-weight: 700;
}

.app-data-grid__table .mud-table-body .mud-link:hover {
    color: var(--app-primary-strong);
}

.app-data-table .mud-table-row:hover,
.app-data-grid__table .mud-table-row:hover {
    background: color-mix(in srgb, var(--app-primary) 4%, white 96%);
}

/* only neutral chips get the soft grey look; coloured chips keep their palette (and readable contrast text) */
.app-data-grid__table .mud-chip {
    font-weight: 600;
}

.app-data-grid__table .mud-chip.mud-chip-color-default {
    border-color: var(--app-border);
    background: var(--app-bg-soft);
    color: var(--app-text);
}

/* === UTILITY === */

.app-text-muted {
    color: var(--app-text-muted);
}

.app-skeleton {
    border-radius: 10px;
}

.app-bullet-list {
    padding: 0;
}

.app-bullet-list .mud-list-item {
    padding-left: 0;
    padding-right: 0;
}

.app-metadata {
    flex-wrap: wrap;
}

.app-category-card {
    min-height: 100%;
}

/* === CONFIRM PANEL === */

.app-confirm-panel {
    background: linear-gradient(180deg, var(--app-surface) 0%, var(--app-surface-strong) 100%);
}

.app-confirm-panel--danger {
    border-color: color-mix(in srgb, #ba1a1a 25%, white 75%);
    background: linear-gradient(180deg, var(--app-surface) 0%, var(--app-danger-soft) 100%);
}

/* === LOGIN === */

.split-login {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.split-login__info {
    flex: 1;
    background-color: #003f73;
    background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 32px 32px;
    background-position: center;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    position: relative;
    overflow: hidden;
}

.split-login__info::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at 10% 30%, rgba(0, 180, 95, 0.22) 0%, transparent 70%);
    pointer-events: none;
}

.split-login__info-content {
    max-width: 520px;
    width: 100%;
    position: relative;
    z-index: 1;
}

.split-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #cbd5e1;
    margin-bottom: 2rem;
    background: rgba(255,255,255,0.03);
}

.split-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #00b45f;
    box-shadow: 0 0 8px #00b45f;
}

.split-heading {
    font-size: 2.75rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
    color: #f8fafc;
}

.split-description {
    font-size: 1.125rem;
    line-height: 1.6;
    color: #94a3b8;
    margin-bottom: 3rem;
}

.split-benefits {
    display: grid;
    gap: 1.25rem;
    margin-bottom: 3rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 2rem;
}

.split-benefit {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.split-benefit-icon {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 8px;
    background: rgba(0, 180, 95, 0.2);
    color: #5eead4;
}

.split-benefit-text {
    font-size: 0.95rem;
    color: #e2e8f0;
    font-weight: 500;
}

.split-alert .mud-alert {
    background: rgba(15, 23, 42, 0.5) !important;
    border-color: rgba(96, 165, 250, 0.3) !important;
    color: #93c5fd !important;
}

.split-alert .mud-alert .mud-icon-root {
    color: #60a5fa !important;
}

/* Right Form Section */

.split-login__form {
    flex: 1;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem;
}

.split-login__form-content {
    max-width: 420px;
    width: 100%;
}

.split-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.split-logo .mud-icon-root {
    background: var(--app-primary);
    color: white;
    border-radius: 8px;
    padding: 0.25rem;
}

.split-form-heading {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.split-form-subtitle {
    font-size: 1rem;
    color: #64748b;
    margin-bottom: 2.5rem;
    line-height: 1.5;
}

.split-form-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.5rem; 
}

.split-form-label a {
    color: var(--app-primary);
    text-transform: none;
    font-size: 0.85rem;
    letter-spacing: 0;
    font-weight: 600;
}

.split-form-label a:hover {
    text-decoration: underline;
}

.split-form-fields {
    display: grid;
    gap: 1.5rem;
}

.split-login .mud-input-control {
    margin-top: 0;
    margin-bottom: 0;
}

.split-login .mud-input-outlined {
    background-color: #f8fafc !important;
    border-radius: 8px !important;
}

.split-login .mud-input-outlined-border {
    border-color: #e2e8f0 !important;
    border-width: 1px !important;
}

.split-login .mud-input:focus-within .mud-input-outlined-border {
    border-color: var(--app-primary) !important;
    border-width: 2px !important;
}

.split-login .mud-input-slot {
    padding: 16px 14px !important;
    font-size: 1rem;
    color: #0f172a !important;
}

.split-login .mud-input-adornment {
    color: #94a3b8 !important;
}

.split-login-btn {
    margin-top: 1rem !important;
    height: 3.25rem;
    border-radius: 8px !important;
    font-size: 1.05rem !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    box-shadow: var(--app-shadow-lg) !important;
}

.split-login-support {
    margin-top: 3rem;
    text-align: center;
    font-size: 0.9rem;
    color: #64748b;
}

.split-login-support a {
    color: var(--app-primary);
    font-weight: 600;
}

.split-login-support a:hover {
    text-decoration: underline;
}

@media (max-width: 1024px) {
    .split-login {
        flex-direction: column;
    }
    
    .split-login__info {
        display: none;
    }

    .split-login__form {
        flex: 1;
        width: 100%;
        padding: 2rem 1.5rem;
    }
}

.logout-form {
    display: inline-flex;
}

/* === USER AVATAR === */

.app-user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    color: white;
    display: grid;
    place-items: center;
    font-size: .72rem;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: 0;
    user-select: none;
}

.app-user-avatar--xs {
    width: 1.6rem;
    height: 1.6rem;
    font-size: .65rem;
}

/* === STATUS DOT === */

.app-status-dot {
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.app-status-dot--active {
    background: #16a34a;
}

.app-status-dot--inactive {
    background: #9ca3af;
}

.app-perm-chip {
    font-size: 0.68rem !important;
    height: 20px !important;
    padding: 0 6px !important;
    background: #f0f3f8 !important;
    color: #565e74 !important;
    border-radius: 4px !important;
}

/* === EXPANDABLE LOG ROW === */

.app-log-expanded {
    background: #1a1f2e;
    padding: 1.25rem 1.5rem;
    display: grid;
    gap: 1.25rem;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
}

.app-log-expanded__section {
    display: grid;
    gap: .5rem;
}

.app-log-expanded__label {
    color: #64748b;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-weight: 700;
}

.app-log-expanded__code {
    color: #e2e8f0;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: .78rem;
    margin: 0;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.6;
}

.app-log-expanded__copy {
    display: flex;
    justify-content: flex-end;
    margin-top: .25rem;
}

/* === SIDEBAR USER PROFILE === */

.app-sidebar__user {
    border: none;
    background: transparent;
    padding: .875rem 1rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    transition: background-color 0.2s ease;
}

.app-sidebar__user:hover {
    background: var(--app-bg-soft);
    border-radius: 8px;
}

.app-sidebar__user-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--app-primary);
    color: white;
    display: grid;
    place-items: center;
    font-size: .8rem;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: 0;
}

.app-sidebar__user-info {
    min-width: 0;
}

.app-sidebar__user-name {
    font-weight: 700;
    font-size: .875rem;
    color: var(--app-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-sidebar__user-role {
    font-size: .72rem;
    color: var(--app-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: .1rem;
}

/* === STAT CARD TOP ROW (icon + badge) === */

.app-stat-card__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

/* === APPBAR ICON BUTTONS === */

.app-shell__appbar-icon {
    color: var(--app-text-muted) !important;
}

/* === OPTIMIZATION TIP === */

.app-tip {
    border-left: 3px solid #b7791f;
    background: linear-gradient(90deg, #fefce8, var(--app-surface));
}

/* === MUDBLAZOR OVERRIDES === */

.mud-chip {
    font-weight: 700;
}

.mud-button-root.mud-button-filled.mud-primary-text {
    box-shadow: 0 4px 12px rgba(0, 169, 87, 0.2);
}

.mud-input-outlined-border {
    border-color: var(--app-border-strong) !important;
}

/* === RESPONSIVE === */

@media (max-width: 959.98px) {
    .app-shell__content {
        padding: 1rem;
    }

    .app-toolbar {
        grid-template-columns: 1fr;
    }

    .app-pagination,
    .app-card__header,
    .app-page-header {
        align-items: stretch;
    }

    .app-page-header__actions,
    .app-pagination {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

/* === BCA SHELL (override layer) === */

.app-shell__appbar {
    height: 64px;
    padding: 0 1.5rem !important;
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: .9rem;
    color: var(--app-text);
}

.app-brand__logo {
    height: 38px;
    width: auto;
}

.app-brand__divider {
    width: 1px;
    height: 28px;
    background: var(--app-border);
}

.app-brand__name {
    font-size: .95rem;
    color: var(--app-text-muted);
}

.app-user-chip {
    display: inline-flex;
    align-items: center;
    gap: .15rem;
    cursor: pointer;
    padding: .2rem .4rem;
    border-radius: 6px;
    color: var(--app-text-muted);
    background: var(--app-bg-soft);
}

.app-user-chip__avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 4px;
    display: grid;
    place-items: center;
    background: var(--app-primary);
    color: #fff;
    font-weight: 700;
    font-size: .85rem;
}

.app-shell__drawer {
    background: #fff;
    border-right: 1px solid var(--app-border);
}

.app-sidebar {
    padding: .75rem .9rem 1.5rem;
}

.app-nav__category {
    color: var(--app-text-muted);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
    padding: 1.1rem .75rem .5rem;
}

.app-sidebar__nav .mud-nav-link,
.app-sidebar__nav .mud-nav-group > .mud-nav-link {
    border-radius: 6px;
    color: #3c3f5c;
    font-weight: 500;
    min-height: 2.5rem;
    margin-bottom: .15rem;
    padding: 0 .75rem;
}

.app-sidebar__nav .mud-nav-link .mud-nav-link-content {
    flex-direction: row-reverse;
    justify-content: space-between;
    width: 100%;
}

.app-sidebar__nav .mud-nav-link .mud-nav-link-icon {
    margin-inline: 0;
    color: #8a8fb0;
}

.app-sidebar__nav .mud-nav-link:hover:not(.mud-nav-link-disabled) {
    background: var(--app-nav-hover);
    color: var(--app-text);
}

.app-sidebar__nav .mud-nav-link.active:not(.mud-nav-link-disabled) {
    background: var(--app-green) !important;
    color: #fff !important;
    box-shadow: none !important;
    border-radius: 6px !important;
}

.app-sidebar__nav .mud-nav-link.active:not(.mud-nav-link-disabled) .mud-nav-link-text,
.app-sidebar__nav .mud-nav-link.active:not(.mud-nav-link-disabled) .mud-nav-link-icon,
.app-sidebar__nav .mud-nav-link.active:not(.mud-nav-link-disabled) .mud-icon-root {
    color: #fff !important;
}

.app-sidebar__nav .mud-nav-group.mud-expanded {
    background: var(--app-nav-open);
    border-radius: 6px;
    margin-bottom: .25rem;
}

.app-sidebar__nav .mud-nav-group .mud-collapse-container .mud-nav-link {
    padding-left: 1.5rem;
}

.app-sidebar__nav .mud-nav-group .mud-collapse-container .mud-nav-link .mud-nav-link-content {
    flex-direction: row;
    justify-content: flex-start;
}

/* breadcrumb (dot separator) */

.app-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    font-size: 1.05rem;
    color: var(--app-text-muted);
}

.app-breadcrumbs__link {
    color: var(--app-text-muted) !important;
}

.app-breadcrumbs__current {
    color: var(--app-text);
    font-weight: 700;
}

.app-breadcrumbs__link::after,
.app-breadcrumbs__current::after {
    content: "\00b7";
    margin-left: .6rem;
    color: var(--app-text-muted);
}

.app-breadcrumbs__current:last-child::after,
.app-breadcrumbs__link:last-child::after {
    content: "";
    margin: 0;
}

.app-page-header {
    position: relative;
}

.app-page-header__section,
.app-page-header .mud-typography-h3,
.app-page-header .app-text-muted {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* card + table (reference look) */

.app-card {
    border-radius: 8px;
    box-shadow: none;
}

.app-card__header .mud-typography-h4 {
    font-size: 1.15rem;
    font-weight: 700;
}

.app-card__section {
    display: none;
}

.app-data-grid__table .mud-table-body td {
    vertical-align: middle;
    padding-top: 1.1rem;
    padding-bottom: 1.1rem;
}

.app-data-grid__table .mud-table-head th:first-child,
.app-data-grid__table .mud-table-head th:last-child {
    border-radius: 0;
}

/* small green icon buttons (+ / refresh) */
.app-card__actions .mud-icon-button,
.app-btn-icon {
    width: 2rem;
    height: 2rem;
    padding: 0;
    border-radius: 4px;
    background: color-mix(in srgb, var(--app-green) 14%, white 86%);
    color: var(--app-green-strong);
}

.app-card__actions .mud-icon-button:hover,
.app-btn-icon:hover {
    background: color-mix(in srgb, var(--app-green) 24%, white 76%);
}

.mud-button-root.mud-button-filled.mud-primary-text {
    box-shadow: none;
}


/* === GREEN ACCENT + ALIGNMENT FIXES === */

.app-shell__appbar .mud-toolbar {
    min-height: 64px;
    height: 64px;
    align-items: center;
}

.app-brand,
.app-user-chip {
    line-height: 1;
}

.app-sidebar {
    padding-top: 1.25rem;
}

.app-sidebar__nav .mud-nav-link,
.app-sidebar__nav .mud-nav-group > .mud-nav-link {
    display: flex;
    align-items: center;
}

.app-sidebar__nav .mud-nav-link .mud-nav-link-content {
    align-items: center;
}

.app-sidebar__nav .mud-nav-link .mud-nav-link-text {
    line-height: 1.2;
}

/* === LOADING STATES === */

form.is-submitting {
    pointer-events: none;
}

form.is-submitting button[type="submit"] {
    opacity: .85;
    position: relative;
}

form.is-submitting button[type="submit"] .mud-button-label {
    visibility: hidden;
}

form.is-submitting button[type="submit"]::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.25rem;
    height: 1.25rem;
    margin: -.625rem 0 0 -.625rem;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: app-spin .7s linear infinite;
}

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

.app-page-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    height: 3px;
}

.logout-form.is-submitting button[type="submit"]::after {
    border-color: rgba(0, 0, 0, .2);
    border-top-color: var(--app-text-muted);
}


/* === LEGACY PARITY: font, text colors, compact inputs === */

:root {
    --app-text: #595c97;
    --app-heading: #141322;
    --app-text-muted: #a1a1c2;
    --app-font: 'BCASans', 'Inter', sans-serif;
}

html,
body,
.mud-typography,
.mud-input,
.mud-button-root,
.mud-nav-link,
.mud-table-root {
    font-family: var(--app-font);
}

body {
    color: var(--app-text);
}

h1, h2, h3, h4, h5, h6,
.mud-typography-h1, .mud-typography-h2, .mud-typography-h3,
.mud-typography-h4, .mud-typography-h5, .mud-typography-h6,
.app-breadcrumbs__current,
.app-data-grid__table .mud-table-head th {
    color: var(--app-heading);
}

.app-sidebar__nav .mud-nav-link {
    color: var(--app-text);
}

.app-sidebar__nav .mud-nav-link .mud-nav-link-icon {
    color: var(--app-text-muted);
}

.app-nav__category {
    color: var(--app-text-muted);
}

/* input values, placeholders and dropdown values use the light face; BCASans regular reads too heavy in forms */
.mud-input input,
.mud-input textarea,
.mud-input .mud-input-slot,
.mud-select .mud-input-slot,
.mud-input input::placeholder,
.mud-input textarea::placeholder {
    font-weight: 300;
}

.mud-input-label,
.mud-input-helper-text {
    font-weight: 400;
}

/* compact outlined inputs (~36px) */
.mud-input.mud-input-outlined > .mud-input-slot,
.mud-input.mud-input-outlined.mud-input-margin-dense > .mud-input-slot {
    padding: 8px 12px;
    font-size: .9rem;
}

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

.mud-input-control .mud-input-label-outlined.mud-input-label-inputcontrol.mud-shrink,
.mud-input-control .mud-input-label-outlined.mud-input-label-margin-dense.mud-shrink {
    transform: translate(14px, -6px) scale(.75);
}

.mud-input-outlined .mud-input-adornment {
    margin-top: 0;
}

.mud-input-control .mud-input-outlined.mud-input-adorned-start > .mud-input-slot,
.mud-input-control .mud-input-outlined.mud-input-adorned-end > .mud-input-slot {
    padding-top: 8px;
    padding-bottom: 8px;
}

.mud-input-outlined:focus-within .mud-input-outlined-border {
    border-color: #00d086 !important;
}

.split-login .mud-input-slot {
    padding: 9px 12px !important;
    font-size: .9rem;
}

.split-login-btn {
    height: 2.75rem;
}


/* === APP PAGINATION === */

.app-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: .75rem 1.5rem;
}

.app-pagination__size,
.app-pagination__nav {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.app-pagination__label,
.app-pagination__total {
    font-size: .9rem;
    color: var(--app-text);
}

.app-pagination__total {
    margin-left: 1rem;
    color: var(--app-text-muted);
}

.app-pagination__select {
    width: 6rem;
    min-width: 6rem;
    margin: 0;
}

/* MudBlazor reserves 3.5-4.5rem right padding on select inputs; the icon already has its own space */
.app-pagination__select .mud-input input,
.app-pagination__select .mud-select-input input {
    padding: 8px 0 8px 12px !important;
    text-overflow: clip !important;
}

.app-pagination__page {
    min-width: 2rem;
    height: 2rem;
    padding: 0 .5rem;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--app-text);
    font-family: var(--app-font);
    font-size: .9rem;
    cursor: pointer;
}

.app-pagination__page:hover:not(:disabled) {
    background: var(--app-nav-hover);
}

.app-pagination__page.is-active {
    background: var(--app-green);
    color: #fff;
    font-weight: 700;
}

.app-pagination__ellipsis {
    color: var(--app-text-muted);
    padding: 0 .25rem;
}

.app-card__actions .mud-icon-button .mud-icon-root,
.app-btn-icon .mud-icon-root {
    font-size: 1.1rem;
}

/* === HEADER DROPDOWNS (notifications, account) === */

.app-dropdown {
    position: relative;
    display: inline-flex;
}

.app-dropdown__trigger {
    display: inline-flex;
    align-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--app-text-muted);
    cursor: pointer;
    font: inherit;
}

.app-dropdown__trigger:hover {
    color: var(--app-green-strong);
}

.app-dropdown__backdrop {
    position: fixed;
    inset: 0;
    z-index: 1390;
}

.app-dropdown__panel {
    position: absolute;
    top: calc(100% + .6rem);
    right: 0;
    z-index: 1400;
    min-width: 15rem;
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(20, 19, 34, .12);
    padding: .35rem 0;
}

.app-dropdown__header {
    padding: .6rem 1rem;
    border-bottom: 1px solid var(--app-border);
    font-weight: 700;
    color: var(--app-heading);
}

.app-dropdown__empty {
    display: grid;
    justify-items: center;
    gap: .4rem;
    padding: 1.5rem 1rem;
    color: var(--app-text-muted);
    font-size: .9rem;
}

.app-dropdown__item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem 1rem;
    color: var(--app-text);
    font-size: .9rem;
}

.app-dropdown__item:hover {
    background: var(--app-nav-hover);
}

.app-dropdown__item--form {
    padding: .1rem .4rem;
}

.app-dropdown__item--form:hover {
    background: transparent;
}

.app-dropdown__divider {
    height: 1px;
    margin: .35rem 0;
    background: var(--app-border);
}

.app-card__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .75rem;
}

/* === RESPONSIVE SHELL === */

.logout-form {
    display: flex;
    width: 100%;
}

.logout-form .mud-button-root {
    width: 100%;
    justify-content: flex-start;
}

.app-shell__appbar {
    padding: 0 1.5rem !important;
}

.app-shell__appbar .mud-toolbar {
    padding: 0;
    gap: .75rem;
}

.app-shell__menu-button {
    margin: 0 !important;
}

.app-brand {
    min-width: 0;
    gap: .75rem;
}

.app-dropdown + .app-dropdown {
    margin-left: .75rem;
}

.app-sidebar__mobile-head {
    display: none;
}

@media (max-width: 959.98px) {
    .app-sidebar__mobile-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 .25rem .75rem;
        margin-bottom: .25rem;
        border-bottom: 1px solid var(--app-border);
    }

    .app-shell__drawer {
        z-index: 1400;
    }
}

@media (max-width: 599.98px) {
    .app-shell__appbar {
        padding: 0 .75rem !important;
    }

    .app-shell__appbar .mud-toolbar {
        gap: .5rem;
    }

    .app-brand {
        gap: .5rem;
    }

    .app-brand__logo {
        height: 30px;
    }

    .app-brand__divider,
    .app-brand__name {
        display: none;
    }

    .app-dropdown + .app-dropdown {
        margin-left: .25rem;
    }

    .app-dropdown__panel {
        position: fixed;
        top: 64px;
        right: .5rem;
        left: .5rem;
        min-width: 0;
    }

    .app-shell__content {
        padding: .75rem;
    }
}

/* === CMS ADMIN MODULES (login extras, tables, matrix, jobs) === */
.split-form-forgot {
    display: flex;
    justify-content: flex-end;
    margin-top: -0.75rem;
    font-size: 0.85rem;
}

.split-form-forgot a {
    color: var(--app-primary);
    font-weight: 600;
}

.split-form-forgot a:hover {
    text-decoration: underline;
}

.split-login-btn.mud-button-filled {
    color: #ffffff;
}

.app-captcha-error {
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    background: var(--app-danger-soft);
    color: #93000a;
    font-size: 0.875rem;
}

.app-auth-card {
    width: 100%;
    max-width: 440px;
    margin: 8vh auto;
    padding: 2.5rem;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 12px;
    box-shadow: var(--app-shadow-md);
}

.app-auth-card .split-logo {
    margin-bottom: 2rem;
}

.app-sort-header {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-weight: inherit;
    color: inherit;
    cursor: pointer;
}

.app-sort-header__icon {
    opacity: 0.35;
    font-size: 1rem !important;
}

.app-sort-header.is-active .app-sort-header__icon {
    opacity: 1;
    color: var(--app-primary);
}

.app-lookup-multi__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.app-matrix {
    overflow-x: auto;
}

.app-matrix__module {
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}

.app-matrix__action,
.app-matrix__cell {
    text-align: center !important;
    white-space: nowrap;
}

.app-matrix__cell .mud-checkbox {
    justify-content: center;
}

.app-detail-item__label {
    font-size: 0.75rem;
    color: var(--app-text-muted);
}

.app-detail-item__value {
    font-size: 0.9rem;
    word-break: break-word;
}

.app-import-errors {
    max-height: 320px;
    overflow-y: auto;
}

.app-job {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--app-border);
    font-size: 0.85rem;
}

.app-job:last-child {
    border-bottom: 0;
}

.app-job__title {
    font-weight: 600;
    text-transform: capitalize;
}

.app-job__meta {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    color: var(--app-text-muted);
    font-size: 0.75rem;
}

.app-job__status--completed {
    color: var(--app-primary-strong);
}

.app-job__status--failed,
.app-job__error {
    color: #ba1a1a;
}

.app-job__download {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.25rem;
    color: var(--app-primary);
    font-weight: 600;
}

/* === RICH TEXT (tickets title, A-08) === */

.app-richtext {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.app-richtext__label {
    font-size: .8rem;
    color: var(--app-text-muted);
}

.app-richtext__toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .125rem;
    padding: .25rem;
    border: 1px solid var(--app-border);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    background: var(--app-surface-strong);
}

.app-richtext__content {
    min-height: 120px;
    max-height: 320px;
    overflow-y: auto;
    padding: 8px 12px;
    font-size: .9rem;
    color: var(--app-text);
    border: 1px solid var(--app-border);
    border-radius: 0 0 6px 6px;
    background: var(--app-surface);
    outline: none;
}

.app-richtext__content:focus {
    border-color: var(--app-primary);
}

.app-richtext__content p {
    margin: 0 0 .5rem;
}

.app-richtext__content ul,
.app-richtext__content ol {
    margin: 0 0 .5rem;
    padding-left: 1.5rem;
}

.app-richtext__content ul {
    list-style: disc outside;
}

.app-richtext__content ol {
    list-style: decimal outside;
}

.app-richtext--error .app-richtext__content {
    border-color: var(--mud-palette-error);
}

.app-richtext__error {
    font-size: .75rem;
    color: var(--mud-palette-error);
}

.app-richtext__helper {
    font-size: .75rem;
    color: var(--app-text-muted);
}

.app-richtext--disabled .app-richtext__content {
    background: var(--app-surface-strong);
    color: var(--app-text-muted);
}

/* === HTML EDITOR (summernote-lite wrapper, Common/Components/HtmlEditor) === */

.app-htmleditor {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.app-htmleditor__label {
    font-size: .8rem;
    color: var(--app-text-muted);
}

.app-htmleditor--error .note-editor.note-frame {
    border-color: var(--mud-palette-error);
}

.app-htmleditor__error {
    font-size: .75rem;
    color: var(--mud-palette-error);
}

.app-htmleditor__helper {
    font-size: .75rem;
    color: var(--app-text-muted);
}

/* summernote renders outside mud's stacking context: keep its popups and fullscreen above mud dialogs (z-index 1300) */
.note-modal,
.note-modal-backdrop {
    z-index: 2000 !important;
}

.note-editor.note-frame.fullscreen {
    z-index: 1500;
}

/* the app css reset removes list markers and table borders; restore them inside the editor */
.note-editable ul {
    list-style: disc outside;
    padding-left: 1.5rem;
}

.note-editable ol {
    list-style: decimal outside;
    padding-left: 1.5rem;
}

.note-editable table {
    border-collapse: collapse;
}

.note-editable td,
.note-editable th {
    border: 1px solid var(--app-border);
    padding: 4px 8px;
}

/* rendered ticket title (sanitised html) */
.app-ticket-title p {
    margin: 0;
}

.app-mono {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    letter-spacing: .04em;
}

/* sidebar groups: header looks like the category label, only the group of the current page is open */
.app-sidebar__nav .app-nav__group {
    margin-top: .35rem;
}

.app-sidebar__nav .app-nav__group.mud-expanded {
    background: transparent;
    margin-bottom: 0;
}

.app-sidebar__nav .app-nav__group > .mud-nav-link {
    min-height: 2rem;
    margin-bottom: 0;
}

.app-sidebar__nav .app-nav__group > .mud-nav-link .mud-nav-link-text {
    color: var(--app-text-muted);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.app-sidebar__nav .app-nav__group > .mud-nav-link:hover:not(.mud-nav-link-disabled) {
    background: transparent;
}

.app-sidebar__nav .app-nav__group .mud-collapse-container .mud-nav-link {
    padding-left: .75rem;
}

/* === FAQ list: the "..." that opens the full question/answer === */
.faq-more {
    color: var(--mud-palette-primary);
    font-weight: 700;
    cursor: pointer;
}

.faq-more:hover {
    text-decoration: underline;
}

/* === SEARCHABLE SELECT (select2 style dropdown with a search box) === */
.app-sselect__field,
.app-sselect__field input {
    cursor: pointer;
}

.app-sselect__popover {
    padding: .5rem;
}

.app-sselect__list {
    max-height: 220px;
    overflow-y: auto;
    margin-top: .25rem;
}

.app-sselect__item {
    padding: .5rem .75rem;
    border-radius: 4px;
    cursor: pointer;
}

.app-sselect__item:hover {
    background: var(--mud-palette-action-default-hover);
}

.app-sselect__item--selected {
    color: var(--mud-palette-primary);
    font-weight: 600;
}
