:root {
    --ink: #14213d;
    --muted: #6b7280;
    --line: #dbe3ef;
    --soft: #f4f7fb;
    --panel: #ffffff;
    --blue: #0d6efd;
    --blue-dark: #084298;
    --green: #0f766e;
    --danger: #b91c1c;
    --warning: #b7791f;
    --shadow: 0 20px 45px rgba(20, 33, 61, .10);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #eef3f9;
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-layout {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    background: #07111f;
    color: #f8fbff;
    padding: 22px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: grid;
    grid-template-columns: 74px 1fr;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.brand img {
    width: 74px;
    height: 50px;
    object-fit: contain;
}

.brand strong {
    display: block;
    font-size: 18px;
}

.brand span {
    display: block;
    color: #9fb0c4;
    font-size: 12px;
    margin-top: 3px;
}

.sidebar nav {
    display: grid;
    gap: 5px;
}

.sidebar nav a {
    border-radius: 8px;
    color: #c7d2e1;
    padding: 10px 12px;
    transition: background .18s ease, color .18s ease;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: #123967;
    color: #ffffff;
}

.main {
    min-width: 0;
    padding: 24px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.eyebrow {
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    margin: 0 0 5px;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: 28px;
    margin-bottom: 0;
}

h2 {
    font-size: 18px;
    margin-bottom: 14px;
}

.user-chip {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 12px;
    padding: 8px 10px 8px 14px;
}

.user-chip a {
    background: #eef4ff;
    border-radius: 6px;
    color: var(--blue-dark);
    font-weight: 700;
    padding: 7px 10px;
}

.alert {
    background: #ecfdf3;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    color: #166534;
    margin-bottom: 16px;
    padding: 12px 14px;
}

.alert.danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: var(--danger);
}

.floating-alert {
    left: 50%;
    max-width: 520px;
    position: fixed;
    top: 22px;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    z-index: 10;
}

.login-page {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(360px, .65fr);
    min-height: 100vh;
}

.login-hero {
    background:
        linear-gradient(135deg, rgba(7, 17, 31, .94) 0%, rgba(16, 37, 62, .86) 48%, rgba(7, 17, 31, .96) 100%),
        url("img/scania-wide.jpeg") center / cover no-repeat,
        #07111f;
    overflow: hidden;
    position: relative;
}

.login-hero-bus {
    bottom: 24%;
    filter:
        drop-shadow(0 34px 50px rgba(0, 0, 0, .58))
        drop-shadow(0 0 38px rgba(158, 210, 255, .26));
    max-width: 940px;
    opacity: .62;
    position: absolute;
    right: -130px;
    transform: rotate(-1.5deg) scale(1.08);
    width: 86%;
    z-index: 1;
}

.login-hero::before {
    background:
        linear-gradient(110deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .02) 34%, rgba(255, 255, 255, 0) 62%),
        linear-gradient(180deg, rgba(77, 163, 255, .22), rgba(7, 17, 31, 0) 46%);
    content: "";
    inset: 0;
    mix-blend-mode: screen;
    position: absolute;
    z-index: 2;
}

.login-hero::after {
    background:
        linear-gradient(90deg, rgba(7, 17, 31, .86), rgba(7, 17, 31, .24) 62%, rgba(7, 17, 31, .08)),
        linear-gradient(0deg, rgba(7, 17, 31, .92), rgba(7, 17, 31, 0) 58%);
    content: "";
    inset: 0;
    position: absolute;
    z-index: 3;
}

.login-copy {
    bottom: 52px;
    color: #fff;
    left: 54px;
    max-width: 720px;
    position: absolute;
    text-shadow: 0 16px 36px rgba(0, 0, 0, .42);
    z-index: 4;
}

.login-copy p {
    color: #b9dcff;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.login-copy h1 {
    font-size: 44px;
    line-height: 1.05;
}

.login-card {
    align-content: center;
    background: #fff;
    display: grid;
    padding: 48px;
}

.login-card form {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.login-bus {
    height: 110px;
    margin-bottom: 14px;
    object-fit: contain;
    width: 180px;
}

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

.hero-panel {
    align-items: end;
    border-radius: 8px;
    box-shadow: var(--shadow);
    color: #fff;
    display: grid;
    min-height: 260px;
    overflow: hidden;
    padding: 28px;
    position: relative;
}

.hero-panel img {
    height: 100%;
    inset: 0;
    object-fit: cover;
    position: absolute;
    width: 100%;
}

.hero-panel::after {
    background: linear-gradient(90deg, rgba(7, 17, 31, .82), rgba(7, 17, 31, .16));
    content: "";
    inset: 0;
    position: absolute;
}

.hero-panel > div,
.month-filter {
    position: relative;
    z-index: 1;
}

.hero-panel h2 {
    font-size: 34px;
    line-height: 1.1;
    max-width: 680px;
}

.month-filter {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-self: end;
}

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

.stats-grid article,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(20, 33, 61, .06);
}

.stats-grid article {
    min-height: 100px;
    padding: 16px;
}

.stats-grid span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.stats-grid strong {
    display: block;
    font-size: 20px;
}

.panel {
    margin-bottom: 18px;
    overflow: auto;
    padding: 18px;
}

.panel-heading {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 14px;
}

.grid-two {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(320px, .82fr) minmax(0, 1.18fr);
}

.form-grid {
    display: grid;
    gap: 13px;
}

.order-form,
.wide-form .inline-form {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.span-2 {
    grid-column: span 2;
}

.inline-form {
    align-items: end;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.reset-password-form {
    align-items: center;
    display: flex;
    gap: 8px;
    min-width: 260px;
}

.reset-password-form input {
    min-width: 150px;
}

label {
    color: #334155;
    display: grid;
    font-size: 12px;
    font-weight: 800;
    gap: 6px;
    text-transform: uppercase;
}

input,
select,
textarea {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    color: var(--ink);
    font: inherit;
    min-height: 40px;
    padding: 9px 10px;
    text-transform: none;
    width: 100%;
}

textarea {
    resize: vertical;
}

.button {
    background: #e8eef7;
    border: 0;
    border-radius: 7px;
    color: #14213d;
    cursor: pointer;
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    min-height: 40px;
    padding: 10px 14px;
}

.button.primary {
    background: var(--blue);
    color: #fff;
}

.button.light {
    background: rgba(255, 255, 255, .92);
    color: #0f172a;
}

table {
    border-collapse: collapse;
    min-width: 760px;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 10px;
    text-align: left;
    vertical-align: top;
}

th {
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
}

.right {
    text-align: right;
}

.strong {
    font-weight: 800;
}

.badge {
    background: #edf6ff;
    border: 1px solid #c7e3ff;
    border-radius: 999px;
    color: #0b4f8a;
    display: inline-block;
    font-size: 12px;
    font-weight: 800;
    padding: 4px 9px;
}

.icon-button {
    align-items: center;
    background: #eef4ff;
    border: 1px solid #c7ddff;
    border-radius: 7px;
    color: #0b4f8a;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 12px;
    font-weight: 900;
    gap: 6px;
    min-height: 32px;
    padding: 6px 10px;
    white-space: nowrap;
}

.toggle-icon {
    align-items: center;
    background: #0d6efd;
    border-radius: 50%;
    color: #fff;
    display: inline-flex;
    font-size: 14px;
    height: 18px;
    justify-content: center;
    line-height: 1;
    width: 18px;
}

.detail-toggle[aria-expanded="true"] .toggle-icon {
    background: #0f766e;
}

.detail-row > td {
    background: #f8fbff;
    padding: 14px;
}

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

.detail-panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.detail-panel.income {
    border-top: 4px solid var(--green);
}

.detail-panel.cost {
    border-top: 4px solid var(--warning);
}

.detail-heading {
    align-items: center;
    background: #f8fafc;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
}

.detail-heading span {
    font-weight: 900;
}

.mini-table {
    min-width: 0;
}

.mini-table td {
    padding: 10px 14px;
}

.mini-table strong,
.mini-table small {
    display: block;
}

.mini-table small {
    color: var(--muted);
    margin-top: 3px;
}

.account-code {
    background: #edf2f7;
    border-radius: 5px;
    color: #475569;
    display: inline-block;
    font-size: 11px;
    font-weight: 900;
    margin-bottom: 5px;
    padding: 3px 6px;
}

.empty-detail {
    color: var(--muted);
    margin: 0;
    padding: 14px;
}

.section-row td {
    background: #eaf3ff;
    color: #0b4f8a;
    font-weight: 900;
}

.total td {
    background: #f8fafc;
    font-weight: 900;
}

.grand-total td {
    background: #14213d;
    color: #fff;
    font-size: 16px;
    font-weight: 900;
}

.report-title {
    text-align: center;
}

.report-title h2 {
    margin-bottom: 4px;
}

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

    .grid-two,
    .order-form,
    .wide-form .inline-form {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 820px) {
    .app-layout,
    .login-page {
        grid-template-columns: 1fr;
    }

    .sidebar {
        height: auto;
        position: relative;
    }

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

    .login-hero {
        min-height: 330px;
    }

    .login-hero-bus {
        bottom: 104px;
        opacity: .42;
        right: -120px;
        width: 104%;
    }

    .login-copy {
        bottom: 28px;
        left: 24px;
        right: 24px;
    }

    .login-copy h1,
    .hero-panel h2 {
        font-size: 30px;
    }

    .login-card {
        padding: 28px;
    }

    .main {
        padding: 16px;
    }

    .topbar,
    .panel-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .stats-grid,
    .grid-two,
    .order-form,
    .wide-form .inline-form,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: auto;
    }
}

@media print {
    .sidebar,
    .topbar,
    .no-print,
    .button,
    .alert {
        display: none !important;
    }

    .app-layout {
        display: block;
    }

    .main {
        padding: 0;
    }

    .panel {
        border: 0;
        box-shadow: none;
        overflow: visible;
    }

    table {
        min-width: 0;
    }
}
