:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #172033;
    --muted: #69758a;
    --line: #e3e9f2;
    --primary: #0f6bff;
    --primary-dark: #084ec2;
    --success: #0c8f5b;
    --error: #c73333;
    --shadow: 0 14px 40px rgba(25, 38, 66, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    padding-bottom: 86px;
}

a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.auth-page {
    display: grid;
    place-items: center;
    padding: 22px;
}

.auth-shell {
    width: min(1040px, 100%);
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 22px;
    align-items: stretch;
}

.brand-panel,
.auth-card,
.panel,
.stat-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.brand-panel {
    min-height: 560px;
    padding: 46px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background:
        linear-gradient(145deg, rgba(15, 107, 255, 0.92), rgba(7, 30, 78, 0.9)),
        radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.22), transparent 30%);
    color: #fff;
}

.brand-panel h1 {
    margin: 18px 0 12px;
    max-width: 520px;
    font-size: 42px;
    line-height: 1.08;
}

.brand-panel p {
    margin: 0;
    max-width: 520px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 17px;
    line-height: 1.6;
}

.badge,
.eyebrow {
    display: inline-flex;
    width: fit-content;
    border-radius: 999px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.auth-card {
    padding: 34px;
    align-self: center;
}

h1,
h2,
p {
    overflow-wrap: anywhere;
}

h2 {
    margin: 0 0 8px;
    font-size: 24px;
}

.muted,
.switch {
    color: var(--muted);
}

.form {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

label {
    display: grid;
    gap: 8px;
    color: #3a465b;
    font-size: 14px;
    font-weight: 700;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px 15px;
    color: var(--text);
    background: #fff;
    font: inherit;
    outline: none;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(15, 107, 255, 0.12);
}

button {
    width: 100%;
    border: 0;
    border-radius: 8px;
    padding: 15px 18px;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

button:hover {
    background: var(--primary-dark);
}

.alert {
    margin: 12px 0;
    border-radius: 8px;
    padding: 12px 14px;
    font-weight: 700;
}

.alert.success {
    background: #e8f8f0;
    color: var(--success);
}

.alert.error {
    background: #fff0f0;
    color: var(--error);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 18px max(18px, calc((100vw - 1080px) / 2));
    background: rgba(244, 247, 251, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.app-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    padding: 22px max(18px, calc((100vw - 1080px) / 2));
    background: linear-gradient(135deg, #0f6bff, #073b91);
    color: #fff;
}

.app-header.compact {
    padding-bottom: 34px;
}

.app-header h1 {
    margin: 8px 0 6px;
    font-size: 28px;
    line-height: 1.12;
}

.app-header p {
    margin: 0;
    color: rgba(255, 255, 255, 0.82);
}

.round-link {
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    padding: 11px 14px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.topbar .eyebrow {
    background: #eaf2ff;
    color: var(--primary);
    padding: 6px 10px;
}

.topbar h1 {
    margin: 8px 0 0;
    font-size: 24px;
}

.logout {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px 14px;
    background: #fff;
    color: var(--text);
}

.top-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.top-actions a {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px 14px;
    background: #fff;
    color: var(--text);
}

.dashboard {
    width: min(1080px, 100%);
    margin: 0 auto;
    padding: 22px 18px 36px;
}

.app-dashboard {
    padding-bottom: 106px;
}

.hero-card {
    margin-top: -6px;
    border-radius: 8px;
    padding: 24px;
    background: #071f4f;
    color: #fff;
    box-shadow: var(--shadow);
}

.hero-card span,
.hero-card small {
    display: block;
    color: rgba(255, 255, 255, 0.76);
    font-weight: 700;
}

.hero-card > strong {
    display: block;
    margin-top: 10px;
    font-size: 42px;
    line-height: 1;
}

.hero-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin: 20px 0 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 16px;
}

.hero-row b {
    font-size: 22px;
}

.setup-link {
    display: inline-flex;
    margin-top: 12px;
    border-radius: 8px;
    padding: 11px 12px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.setup-link.dark {
    background: #eef5ff;
    color: var(--primary);
}

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

.quick-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(25, 38, 66, 0.06);
}

.quick-card span {
    display: block;
    min-height: 32px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.quick-card strong {
    display: block;
    margin-top: 8px;
    font-size: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.stat-card {
    padding: 20px;
}

.stat-card.primary {
    background: var(--primary);
    color: #fff;
}

.stat-card span {
    display: block;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.stat-card.primary span {
    color: rgba(255, 255, 255, 0.8);
}

.stat-card strong {
    font-size: 30px;
}

.panel {
    margin-top: 16px;
    padding: 22px;
}

.app-panel {
    box-shadow: 0 8px 24px rgba(25, 38, 66, 0.07);
}

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

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

.section-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin-bottom: 12px;
}

.section-head p {
    margin: 4px 0 0;
}

.section-head span {
    color: var(--muted);
    font-weight: 700;
}

.filters {
    display: grid;
    grid-template-columns: 180px minmax(160px, 1fr) 120px 90px;
    gap: 12px;
    align-items: end;
    margin: 16px 0 12px;
}

.button-light {
    display: inline-flex;
    min-height: 49px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--primary);
}

.total-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 8px 0 14px;
    border-radius: 8px;
    padding: 12px;
    background: #f6f9fd;
    color: var(--muted);
    font-weight: 700;
}

.total-line strong {
    color: var(--text);
}

.total-line span {
    color: var(--success);
}

.entries {
    display: grid;
    gap: 10px;
}

.entry {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #fbfdff;
}

.entry strong,
.entry span {
    display: block;
}

.entry span,
.entry p {
    color: var(--muted);
    font-size: 13px;
}

.entry p {
    margin: 8px 0 0;
}

.entry b {
    white-space: nowrap;
    color: var(--primary);
}

.entry-side {
    display: grid;
    gap: 10px;
    justify-items: end;
}

.entry-side small {
    color: var(--success);
    font-weight: 800;
}

.entry-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    font-size: 13px;
}

.danger-link {
    color: var(--error);
}

.mini-grid {
    display: grid;
    grid-template-columns: 1fr 140px;
    gap: 12px;
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    border-top: 1px solid var(--line);
    border-radius: 0;
    padding: 8px max(10px, calc((100vw - 520px) / 2)) calc(8px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 -10px 34px rgba(25, 38, 66, 0.14);
    backdrop-filter: blur(12px);
}

.bottom-nav a {
    display: grid;
    gap: 4px;
    align-content: center;
    min-height: 54px;
    border-radius: 8px;
    padding: 8px 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-align: center;
}

.bottom-nav a::before {
    content: "";
    width: 7px;
    height: 7px;
    margin: 0 auto;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.45;
}

.bottom-nav a.active {
    background: #eaf2ff;
    color: var(--primary);
}

.report-card h2 {
    margin-bottom: 16px;
}

.report-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0 0 18px;
}

.summary-list {
    display: grid;
    gap: 10px;
}

.summary-list div {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding: 12px 0;
}

.summary-list span {
    color: var(--muted);
    font-weight: 700;
}

.summary-list strong {
    text-align: right;
}

.compact-filter {
    display: flex;
    gap: 8px;
    align-items: center;
}

.compact-filter input {
    width: 150px;
}

.compact-filter button {
    width: auto;
}

.report-table {
    display: grid;
    gap: 0;
}

.report-table > div {
    display: grid;
    grid-template-columns: 1fr 1.4fr 0.8fr;
    gap: 10px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding: 13px 0;
}

.report-table.two-col > div {
    grid-template-columns: 1fr 0.6fr;
}

.report-table.full-register > div {
    grid-template-columns: 0.7fr 1.2fr 0.7fr 0.9fr;
}

.report-table .table-head {
    color: var(--text);
    font-weight: 900;
}

.report-table b,
.report-table em {
    font-style: normal;
    font-weight: 900;
    text-align: right;
}

.report-table em {
    color: var(--success);
}

.empty {
    border: 1px dashed #c8d3e2;
    border-radius: 8px;
    padding: 22px;
    color: var(--muted);
    text-align: center;
}

@media (max-width: 760px) {
    .auth-page {
        display: block;
        padding: 14px;
    }

    .auth-shell,
    .stats-grid,
    .grid-form,
    .filters,
    .quick-grid,
    .mini-grid {
        grid-template-columns: 1fr;
    }

    .brand-panel {
        min-height: auto;
        padding: 28px 22px;
        margin-bottom: 14px;
    }

    .brand-panel h1 {
        font-size: 30px;
    }

    .auth-card,
    .panel,
    .stat-card {
        padding: 18px;
    }

    .topbar {
        padding: 14px;
        align-items: flex-start;
    }

    .topbar h1 {
        font-size: 20px;
    }

    .dashboard {
        padding: 14px 12px 28px;
    }

    .app-dashboard {
        padding-bottom: 106px;
    }

    .app-header {
        padding: 18px 14px 28px;
    }

    .app-header h1 {
        font-size: 24px;
    }

    .round-link {
        padding: 9px 12px;
    }

    .hero-card {
        padding: 20px;
    }

    .hero-card > strong {
        font-size: 36px;
    }

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

    .quick-card {
        padding: 14px;
    }

    .section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .filters button,
    .button-light,
    .report-actions {
        width: 100%;
    }

    .report-actions {
        grid-template-columns: 1fr;
    }

    .total-line {
        flex-direction: column;
    }

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

    .entry-side {
        display: flex;
        justify-content: space-between;
        align-items: center;
        justify-items: stretch;
    }

    .entry-actions {
        justify-content: flex-end;
    }

    .summary-list div,
    .hero-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .compact-filter {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr auto;
    }

    .compact-filter input {
        width: 100%;
    }

    .report-table > div,
    .report-table.full-register > div {
        grid-template-columns: 0.65fr 1fr 0.55fr;
    }

    .report-table.full-register em {
        grid-column: 1 / -1;
        text-align: left;
        color: var(--success);
    }

    .report-table.full-register .table-head span:last-child {
        display: none;
    }
}
