:root {
    color-scheme: light;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --bg-page: #f3f6fa;
    --bg-surface: #ffffff;
    --bg-subtle: #f8fafc;
    --bg-muted: #f1f5f9;
    --text-main: #172033;
    --text-strong: #0f172a;
    --text-secondary: #334155;
    --text-muted: #52647e;
    --border: #cbd5e1;
    --border-subtle: #e2e8f0;
    --border-panel: #dce3ed;
    --input-bg: #ffffff;
    --input-border: #aebacc;
    --shadow: rgba(17, 24, 39, 0.06);
    --shadow-strong: rgba(15, 23, 42, 0.12);
    color: var(--text-main);
    background: var(--bg-page);
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    --accent: #15803d;
    --accent-hover: #166534;
    --accent-soft: #ecfdf5;
    --accent-border: #bbf7d0;
    --matrix-active-hdr: #dbeafe;
    --matrix-active-sub: #eff6ff;
    --matrix-active-cell: #f8fbff;
    --matrix-locked-hdr: #cbd5e1;
    --matrix-locked-sub: #e2e8f0;
    --matrix-locked-cell: #e2e8f0;
    --matrix-alt-hdr: #e6edf5;
    --matrix-alt-sub: #eef3f8;
    --matrix-alt-cell: #f1f5f9;
    --matrix-hover-col: #eff6ff;
    --matrix-hover-row: #dbeafe;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg-page: #0b1120;
    --bg-surface: #111827;
    --bg-subtle: #1e293b;
    --bg-muted: #1f2937;
    --text-main: #e2e8f0;
    --text-strong: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border: #334155;
    --border-subtle: #1e293b;
    --border-panel: #273244;
    --input-bg: #0f172a;
    --input-border: #475569;
    --shadow: rgba(0, 0, 0, 0.45);
    --shadow-strong: rgba(0, 0, 0, 0.65);
    --accent: #22c55e;
    --accent-hover: #16a34a;
    --accent-soft: rgba(34, 197, 94, 0.16);
    --accent-border: rgba(34, 197, 94, 0.35);
    --matrix-active-hdr: #1e3a8a;
    --matrix-active-sub: #172554;
    --matrix-active-cell: rgba(30, 58, 138, 0.25);
    --matrix-locked-hdr: #334155;
    --matrix-locked-sub: #1e293b;
    --matrix-locked-cell: rgba(51, 65, 85, 0.48);
    --matrix-alt-hdr: #243247;
    --matrix-alt-sub: #1d293b;
    --matrix-alt-cell: #192334;
    --matrix-hover-col: rgba(96, 165, 250, 0.14);
    --matrix-hover-row: rgba(96, 165, 250, 0.24);
}

:root[data-color-scheme="blue"] {
    --accent: #1d4ed8;
    --accent-hover: #1e40af;
    --accent-soft: #eff6ff;
    --accent-border: #bfdbfe;
}

:root[data-theme="dark"][data-color-scheme="blue"] {
    --accent: #60a5fa;
    --accent-hover: #3b82f6;
    --accent-soft: rgba(96, 165, 250, 0.16);
    --accent-border: rgba(96, 165, 250, 0.35);
}

:root[data-color-scheme="indigo"] {
    --accent: #4338ca;
    --accent-hover: #3730a3;
    --accent-soft: #eef2ff;
    --accent-border: #c7d2fe;
}

:root[data-theme="dark"][data-color-scheme="indigo"] {
    --accent: #818cf8;
    --accent-hover: #6366f1;
    --accent-soft: rgba(129, 140, 248, 0.16);
    --accent-border: rgba(129, 140, 248, 0.35);
}

:root[data-color-scheme="red"] {
    --accent: #b91c1c;
    --accent-hover: #991b1b;
    --accent-soft: #fef2f2;
    --accent-border: #fecaca;
}

:root[data-theme="dark"][data-color-scheme="red"] {
    --accent: #f87171;
    --accent-hover: #ef4444;
    --accent-soft: rgba(248, 113, 113, 0.16);
    --accent-border: rgba(248, 113, 113, 0.35);
}

:root[data-color-scheme="amber"] {
    --accent: #b45309;
    --accent-hover: #92400e;
    --accent-soft: #fffbeb;
    --accent-border: #fde68a;
}

:root[data-theme="dark"][data-color-scheme="amber"] {
    --accent: #fbbf24;
    --accent-hover: #f59e0b;
    --accent-soft: rgba(251, 191, 36, 0.16);
    --accent-border: rgba(251, 191, 36, 0.35);
}

:root[data-color-scheme="slate"] {
    --accent: #334155;
    --accent-hover: #1e293b;
    --accent-soft: #f1f5f9;
    --accent-border: #cbd5e1;
}

:root[data-theme="dark"][data-color-scheme="slate"] {
    --accent: #94a3b8;
    --accent-hover: #64748b;
    --accent-soft: rgba(148, 163, 184, 0.16);
    --accent-border: rgba(148, 163, 184, 0.35);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 320px;
}

a {
    color: var(--accent);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    padding: 0.8rem max(1.5rem, calc((100vw - 96vw) / 2));
    background: var(--bg-surface);
    border-bottom: 3px solid var(--accent);
    box-shadow: 0 2px 6px var(--shadow);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    flex: 1;
    color: var(--text-main);
    text-decoration: none;
}

.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    padding: 2px;
    border-radius: 10px;
    background: var(--bg-surface);
    border: 1.5px solid var(--accent);
    box-shadow: 0 2px 6px rgba(17, 24, 39, 0.12);
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-title {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text-strong);
}

.brand-subtitle {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin-top: 0.12rem;
}

nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem 0.65rem;
}

nav a,
.nav-button {
    font: inherit;
    text-decoration: none;
}

.nav-form {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.nav-button {
    padding: 0;
    border: 0;
    color: var(--accent);
    background: none;
    cursor: pointer;
}

.nav-link,
.nav-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 2.2rem;
    padding: 0 0.65rem;
    border-radius: 6px;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-main);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    line-height: 1;
    box-sizing: border-box;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nav-link:hover,
.nav-dropdown-trigger:hover,
.nav-dropdown[open] > .nav-dropdown-trigger {
    background: var(--bg-muted);
    color: var(--text-strong);
}

.nav-link.is-active,
.nav-dropdown-trigger.is-active {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent-border);
    font-weight: 600;
}

.nav-dropdown {
    position: relative;
    margin: 0;
    display: inline-flex;
    align-items: center;
}

.nav-dropdown-trigger {
    list-style: none;
}

.nav-dropdown-trigger::-webkit-details-marker {
    display: none;
}

.nav-caret {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.15s ease;
}

.nav-dropdown[open] > .nav-dropdown-trigger .nav-caret {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    min-width: 13.5rem;
    padding: 0.35rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 10px 25px var(--shadow-strong);
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.nav-dropdown-right .nav-dropdown-menu {
    left: auto;
    right: 0;
}

.nav-dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.45rem 0.7rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-main);
    font: inherit;
    font-size: 0.9rem;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
}

.nav-dropdown-item:hover {
    background: var(--bg-muted);
    color: var(--text-strong);
}

.nav-dropdown-item.is-active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.nav-dropdown-item.is-danger {
    color: #b91c1c;
}

.nav-dropdown-item.is-danger:hover {
    background: #fef2f2;
    color: #991b1b;
}

.nav-dropdown-divider {
    height: 1px;
    margin: 0.25rem 0.35rem;
    border: 0;
    background: var(--border-subtle);
}

.nav-user-trigger {
    font-size: 0.84rem;
    color: var(--text-secondary);
    padding: 0 0.65rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 6px;
    white-space: nowrap;
}

.nav-user-trigger:hover,
.nav-dropdown[open] > .nav-user-trigger {
    background: var(--bg-muted);
    border-color: var(--text-muted);
}

.nav-phase-select {
    height: 2.2rem;
    font-size: 0.84rem;
    padding: 0 0.55rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-subtle);
    color: var(--text-main);
    box-sizing: border-box;
}

.nav-mobile-toggle {
    display: none;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-subtle);
    color: var(--text-strong);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.container {
    width: min(100% - 2rem, 68rem);
    min-height: calc(100vh - 9rem);
    margin: 0 auto;
    padding: 3.5rem 0;
}

.container.container-wide {
    width: min(100% - 2rem, 96vw);
    padding: 2rem 0;
}

.hero {
    margin-bottom: 2rem;
}

.eyebrow {
    margin: 0 0 0.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(1.45rem, 4vw, 2.65rem);
    line-height: 1.15;
}

h2 {
    margin-top: 0;
}

.lead {
    max-width: 42rem;
    color: var(--text-secondary);
    font-size: 1.2rem;
    line-height: 1.6;
}

.panel,
.auth-card,
.form-panel {
    padding: 1.5rem;
    border: 1px solid var(--border-panel);
    border-radius: 0.75rem;
    background: var(--bg-surface);
    box-shadow: 0 0.25rem 1rem var(--shadow);
}

.subpanel {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-subtle);
    border-radius: 0.55rem;
    background: var(--bg-subtle);
}

.subpanel h3,
.subpanel h4 {
    margin-top: 0;
}

details:not(.nav-dropdown) {
    margin-top: 1rem;
}

summary:not(.nav-dropdown-trigger) {
    color: var(--accent);
    font-weight: 650;
    cursor: pointer;
}

.form-panel {
    max-width: 48rem;
    margin: 0 auto;
}

.auth-card {
    width: min(100%, 30rem);
    margin: 0 auto;
}

.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

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

.form {
    display: grid;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: minmax(9rem, 0.35fr) minmax(0, 1fr);
    align-items: center;
    gap: 0.85rem 1rem;
    margin-top: 1.25rem;
}

main input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
main select,
main textarea {
    min-height: 2.2rem;
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-subtle);
    color: var(--text-main);
    font: inherit;
    font-size: 0.9rem;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

main input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):focus,
main select:focus,
main textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-border);
}

main input[type="file"] {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-subtle);
    color: var(--text-muted);
    font: inherit;
    font-size: 0.88rem;
    cursor: pointer;
    box-sizing: border-box;
    max-width: 100%;
}

main input[type="file"]::file-selector-button {
    margin-right: 0.75rem;
    padding: 0.38rem 0.75rem;
    border: 1px solid var(--accent-border);
    border-radius: 5px;
    background: var(--accent-soft);
    color: var(--accent);
    font: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

main input[type="file"]::file-selector-button:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.form-grid input,
.form-grid select,
.form-grid textarea,
.filters input,
.filters select {
    width: 100%;
    min-width: 0;
}

.form-grid textarea {
    resize: vertical;
}

.form-wide {
    grid-column: 1 / -1;
}

.form-actions,
.filters {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.form-actions {
    margin-top: 0.5rem;
}

.filters {
    margin-bottom: 1.5rem;
}

.filters label {
    flex: 1 1 14rem;
}

.form input[type="email"],
.form input[type="password"] {
    width: 100%;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--input-border);
    border-radius: 0.35rem;
    font: inherit;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.button {
    display: inline-block;
    width: fit-content;
    margin-top: 0.5rem;
    padding: 0.7rem 1rem;
    border: 0;
    border-radius: 0.4rem;
    color: var(--bg-surface);
    background: var(--accent);
    font: inherit;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    background: var(--accent-hover);
}

.alert {
    padding: 0.75rem 1rem;
    border-left: 4px solid #b42318;
    color: #7a271a;
    background: #fff1f0;
}

.warning {
    margin: 1rem 0;
    padding: 0.85rem 1rem;
    border-left: 4px solid #b54708;
    color: #7a2e0e;
    background: #fff7ed;
}

.warning p:last-child {
    margin-bottom: 0;
}

.notice {
    padding: 0.75rem 1rem;
    border-left: 4px solid #039855;
    color: #05603a;
    background: #ecfdf3;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th,
td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: top;
}

th {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.details-grid {
    display: grid;
    grid-template-columns: minmax(9rem, 0.3fr) minmax(0, 1fr);
    gap: 0.75rem 1rem;
    margin: 0 0 1.5rem;
}

.details-grid dt {
    color: var(--text-muted);
    font-weight: 650;
}

.details-grid dd {
    margin: 0;
}

.button-secondary {
    color: var(--accent);
    border: 1px solid var(--input-border);
    background: var(--bg-surface);
}

.section-gap {
    margin-top: 1.5rem;
}

.alert ul {
    margin: 0;
    padding-left: 1.2rem;
}

.site-footer {
    padding: 1rem;
    color: var(--text-muted);
    text-align: center;
}

.pagination-nav {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.pagination-summary {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.pagination-list {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.25rem;
}

.pagination-list li a,
.pagination-list li span {
    display: inline-block;
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--border-panel);
    border-radius: 4px;
    font-size: 0.875rem;
    text-decoration: none;
    background: var(--bg-surface);
    color: var(--accent);
}

.pagination-list li.active span {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-surface);
    font-weight: 600;
}

.pagination-list li.disabled span {
    color: var(--text-muted);
    background: var(--bg-subtle);
}

@media (min-width: 56.01rem) {
    body.layout-sidebar {
        display: grid;
        grid-template-columns: 16.5rem minmax(0, 1fr);
        grid-template-rows: 1fr auto;
        min-height: 100vh;
    }

    body.layout-sidebar .site-header {
        grid-column: 1;
        grid-row: 1 / -1;
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        flex-wrap: nowrap;
        gap: 1.25rem;
        padding: 1.15rem 0.9rem;
        border-bottom: 0;
        border-right: 3px solid var(--accent);
        box-shadow: 2px 0 8px var(--shadow);
        box-sizing: border-box;
    }

    body.layout-sidebar .brand {
        flex: 0 0 auto;
    }

    body.layout-sidebar nav.site-nav {
        flex-direction: column;
        align-items: stretch;
        flex-wrap: nowrap;
        flex: 1;
        gap: 0.35rem;
    }

    body.layout-sidebar .nav-link,
    body.layout-sidebar .nav-dropdown,
    body.layout-sidebar .nav-dropdown-trigger,
    body.layout-sidebar .nav-user-trigger,
    body.layout-sidebar .nav-form,
    body.layout-sidebar .nav-phase-select {
        width: 100%;
        box-sizing: border-box;
    }

    body.layout-sidebar .nav-dropdown {
        flex-direction: column;
        align-items: stretch;
    }

    body.layout-sidebar .nav-dropdown-trigger {
        justify-content: space-between;
    }

    body.layout-sidebar .nav-dropdown-menu {
        position: static;
        min-width: 0;
        width: 100%;
        margin-top: 0.25rem;
        box-shadow: none;
        background: var(--bg-subtle);
        border-color: var(--border-subtle);
        box-sizing: border-box;
    }

    body.layout-sidebar .nav-dropdown-right {
        margin-top: auto;
        padding-top: 0.75rem;
        border-top: 1px solid var(--border-subtle);
        flex-direction: column-reverse;
    }

    body.layout-sidebar .nav-user-trigger {
        height: auto;
        min-height: 2.2rem;
        padding: 0.45rem 0.65rem;
        white-space: normal;
        line-height: 1.3;
        gap: 0.45rem;
    }

    body.layout-sidebar .nav-user-label {
        min-width: 0;
        flex: 1;
        overflow-wrap: anywhere;
        display: flex;
        flex-direction: column;
        gap: 0.1rem;
    }

    body.layout-sidebar .nav-user-role {
        font-size: 0.78rem;
        color: var(--text-muted);
    }

    body.layout-sidebar .nav-dropdown-right > .nav-dropdown-menu {
        margin-top: 0;
        margin-bottom: 0.35rem;
    }

    body.layout-sidebar .nav-dropdown-right > .nav-dropdown-trigger .nav-caret {
        transform: rotate(180deg);
    }

    body.layout-sidebar .nav-dropdown-right[open] > .nav-dropdown-trigger .nav-caret {
        transform: rotate(0deg);
    }

    body.layout-sidebar .nav-theme-toggle-btn {
        width: 100%;
        justify-content: center;
        margin-top: 0.45rem;
    }

    body.layout-sidebar main.container,
    body.layout-sidebar main.container.container-wide {
        grid-column: 2;
        grid-row: 1;
        width: 100%;
        max-width: none;
        padding: 1.75rem 1.75rem 2.5rem;
        min-height: 0;
        box-sizing: border-box;
    }

    body.layout-sidebar footer.site-footer {
        grid-column: 2;
        grid-row: 2;
    }
}

@media (max-width: 56rem) {
    .site-header {
        padding: 0.65rem 1rem;
        gap: 0.65rem;
    }

    .nav-mobile-toggle {
        display: inline-flex;
        margin-left: auto;
        flex-shrink: 0;
    }

    nav.site-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
        padding-top: 0.6rem;
        border-top: 1px solid var(--border-subtle);
    }

    nav.site-nav.is-open {
        display: flex;
    }

    .nav-link,
    .nav-dropdown,
    .nav-dropdown-trigger,
    .nav-user-trigger,
    .nav-form,
    .nav-phase-select {
        width: 100%;
        box-sizing: border-box;
    }

    .nav-dropdown {
        flex-direction: column;
        align-items: stretch;
    }

    .nav-link,
    .nav-dropdown-trigger {
        justify-content: space-between;
    }

    .nav-user-trigger {
        height: auto;
        min-height: 2.2rem;
        padding: 0.45rem 0.65rem;
        white-space: normal;
        line-height: 1.3;
        gap: 0.45rem;
    }

    .nav-user-label {
        min-width: 0;
        flex: 1;
        overflow-wrap: anywhere;
        display: flex;
        flex-direction: column;
        gap: 0.1rem;
    }

    .nav-user-role {
        font-size: 0.78rem;
        color: var(--text-muted);
    }

    .nav-dropdown-menu,
    .nav-dropdown-right .nav-dropdown-menu {
        position: static;
        min-width: 0;
        width: 100%;
        margin-top: 0.25rem;
        box-shadow: none;
        background: var(--bg-subtle);
        border-color: var(--border-subtle);
        box-sizing: border-box;
    }

    .container,
    .container.container-wide {
        width: calc(100% - 1.25rem);
        padding: 1.25rem 0;
    }
}

@media (max-width: 36rem) {
    .site-header {
        align-items: center;
    }

    .brand-title {
        font-size: 0.95rem;
    }

    .brand-subtitle {
        font-size: 0.65rem;
    }

    .panel,
    .auth-card,
    .form-panel {
        padding: 1rem;
        border-radius: 0.6rem;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.65rem;
        margin-bottom: 1rem;
    }

    .notif-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .filters label {
        flex: 1 1 100%;
    }

    th,
    td {
        padding: 0.5rem 0.45rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }

    .form-wide {
        grid-column: auto;
    }

    .details-grid {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .details-grid dd {
        margin-bottom: 0.65rem;
    }
}

:root[data-theme="dark"] .alert {
    background: rgba(185, 28, 28, 0.18);
    color: #fca5a5;
    border-left-color: #ef4444;
}

:root[data-theme="dark"] .warning {
    background: rgba(180, 83, 9, 0.18);
    color: #fcd34d;
    border-left-color: #f59e0b;
}

:root[data-theme="dark"] .notice {
    background: rgba(3, 152, 85, 0.18);
    color: #6ee7b7;
    border-left-color: #10b981;
}

:root[data-theme="dark"] .nav-dropdown-item.is-danger {
    color: #fca5a5;
}

:root[data-theme="dark"] .nav-dropdown-item.is-danger:hover {
    background: rgba(185, 28, 28, 0.22);
    color: #fecaca;
}

:root[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]),
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
    background-color: var(--input-bg);
    color: var(--text-main);
    border-color: var(--input-border);
}

:root[data-theme="dark"] main [style*="background:#fff"],
:root[data-theme="dark"] main [style*="background: #fff"],
:root[data-theme="dark"] main [style*="background:#ffffff"],
:root[data-theme="dark"] main [style*="background: #ffffff"] {
    background: var(--bg-surface) !important;
}

:root[data-theme="dark"] main [style*="background:#f8fafc"],
:root[data-theme="dark"] main [style*="background: #f8fafc"],
:root[data-theme="dark"] main [style*="background:#f1f5f9"],
:root[data-theme="dark"] main [style*="background: #f1f5f9"],
:root[data-theme="dark"] main [style*="background:#f9fafb"],
:root[data-theme="dark"] main [style*="background: #f9fafb"] {
    background: var(--bg-subtle) !important;
}

:root[data-theme="dark"] main [style*="color:#0f172a"],
:root[data-theme="dark"] main [style*="color: #0f172a"],
:root[data-theme="dark"] main [style*="color:#1e293b"],
:root[data-theme="dark"] main [style*="color: #1e293b"],
:root[data-theme="dark"] main [style*="color:#334155"],
:root[data-theme="dark"] main [style*="color: #334155"] {
    color: var(--text-main) !important;
}

:root[data-theme="dark"] main [style*="border:1px solid #cbd5e1"],
:root[data-theme="dark"] main [style*="border: 1px solid #cbd5e1"],
:root[data-theme="dark"] main [style*="border:1px solid #e2e8f0"],
:root[data-theme="dark"] main [style*="border: 1px solid #e2e8f0"] {
    border-color: var(--border) !important;
}

.notif-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.notif-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 0.85rem;
    border-radius: 6px;
    border-left: 4px solid var(--border);
    background: var(--bg-subtle);
    color: var(--text-main);
}

.notif-item-red {
    border-left-color: #dc2626;
    background: #fef2f2;
    color: #991b1b;
}

.notif-item-orange {
    border-left-color: #d97706;
    background: #fffbeb;
    color: #92400e;
}

.notif-item-green {
    border-left-color: #16a34a;
    background: #ecfdf5;
    color: #166534;
}

:root[data-theme="dark"] .notif-item-red {
    background: rgba(185, 28, 28, 0.22);
    color: #fca5a5;
    border-left-color: #ef4444;
}

:root[data-theme="dark"] .notif-item-orange {
    background: rgba(180, 83, 9, 0.22);
    color: #fcd34d;
    border-left-color: #f59e0b;
}

:root[data-theme="dark"] .notif-item-green {
    background: rgba(22, 163, 74, 0.22);
    color: #86efac;
    border-left-color: #22c55e;
}

.role-box-captain {
    background: #dbeafe !important;
    color: #1e3a8a !important;
    border-color: #93c5fd;
    font-weight: 600;
}

.role-box-reserve {
    background: #fef9c3 !important;
    color: #713f12 !important;
    border-color: #fde047;
    font-style: italic;
}

.role-box-default {
    background: var(--bg-surface);
    color: var(--text-main);
    border-color: var(--border);
}

:root[data-theme="dark"] .role-box-captain {
    background: #1e3a5f !important;
    color: #bfdbfe !important;
    border-color: rgba(96, 165, 250, 0.45);
}

:root[data-theme="dark"] .role-box-reserve {
    background: #423310 !important;
    color: #fde68a !important;
    border-color: rgba(250, 204, 21, 0.45);
}

.team-colored {
    background: var(--team-bg) !important;
    color: var(--team-text) !important;
    border-color: var(--team-border, var(--border)) !important;
}

:root[data-theme="dark"] .team-colored {
    background: color-mix(in srgb, var(--team-text) 28%, #0f172a 72%) !important;
    color: color-mix(in srgb, var(--team-bg) 55%, #ffffff 45%) !important;
    border-color: color-mix(in srgb, var(--team-text) 55%, #334155 45%) !important;
}

.opt-status-available {
    background: #dcfce7;
    color: #166534;
}

.opt-status-conditional {
    background: #ffedd5;
    color: #9a3412;
}

.opt-status-unavailable {
    background: #fee2e2;
    color: #991b1b;
}

:root[data-theme="dark"] .opt-status-available {
    background: #143622;
    color: #86efac;
}

:root[data-theme="dark"] .opt-status-conditional {
    background: #42250d;
    color: #fdba74;
}

:root[data-theme="dark"] .opt-status-unavailable {
    background: #45151a;
    color: #fca5a5;
}

.charter-status-card {
    padding: 0.35rem 0.55rem;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    background: var(--bg-surface);
    color: var(--text-main);
    font-size: 0.84rem;
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.charter-status-card.is-accepted {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.charter-status-check {
    color: #15803d;
    font-weight: 600;
}

:root[data-theme="dark"] .charter-status-card.is-accepted {
    border-color: rgba(34, 197, 94, 0.38);
    background: rgba(22, 163, 74, 0.18);
}

:root[data-theme="dark"] .charter-status-check {
    color: #86efac;
}

.team-color-preview-dark-wrap {
    display: inline-block;
    padding: 3px 6px;
    border-radius: 6px;
    background: #111827;
}

.team-color-preview-dark {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.84rem;
    border: 2px solid color-mix(in srgb, var(--team-text) 55%, #334155 45%);
    background: color-mix(in srgb, var(--team-text) 28%, #0f172a 72%);
    color: color-mix(in srgb, var(--team-bg) 55%, #ffffff 45%);
}

.status-pill {
    display: inline-block;
    padding: 2px 7px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-pill-muted {
    background: #e2e8f0;
    color: #475569;
}

.status-pill-success {
    background: #dcfce7;
    color: #166534;
}

.status-pill-warning {
    background: #fef3c7;
    color: #92400e;
}

.status-pill-danger {
    background: #fee2e2;
    color: #991b1b;
}

.status-pill-orange {
    background: #ffedd5;
    color: #9a3412;
}

:root[data-theme="dark"] .status-pill-muted {
    background: rgba(148, 163, 184, 0.18);
    border-color: rgba(148, 163, 184, 0.35);
    color: #cbd5e1;
}

:root[data-theme="dark"] .status-pill-success {
    background: rgba(22, 163, 74, 0.24);
    border-color: rgba(34, 197, 94, 0.42);
    color: #86efac;
}

:root[data-theme="dark"] .status-pill-warning {
    background: rgba(217, 119, 6, 0.24);
    border-color: rgba(251, 191, 36, 0.42);
    color: #fcd34d;
}

:root[data-theme="dark"] .status-pill-danger {
    background: rgba(220, 38, 38, 0.24);
    border-color: rgba(248, 113, 113, 0.42);
    color: #fca5a5;
}

:root[data-theme="dark"] .status-pill-orange {
    background: rgba(234, 88, 12, 0.24);
    border-color: rgba(251, 146, 60, 0.42);
    color: #fdba74;
}

.diff-row-added {
    background: #f0fdf4;
}

.diff-row-removed {
    background: #fef2f2;
}

.diff-row-moved {
    background: #fffbeb;
}

:root[data-theme="dark"] .diff-row-added {
    background: rgba(22, 163, 74, 0.14);
}

:root[data-theme="dark"] .diff-row-removed {
    background: rgba(220, 38, 38, 0.14);
}

:root[data-theme="dark"] .diff-row-moved {
    background: rgba(217, 119, 6, 0.14);
}

.schedule-info-banner {
    background: #fffbeb;
    border-color: #fcd34d;
    color: #92400e;
}

:root[data-theme="dark"] .schedule-info-banner {
    background: rgba(217, 119, 6, 0.16);
    border-color: rgba(251, 191, 36, 0.4);
    color: #fde68a;
}

.championship-participation-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-subtle);
    cursor: pointer;
    margin: 0.25rem 0;
}

.championship-participation-box.is-engaged {
    border-color: #86efac;
    background: #f0fdf4;
}

:root[data-theme="dark"] .championship-participation-box.is-engaged {
    border-color: rgba(34, 197, 94, 0.38);
    background: rgba(22, 163, 74, 0.16);
}
