:root {
    --font-heading: "Be Vietnam Pro", "Segoe UI", sans-serif;
    --font-body: "Be Vietnam Pro", "Segoe UI", sans-serif;

    /* ===== Primary ===== */
    --color-primary: #2859A4;
    --color-primary-strong: #1F4783;
    --color-primary-soft: #3A6FBB;
    --color-primary-tint: #DCEAFE;

    /* ===== Accent ===== */
    --color-accent: #F4A31D;
    --color-accent-strong: #D78908;
    --color-accent-tint: #FEF3C7;

    /* ===== Background ===== */
    --color-bg: #F6F8FC;
    --color-bg-soft: #EEF3FA;
    --color-surface: #FFFFFF;
    --color-surface-muted: #FAFBFE;
    --color-surface-deep: #E9EEF5;

    /* ===== Text ===== */
    --color-text: #181D27;
    --color-text-muted: #6B778C;
    --color-text-faint: #8A97AB;

    /* ===== Line ===== */
    --color-line: #E6EBF2;
    --color-line-soft: #F0F3F8;

    /* ===== Semantic ===== */
    --color-success-bg: #D9F8E3;
    --color-success-fg: #148544;
    --color-warning-bg: #FFF0D8;
    --color-warning-fg: #D78908;
    --color-danger-bg: #FFE2E2;
    --color-danger-fg: #CC4545;

    /* ===== Shadow ===== */
    --shadow-xs: 0 2px 10px rgba(4, 36, 121, 0.04);
    --shadow-sm: 0 10px 30px rgba(8, 26, 76, 0.06);
    --shadow-md: 0 18px 45px rgba(8, 26, 76, 0.08);
    --shadow-lg: 0 30px 80px rgba(11, 30, 86, 0.12);

    /* ===== Radius ===== */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 999px;
    --input-radius: var(--radius-sm);

    /* ===== Layout spacing ===== */
    --space-page-x: 1rem;
    --space-page-y: 1rem;
    --space-page-bottom: 2rem;
    --space-section-gap: 1rem;
    --space-card: 1rem;
    --space-card-lg: 1.5rem;
    --space-state: 2rem;
}

@media (max-width: 959.98px) {
    :root {
        --space-page-x: 0.75rem;
        --space-page-y: 0.75rem;
        --space-page-bottom: 1.5rem;
        --space-card: 0.875rem;
        --space-state: 1.5rem;
    }
}

html {
    font-size: 16px;
    background: var(--color-bg);
}

body {
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(83, 128, 255, 0.10), transparent 30%),
        linear-gradient(180deg, #f9fbff 0%, var(--color-bg) 50%, #f4f7fc 100%);
    color: var(--color-text);
    font-family: var(--font-body);
}

h1,
h2,
h3,
h4,
h5,
h6,
.mud-typography-h1,
.mud-typography-h2,
.mud-typography-h3,
.mud-typography-h4,
.mud-typography-h5,
.mud-typography-h6,
.mud-button-root,
.mud-chip,
.mud-nav-link-text {
    font-family: var(--font-heading);
}

.mud-main-content {
    background: #ffffff !important;
}

.mud-paper,
.mud-table-container,
.mud-card,
.mud-popover,
.mud-dialog,
.mud-menu,
.mud-snackbar {
    border-radius: var(--radius-xs) !important;
}

.mud-paper,
.mud-card,
.mud-table-root {
    box-shadow: var(--shadow-sm) !important;
}

.mud-paper {
    box-shadow: none !important;
}

.mud-paper.mud-paper-outlined,
.mud-table-root,
.mud-input-control .mud-input-outlined-border,
.mud-dialog,
.mud-popover,
.mud-menu {
    border-color: var(--color-line) !important;
}

.mud-popover:not(.mud-menu) {
    border: 1px solid var(--color-line) !important;
    box-shadow: var(--shadow-md) !important;
    overflow: hidden;
}

.mud-table-root {
    overflow: hidden;
    background: var(--color-surface);
}

.app-table-card .mud-table,
.app-table-card .mud-table-root,
.app-table-card .mud-table-container {
    box-shadow: none !important;
}

.app-table-card .mud-table,
.app-table-card .mud-table-root {
    border-radius: 0 !important;
}

.app-table-card .mud-table-body .mud-table-row:last-child .mud-table-cell {
    border-bottom: 0 !important;
}

.mud-table-head .mud-table-cell {
    background: rgba(238, 243, 250, 0.68);
    color: var(--color-text-faint);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.76rem;
    font-weight: 800;
    border-bottom: 1px solid var(--color-line-soft);
}

.mud-table-body .mud-table-row:hover {
    background: rgba(4, 36, 121, 0.02);
}

.mud-table-body .mud-table-cell {
    border-bottom: 1px solid var(--color-line-soft);
    font-size: 0.98rem;
}

.mud-button-root:not(.mud-switch-base) {
    border-radius: var(--radius-pill) !important;
    min-height: 35px;
    padding-inline: 1.25rem;
    letter-spacing: 0;
    box-shadow: none !important;
}


.mud-button-outlined {
    border-width: 1px;
    background: rgba(255, 255, 255, 0.78);
}

.mud-icon-button {
    border-radius: var(--radius-md) !important;
}

.mud-input-control {
    --mud-palette-lines-default: var(--color-line);
}

.mud-input-outlined>.mud-input-outlined-border {
    border-width: 1px !important;
}

.mud-input>input,
.mud-input-slot,
.mud-select-input,
.mud-input-text {
    font-size: 0.98rem !important;
    font-weight: 500 !important;
}

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

.mud-input-outlined,
.mud-input-outlined>.mud-input-outlined-border,
.mud-select,
.mud-picker,
.mud-input-control .mud-input-slot {
    border-radius: var(--input-radius) !important;
}

.mud-dialog .mud-input>input.mud-input-root-outlined,
.mud-dialog .mud-input>textarea.mud-input-root-outlined,
.mud-dialog div.mud-input-slot.mud-input-root-outlined {
    padding: 12px 14px !important;
}

.mud-dialog .mud-input-control.mud-input-number-control .mud-input>input.mud-input-root-outlined {
    padding-right: 46px !important;
}

.mud-dialog .mud-input-control.mud-input-number-control .mud-input-numeric-spin {
    top: 7px;
    right: 10px !important;
    bottom: 7px;
    width: 24px;
    justify-content: center;
    gap: 2px;
}

.mud-dialog .mud-input-control.mud-input-number-control .mud-input-numeric-spin button {
    width: 24px;
    height: 16px;
    min-width: 24px;
    min-height: 16px;
    padding: 0 !important;
    border-radius: var(--radius-xs);
    color: var(--color-text-muted);
}

.mud-dialog .mud-input-control.mud-input-number-control .mud-input-numeric-spin button:hover {
    background: var(--color-bg-soft);
    color: var(--color-primary-strong);
}

.mud-dialog .mud-input-control.mud-input-number-control .mud-input-numeric-spin .mud-icon-root {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

.mud-dialog .mud-button-root {
    min-height: 44px;
    border-radius: var(--radius-sm) !important;
    padding-inline: 1.35rem;
}

.mud-popover:not(.mud-menu) .mud-list {
    padding: 0.35rem !important;
    background: var(--color-surface) !important;
}

.mud-popover:not(.mud-menu) .mud-list-item {
    min-height: 2.65rem !important;
    border-radius: var(--radius-xs) !important;
    color: var(--color-text) !important;
    font-weight: 500 !important;
}

.mud-popover:not(.mud-menu) .mud-list-item:hover {
    background: var(--color-bg-soft) !important;
}

.mud-popover:not(.mud-menu) .mud-list-item.mud-selected-item,
.mud-popover:not(.mud-menu) .mud-list-item[aria-selected="true"],
.mud-popover:not(.mud-menu) .mud-list-item.mud-selected-item:hover,
.mud-popover:not(.mud-menu) .mud-list-item[aria-selected="true"]:hover {
    background: var(--color-primary-tint) !important;
    color: var(--color-primary-strong) !important;
    font-weight: 700 !important;
}

/* .mud-input-outlined.mud-input-adorned-end,
.mud-input-outlined.mud-input-adorned-start {
    background: var(--color-surface-muted);
} */

/* .mud-select,
.mud-input-control .mud-input-slot {
    background: var(--color-surface-muted);
} */

.mud-chip {
    border-radius: var(--radius-pill) !important;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.mud-chip-color-primary {
    color: var(--color-primary);
    background: rgba(4, 36, 121, 0.08);
}

.mud-chip-color-success {
    color: var(--color-success-fg);
    background: var(--color-success-bg);
}

.mud-chip-color-warning {
    color: var(--color-warning-fg);
    background: var(--color-warning-bg);
}

.mud-chip-color-error {
    color: var(--color-danger-fg);
    background: var(--color-danger-bg);
}

.app-badge {
    --app-badge-bg: #f6f8fb;
    --app-badge-border: #dfe6f0;
    --app-badge-color: var(--color-text);

    min-height: 28px !important;
    height: auto !important;
    min-width: max-content;
    padding: 0.24rem 0.78rem !important;
    border: 1.5px solid var(--app-badge-border) !important;
    border-radius: var(--radius-xs) !important;
    background: var(--app-badge-bg) !important;
    color: var(--app-badge-color) !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.58);
    font-family: var(--font-heading);
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    line-height: 1.15;
    white-space: nowrap;
}

.app-badge .mud-chip-content {
    color: inherit !important;
    font: inherit;
    line-height: inherit;
    padding: 0 !important;
    white-space: nowrap;
}

.app-badge--success {
    --app-badge-bg: #f4fbf7;
    --app-badge-border: #bfe8d1;
    --app-badge-color: #15985a;
}

.app-badge--default {
    --app-badge-bg: #f3f6fb;
    --app-badge-border: #d9e1ec;
    --app-badge-color: #1f2937;
}

.app-badge--primary {
    --app-badge-bg: #f3f7ff;
    --app-badge-border: #c8d9ff;
    --app-badge-color: var(--color-primary);
}

.app-badge--info {
    --app-badge-bg: #f0f8ff;
    --app-badge-border: #bfdfff;
    --app-badge-color: #1f69b3;
}

.app-badge--warning {
    --app-badge-bg: #fff8eb;
    --app-badge-border: #f7d9a1;
    --app-badge-color: #b77905;
}

.app-badge--danger {
    --app-badge-bg: #fff4f4;
    --app-badge-border: #f2c6c6;
    --app-badge-color: #c23b3b;
}

.app-status-toggle {
    --app-status-toggle-bg: #f3f6fb;
    --app-status-toggle-border: #d9e1ec;
    --app-status-toggle-color: #1f2937;
    --app-status-toggle-track-bg: #cbd5e1;
    --app-status-toggle-thumb-bg: #ffffff;
    --app-status-toggle-thumb-x: 2px;

    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    min-width: 174px;
    min-height: 34px;
    padding: 0.25rem 0.34rem 0.25rem 0.82rem;
    border: 1.5px solid var(--app-status-toggle-border);
    border-radius: var(--radius-pill);
    background: var(--app-status-toggle-bg);
    color: var(--app-status-toggle-color);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.58);
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.app-status-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 89, 164, 0.16);
}

.app-status-toggle:disabled {
    cursor: not-allowed;
    opacity: 0.68;
}

.app-status-toggle__label {
    min-width: 0;
    color: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-status-toggle__track {
    position: relative;
    flex: 0 0 auto;
    width: 38px;
    height: 20px;
    border-radius: var(--radius-pill);
    background: var(--app-status-toggle-track-bg);
    transition: background-color 0.18s ease;
}

.app-status-toggle__thumb {
    position: absolute;
    top: 2px;
    left: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--app-status-toggle-thumb-bg);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
    transform: translateX(var(--app-status-toggle-thumb-x));
    transition: transform 0.18s ease, background-color 0.18s ease;
}

.app-status-toggle--active {
    --app-status-toggle-bg: #f4fbf7;
    --app-status-toggle-border: #bfe8d1;
    --app-status-toggle-color: #15985a;
    --app-status-toggle-track-bg: #23a967;
    --app-status-toggle-thumb-x: 20px;
}

.app-status-toggle--inactive {
    --app-status-toggle-bg: #f3f6fb;
    --app-status-toggle-border: #d9e1ec;
    --app-status-toggle-color: #1f2937;
    --app-status-toggle-track-bg: #cbd5e1;
    --app-status-toggle-thumb-x: 2px;
}

.app-status-toggle--loading .app-status-toggle__thumb {
    opacity: 0.72;
}

.mud-pagination .mud-button-root {
    min-width: 42px;
    min-height: 42px;
    border-radius: var(--radius-md) !important;
}

.mud-pagination .mud-selected-item {
    background: var(--color-primary) !important;
    color: #fff !important;
    box-shadow: 0 10px 20px rgba(4, 36, 121, 0.22) !important;
}

.mud-dialog {
    box-shadow: var(--shadow-lg) !important;
    overflow: hidden;
}

.mud-dialog-content {
    padding: 1.5rem 1.5rem 1rem 1.5rem;
}

.mud-dialog-actions {
    padding: 0 1.5rem 1.5rem 1.5rem;
}

.mud-snackbar {
    background: rgba(20, 27, 54, 0.94) !important;
    color: #fff !important;
    box-shadow: var(--shadow-md) !important;
}

.mud-alert {
    border-radius: var(--radius-md) !important;
}

.mud-badge-dot {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.95);
}