:root {
    --bg: #eef2f6;
    --bg-deep: #dfe8f1;
    --surface: #ffffff;
    --surface-alt: #f6f9fc;
    --ink: #1b2a3a;
    --ink-soft: #3f556b;
    --muted: #6b7f92;
    --brand: #0f5b91;
    --brand-strong: #0b446c;
    --accent: #118a7e;
    --danger: #b42329;
    --line: #d4dee8;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-xs: 0 2px 8px rgba(15, 42, 68, 0.08);
    --shadow-md: 0 16px 35px rgba(15, 42, 68, 0.11);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: "Source Sans 3", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 6% 8%, rgba(15, 91, 145, 0.12), rgba(15, 91, 145, 0) 34%),
        radial-gradient(circle at 94% 18%, rgba(17, 138, 126, 0.13), rgba(17, 138, 126, 0) 32%),
        linear-gradient(165deg, var(--bg) 0%, var(--bg-deep) 100%);
    letter-spacing: 0.01em;
}

a {
    color: var(--brand);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--brand-strong);
}

code {
    font-family: "Sora", "Segoe UI", sans-serif;
    font-size: 0.82rem;
    background: #eef4fa;
    border: 1px solid #d6e2ed;
    padding: 2px 6px;
    border-radius: 7px;
    color: #27425b;
}

h1,
h2,
h3,
h4,
h5,
h6,
.brand,
.nav-title,
.card-header,
.stat strong,
th {
    font-family: "Sora", "Segoe UI", sans-serif;
}

.container {
    width: min(1240px, 92%);
    margin: 0 auto;
}

.center-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 16px;
}

.guest-shell {
    width: min(980px, 96%);
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 14px;
}

.guest-panel {
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: linear-gradient(145deg, rgba(10, 39, 64, 0.9), rgba(15, 91, 145, 0.84));
    color: #eff7ff;
    box-shadow: var(--shadow-md);
}

.guest-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.guest-brand-logo {
    width: 70px;
    height: auto;
    display: block;
}

.guest-brand-copy {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    font-family: "Sora", "Segoe UI", sans-serif;
}

.guest-brand-copy strong {
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.guest-brand-copy span {
    font-size: 0.82rem;
    opacity: 0.9;
}

.guest-panel h1 {
    margin: 0 0 10px;
    font-size: 2rem;
    line-height: 1.12;
}

.guest-panel p {
    margin: 0 0 16px;
    color: #d9e8f7;
    max-width: 42ch;
}

.card {
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.card-body {
    padding: 20px;
}

.hero {
    padding: clamp(22px, 3vw, 46px);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    width: 340px;
    height: 340px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(15, 91, 145, 0.2), rgba(15, 91, 145, 0));
    top: -180px;
    right: -120px;
    pointer-events: none;
}

.hero h1 {
    margin: 14px 0 12px;
    font-size: clamp(2rem, 3.1vw, 3rem);
    line-height: 1.1;
}

.hero p {
    margin: 0 0 22px;
    color: var(--ink-soft);
    max-width: 760px;
    font-size: 1.05rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 15px;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #1769a6 0%, #0f5b91 100%);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(15, 91, 145, 0.27);
}

.btn-primary:hover {
    box-shadow: 0 10px 22px rgba(15, 91, 145, 0.34);
}

.btn-ghost {
    background: #ffffff;
    border-color: var(--line);
    color: var(--ink-soft);
}

.btn-ghost:hover {
    background: var(--surface-alt);
}

.btn-danger {
    background: #fff4f4;
    color: var(--danger);
    border-color: #f2c9cb;
}

.btn-danger:hover {
    background: #ffe9e9;
}

.grid {
    display: grid;
    gap: 16px;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    background:
        radial-gradient(circle at 12% 12%, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 35%),
        linear-gradient(195deg, #0a2740 0%, #0d385a 65%, #124a73 100%);
    color: #d6e4f1;
    padding: 20px 14px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 20;
}

.brand {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    margin: 4px 8px 22px;
    color: #ffffff;
}

.nav-group {
    margin-bottom: 16px;
}

.nav-title {
    text-transform: uppercase;
    letter-spacing: 0.11em;
    font-size: 0.68rem;
    color: #8eb4d2;
    margin: 10px 10px 8px;
}

.nav-link {
    display: block;
    padding: 10px 11px;
    border-radius: 10px;
    color: #d6e4f1;
    margin-bottom: 5px;
    font-weight: 600;
    border: 1px solid transparent;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.11);
    color: #ffffff;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.main {
    padding: 22px;
}

.page-shell {
    max-width: 1160px;
    margin: 0 auto;
}

.topbar {
    position: sticky;
    top: 12px;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(10px);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar h2 {
    margin: 0;
    font-size: 1.2rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-nav-toggle {
    display: none;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 11px;
    font-weight: 700;
    color: var(--ink-soft);
}

.muted {
    color: var(--muted);
    font-size: 0.9rem;
}

.login-brand-inline {
    margin-bottom: 8px;
}

.login-brand-inline-logo {
    width: 70px;
    height: auto;
    display: block;
}

.guest-auth .guest-panel {
    background:
        radial-gradient(circle at 82% 14%, rgba(208, 185, 123, 0.2), rgba(208, 185, 123, 0) 36%),
        linear-gradient(148deg, #0e0e0f 0%, #161617 52%, #262221 100%);
    border: 1px solid rgba(208, 185, 123, 0.34);
}

.guest-auth .guest-panel .badge {
    background: rgba(208, 185, 123, 0.2) !important;
    color: #f1e3bf !important;
}

.guest-auth .btn-primary {
    background: linear-gradient(135deg, #d0b97b 0%, #b59a5f 100%);
    color: #1c1812;
    border-color: #b59a5f;
    box-shadow: 0 10px 22px rgba(126, 96, 38, 0.25);
}

.guest-auth .btn-primary:hover {
    box-shadow: 0 12px 26px rgba(126, 96, 38, 0.34);
    background: linear-gradient(135deg, #d8c28c 0%, #c0a76d 100%);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-group label {
    font-size: 0.82rem;
    color: var(--ink-soft);
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--ink);
    border-radius: 10px;
    padding: 9px 11px;
    font-size: 0.94rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #7eb3dc;
    box-shadow: 0 0 0 3px rgba(23, 105, 166, 0.12);
}

input[type="checkbox"] {
    accent-color: var(--brand);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

th,
td {
    text-align: left;
    padding: 11px 12px;
    border-bottom: 1px solid #e6edf4;
    vertical-align: top;
    font-size: 0.91rem;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f7fbff;
    font-size: 0.74rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #5f7388;
}

tr:hover td {
    background: #f8fbfe;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    font-size: 0.73rem;
    background: #e3f0fa;
    color: var(--brand-strong);
    padding: 5px 9px;
    border-radius: 999px;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.stats {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat {
    background: linear-gradient(170deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 15px;
    box-shadow: var(--shadow-xs);
}

.stat span {
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-weight: 700;
}

.stat strong {
    margin-top: 7px;
    display: block;
    font-size: 1.45rem;
}

.flash,
.errors {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    border-radius: 12px;
    padding: 11px 12px;
    margin-bottom: 14px;
    animation: fadeUp 0.35s ease;
}

.flash {
    border: 1px solid #a9dfc5;
    background: #edf9f2;
    color: #1e6a46;
}

.errors {
    border: 1px solid #f1c8cb;
    background: #fff3f4;
    color: #8a1f28;
}

.flash-close {
    border: none;
    background: transparent;
    color: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
}

.pagination {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--ink-soft);
    font-weight: 700;
    font-size: 0.84rem;
}

.pagination .active {
    background: var(--brand);
    border-color: var(--brand);
    color: #ffffff;
}

.pagination .disabled {
    opacity: 0.55;
}

.doc-items {
    margin-top: 16px;
    padding: 12px;
    border: 1px dashed #c9d9e8;
    border-radius: 12px;
    background: #fbfdff;
}

.doc-items .row {
    display: grid;
    gap: 8px;
    grid-template-columns: 2fr 2fr 1fr 1fr 1fr auto;
    margin-bottom: 8px;
}

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

.empty {
    padding: 18px;
    border: 1px dashed #c9d9e8;
    background: #f8fbff;
    border-radius: 10px;
    color: var(--ink-soft);
}

.layout-overlay {
    display: none;
    border: none;
    padding: 0;
}

main > * {
    animation: fadeUp 0.34s ease;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1080px) {
    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 960px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .mobile-nav-toggle {
        display: inline-flex;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(290px, 82vw);
        transform: translateX(-110%);
        transition: transform 0.24s ease;
        box-shadow: var(--shadow-md);
    }

    body.nav-open .sidebar {
        transform: translateX(0);
    }

    .layout-overlay {
        position: fixed;
        inset: 0;
        background: rgba(4, 16, 27, 0.45);
        z-index: 15;
    }

    body.nav-open .layout-overlay {
        display: block;
    }

    .main {
        padding: 14px;
    }

    .topbar {
        top: 8px;
        padding: 10px;
    }

    .form-grid,
    .grid-2,
    .grid-3,
    .doc-items .row,
    .guest-shell {
        grid-template-columns: 1fr;
    }

    .topbar-right {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
