:root {
    color-scheme: light;
    font-family: "Segoe UI", Tahoma, sans-serif;
    --brand-primary: #1a73e8;
    --brand-secondary: #1558b0;
    --text-color: #202124;
    --surface-bg: #ffffff;
    --surface-alt: #f8f9fa;
    --border-color: #dadce0;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: inherit;
    background: var(--surface-bg);
    color: var(--text-color);
    line-height: 1.6;
}

a {
    color: var(--brand-primary);
    text-decoration: none;
}

a:hover,
a:focus {
    text-decoration: underline;
}

.site-header {
    background: #0b4870;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    gap: 1rem;
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    color: #fff;
}

.brand-title {
    font-weight: 600;
    font-size: 1.25rem;
    letter-spacing: 0.02em;
    color: #fff;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 0.25rem;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.nav-toggle span {
    width: 1.5rem;
    height: 0.15rem;
    background: #fff;
    border-radius: 1rem;
    transition: transform 0.2s ease;
}

.user-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.95rem;
    color: #e3ecff;
}

.user-meta .user-name strong {
    color: #fff;
}

.logout-link {
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}

.logout-link:hover,
.logout-link:focus {
    text-decoration: underline;
}

.site-nav {
    width: 100%;
    background: #fff;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.5rem;
}

.site-nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 0;
    padding: 0.65rem 0;
}

.site-nav li {
    position: relative;
}

.site-nav > ul > li > a,
.site-nav > ul > li > button {
    color: var(--text-color);
    font-weight: 500;
    border: 0;
    background: none;
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    display: inline-flex;
    align-items: center;
    border-radius: 0.4rem;
}

.site-nav > ul > li > a:hover,
.site-nav > ul > li > a:focus,
.site-nav > ul > li > button:hover,
.site-nav > ul > li > button:focus {
    background: rgba(26, 115, 232, 0.12);
    color: var(--brand-primary);
}

.site-nav li.active > a,
.site-nav li.active > button {
    color: var(--brand-primary);
    font-weight: 600;
    background: rgba(26, 115, 232, 0.12);
}

.site-nav li.has-children:hover > .sub-menu,
.site-nav li.has-children:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.sub-menu {
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    min-width: 12rem;
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 1000;
}

.sub-menu li {
    padding: 0;
}

.sub-menu a {
    display: block;
    padding: 0.35rem 1rem;
    color: var(--text-color);
    font-weight: 500;
}

.sub-menu a:hover,
.sub-menu a:focus {
    background: var(--surface-alt);
}

.page-content {
    padding: 1.25rem 1.75rem;
    margin: 0;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    margin: 0;
    font-size: 1.75rem;
    color: var(--brand-primary);
}

.breadcrumb {
    margin-bottom: 1rem;
    font-size: 0.95rem;
    color: rgba(32, 33, 36, 0.8);
}

.breadcrumb ol {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
}

.breadcrumb li {
    display: flex;
    align-items: center;
}

.breadcrumb li + li::before {
    content: '\203A';
    font-size: 1rem;
    color: rgba(32, 33, 36, 0.4);
    margin: 0 0.35rem;
}

.breadcrumb a {
    color: var(--brand-primary);
    text-decoration: none;
}

.breadcrumb a:hover,
.breadcrumb a:focus {
    text-decoration: underline;
}

.card {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

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

.link-list.horizontal {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.link-list a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--border-color);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.link-list a:hover,
.link-list a:focus {
    background: rgba(26, 115, 232, 0.1);
    border-color: rgba(26, 115, 232, 0.35);
}

.form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.form-vertical {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 28rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 12rem;
}

.form-group label {
    font-weight: 600;
    font-size: 0.95rem;
}

.form-group input,
button,
select {
    font: inherit;
}

.form-group input,
select {
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--surface-bg);
}

.input-with-action {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

button {
    padding: 0.5rem 1.1rem;
    border-radius: 0.6rem;
    border: 0;
    background: var(--brand-primary);
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease;
}

button:hover,
button:focus {
    background: var(--brand-secondary);
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.9rem;
    border-radius: 0.6rem;
    background: rgba(26, 115, 232, 0.12);
    color: var(--brand-primary);
    font-weight: 600;
}

.button-link:hover,
.button-link:focus {
    background: rgba(26, 115, 232, 0.2);
    text-decoration: none;
}

.button-link.button-danger {
    background: rgba(217, 48, 37, 0.12);
    color: #a50e0e;
}

.button-link.button-danger:hover,
.button-link.button-danger:focus {
    background: rgba(217, 48, 37, 0.2);
}

.button-danger {
    background: #c81f1f;
}

.button-danger:hover,
.button-danger:focus {
    background: #9a1717;
}

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

.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 0.35rem;
}

.upload-list {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.upload-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 0.75rem;
    background: rgba(26, 115, 232, 0.08);
    border-radius: 0.5rem;
}

.upload-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.upload-progress {
    margin-top: 0.5rem;
    height: 0.6rem;
}

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.modal-dialog {
    position: relative;
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.25);
    padding: 1rem 1.5rem 1.5rem;
    width: min(90vw, 900px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1;
}

.modal-dialog iframe {
    width: 100%;
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    min-height: 60vh;
}

.modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: transparent;
    border: 0;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    font-size: 0.95rem;
}

.pagination a {
    color: var(--brand-primary);
    text-decoration: none;
    font-weight: 600;
}

.pagination a:hover,
.pagination a:focus {
    text-decoration: underline;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--surface-alt);
}

.data-table th,
.data-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: top;
}

.data-table th {
    font-size: 0.95rem;
    font-weight: 600;
}

.data-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.data-table tbody tr.summary {
    background: rgba(26, 115, 232, 0.1);
    font-weight: 600;
}

.data-table tbody tr.summary.balanced {
    background: rgba(26, 115, 232, 0.08);
}

.data-table tbody tr.summary.unbalanced {
    background: rgba(217, 48, 37, 0.12);
    color: #a50e0e;
}

.text-right {
    text-align: right;
}

.locked-row {
    background: rgba(240, 200, 20, 0.18);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}


.status-unposted {
    background: rgba(244, 180, 0, 0.15);
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
}

.badge-warning {
    background: #f9ab00;
}

.badge-success {
    background: #34a853;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.65rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.alert-success {
    background: rgba(52, 168, 83, 0.12);
    border: 1px solid rgba(52, 168, 83, 0.35);
    color: #0d652d;
}

.alert-error {
    background: rgba(217, 48, 37, 0.12);
    border: 1px solid rgba(217, 48, 37, 0.35);
    color: #a50e0e;
}

.site-footer {
    text-align: center;
    padding: 1.5rem;
    font-size: 0.875rem;
    color: rgba(22, 36, 58, 0.7);
}

@media (max-width: 900px) {
    .site-nav ul {
        gap: 0.75rem;
    }
}

@media (max-width: 720px) {
    .nav-toggle {
        display: flex;
    }

    .header-inner {
        flex-wrap: wrap;
    }

    .user-meta {
        order: 3;
        width: 100%;
        justify-content: space-between;
    }

    .site-nav {
        display: none;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
        padding: 0 1.5rem;
    }

    .site-nav.open {
        display: block;
    }

    .site-nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
        padding: 1rem 0;
    }

    .site-nav > ul > li > a,
    .site-nav > ul > li > button {
        width: 100%;
        justify-content: flex-start;
        font-size: 1rem;
        padding: 0.6rem 0;
        border-radius: 0;
        border-bottom: 1px solid var(--border-color);
    }

    .site-nav > ul > li:last-child > a,
    .site-nav > ul > li:last-child > button {
        border-bottom: 0;
    }

    .site-nav li.has-children .sub-menu {
        position: static;
        box-shadow: none;
        border: 0;
        padding: 0.25rem 0 0.25rem 1rem;
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .site-nav li.has-children .sub-menu a {
        padding: 0.35rem 0;
    }
}
