html, body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    background-color: #f8fafc;
    color: #0f172a;
}

html[data-text-size="compact"],
html[data-text-size="compact"] body {
    font-size: 14px;
}

html[data-text-size="standard"],
html[data-text-size="standard"] body {
    font-size: 15px;
}

html[data-text-size="large"],
html[data-text-size="large"] body {
    font-size: 16px;
}

a, .btn-link {
    color: #2563eb;
}

.btn-primary {
    color: #fff;
    background-color: #2563eb;
    border-color: #1d4ed8;
}

.btn-primary:hover {
    background-color: #1d4ed8;
    border-color: #1e40af;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.15rem rgba(37, 99, 235, 0.25);
}

.content {
    padding-top: 1rem;
    padding-bottom: 1.5rem;
}

h1, .h1, h2, .h2, h3, .h3 {
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #0f172a;
}

.h3, h1.h3 {
    font-size: 1.25rem;
}

.card {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.85rem;
    padding: 0.55rem 0.85rem;
}

.table {
    font-size: 0.84rem;
}

.table > thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #475569;
    font-weight: 600;
    border-bottom-color: #cbd5e1;
    background-color: #f8fafc;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #16a34a;
}

.invalid {
    outline: 1px solid #dc2626;
}

.validation-message {
    color: #dc2626;
}

/* Dark theme overrides (placed last so they win over component/light rules) */
html[data-bs-theme="dark"] body,
html[data-bs-theme="dark"] main {
    background-color: #0f172a !important;
    color: #e2e8f0;
}

html[data-bs-theme="dark"] h1,
html[data-bs-theme="dark"] .h1,
html[data-bs-theme="dark"] h2,
html[data-bs-theme="dark"] .h2,
html[data-bs-theme="dark"] h3,
html[data-bs-theme="dark"] .h3,
html[data-bs-theme="dark"] h4,
html[data-bs-theme="dark"] .h4,
html[data-bs-theme="dark"] h5,
html[data-bs-theme="dark"] .h5,
html[data-bs-theme="dark"] h6,
html[data-bs-theme="dark"] .h6 {
    color: #f1f5f9 !important;
}

html[data-bs-theme="dark"] .top-row {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

html[data-bs-theme="dark"] .card,
html[data-bs-theme="dark"] .modal-content,
html[data-bs-theme="dark"] .dropdown-menu {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

html[data-bs-theme="dark"] .card-header,
html[data-bs-theme="dark"] .card-footer,
html[data-bs-theme="dark"] .modal-header,
html[data-bs-theme="dark"] .modal-footer {
    background-color: #162032 !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

html[data-bs-theme="dark"] .table > thead th {
    background-color: #162032 !important;
    color: #94a3b8 !important;
    border-bottom-color: #334155 !important;
}

html[data-bs-theme="dark"] .bg-light,
html[data-bs-theme="dark"] .bg-white,
html[data-bs-theme="dark"] .table-light {
    background-color: #162032 !important;
    color: #e2e8f0 !important;
}

html[data-bs-theme="dark"] .text-dark:not(.bg-warning):not(.bg-info) {
    color: #e2e8f0 !important;
}

html[data-bs-theme="dark"] .btn-outline-dark {
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}

html[data-bs-theme="dark"] .btn-outline-secondary {
    color: #cbd5e1 !important;
    border-color: #475569 !important;
}

html[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background-color: #334155 !important;
    color: #f8fafc !important;
    border-color: #64748b !important;
}

html[data-bs-theme="dark"] .btn-outline-primary {
    color: #60a5fa !important;
    border-color: #3b82f6 !important;
}

html[data-bs-theme="dark"] .btn-outline-primary:hover {
    background-color: #2563eb !important;
    color: #ffffff !important;
}

html[data-bs-theme="dark"] a:not(.btn):not(.nav-link):not(.dropdown-item),
html[data-bs-theme="dark"] .btn-link {
    color: #60a5fa !important;
}

html[data-bs-theme="dark"] a:not(.btn):not(.nav-link):not(.dropdown-item):hover,
html[data-bs-theme="dark"] .btn-link:hover {
    color: #93c5fd !important;
}

html[data-bs-theme="dark"] .btn-outline-danger {
    color: #f87171 !important;
    border-color: #ef4444 !important;
}

html[data-bs-theme="dark"] .btn-outline-danger:hover {
    background-color: #dc2626 !important;
    color: #ffffff !important;
}

html[data-bs-theme="dark"] .alert-primary {
    background-color: #172554 !important;
    border-color: #1d4ed8 !important;
    color: #dbeafe !important;
}

html[data-bs-theme="dark"] .nav-tabs {
    border-bottom-color: #334155 !important;
}

html[data-bs-theme="dark"] .nav-tabs .nav-link.active {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
    border-color: #334155 #334155 #1e293b !important;
}

html[data-bs-theme="dark"] .text-muted,
html[data-bs-theme="dark"] .text-secondary {
    color: #94a3b8 !important;
}

html[data-bs-theme="dark"] .list-group-item:not(.active) {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

html[data-bs-theme="dark"] .border,
html[data-bs-theme="dark"] .border-bottom,
html[data-bs-theme="dark"] .border-top,
html[data-bs-theme="dark"] .border-end {
    border-color: #334155 !important;
}

html[data-bs-theme="dark"] svg text {
    fill: #e2e8f0 !important;
}

.blazor-error-boundary {
    background: #b91c1c;
    padding: 0.75rem 1rem;
    color: white;
    border-radius: 0.375rem;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* Collapsible sidebar (ARMusic-style icon rail) */
@media (min-width: 641px) {
    #app-shell .sidebar {
        width: 224px;
        transition: width 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }

    #app-shell.sidebar-collapsed .sidebar {
        width: 60px;
    }

    #app-shell.sidebar-collapsed .nav-label,
    #app-shell.sidebar-collapsed .navbar-brand,
    #app-shell.sidebar-collapsed .nav-group-summary {
        display: none !important;
    }

    #app-shell.sidebar-collapsed .brand-row {
        justify-content: center;
        padding: 0;
    }

    #app-shell.sidebar-collapsed .nav-item {
        padding: 0.12rem 0.4rem;
    }

    #app-shell.sidebar-collapsed .nav-item .nav-link {
        justify-content: center;
        padding: 0;
        gap: 0;
    }

    #app-shell.sidebar-collapsed .sidebar-collapse-btn svg {
        transform: rotate(180deg);
    }
}
