@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #eef4ff;
    --surface: #ffffff;
    --surface-soft: #f7faff;
    --line: #d4e0f3;
    --line-strong: #bdd0ee;
    --ink: #0f2037;
    --muted: #4f6282;
    --brand: #1f67f2;
    --brand-deep: #1749a9;
    --good: #0d8c57;
    --good-soft: #def7eb;
    --warn: #996000;
    --warn-soft: #fff2d8;
    --bad: #b82525;
    --bad-soft: #ffe6e6;
    --shadow: 0 14px 28px rgba(20, 47, 97, 0.12);
    --radius-xl: 22px;
    --radius-lg: 16px;
    --radius-md: 12px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: "Manrope", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 0% 0%, #d8e6ff 0%, transparent 38%),
        radial-gradient(circle at 100% 14%, #ffe8cc 0%, transparent 32%),
        linear-gradient(180deg, #f9fbff 0%, var(--bg) 44%, #e8f0ff 100%);
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: auto auto 5% 2%;
    width: 220px;
    height: 220px;
    pointer-events: none;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(31, 103, 242, 0.14) 0%, rgba(31, 103, 242, 0) 68%);
    z-index: -1;
}

body::after {
    inset: 12% 2% auto auto;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(255, 165, 59, 0.16) 0%, rgba(255, 165, 59, 0) 68%);
}

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

h1,
h2 {
    font-family: "Fraunces", Georgia, serif;
    margin: 0;
    color: #112443;
    letter-spacing: 0.01em;
}

.top {
    position: sticky;
    top: 14px;
    z-index: 20;
    width: min(1480px, calc(100% - 24px));
    margin: 14px auto 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(167, 190, 230, 0.8);
    backdrop-filter: blur(8px);
    box-shadow: 0 14px 35px rgba(20, 47, 97, 0.1);
}

.top h1 {
    font-size: clamp(1.35rem, 1.8vw, 2rem);
}

.top .meta {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
}

.top a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 9px 14px;
    border: 1px solid #bdd2fa;
    background: #f2f7ff;
    color: #173d87;
    font-weight: 700;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.top a:hover {
    transform: translateY(-1px);
    background: #e8f1ff;
    box-shadow: 0 8px 16px rgba(23, 61, 135, 0.14);
}

.msg {
    width: min(1480px, calc(100% - 24px));
    margin: 10px auto;
    border-radius: var(--radius-md);
    padding: 12px 14px;
    border: 1px solid transparent;
    font-weight: 600;
    box-shadow: 0 10px 22px rgba(21, 50, 92, 0.08);
}

.msg.ok {
    color: var(--good);
    background: var(--good-soft);
    border-color: #afe4c9;
}

.msg.err {
    color: var(--bad);
    background: var(--bad-soft);
    border-color: #f3c1c1;
}

.dashboard-shell {
    width: min(1480px, calc(100% - 24px));
    margin: 0 auto 22px;
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.sidebar-toggle {
    display: none;
}

.dashboard-sidebar {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(246, 250, 255, 0.96) 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 14px;
}

.sidebar-head {
    margin-bottom: 10px;
}

.sidebar-head h2 {
    font-size: 1.15rem;
    margin-bottom: 4px;
}

.sidebar-nav {
    display: grid;
    gap: 7px;
}

.sidebar-link {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #d2def3;
    background: #f7faff;
    color: #294066;
    font-weight: 700;
    font-size: 0.88rem;
    transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.sidebar-link:hover {
    transform: translateY(-1px);
    background: #eff5ff;
    border-color: #c0d1ef;
}

.sidebar-link.active {
    background: linear-gradient(135deg, #1f67f2 0%, #3a8dff 100%);
    border-color: #1d65ea;
    color: #fff;
    box-shadow: 0 9px 18px rgba(31, 103, 242, 0.32);
}

.dashboard-main {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.dashboard-main .grid {
    width: 100%;
    margin: 0;
}

.page-intro {
    border-radius: var(--radius-lg);
}

.page-chip-nav {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.page-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    border-radius: 999px;
    background: #f3f7ff;
    border: 1px solid #d1def4;
    color: #2e4873;
    font-weight: 700;
    font-size: 0.78rem;
    transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.page-chip:hover {
    transform: translateY(-1px);
    background: #ebf3ff;
    border-color: #b7cdee;
}

.page-chip.active {
    color: #fff;
    border-color: #1d65ea;
    background: linear-gradient(135deg, #1f67f2 0%, #3a8dff 100%);
}

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

.overview-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.grid {
    width: min(1480px, calc(100% - 24px));
    margin: 0 auto 22px;
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
}

.card {
    background: linear-gradient(180deg, #ffffff 0%, #fcfdff 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 16px;
    min-width: 0;
    overflow-x: hidden;
    box-shadow: var(--shadow);
    animation: rise-in 0.36s ease both;
}

.card h2 {
    font-size: 1.25rem;
}

.small {
    color: var(--muted);
    font-size: 0.79rem;
    line-height: 1.45;
}

.kpi {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 12px;
    margin-bottom: 10px;
}

.pill {
    border-radius: var(--radius-md);
    padding: 10px;
    background:
        linear-gradient(180deg, #f9fbff 0%, #edf4ff 100%);
    border: 1px solid #c8daf7;
}

.pill .label {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
}

.pill .value {
    margin-top: 4px;
    font-size: clamp(1.15rem, 1.35vw, 1.5rem);
    font-weight: 800;
    color: #12356f;
}

.row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    align-items: end;
}

.row > div {
    flex: 1;
}

label {
    display: block;
    margin-bottom: 6px;
    color: #3c5174;
    font-size: 0.82rem;
    font-weight: 700;
}

input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 11px;
    border: 1px solid var(--line-strong);
    background: #fff;
    color: #152b4f;
    font-size: 0.93rem;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

input::placeholder {
    color: #8ea3c5;
}

input:focus {
    outline: none;
    border-color: #5a8cf3;
    box-shadow: 0 0 0 4px rgba(90, 140, 243, 0.17);
    transform: translateY(-1px);
}

button,
a.btn {
    border: 0;
    border-radius: 11px;
    padding: 10px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 800;
    text-align: center;
    line-height: 1.2;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

button:hover,
a.btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.02);
}

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

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #1f67f2 0%, #2f82ff 100%);
    box-shadow: 0 10px 18px rgba(30, 98, 214, 0.28);
}

.btn-good {
    color: #fff;
    background: linear-gradient(135deg, #0f8d58 0%, #27b171 100%);
    box-shadow: 0 10px 18px rgba(15, 141, 88, 0.25);
}

.btn-bad {
    color: #fff;
    background: linear-gradient(135deg, #b82525 0%, #d74141 100%);
    box-shadow: 0 10px 18px rgba(184, 37, 37, 0.24);
}

.btn-small {
    padding: 7px 11px;
    border-radius: 9px;
    font-size: 0.78rem;
}

.link-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.link-grid > div {
    min-width: 0;
}

.link-grid .btn {
    width: 100%;
    min-height: 46px;
}

.inline {
    display: inline;
    margin: 0;
}

.mt8 {
    margin-top: 8px;
}

.mono {
    font-family: "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 0.84rem;
    word-break: break-all;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 12px;
    font-size: 0.82rem;
}

th,
td {
    padding: 9px 8px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #e5eefc;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #324a71;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    background: #eff5ff;
}

tbody tr:nth-child(even) {
    background: #fafcff;
}

tbody tr:hover {
    background: #eef5ff;
}

td.status {
    font-weight: 800;
    text-transform: capitalize;
}

td.status.approved,
td.status.paid,
td.status.fulfilled,
td.status.active {
    color: var(--good);
}

td.status.submitted,
td.status.open,
td.status.pending,
td.status.unpaid {
    color: #305a96;
}

td.status.denied,
td.status.rejected,
td.status.deleted {
    color: var(--bad);
}

td.status.forfeited {
    color: #6a4bd0;
}

.ok {
    color: var(--good);
}

.warn {
    color: var(--warn);
}

.err {
    color: var(--bad);
}

.auth-page .wrap,
.helper-page .wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-page .card,
.helper-page .card {
    width: min(100%, 760px);
    border-radius: var(--radius-xl);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow);
    padding: 26px;
}

.auth-page .card {
    max-width: 460px;
}

.auth-page h1,
.helper-page h1 {
    font-size: clamp(1.55rem, 2.1vw, 2.05rem);
    margin-bottom: 6px;
}

.auth-page p.sub {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 600;
}

.auth-page .btn {
    width: 100%;
    color: #fff;
    background: linear-gradient(135deg, #1f67f2 0%, #2f82ff 100%);
    box-shadow: 0 10px 18px rgba(30, 98, 214, 0.28);
}

.auth-page .err {
    margin-top: 10px;
    border-radius: var(--radius-md);
    padding: 10px 12px;
    background: var(--bad-soft);
    color: var(--bad);
    border: 1px solid #f3c1c1;
    font-weight: 600;
}

.auth-page .lock {
    margin-top: 8px;
    color: #946200;
    font-size: 0.8rem;
    font-weight: 700;
}

.helper-page p {
    margin: 8px 0;
    line-height: 1.5;
}

.helper-page .row {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.helper-page input {
    flex: 1 1 360px;
    min-width: 280px;
}

.helper-page .copy {
    color: #fff;
    background: linear-gradient(135deg, #1f67f2 0%, #2f82ff 100%);
}

.helper-page .dash {
    color: #fff;
    background: linear-gradient(135deg, #33415f 0%, #4c5f86 100%);
}

.helper-page .status {
    margin-top: 9px;
    min-height: 22px;
    color: var(--good);
    font-weight: 700;
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 980px) {
    .top {
        top: 8px;
        width: calc(100% - 16px);
        margin: 8px auto;
        padding: 13px 14px;
        border-radius: 14px;
    }

    .top h1 {
        font-size: 1.3rem;
    }

    .grid,
    .msg {
        width: calc(100% - 16px);
    }

    .dashboard-shell {
        width: calc(100% - 16px);
        grid-template-columns: 1fr;
        margin-bottom: 16px;
    }

    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 110px;
        justify-self: end;
        border: 1px solid #bdd2fa;
        background: #f2f7ff;
        color: #173d87;
        font-weight: 800;
        border-radius: 12px;
        box-shadow: 0 7px 16px rgba(23, 61, 135, 0.14);
    }

    .dashboard-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(88vw, 330px);
        border-radius: 0 18px 18px 0;
        transform: translateX(-105%);
        transition: transform 0.2s ease;
        z-index: 60;
        overflow-y: auto;
    }

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

    .dashboard-main {
        gap: 10px;
    }

    .page-chip-nav {
        display: none;
    }

    .grid {
        grid-template-columns: 1fr;
        margin-bottom: 16px;
    }

    .link-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 13px;
        border-radius: 14px;
    }

    .kpi {
        grid-template-columns: 1fr;
    }

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

    .row > div {
        width: 100%;
    }

    .btn-primary,
    .btn-good,
    .btn-bad,
    button,
    a.btn {
        width: 100%;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .auth-page .card,
    .helper-page .card {
        padding: 20px;
    }
}
