:root {
    --navy: #102a43;
    --navy-soft: #183b56;
    --blue: #1677a8;
    --blue-dark: #0d5f89;
    --blue-soft: #edf7fb;
    --ink: #18324b;
    --muted: #698096;
    --line: #dce7ee;
    --line-strong: #c7d8e2;
    --paper: #f7fafc;
    --surface: #ffffff;
    --gold: #d99b38;
    --success: #278650;
    --danger: #a33131;
    --shadow: 0 8px 24px rgba(16, 42, 67, .06);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--paper);
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 14px/1.55 Arial, sans-serif;
    overflow-x: hidden;
}

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

a:hover {
    color: var(--blue-dark);
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

button,
a.primary,
.primary {
    border: 0;
    border-radius: 7px;
    padding: 10px 16px;
    background: var(--blue);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(22, 119, 168, .22);
    outline-offset: 2px;
}

input,
select,
textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    padding: 10px 12px;
    background: var(--surface);
    color: var(--ink);
}

input::placeholder,
textarea::placeholder {
    color: #93a5b3;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    min-width: auto;
    accent-color: var(--blue);
}

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

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

h1,
h2,
h3 {
    font-family: Georgia, serif;
    color: var(--navy);
    line-height: 1.18;
}

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

h1 {
    margin-bottom: 10px;
    font-size: clamp(28px, 3vw, 36px);
}

h2 {
    margin-bottom: 8px;
    font-size: clamp(22px, 2.4vw, 28px);
}

h3 {
    margin-bottom: 6px;
    font-size: 20px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 78px;
    background: rgba(255, 255, 255, .97);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 12px 5vw;
    backdrop-filter: blur(10px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    color: var(--navy);
    font-weight: 700;
    font-size: 19px;
}

.brand:hover {
    color: var(--navy);
}

.brand > span:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
}

.brand small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 400;
    letter-spacing: .01em;
}

.brand-mark {
    flex: 0 0 auto;
    background: var(--blue);
    color: #fff;
    border-radius: 9px;
    padding: 8px 13px;
    font: bold 24px Georgia, serif;
    box-shadow: 0 4px 10px rgba(22, 119, 168, .2);
}

.topbar form {
    display: flex;
    align-items: center;
    gap: 8px;
    width: min(430px, 42vw);
}

.topbar input {
    min-width: 0;
}

.shell {
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - 130px);
}

.sapl-sidebar {
    flex: 0 0 245px;
    width: 245px;
    position: sticky;
    top: 78px;
    height: calc(100vh - 78px);
    overflow-y: auto;
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 30px 20px;
}

main {
    flex: 1 1 auto;
    width: 100%;
    max-width: 1320px;
    min-width: 0;
    margin: 0 auto;
    padding: 42px clamp(20px, 5vw, 64px) 54px;
}

.topbar + .shell > main {
    margin-right: auto;
}

.eyebrow {
    margin: 0 0 9px;
    color: var(--blue);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .15em;
    line-height: 1.3;
}

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

.topbar .sidebar-toggle,
.sidebar-toggle {
    flex: 0 0 auto;
    display: inline-flex;
    padding: 8px 11px;
    background: var(--blue-soft);
    color: var(--blue);
    border: 1px solid #cde6ef;
}

.sidebar-toggle:hover {
    background: #dceff6;
    color: var(--blue-dark);
}

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

.sidebar-close {
    display: none;
    padding: 2px 8px;
    background: transparent;
    color: var(--muted);
    font-size: 22px;
}

.side-link {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    margin: 3px 0;
    padding: 11px 12px;
    border-radius: 7px;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.side-link:hover {
    background: var(--blue-soft);
    color: var(--blue);
}

.side-link.active {
    background: #e7f5fa;
    color: var(--blue);
    font-weight: 700;
    box-shadow: inset 3px 0 0 var(--blue);
}

.side-icon {
    flex: 0 0 28px;
    color: var(--blue);
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.side-label {
    min-width: 0;
}

.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    min-height: 210px;
    padding: 38px 42px;
    background: linear-gradient(120deg, var(--navy), var(--navy-soft));
    border-radius: 14px;
    color: #fff;
    box-shadow: var(--shadow);
}

.hero h1 {
    margin-bottom: 12px;
    color: #fff;
    font-size: clamp(30px, 4vw, 42px);
}

.hero p:not(.eyebrow) {
    max-width: 620px;
    margin-bottom: 0;
    color: #c6d7e5;
    line-height: 1.7;
}

.hero-badge {
    flex: 0 0 auto;
    color: #c6d7e5;
    font: 600 13px Georgia, serif;
    text-align: center;
}

.hero-badge strong {
    display: block;
    color: #fff;
    font-size: 70px;
    line-height: 1;
}

.section-head,
.module-heading,
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.section-head {
    margin: 36px 0 18px;
}

.section-head > *,
.module-heading > * {
    min-width: 0;
}

.section-head h1,
.section-head h2 {
    margin-bottom: 0;
}

.section-head > .muted {
    text-align: right;
}

.module-heading {
    align-items: flex-start;
    margin-bottom: 28px;
}

.module-heading > div {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.module-heading .card-icon {
    flex: 0 0 auto;
}

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

.card {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    min-width: 0;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    box-shadow: 0 2px 8px rgba(16, 42, 67, .02);
}

a.card:hover {
    color: var(--ink);
    border-color: #80bed4;
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.card-icon {
    flex: 0 0 auto;
    color: var(--blue);
    font-size: 24px;
    line-height: 1.2;
}

.card > span:nth-child(2) {
    flex: 1 1 auto;
    min-width: 0;
}

.card strong,
.card small,
.card em {
    display: block;
    overflow-wrap: anywhere;
}

.card small,
.record small {
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.card em {
    margin-top: 13px;
    color: var(--blue);
    font-size: 11px;
    font-style: normal;
}

.card b {
    flex: 0 0 auto;
    color: var(--gold);
}

.breadcrumb {
    margin-bottom: 24px;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.breadcrumb a {
    color: var(--blue);
}

.panel {
    margin-bottom: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(16, 42, 67, .025);
}

.panel-head {
    min-height: 57px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--line);
    background: #fbfdfe;
}

.panel-head strong {
    overflow-wrap: anywhere;
}

.panel > h2,
.panel > h3 {
    margin: 0;
    padding: 20px 20px 0;
}

.record {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-width: 0;
    padding: 17px 20px;
    border-bottom: 1px solid #edf2f5;
}

.record:last-child {
    border-bottom: 0;
}

.record > div {
    flex: 1 1 auto;
    min-width: 0;
}

.record strong,
.record small {
    display: block;
    overflow-wrap: anywhere;
}

a.record {
    color: var(--ink);
}

a.record:hover {
    background: #fbfdfe;
}

.record-actions,
.filter-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.record-actions label,
.filter-actions label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
}

.record-actions input,
.record-actions select,
.filter-actions input,
.filter-actions select {
    width: auto;
    max-width: 240px;
}

.record-actions form,
.filter-actions form {
    display: inline-flex;
    align-items: center;
}

.status {
    flex: 0 0 auto;
    max-width: 45%;
    padding: 5px 9px;
    border-radius: 20px;
    background: #e7f5ed;
    color: var(--success);
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
    overflow-wrap: anywhere;
}

.empty {
    padding: 42px 24px;
    color: var(--muted);
    text-align: center;
}

.advanced-filter {
    display: block;
    margin-bottom: 18px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.filter:not(.advanced-filter) {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 20px 20px;
    border-top: 1px solid var(--line);
}

.filter:not(.advanced-filter) label {
    display: flex;
    flex: 1 1 280px;
    flex-direction: column;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

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

.filter-grid label,
.login form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

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

.filter-actions {
    margin-top: 15px;
}

.button-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 39px;
    padding: 9px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    line-height: 1.2;
    white-space: nowrap;
}

.button-secondary:hover {
    border-color: #80bed4;
    color: var(--blue);
    background: var(--blue-soft);
}

.button-danger {
    min-height: 39px;
    padding: 9px 14px;
    border: 1px solid #e4b1b1;
    border-radius: 7px;
    background: #fff;
    color: var(--danger);
    cursor: pointer;
}

.button-danger:hover {
    background: #fff0f0;
    border-color: #c96b6b;
    color: var(--danger);
}

.detail {
    overflow: hidden;
}

.detail form {
    display: block;
}

.detail > .eyebrow,
.detail > h1,
.detail > h2,
.detail > .muted,
.detail > .alert {
    margin-right: 20px;
    margin-left: 20px;
}

.detail > .eyebrow {
    padding-top: 22px;
}

.detail > h1,
.detail > h2 {
    margin-bottom: 10px;
}

.detail > form:not(.filter) {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 0 20px 22px;
}

.detail > form:not(.filter) label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.detail .filter-grid {
    margin: 20px 0;
}

.detail dl,
.receipt dl {
    display: grid;
    grid-template-columns: minmax(150px, 220px) minmax(0, 1fr);
    gap: 0;
    margin: 0;
    padding: 4px 20px 20px;
}

.detail dt,
.receipt dt {
    padding: 12px 16px 12px 0;
    border-bottom: 1px solid #edf2f5;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.detail dd,
.receipt dd {
    min-width: 0;
    margin: 0;
    padding: 12px 0;
    border-bottom: 1px solid #edf2f5;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.detail dt:last-of-type,
.detail dd:last-of-type,
.receipt dt:last-of-type,
.receipt dd:last-of-type {
    border-bottom: 0;
}

.rich-text {
    padding: 18px 20px;
    line-height: 1.75;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.panel-subsection {
    margin: 0 20px 20px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.panel-subsection h2 {
    margin-bottom: 14px;
    font-size: 20px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 7px;
}

table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
    background: var(--surface);
}

th,
td {
    padding: 11px 13px;
    border-bottom: 1px solid #edf2f5;
    text-align: left;
    vertical-align: top;
    overflow-wrap: anywhere;
}

th {
    background: #f6fafc;
    color: var(--navy);
    font-size: 11px;
    letter-spacing: .03em;
    text-transform: uppercase;
}

tr:last-child td {
    border-bottom: 0;
}

.report {
    width: min(1100px, 100%);
    max-width: none;
    margin: 0 auto;
    padding: 34px clamp(20px, 5vw, 64px) 50px;
    background: #fff;
}

.report h1 {
    margin-bottom: 5px;
}

.report table {
    margin-top: 22px;
}

.login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    max-width: none;
    padding: 28px 20px;
    background: linear-gradient(135deg, #eef7fb, #f7fafc 55%, #fff);
}

.login .panel {
    width: min(100%, 450px);
    margin: 0;
    padding: 32px;
    box-shadow: var(--shadow);
}

.login h1 {
    margin-bottom: 22px;
}

.login form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login form label:has(input[type="checkbox"]) {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-weight: 400;
}

.login .success,
.login .error {
    margin: 0 0 15px;
}

.login > .panel > p:last-child {
    margin: 20px 0 0;
    text-align: center;
}

.flash,
.alert {
    margin-bottom: 18px;
    padding: 13px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.flash-success,
.alert.success,
.success {
    background: #ecfdf3;
    border-color: #86efac;
    color: #166534;
}

.flash-error,
.alert.error,
.error {
    background: #fff1f2;
    border-color: #fda4af;
    color: #9f1239;
}

.flash ul {
    margin: 7px 0 0;
    padding-left: 20px;
}

.form-error {
    display: block;
    margin-top: 5px;
    color: #b42318;
}

footer {
    padding: 20px;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.sidebar-scrim {
    display: none;
}

/* Laravel's default paginator uses utility classes. These small rules keep it
   readable without requiring Tailwind at runtime. */
main nav[role="navigation"] {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 20px;
    color: var(--muted);
}

main nav[role="navigation"] .hidden {
    display: none;
}

main nav[role="navigation"] .flex {
    display: flex;
}

main nav[role="navigation"] .items-center {
    align-items: center;
}

main nav[role="navigation"] .justify-between {
    justify-content: space-between;
}

main nav[role="navigation"] .flex-1 {
    flex: 1 1 0%;
}

main nav[role="navigation"] a,
main nav[role="navigation"] span[aria-current="page"] span,
main nav[role="navigation"] span[aria-disabled="true"] span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
}

main nav[role="navigation"] a:hover {
    background: var(--blue-soft);
    border-color: #80bed4;
    color: var(--blue);
}

main nav[role="navigation"] svg {
    width: 16px;
    height: 16px;
}

.no-print {
    print-color-adjust: exact;
}

@media (min-width: 640px) {
    main nav[role="navigation"] .sm\:hidden {
        display: none;
    }

    main nav[role="navigation"] .sm\:flex {
        display: flex;
    }

    main nav[role="navigation"] .sm\:flex-1 {
        flex: 1 1 0%;
    }

    main nav[role="navigation"] .sm\:items-center {
        align-items: center;
    }

    main nav[role="navigation"] .sm\:justify-between {
        justify-content: space-between;
    }
}

@media (min-width: 801px) {
    .sidebar-collapsed .sapl-sidebar {
        flex-basis: 78px;
        width: 78px;
        padding-right: 12px;
        padding-left: 12px;
    }

    .sidebar-collapsed .side-label,
    .sidebar-collapsed .sidebar-heading .eyebrow {
        display: none;
    }

    .sidebar-collapsed .side-link {
        justify-content: center;
        padding-right: 8px;
        padding-left: 8px;
    }

    .sidebar-collapsed .side-icon {
        flex-basis: auto;
    }
}

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

@media (max-width: 800px) {
    .topbar {
        gap: 10px;
        padding: 10px 20px;
    }

    .topbar form {
        display: none;
    }

    .brand {
        flex: 1 1 auto;
        justify-content: center;
        font-size: 17px;
    }

    .brand small {
        display: none;
    }

    .sapl-sidebar {
        display: none;
        position: fixed;
        z-index: 20;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(84vw, 320px);
        height: 100vh;
        padding: 25px 20px;
        overflow-y: auto;
        box-shadow: 8px 0 24px rgba(16, 42, 67, .15);
    }

    body.sidebar-open .sapl-sidebar {
        display: block;
    }

    body.sidebar-open .sidebar-scrim {
        display: block;
        position: fixed;
        z-index: 10;
        inset: 0;
        padding: 0;
        background: rgba(16, 42, 67, .4);
        border-radius: 0;
    }

    .sidebar-close {
        display: block;
    }

    .sidebar-toggle-label {
        display: none;
    }

    .sidebar-collapsed .side-label {
        display: inline;
    }

    main {
        padding: 30px 20px 40px;
    }

    .hero {
        padding: 28px;
    }

    .hero-badge {
        display: none;
    }

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

    .section-head > .muted {
        text-align: left;
    }

    .section-head .filter-actions,
    .module-heading > .primary,
    .module-heading > .button-secondary {
        width: 100%;
    }

    .section-head .filter-actions > *,
    .module-heading > .primary,
    .module-heading > .button-secondary {
        flex: 1 1 auto;
    }
}

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

    .filter-grid .filter-wide {
        grid-column: auto;
    }

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

    .hero {
        min-height: 0;
        padding: 24px 22px;
    }

    .record {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .status {
        max-width: 100%;
    }

    .detail dl,
    .receipt dl {
        display: block;
        padding-right: 20px;
        padding-left: 20px;
    }

    .detail dt,
    .receipt dt {
        padding: 12px 0 4px;
        border-bottom: 0;
    }

    .detail dd,
    .receipt dd {
        padding: 0 0 12px;
    }

    .login .panel {
        padding: 24px 20px;
    }

    main nav[role="navigation"] {
        align-items: stretch;
        flex-direction: column;
    }
}

@media print {
    body {
        background: #fff;
    }

    .topbar,
    .sapl-sidebar,
    .sidebar-scrim,
    footer,
    .no-print {
        display: none !important;
    }

    .shell,
    main,
    .report {
        display: block;
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .panel,
    .card {
        box-shadow: none;
    }

    .panel {
        break-inside: avoid;
    }
}
