:root {
    color-scheme: light;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #162743;
    background: #f5f7fb;
    font-synthesis: none;
    --navy: #112447;
    --ink: #162743;
    --muted: #566783;
    --line: #e1e7f0;
    --primary: #2456d2;
    --primary-hover: #1d45ad;
    --surface: #fff;
    --radius: 16px;
    --shadow: 0 2px 5px #132b4c06;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; line-height: 1.5; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.2; }
h1 { font-size: clamp(1.9rem, 3.5vw, 2.75rem); letter-spacing: -.045em; }
h2 { font-size: 1.2rem; letter-spacing: -.02em; }
h3 { font-size: 1.1rem; }
a { color: var(--primary); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .6; }
svg { flex: none; vertical-align: middle; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #7096ff; outline-offset: 3px; }
.main:focus { outline: 0; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 12px; left: 12px; padding: .55rem .85rem; background: white; z-index: 4; }

.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 28px 16px 18px; background: var(--navy); color: white; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: white; text-decoration: none; font-size: 1.25rem; font-weight: 750; letter-spacing: -.025em; line-height: 1.15; }
.sidebar .brand { align-self: start; padding-inline: 8px; }
.brand small, .profile-text small { display: block; margin-top: 5px; color: #b2c2e1; font-size: .8rem; font-weight: 500; letter-spacing: 0; }
.brand-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: #426ef0; color: #fff; box-shadow: inset 0 1px #ffffff35; }
.nav { display: grid; gap: 5px; margin-top: 42px; }
.nav-item { min-height: 46px; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; color: #c3d1e9; text-decoration: none; font-size: .925rem; font-weight: 600; }
.nav-item:hover, .nav-item.current { background: #263f6b; color: #fff; }
.nav-item.current svg { color: #a9c1ff; }
.profile { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 16px 4px 0; border-top: 1px solid #ffffff23; }
.avatar { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: #2d4777; color: #e2ebff; font-size: .82rem; font-weight: 750; }
.profile-text { flex: 1; min-width: 0; }
.profile-text strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; font-weight: 650; }
.profile-text small { margin-top: 0; }
.profile .icon-button { color: #c3d1e9; }
.profile .icon-button:hover { color: #fff; background: #2d4777; }

.topbar { min-height: 71px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px clamp(20px, 3vw, 38px); border-bottom: 1px solid var(--line); background: white; }
.topbar > span { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .9rem; }
.topbar strong { color: var(--ink); }
.topbar-separator { color: #8190a8; }
.main { width: 100%; max-width: 1510px; margin-inline: auto; padding: clamp(20px, 3vw, 38px); }
.button { min-height: 42px; width: fit-content; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 9px; padding: 9px 15px; text-align: center; text-decoration: none; font-size: .9rem; font-weight: 700; line-height: 1.35; }
.primary { color: white; background: var(--primary); box-shadow: 0 1px 2px #163b9124; }
.primary:hover { background: var(--primary-hover); }
.secondary { border-color: #d5dfed; background: white; color: #284875; }
.secondary:hover { background: #eff4ff; border-color: #b7c8e5; }
.text-link { color: #214fbd; font-size: .9rem; font-weight: 700; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.icon-button { display: inline-grid; place-items: center; padding: 0; width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: #5b7090; }
.icon-button:hover { background: #eaf1ff; color: #214fbd; }

.hero { position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: center; min-height: 244px; padding: clamp(24px, 4vw, 50px); border-radius: 20px; background: linear-gradient(111deg, #132650 2%, #153676 51%, #2454c0 100%); color: #fff; }
.hero-copy { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(2.1rem, 3.9vw, 3.3rem); }
.hero p { max-width: 405px; margin-top: 10px; color: #dbe6ff; }
.hero-button { margin-top: 22px; color: #163d9a; background: #fff; }
.hero-button:hover { background: #e4edff; }
.hero-illustration { position: absolute; width: 360px; height: 320px; top: 50%; right: 4%; transform: translateY(-50%); pointer-events: none; }
.hero-orbit { position: absolute; border-radius: 50%; border: 1px solid #a4c3ff45; inset: 34px 43px; }
.hero-orbit-outer { transform: scale(1.2); }
.hero-orbit-inner { background: #72a5ff19; transform: scale(.86); }
.hero-receipt { position: absolute; top: 68px; left: 113px; width: 126px; min-height: 176px; padding: 34px 21px 26px; border: 1px solid #9dbaffb0; border-radius: 12px 12px 16px 16px; background: linear-gradient(150deg, #8ab0ff, #4875df 65%, #3364d7); transform: rotate(-13deg); box-shadow: -11px 18px 35px #0b246a56, inset 0 2px #d7e4ff47; }
.hero-receipt span { display: block; height: 5px; margin-bottom: 13px; border-radius: 10px; background: #d2e2ffae; }
.hero-receipt span:first-child { width: 38%; height: 9px; background: #eff5ff; margin-bottom: 22px; }
.hero-receipt span:last-child { width: 67%; }
.hero-check { position: absolute; display: grid; place-items: center; top: 159px; left: 218px; width: 65px; height: 65px; border: 1px solid #90c4ff; border-radius: 19px; color: #164397; background: linear-gradient(145deg, #e9f7ff, #9acaff); box-shadow: 2px 9px 23px #18347979; transform: rotate(10deg); }

.card { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 20px 0 24px; }
.stat { display: flex; align-items: start; gap: 14px; padding: 19px; }
.stat-icon { flex: none; display: inline-grid; place-items: center; width: 43px; height: 43px; border-radius: 12px; }
.stat-icon.blue { background: #eaf0ff; color: #2456ca; }
.stat-icon.lavender { background: #f0ecff; color: #6548be; }
.stat-icon.mint { background: #e6f8f0; color: #127355; }
.stat h2 { margin-bottom: 5px; color: var(--muted); font-size: .875rem; font-weight: 650; letter-spacing: 0; }
.stat strong { display: block; font-size: clamp(1.35rem, 2vw, 1.82rem); font-variant-numeric: tabular-nums; letter-spacing: -.045em; line-height: 1.18; }
.stat p { margin-top: 5px; color: var(--muted); font-size: .8rem; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(235px, 284px); gap: 20px; align-items: start; }
.dashboard-aside { display: grid; gap: 16px; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 21px 20px 16px; }
.card-heading p, .aside-action p { margin-top: 6px; color: var(--muted); font-size: .925rem; }
.aside-action, .aside-history { padding: 20px; }
.aside-action h2 { margin-top: 13px; }
.aside-action > .button, .aside-action form:first-of-type { margin-top: 16px; }
.aside-action p.muted-note { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .85rem; }
.history-link { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); color: #21467c; text-decoration: none; }
.history-link:last-child { border-bottom: 0; padding-bottom: 0; }
.history-link:hover strong { text-decoration: underline; }
.history-link span { min-width: 0; }
.history-link strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.history-link small { display: block; color: var(--muted); font-size: .8rem; }

.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin: 5px 0 24px; }
.page-heading h1 { overflow-wrap: anywhere; }
.page-heading p { margin-top: 7px; color: var(--muted); }
.page-heading > .button { flex: none; }
.back-link { display: inline-block; margin-bottom: 10px; }
.narrow { max-width: 780px; }
.empty-state { display: grid; justify-items: center; justify-content: center; gap: 9px; padding: 36px 20px 39px; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 60px; height: 60px; margin-bottom: 4px; border: 1px solid #dfe8fb; border-radius: 16px; background: #f1f5ff; color: #4164b1; }
.empty-state p { color: var(--muted); font-size: .925rem; }
.empty-state .button { margin-top: 7px; }
.filters { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; padding: 0 20px 16px; }
.search-field { display: flex; align-items: center; flex: 1 1 180px; max-width: 310px; gap: 7px; padding-inline: 10px; border: 1px solid #d5dfed; border-radius: 8px; color: var(--muted); }
.search-field:focus-within { outline: 3px solid #7096ff; outline-offset: 2px; }
.search-field input { width: 100%; min-width: 0; border: 0; outline: 0; height: 40px; color: var(--ink); background: transparent; }
.search-field input:focus-visible { outline: 0; }
.filters select { width: auto; max-width: 100%; }
.table-wrap { position: relative; overflow-x: auto; }
.expense-table { width: 100%; border-collapse: collapse; text-align: left; font-size: .875rem; }
.expense-table th { padding: 10px 11px; border-block: 1px solid #ecf0f6; background: #f8faff; color: #52647e; font-weight: 650; white-space: nowrap; }
.expense-table td { padding: 12px 11px; border-bottom: 1px solid #ecf0f6; }
.expense-table tbody tr:last-child td { border-bottom: 0; }
.expense-table th:first-child, .expense-table td:first-child { padding-left: 20px; }
.expense-table th:last-child, .expense-table td:last-child { padding-right: 20px; }
.expense-label { display: flex; align-items: center; gap: 9px; overflow-wrap: anywhere; }
.expense-label > div { min-width: 85px; }
.table-icon { display: inline-grid; flex: none; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: #eef3ff; color: #5173b5; }
.subtext { display: block; margin-top: 2px; color: var(--muted); font-size: .8rem; }
.date { white-space: nowrap; color: var(--muted); }
.category-pill, .status { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 7px; background: #f0f3f9; color: #4c6084; font-size: .8rem; font-weight: 650; white-space: nowrap; }
.status.sent { color: #096247; background: #e5f6ef; }
.status.failed, .status.unknown { color: #8c4400; background: #fff1dc; }
.status.sending { color: #2153ba; background: #e9f1ff; }
.amount { text-align: right; white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; }
.cell-actions { white-space: nowrap; text-align: right; width: 1%; }
.filter-empty { text-align: center; padding: 18px; color: var(--muted); }

.form-fields { display: grid; gap: 19px; padding: 24px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-fields label, .auth-form label { display: block; font-size: .925rem; font-weight: 650; }
.optional { margin-left: 4px; color: var(--muted); font-weight: 400; font-size: .85rem; }
.form-fields input:not([type="checkbox"], [type="file"]), .auth-form input, select { width: 100%; min-height: 43px; padding: 8px 11px; border: 1px solid #cfdaec; border-radius: 8px; background: #fff; color: var(--ink); }
.form-fields label :is(input:not([type="checkbox"]), select), .auth-form label input { display: block; margin-top: 6px; }
select { appearance: none; padding-right: 31px; background-image: linear-gradient(45deg, transparent 50%, #536d96 50%), linear-gradient(135deg, #536d96 50%, transparent 50%); background-position: right 15px center, right 10px center; background-size: 5px 5px; background-repeat: no-repeat; }
input::placeholder { color: #647695; opacity: 1; }
input[type="checkbox"] { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.upload-box { display: flex; align-items: center; gap: 12px; margin-top: 7px; padding: 16px; border: 1px dashed #9ab0d4; border-radius: 10px; background: #f7faff; color: #214fbd; }
.upload-box div { min-width: 0; }
.upload-box input { display: block; max-width: 100%; color: var(--ink); font-size: .875rem; }
.upload-box input::file-selector-button { margin-right: 8px; padding: 6px 9px; border: 1px solid #cdd9ef; border-radius: 6px; background: white; color: #214fbd; font: inherit; font-weight: 650; cursor: pointer; }
.upload-box small { display: block; margin-top: 4px; color: var(--muted); }
.current-receipt { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin-top: 7px; }
label.checkbox-label { display: inline-flex; align-items: center; gap: 8px; }
.form-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: 9px; align-items: center; padding: 16px 24px; border-top: 1px solid var(--line); }
.danger-zone { margin-top: 14px; display: flex; justify-content: end; }
.danger-button { color: #9b2932; background: transparent; }
.danger-button:hover { background: #fff0f1; }
.selection { min-width: 0; margin: 0; padding: 0 24px 16px; border: 0; }
.selection legend { padding: 0; font-weight: 750; margin-bottom: 8px; }
.select-item, .select-all { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.select-item > span:nth-child(2) { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.select-item small { display: block; color: var(--muted); font-size: .83rem; }
.select-item:hover, .select-all:hover { background: #f8faff; }
.selection-total { margin-right: auto; }
.selection-total > * { display: block; }
.selection-total small { color: var(--muted); }
.selection-total strong, .detail-total { font-size: 1.27rem; }
.detail-grid .status { margin-top: 10px; }
.details { margin: 12px 0; font-size: .9rem; overflow-wrap: anywhere; }
.details dt { margin-top: 6px; color: var(--muted); }
.details dd { margin: 0; font-weight: 650; }
.release-form { margin-top: 9px; }
.release-form .button { padding-left: 0; }
.notice, .aside-action .notice { padding: 10px 11px; border-radius: 8px; background: #fff4e5; color: #75440c; font-size: .9rem; }
.notice.danger { color: #862833; background: #ffedef; }

.auth-page { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: #eef3fc; }
.login-layout { display: grid; grid-template-columns: 1.1fr 1fr; width: min(100%, 910px); overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: 0 14px 50px #193a701b; }
.login-art { position: relative; isolation: isolate; overflow: hidden; min-height: 495px; padding: 32px; background: linear-gradient(135deg, #132650, #2455b9); color: white; }
.login-message { display: grid; gap: 9px; margin-top: 38px; }
.login-message h2 { font-size: clamp(1.75rem, 3vw, 2.45rem); letter-spacing: -.04em; }
.login-message p { color: #dbe6ff; }
.login-art .hero-illustration { top: auto; bottom: -62px; right: -38px; transform: scale(.84); }
.auth-card { width: min(100%, 450px); display: grid; align-content: center; gap: 12px; padding: 34px clamp(22px, 5vw, 45px); border-radius: var(--radius); background: white; }
.auth-card h1 { font-size: 2rem; }
.auth-card p:not(.notice) { color: var(--muted); }
.auth-form { display: grid; gap: 15px; margin-top: 9px; }
.auth-form .button, .oidc-button { width: 100%; }
.oidc-button { margin-top: 5px; }

@media (max-width: 1140px) {
    .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
    .dashboard-aside { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
}
@media (max-width: 930px) {
    .shell { grid-template-columns: 195px minmax(0, 1fr); }
    .sidebar { padding-inline: 12px; }
    .hero-illustration { right: -6%; transform: translateY(-50%) scale(.8); }
    .hero p { max-width: 345px; }
    .stat { display: grid; gap: 8px; padding: 14px; }
}
@media (max-width: 700px) {
    .shell { display: block; }
    .sidebar { position: static; height: auto; display: grid; grid-template-columns: minmax(0,1fr) auto; grid-template-areas: "brand profile" "nav nav"; padding: 12px 14px 10px; gap: 10px; align-items: center; }
    .sidebar .brand { grid-area: brand; padding: 0; }
    .sidebar .brand small, .profile-text { display: none; }
    .brand-icon { width: 36px; height: 36px; }
    .profile { grid-area: profile; margin: 0; padding: 0; border: 0; }
    .nav { grid-area: nav; display: flex; flex-wrap: wrap; gap: 4px; margin: 0; }
    .nav-item { min-height: 36px; padding: 6px 8px; gap: 6px; font-size: .84rem; }
    .nav-item svg { width: 16px; height: 16px; }
    .topbar { min-height: 61px; padding: 8px 15px; }
    .topbar > span > :is(svg, span) { display: none; }
    .main { padding: 16px 14px 25px; }
    .hero { min-height: 225px; padding: 22px; }
    .hero-illustration { opacity: .53; right: -104px; transform: translateY(-51%) scale(.68); }
    .hero p { max-width: 260px; }
    .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 13px 0 16px; }
    .stat { padding: 11px 9px; }
    .stat h2 { font-size: .8rem; overflow-wrap: anywhere; }
    .stat p { font-size: .75rem; }
    .stat strong { font-size: clamp(.95rem, 3.6vw, 1.3rem); overflow-wrap: anywhere; }
    .stat .stat-icon { width: 35px; height: 35px; }
    .stat .stat-icon svg { width: 18px; height: 18px; }
    .page-heading { flex-direction: column; align-items: start; gap: 12px; }
    .card-heading { padding-inline: 14px; }
    .filters { padding-inline: 14px; }
    .expense-table th:first-child, .expense-table td:first-child { padding-left: 14px; }
    .expense-table th:last-child, .expense-table td:last-child { padding-right: 14px; }
    .expense-table .table-icon { display: none; }
    .form-fields, .form-actions { padding-inline: 15px; }
    .selection { padding-inline: 15px; }
    .form-grid { grid-template-columns: 1fr; }
    .login-layout { grid-template-columns: 1fr; max-width: 440px; }
    .login-art { min-height: auto; padding: 21px; }
    .login-message { margin-top: 16px; }
    .login-art .hero-illustration { display: none; }
}
@media (max-width: 390px) {
    .nav-item svg { display: none; }
    .selection-total { flex-basis: 100%; }
    .hero-illustration { opacity: .36; }
}

.nav-label { margin: 14px 12px 1px; color: #b2c2e1; font-size: .81rem; font-weight: 650; }
.management-grid { grid-template-columns: minmax(0, 1fr) minmax(275px, 327px); }
.user-row { padding: 16px 20px; border-top: 1px solid var(--line); }
.user-row header, .user-links { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; }
.user-row p { margin-top: 4px; color: var(--muted); font-size: .9rem; }
.user-row details { margin-top: 12px; }
.user-row summary { width: fit-content; color: #214fbd; font-size: .9rem; font-weight: 650; cursor: pointer; }
.user-row .form-fields { padding: 12px 0 0; }
.user-row .import-id { overflow-wrap: anywhere; }
.user-row .import-id code { display: block; font-size: .8rem; }
.make-user .form-fields { padding-top: 4px; }
.receipt-link { display: flex; align-items: center; gap: 10px; padding: 15px 20px; border-bottom: 1px solid var(--line); color: var(--primary); font-weight: 650; text-decoration: none; }
.receipt-link:last-child { border-bottom: 0; }
.receipt-link:hover { text-decoration: underline; }
@media (max-width: 1020px) {
    .management-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
    .nav-label { flex-basis: 100%; margin: 4px 8px 0; }
    .user-row { padding-inline: 14px; }
}

.user-records { display: grid; gap: 20px; }
