*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --app-surface: #f5f7fa;
    --app-surface-muted: #ffffff;
    --app-surface-subtle: #ffffff;
    --app-surface-raised: #ffffff;
    --app-text: #20252c;
    --app-text-muted: #69717d;
    --app-line: #e5e9f0;
    --app-line-strong: #ced5df;
    --app-focus: #32649b;
    --app-danger: #98443e;
    --app-success: #2c6848;
    --app-shadow-soft: 0 12px 32px rgba(31, 44, 61, 0.08);
    --app-shadow-subtle: 0 8px 20px rgba(31, 44, 61, 0.06);
    --app-radius: 6px;
}

html {
    min-height: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    background: var(--app-surface);
    color: var(--app-text);
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

body.app-layout {
    display: grid;
    grid-template-columns: minmax(220px, 16rem) minmax(0, 1fr);
    column-gap: clamp(18px, 2.8vw, 40px);
    align-items: start;
    padding-right: clamp(16px, 2.5vw, 32px);
}

body.app-layout > aside {
    grid-column: 1;
    grid-row: 1 / span 1000;
    position: sticky;
    top: 0;
    min-height: 100vh;
    padding: 24px 20px;
    background: var(--app-surface-muted);
    box-shadow: 10px 0 30px rgba(31, 44, 61, 0.06);
}

body.app-layout > :not(aside):not(script) {
    grid-column: 2;
    width: min(100%, 1480px);
    margin-right: 0;
}

body.app-layout > h1 {
    margin-top: 28px;
}

h1,
h2,
h3 {
    line-height: 1.2;
}

h1 {
    margin-bottom: 20px;
    font-size: 2rem;
    font-weight: 650;
}

h2 {
    margin-top: 32px;
    margin-bottom: 14px;
    font-size: 1.35rem;
    font-weight: 650;
}

a {
    color: #235083;
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.18em;
}

a:hover {
    color: #183a61;
}

aside ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

aside li + li {
    margin-top: 4px;
}

.app-nav-group-label {
    margin: 22px 0 6px;
    padding: 0 11px;
    color: var(--app-text-muted);
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0;
    text-transform: uppercase;
}

aside ul > .app-nav-group-label:first-child {
    margin-top: 0;
}

aside a {
    display: block;
    padding: 9px 11px;
    border-radius: 4px;
    color: var(--app-text);
    text-decoration: none;
}

aside a:hover,
aside a[aria-current="page"] {
    background: #f2f5f9;
    box-shadow: inset 0 0 0 1px rgba(206, 213, 223, 0.8);
}

.app-nav-active-text,
.app-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.app-sidebar-logout {
    margin-top: 18px;
}

.app-actions {
    margin-top: 12px;
}

.app-link-list {
    margin-bottom: 16px;
}

.app-link-list a {
    display: inline-block;
    margin-right: 8px;
    margin-bottom: 8px;
}

.app-section {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--app-line);
}

.app-state-success {
    color: var(--app-success);
    text-align: center;
}

label {
    display: inline-block;
    margin-bottom: 4px;
    font-weight: 600;
}

input,
select,
textarea {
    max-width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--app-line-strong);
    border-radius: 4px;
    background: var(--app-surface-subtle);
    color: var(--app-text);
    font: inherit;
    box-shadow: 0 1px 2px rgba(31, 44, 61, 0.04);
}

textarea {
    min-height: 96px;
    resize: none;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--app-focus);
    outline-offset: 2px;
}

button,
input[type="submit"] {
    padding: 9px 14px;
    border: 1px solid #bbc5d3;
    border-radius: 4px;
    background: #ffffff;
    color: var(--app-text);
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(31, 44, 61, 0.07);
}

button:hover,
input[type="submit"]:hover {
    background: #f8f9fc;
}

button[data-save-lock],
input[type="submit"][data-save-lock] {
    transition:
        background-color 120ms ease,
        border-color 120ms ease,
        color 120ms ease,
        box-shadow 120ms ease;
}

button.app-save-lock-active,
input[type="submit"].app-save-lock-active {
    border-color: #cbd3df !important;
    background: #e8edf3 !important;
    color: var(--app-text-muted) !important;
    box-shadow: 0 4px 12px rgba(31, 44, 61, 0.04) !important;
}

button[data-confirm-click],
input[type="submit"][data-confirm-click] {
    border-color: #d6dce5 !important;
    transition:
        background-color 120ms ease,
        border-color 120ms ease,
        color 120ms ease,
        box-shadow 120ms ease;
}

button.app-confirm-click-pending,
input[type="submit"].app-confirm-click-pending {
    border-color: #d6dce5 !important;
    background: #fbedec !important;
    color: #98443e !important;
    box-shadow: 0 8px 16px rgba(186, 106, 99, 0.12) !important;
}

button.app-confirm-click-pending img,
input[type="submit"].app-confirm-click-pending img {
    opacity: 0.72;
    filter: invert(31%) sepia(20%) saturate(1533%) hue-rotate(317deg) brightness(93%) contrast(89%);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
}

th,
td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--app-line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--app-text-muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.app-alert {
    width: min(100%, 980px);
    margin: 10px 0;
    padding: 10px 12px;
    border-left: 4px solid var(--app-line-strong);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: var(--app-shadow-subtle);
}

.app-alert--success {
    border-left-color: var(--app-success);
}

.app-alert--error,
[role="alert"] {
    border-left-color: var(--app-danger);
}

.app-alert--info {
    border-left-color: var(--app-focus);
}

.auth-page {
    position: relative;
    display: grid;
    min-height: 100vh;
    place-items: center;
    overflow: hidden;
    padding: clamp(18px, 4vw, 48px);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(245, 247, 250, 0.82)),
        var(--app-surface);
}

.auth-particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.auth-shell {
    position: relative;
    z-index: 1;
    width: min(100%, 440px);
}

.auth-panel {
    padding: clamp(26px, 5vw, 38px);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 20px 54px rgba(31, 44, 61, 0.12), 0 2px 8px rgba(31, 44, 61, 0.05);
}

.auth-brand {
    margin-bottom: 24px;
}

.auth-kicker {
    margin: 0 0 8px;
    color: var(--app-focus);
    font-size: 0.82rem;
    font-weight: 750;
    letter-spacing: 0;
    text-transform: uppercase;
}

.auth-brand h1 {
    margin: 0;
    font-size: clamp(1.8rem, 5vw, 2.25rem);
}

.auth-copy {
    margin: 10px 0 0;
    color: var(--app-text-muted);
}

.auth-panel .app-alert {
    width: 100%;
    margin: 0 0 14px;
}

.auth-form {
    display: grid;
    gap: 16px;
}

.auth-field {
    display: grid;
    gap: 6px;
}

.auth-field label {
    margin-bottom: 0;
    color: var(--app-text-muted);
    font-size: 0.92rem;
}

.auth-field input {
    width: 100%;
    padding: 11px 12px;
    background: #fbfcfe;
}

.auth-submit {
    width: 100%;
    margin-top: 4px;
    padding: 11px 14px;
    background: #244f7f;
    border-color: #244f7f;
    color: #ffffff;
    box-shadow: 0 10px 22px rgba(36, 79, 127, 0.18);
}

.auth-submit:hover {
    background: #1f456f;
}

@media (max-width: 760px) {
    body.app-layout {
        display: block;
        padding: 0 16px 28px;
    }

    body.app-layout > aside {
        position: static;
        min-height: auto;
        margin: 0 -16px 22px;
        padding: 16px;
    }

    body.app-layout > :not(aside):not(script) {
        width: 100%;
        margin-right: 0;
    }

    table {
        display: block;
        overflow-x: auto;
    }
}
