:root {
    color-scheme: light;
    --ink: #17324d;
    --blue: #173f5f;
    --sky: #dcecf5;
    --mint: #2a9d8f;
    --paper: #ffffff;
    --muted: #66788a;
    --line: #dbe3e9;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.ui-icon { width: 1.15em; height: 1.15em; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--ink);
    background: linear-gradient(145deg, #eef6fa 0%, #f8fafb 55%, #e8f2ed 100%);
}

.shell { width: min(920px, calc(100% - 32px)); margin: 0 auto; padding: 56px 0; }
.hero { max-width: 720px; }
.eyebrow { color: var(--mint); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: .78rem; }
h1 { margin: 12px 0 14px; font-size: clamp(2rem, 7vw, 4.25rem); line-height: 1.02; letter-spacing: -.045em; }
.hero p { color: var(--muted); font-size: 1.12rem; line-height: 1.6; }

.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 32px 0; }
button {
    border: 0;
    border-radius: 14px;
    padding: 16px;
    background: var(--blue);
    color: white;
    font: inherit;
    font-weight: 750;
    opacity: .45;
}

button[type="submit"], .text-button { opacity: 1; cursor: pointer; }
a:focus-visible, button:focus-visible { outline: 3px solid rgba(42, 157, 143, .28); outline-offset: 3px; }
.auth-page { display: grid; place-items: center; }
.auth-shell {
    width: min(1050px, calc(100% - 32px));
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: clamp(32px, 7vw, 90px);
    align-items: center;
    min-height: 100vh;
    padding: 40px 0;
}
.auth-intro h1 { font-size: clamp(2.6rem, 6vw, 5.2rem); }
.auth-intro p { color: var(--muted); font-size: 1.1rem; line-height: 1.7; max-width: 580px; }
.login-card { background: var(--paper); padding: 34px; border-radius: 22px; box-shadow: 0 24px 70px rgba(23, 63, 95, .14); }
.login-card h2 { font-size: 2rem; margin: 4px 0 24px; }
.section-label { color: var(--mint); font-weight: 750; margin: 0; }
label { display: grid; gap: 8px; margin: 18px 0; font-weight: 700; }
input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    font: inherit;
    color: var(--ink);
    background: #fbfcfd;
}
input:focus { outline: 3px solid rgba(42, 157, 143, .16); border-color: var(--mint); }
.login-card button { width: 100%; margin-top: 8px; }
.alert { background: #fff0f0; color: #963434; padding: 12px 14px; border-radius: 10px; }
.app-header { position: relative; z-index: 20; background: var(--paper); }
.topbar { position: relative; min-height: 68px; padding: 0 max(20px, calc((100vw - 1180px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 22px; background: var(--paper); border-bottom: 1px solid var(--line); }
.brand {
    display: block;
    flex: 0 0 auto;
    width: 178px;
    height: 52px;
    overflow: hidden;
    color: transparent;
    font-size: 0;
    text-decoration: none;
    background: url('/assets/brand/seinlec-logo-horizontal.webp') center / contain no-repeat;
}
.brand span { display: none; }
.auth-brand { display: block; width: min(390px, 100%); height: auto; margin: 0 0 24px; }
.text-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; color: var(--blue); background: transparent; padding: 8px; }
.topnav { display: flex; align-items: center; justify-content: flex-end; gap: 14px; min-width: 0; }
.topnav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--blue); font-size: .92rem; font-weight: 700; text-decoration: none; }
.nav-label { display: inline-flex; align-items: center; gap: 6px; }
.topnav a[aria-current="page"] { color: #176b5f; }
.topnav a small { display: none; }
.topnav form { margin: 0; }
.topnav .text-button { min-height: 44px; white-space: nowrap; }
.context-bar { display: flex; align-items: center; min-height: 45px; padding: 0 max(20px, calc((100vw - 1180px) / 2)); border-bottom: 1px solid var(--line); background: #f7fafb; }
.context-bar .back-link { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; }
.menu-toggle { display: none; min-width: auto; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f5f8fa; color: var(--blue); font: inherit; font-weight: 800; align-items: center; gap: 9px; }
.menu-toggle-icon { display: grid; gap: 3px; width: 17px; }
.menu-toggle-icon i { display: block; height: 2px; border-radius: 2px; background: currentColor; }
.dashboard-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 44px 0; }
.welcome { display: flex; justify-content: space-between; align-items: end; gap: 24px; }
.welcome h1 { font-size: clamp(2rem, 5vw, 3.3rem); margin-bottom: 6px; }
.welcome p { color: var(--muted); margin-top: 0; }
.primary-action { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 180px; min-height: 48px; opacity: 1; text-align: center; text-decoration: none; border-radius: 14px; padding: 12px 16px; background: var(--blue); color: white; font-weight: 750; }
.primary-action:hover { background: #0f3655; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 34px 0; }
.metric { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.metric span { color: var(--muted); display: block; min-height: 42px; }
.metric strong { display: block; margin-top: 10px; font-size: 1.8rem; }
.metric.overdue strong { color: #b45d2d; }
.shipment-overview { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 24px; margin: -8px 0 22px; padding: 20px 22px; border: 1px solid #cddfe8; border-radius: 18px; background: rgba(238, 247, 250, .84); }
.shipment-overview h2 { margin: 4px 0; font-size: 1.25rem; }
.shipment-overview p { margin: 0; color: var(--muted); font-size: .9rem; }
.shipment-overview-stats { display: grid; grid-template-columns: repeat(2, minmax(145px, 1fr)); gap: 10px; }
.shipment-overview-stats a { display: grid; gap: 4px; min-height: 68px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); text-decoration: none; }
.shipment-overview-stats span { color: var(--muted); font-size: .82rem; }
.shipment-overview-stats strong { color: var(--blue); font-size: 1.35rem; }
.empty-state { text-align: center; background: rgba(255, 255, 255, .72); border: 1px dashed #b9c8d2; border-radius: 20px; padding: 54px 20px; }
.empty-icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: #dff2ed; color: var(--mint); font-size: 1.5rem; font-weight: 900; }
.empty-icon .ui-icon { width: 25px; height: 25px; }
.empty-state h2 { margin-bottom: 8px; }
.empty-state p { color: var(--muted); max-width: 520px; margin: 0 auto; line-height: 1.6; }
.success-alert { margin: 24px 0 -10px; padding: 14px 16px; border-radius: 12px; background: #dff2ed; color: #176b5f; font-weight: 700; }
.records-card { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 24px; }
.section-heading h2 { margin: 5px 0 18px; }
.activity-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.activity-heading > span { margin-bottom: 18px; color: var(--muted); font-size: .88rem; }
.activity-list { display: grid; }
.activity-row { display: grid; grid-template-columns: 92px minmax(0, 1.35fr) minmax(170px, .8fr) 82px; align-items: center; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.activity-row:first-child { border-top: 0; }
.activity-type { width: fit-content; padding: 6px 9px; border-radius: 999px; font-size: .78rem; font-weight: 850; }
.activity-type.expense { background: #e8f1f6; color: #365c75; }
.activity-type.shipment { background: #e6f5f1; color: #147d6f; }
.activity-type.payment { background: #fff0d3; color: #8a5711; }
.activity-main, .activity-detail, .activity-row time { display: grid; gap: 4px; min-width: 0; }
.activity-main > span, .activity-detail > span, .activity-row time, .activity-row time small { color: var(--muted); font-size: .86rem; }
.activity-main > span, .activity-detail > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-detail strong { color: var(--blue); }
.activity-row time { text-align: right; }
.record-row { display: grid; grid-template-columns: 1.5fr 1fr .7fr; gap: 20px; align-items: center; padding: 16px 0; border-top: 1px solid var(--line); }
.record-row:first-child { border-top: 0; }
.record-row div { display: grid; gap: 4px; }
.record-row span, .record-row small { color: var(--muted); }
.record-code { color: var(--blue); font-weight: 850; text-decoration: none; }
.row-action {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 36px;
    margin-top: 4px;
    padding: 8px 11px;
    border-radius: 9px;
    color: #176b5f;
    background: #dff2ed;
    font-size: .88rem;
    font-weight: 800;
    text-decoration: none;
}
.row-action:hover { background: #cce9e2; }
.form-shell { width: min(900px, calc(100% - 32px)); margin: 0 auto; padding: 44px 0 70px; }
.form-heading { max-width: 700px; margin-bottom: 28px; }
.form-heading h1 { font-size: clamp(2.2rem, 5vw, 3.5rem); margin-bottom: 8px; }
.form-heading p, .section-help { color: var(--muted); line-height: 1.6; }
.back-link { color: var(--blue); text-decoration: none; font-weight: 700; }
.secondary-action { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 14px; border-radius: 12px; background: #e5eef3; color: var(--blue); text-decoration: none; font-weight: 750; }
.shipment-form { display: grid; gap: 18px; }
.form-section { display: grid; grid-template-columns: 46px 1fr; gap: 18px; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 26px; }
.section-number { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--sky); color: var(--blue); font-weight: 900; }
.section-content h2 { margin: 4px 0 18px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; }
.field-grid label { min-width: 0; }
.field-grid .wide { grid-column: 1 / -1; }
.participant-guide { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: -4px 0 16px; }
.participant-guide div { display: grid; gap: 3px; padding: 12px; border-radius: 12px; background: #f2f7f9; }
.participant-guide strong { color: var(--blue); }
.participant-guide span { color: var(--muted); font-size: .88rem; line-height: 1.35; }
.new-party-fields { display: none; grid-template-columns: 1fr 1fr; gap: 4px 18px; padding: 14px; border-radius: 12px; background: #f5f8fa; }
.new-party-fields.visible { display: grid; }
select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 14px; font: inherit; color: var(--ink); background: #fbfcfd; }
textarea { resize: vertical; }
select:focus, textarea:focus { outline: 3px solid rgba(42, 157, 143, .16); border-color: var(--mint); }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 20px; padding-top: 6px; }
.form-actions button { min-width: 210px; }
.alert ul { list-style: disc; padding-left: 20px; margin-top: 8px; }
.alert li { display: list-item; border: 0; padding: 2px 0; }
.shipment-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
.shipment-summary div { display: grid; gap: 5px; padding: 16px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); }
.shipment-summary span { color: var(--muted); font-size: .85rem; }
.shipment-summary strong { line-height: 1.35; }
.field-grid small { color: var(--muted); font-weight: 500; }
.scope-notice { margin: -6px 0 16px; padding: 11px 13px; border-radius: 11px; background: #e8f1f6; color: #365c75; font-size: .9rem; font-weight: 700; line-height: 1.45; }
.reimbursement-preview { margin-top: 16px; border-radius: 12px; padding: 14px; font-weight: 700; line-height: 1.45; }
.reimbursement-preview.no-debt { background: #e3f3ef; color: #176b5f; }
.reimbursement-preview.debt { background: #fff1dc; color: #8a5711; }
.list-shell, .detail-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 44px 0 70px; }
.list-heading, .detail-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.list-heading h1, .detail-heading h1 { margin: 6px 0; font-size: clamp(2.3rem, 5vw, 3.8rem); }
.list-heading p, .detail-heading p, .muted { color: var(--muted); }
.filter-card { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 12px; padding: 20px; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; margin-bottom: 20px; }
.filter-card label { margin: 0; font-size: .88rem; }
.filter-card .search-field { grid-column: span 2; }
.filter-actions { display: flex; align-items: end; justify-content: flex-end; gap: 14px; }
.filter-actions a { align-self: center; color: var(--muted); font-weight: 700; text-decoration: none; }
.filter-actions button { white-space: nowrap; }
.shipment-list-card { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 22px; }
.result-count { color: var(--muted); font-weight: 700; padding-bottom: 10px; }
.shipment-list-row { display: grid; grid-template-columns: 1.5fr .85fr .75fr .65fr .75fr; gap: 16px; align-items: center; padding: 18px 0; border-top: 1px solid var(--line); }
.shipment-list-row div { display: grid; gap: 4px; min-width: 0; }
.shipment-list-row small { color: var(--muted); line-height: 1.35; }
.shipment-main a { color: var(--mint); font-weight: 850; text-decoration: none; }
.shipment-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-badge { width: fit-content; display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; font-size: .82rem; font-weight: 800; }
.status-badge::before, .priority-badge::before, .status-chip::before { content: ""; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: currentColor; opacity: .72; }
.status-badge.pending { background: #fff1dc; color: #8a5711; }
.status-badge.picked_up { background: #dff2ed; color: #176b5f; }
.status-badge.cancelled { background: #f1e6e6; color: #8e3c3c; }
.list-actions a { color: var(--blue); font-size: .88rem; font-weight: 750; text-decoration: none; }
.empty-state.compact { padding: 32px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.detail-card { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 24px; margin-bottom: 18px; }
.detail-card h2 { margin: 0 0 18px; }
dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
dl div { min-width: 0; }
dt { color: var(--muted); font-size: .85rem; margin-bottom: 5px; }
dd { margin: 0; font-weight: 750; line-height: 1.35; }
.reimbursement-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.reimbursement-stats div { display: grid; gap: 5px; padding: 14px; background: #f5f8fa; border-radius: 12px; }
.reimbursement-stats span { color: var(--muted); font-size: .82rem; }
.card-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 16px; margin-bottom: 18px; }
.card-heading h2 { margin: 0; }
.payment-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.payment-summary div { display: grid; gap: 5px; padding: 16px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); }
.payment-summary span { color: var(--muted); font-size: .85rem; }
.payment-summary .balance { background: #fff7e9; border-color: #eed6ac; }
.payment-history { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.payment-history h3 { margin: 0 0 10px; }
.payment-history article { display: grid; grid-template-columns: .7fr 1fr .8fr; gap: 16px; padding: 13px 0; border-top: 1px solid var(--line); }
.payment-history article div { display: grid; gap: 3px; }
.payment-history span, .payment-history small { color: var(--muted); }
.payment-history a { color: var(--mint); font-weight: 800; text-decoration: none; }
.reimbursement-queue { margin-top: 18px; }
.queue-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.queue-heading > a { color: var(--blue); font-weight: 800; text-decoration: none; }
.queue-empty { display: flex; align-items: center; gap: 13px; padding: 18px; border-radius: 13px; background: #f2f8f6; }
.queue-empty > span { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 auto; border-radius: 50%; background: #dff2ed; color: var(--mint); font-weight: 900; }
.queue-empty p { display: grid; gap: 2px; margin: 0; color: var(--muted); }
.queue-empty strong { color: var(--ink); }
.queue-list article { display: grid; grid-template-columns: 1.4fr .5fr .8fr; align-items: center; gap: 16px; padding: 15px 0; border-top: 1px solid var(--line); }
.queue-list article > div { display: grid; gap: 3px; }
.queue-list a { color: var(--mint); font-weight: 800; text-decoration: none; }
.queue-list small { color: var(--muted); }
.queue-priority { justify-items: end; }
.priority-badge { width: fit-content; display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; font-size: .8rem; font-weight: 850; white-space: nowrap; }
.priority-badge.overdue { background: #f8dddd; color: #9b3030; }
.priority-badge.due-today { background: #fff0d3; color: #8a5711; }
.priority-badge.on-time { background: #e8f1f6; color: #365c75; }
.priority-badge.paid { background: #dff2ed; color: #176b5f; }
.summary-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.summary-strip div { display: grid; gap: 4px; padding: 18px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
.summary-strip span { color: var(--muted); font-size: .85rem; }
.summary-strip strong { font-size: 1.55rem; }
.summary-strip .has-alert { background: #fff2f2; border-color: #edc2c2; }
.reimbursement-filters { grid-template-columns: repeat(5, 1fr); }
.reimbursement-list { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 22px; }
.reimbursement-row { display: grid; grid-template-columns: 1.1fr .8fr .8fr .6fr .8fr .7fr; gap: 16px; align-items: center; padding: 18px 0; border-top: 1px solid var(--line); }
.reimbursement-row:first-child { border-top: 0; }
.reimbursement-row > div { display: grid; gap: 4px; min-width: 0; }
.reimbursement-row span:not(.priority-badge), .reimbursement-row small { color: var(--muted); font-size: .83rem; }
.reimbursement-title a { color: var(--mint); font-weight: 850; text-decoration: none; }
.priority-cell { justify-items: start; }
.reimbursement-actions a { color: var(--blue); font-size: .88rem; font-weight: 800; text-decoration: none; }
.report-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 44px 0 70px; }
.report-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 24px; }
.report-heading h1 { margin: 5px 0; font-size: clamp(2.3rem, 5vw, 3.7rem); }
.report-heading p, .report-security { color: var(--muted); }
.report-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.report-actions a, .report-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: auto; min-height: 44px; padding: 10px 14px; border-radius: 10px; background: var(--blue); color: white; font: inherit; font-weight: 800; text-decoration: none; opacity: 1; cursor: pointer; }
.report-actions .secondary-button { background: #e5eef3; color: var(--blue); }
.report-filters { grid-template-columns: repeat(5, 1fr); }
.report-summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 18px 0; }
.report-summary article { display: grid; gap: 5px; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.report-summary span { color: var(--muted); font-size: .84rem; }
.report-summary strong { font-size: 1.35rem; }
.report-table-card { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 10px 18px; }
.report-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.report-table th { padding: 14px 10px; color: var(--muted); font-size: .8rem; text-align: left; text-transform: uppercase; letter-spacing: .04em; }
.report-table td { padding: 16px 10px; border-top: 1px solid var(--line); vertical-align: top; }
.report-table td > * { display: block; }
.report-table td small { color: var(--muted); margin-top: 4px; line-height: 1.4; }
.report-table a { color: var(--mint); font-weight: 850; text-decoration: none; }
.no-results { text-align: center; color: var(--muted); padding: 30px !important; }
.report-security { text-align: right; font-size: .82rem; }
.document-list { display: grid; gap: 10px; }
.document-list a { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; }
.document-list a > span:nth-child(2) { display: grid; gap: 3px; }
.document-list small { color: var(--muted); }
.document-list b { color: var(--mint); }
.document-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: var(--sky); color: var(--blue); font-size: .72rem; font-weight: 900; }
.timeline { display: grid; }
.timeline > div { display: grid; grid-template-columns: 16px 1fr; gap: 10px; }
.timeline > div > span { width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px #dff2ed; }
.timeline p { display: grid; gap: 4px; margin: 0 0 18px; }
.timeline small { color: var(--muted); }

.status-card {
    background: rgba(255, 255, 255, .88);
    border: 1px solid rgba(255, 255, 255, .9);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 18px 60px rgba(23, 63, 95, .10);
}
.status-card p { color: var(--muted); }
.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; }
.status-dot.ok { background: var(--mint); box-shadow: 0 0 0 5px rgba(42, 157, 143, .12); }
.status-dot.warn { background: #e9a23b; }
ul { list-style: none; padding: 0; margin: 20px 0 0; }
li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.good { color: #187566; }
.bad { color: #b33a3a; }
.pending { color: #9a681d; }

@media (max-width: 900px) {
    .topbar { min-height: 64px; padding: 0 18px; gap: 12px; }
    .menu-toggle { display: inline-flex; flex: 0 0 auto; min-height: 44px; opacity: 1; }
    .topnav {
        position: absolute;
        top: calc(100% + 8px);
        left: 14px;
        right: 14px;
        display: none;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        padding: 12px;
        border: 1px solid var(--line);
        border-radius: 16px;
        background: var(--paper);
        box-shadow: 0 18px 48px rgba(23, 63, 95, .18);
    }
    .topnav.is-open { display: grid; }
    .topnav a {
        display: flex;
        min-width: 0;
        flex-direction: column;
        gap: 3px;
        padding: 12px;
        border-radius: 11px;
        background: #f5f8fa;
    }
    .topnav a[aria-current="page"] { background: #dff2ed; color: #176b5f; }
    .topnav a small { display: block; color: var(--muted); font-size: .75rem; font-weight: 600; }
    .topnav form { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 8px; }
    .topnav .text-button { width: 100%; padding: 11px; text-align: center; }
    .context-bar { min-height: 45px; padding: 0 18px; }
}

@media (max-width: 650px) {
    .shell { padding: 34px 0; }
    .actions { grid-template-columns: 1fr; }
    .status-card { padding: 20px; }
    .auth-shell { grid-template-columns: 1fr; padding: 28px 0; }
    .auth-intro h1 { font-size: 2.6rem; }
    .login-card { padding: 24px; }
    .welcome { align-items: stretch; flex-direction: column; }
    .metric-grid { grid-template-columns: 1fr 1fr; }
    .metric strong { font-size: 1.45rem; }
    .brand { width: 136px; height: 48px; }
    .form-section { grid-template-columns: 1fr; padding: 20px; }
    .field-grid { grid-template-columns: 1fr; }
    .field-grid .wide { grid-column: auto; }
    .participant-guide { grid-template-columns: 1fr; }
    .new-party-fields, .new-party-fields.visible { grid-template-columns: 1fr; }
    .form-actions { align-items: stretch; flex-direction: column-reverse; text-align: center; }
    .form-actions button { width: 100%; }
    .record-row { grid-template-columns: 1fr; gap: 8px; }
    .shipment-overview { grid-template-columns: 1fr; }
    .shipment-overview-stats { grid-template-columns: 1fr 1fr; }
    .activity-heading { align-items: flex-start; flex-direction: column; gap: 0; }
    .activity-heading > span { margin-top: -12px; }
    .activity-row { grid-template-columns: auto 1fr; gap: 9px 12px; }
    .activity-main { align-self: center; }
    .activity-detail { grid-column: 2; }
    .activity-row time { grid-column: 2; grid-auto-flow: column; justify-content: start; text-align: left; }
    .activity-main > span, .activity-detail > span { white-space: normal; }
    .shipment-summary { grid-template-columns: 1fr 1fr; }
    .topnav { grid-template-columns: 1fr 1fr; }
    .list-heading, .detail-heading { align-items: stretch; flex-direction: column; }
    .filter-card { grid-template-columns: 1fr; }
    .filter-card .search-field { grid-column: auto; }
    .filter-actions { justify-content: space-between; }
    .shipment-list-row { grid-template-columns: 1fr; gap: 9px; }
    .shipment-main strong { white-space: normal; }
    .detail-grid { grid-template-columns: 1fr; }
    dl { grid-template-columns: 1fr 1fr; }
    .reimbursement-stats { grid-template-columns: 1fr 1fr; }
    .payment-summary { grid-template-columns: 1fr 1fr; }
    .payment-history article { grid-template-columns: 1fr; gap: 7px; }
    .queue-list article { grid-template-columns: 1fr; gap: 8px; }
    .queue-priority { justify-items: start; }
    .summary-strip { grid-template-columns: 1fr 1fr 1fr; }
    .reimbursement-filters { grid-template-columns: 1fr; }
    .reimbursement-row { grid-template-columns: 1fr; gap: 9px; }
    .report-heading { align-items: stretch; flex-direction: column; }
    .report-filters { grid-template-columns: 1fr; }
    .report-summary { grid-template-columns: 1fr 1fr; }
    .report-table-card { overflow: visible; padding: 0; border: 0; background: transparent; }
    .report-table { display: block; min-width: 0; }
    .report-table thead { display: none; }
    .report-table tbody { display: grid; gap: 14px; }
    .report-table tr { display: grid; gap: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); box-shadow: 0 8px 24px rgba(23, 63, 95, .05); }
    .report-table td { display: grid; grid-template-columns: 105px minmax(0, 1fr); gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); }
    .report-table td:first-child { border-top: 0; }
    .report-table td::before { content: attr(data-label); color: var(--muted); font-size: .72rem; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
    .report-table td > * { grid-column: 2; }
    .report-table .no-results { display: block; padding: 28px 18px !important; }
    .report-table .no-results::before { display: none; }
    .back-link, .secondary-action, .row-action, .list-actions a, .reimbursement-actions a,
    .queue-heading > a, .queue-priority a, .catalog-actions a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }
}

@media print {
    body { background: white; }
    .no-print { display: none !important; }
    .report-shell { width: 100%; padding: 0; }
    .report-heading h1 { font-size: 26px; }
    .report-summary { grid-template-columns: repeat(5, 1fr); }
    .report-summary article, .report-table-card { break-inside: avoid; box-shadow: none; }
    .report-table { min-width: 0; font-size: 9px; }
    .report-table th, .report-table td { padding: 7px 5px; }
    .report-security { text-align: left; }
}

.admin-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 70px; }
.admin-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 24px; }
.admin-heading h1 { margin: 6px 0 4px; font-size: clamp(2rem, 5vw, 3.25rem); color: var(--ink); }
.admin-heading p { margin: 0; color: var(--muted); }
.admin-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 14px; margin-bottom: 20px; }
.admin-tabs a { white-space: nowrap; padding: 10px 14px; border-radius: 999px; color: var(--ink); background: #fff; border: 1px solid var(--line); font-weight: 700; text-decoration: none; }
.admin-tabs a.active { color: #fff; background: var(--blue); border-color: var(--blue); }
.admin-section-picker { display: none; margin: 0 0 20px; }
.admin-intro { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 24px 0 14px; }
.admin-intro h2 { margin: 5px 0 0; font-size: 1.15rem; color: var(--ink); }
.catalog-count { color: var(--muted); font-weight: 700; white-space: nowrap; }
.admin-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .8fr); gap: 22px; align-items: start; }
.admin-list-card, .admin-form-card { background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 14px 38px rgba(23, 50, 77, .06); }
.admin-list-card { overflow: hidden; }
.admin-form-card { padding: 24px; position: sticky; top: 18px; }
.admin-form-card h2 { margin: 7px 0 20px; color: var(--ink); font-size: 1.35rem; }
.catalog-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 18px; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.catalog-row:last-child { border-bottom: 0; }
.catalog-row.inactive { background: #f7f9fa; opacity: .76; }
.catalog-main { min-width: 0; }
.catalog-main strong, .catalog-main small { display: block; }
.catalog-main strong { color: var(--ink); margin-bottom: 5px; }
.catalog-main small { color: var(--muted); overflow-wrap: anywhere; }
.catalog-actions { display: flex; align-items: center; gap: 12px; }
.catalog-actions a, .catalog-actions .text-button { font-weight: 700; color: var(--mint); text-decoration: none; font-size: .9rem; }
.catalog-actions form { margin: 0; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; width: fit-content; padding: 6px 9px; border-radius: 999px; font-size: .8rem; font-weight: 800; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .72; }
.status-pill.paid { background: #dff2ed; color: #176b5f; }
.status-pill.neutral { background: #e9eef1; color: #5d6a73; }
.catalog-form { display: grid; gap: 14px; }
.catalog-form label { display: grid; gap: 7px; color: var(--ink); font-weight: 700; }
.catalog-form small { color: var(--muted); font-weight: 400; }
.form-actions.compact { margin-top: 6px; }
.empty-state.compact { min-height: 220px; padding: 48px 20px; }

@media (max-width: 820px) {
    .admin-layout { grid-template-columns: 1fr; }
    .admin-form-card { position: static; order: -1; }
    .catalog-row { grid-template-columns: minmax(0, 1fr) auto; }
    .catalog-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

@media (max-width: 520px) {
    .admin-shell { width: min(100% - 20px, 1180px); padding-top: 26px; }
    .admin-intro { align-items: start; }
    .catalog-row { padding: 16px; gap: 12px; }
    .admin-tabs { display: none; }
    .admin-section-picker { display: grid; }
}

.welcome-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.filter-bar { display: grid; grid-template-columns: 2fr 1fr 1fr auto auto; gap: 12px; align-items: end; padding: 20px; margin-bottom: 20px; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; }
.filter-bar label { margin: 0; }
.filter-bar > a { align-self: center; padding: 12px; color: var(--muted); font-weight: 750; text-decoration: none; }
.expense-list { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 0 22px; }
.expense-row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(180px, .8fr) minmax(130px, .45fr); gap: 22px; align-items: center; padding: 20px 0; border-bottom: 1px solid var(--line); }
.expense-row:last-child { border-bottom: 0; }
.expense-row.inactive { opacity: .68; background: #fafafa; }
.expense-row > div { display: grid; gap: 5px; min-width: 0; }
.expense-row span, .expense-row small { color: var(--muted); font-size: .84rem; }
.expense-code { color: var(--mint); font-weight: 850; text-decoration: none; }
.expense-amount { text-align: right; }
.expense-amount strong, .detail-total { color: var(--blue); font-size: 1.25rem; }
.detail-total { padding: 14px 18px; border-radius: 14px; background: #fff7e9; white-space: nowrap; }
.documents-card { display: grid; gap: 10px; }
.document-link { display: flex; justify-content: space-between; gap: 16px; padding: 14px 16px; border-radius: 12px; background: #f4f8fa; color: var(--ink); text-decoration: none; }
.document-link small { color: var(--mint); font-weight: 750; }
.detail-heading-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.detail-action { display: inline-block; margin-top: 18px; padding: 11px 14px; border-radius: 12px; background: var(--blue); color: #fff; font-weight: 800; text-decoration: none; }
.correction-reason { border-color: #e8c98d; background: #fffdf8; }
.audit-timeline { display: grid; }
.audit-timeline article { display: grid; grid-template-columns: 18px 1fr; gap: 12px; position: relative; padding: 2px 0 20px; }
.audit-timeline article:not(:last-child)::before { content: ""; position: absolute; left: 6px; top: 15px; bottom: 0; width: 2px; background: var(--line); }
.audit-dot { width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; background: var(--mint); border: 3px solid #dff2ed; z-index: 1; }
.audit-timeline article > div { display: grid; gap: 4px; }
.audit-timeline small { color: var(--muted); }
.audit-timeline p { margin: 5px 0 0; padding: 9px 12px; border-radius: 10px; background: #f4f8fa; }
.danger-zone { border-color: #e4b8b8; background: #fffafa; }
.danger-zone > p { color: var(--muted); }
.danger-zone form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 14px; }
.danger-zone button { background: #9b3030; }

@media (max-width: 760px) {
    .filter-bar { grid-template-columns: 1fr; }
    .expense-row { grid-template-columns: 1fr; gap: 12px; }
    .expense-amount { text-align: left; }
    .welcome-actions { justify-content: flex-start; }
    .detail-heading-actions { justify-content: flex-start; }
    .danger-zone form { grid-template-columns: 1fr; }
}

.reimbursement-detail { max-width: 1120px; }
.status-chip { display: inline-flex; align-items: center; padding: 9px 14px; border-radius: 999px; background: #e8f1f6; color: var(--blue); font-weight: 800; }
.status-observed { background: #fff0e5; color: #a54b12; }
.status-corrected { background: #e9f7f3; color: #147d6f; }
.status-paid { background: #e8f6ec; color: #287443; }
.request-summary { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin: 16px 0; padding: 16px 19px; border: 1px solid var(--line); border-radius: 16px; background: #f7fbfc; }
.request-summary span, .request-summary small { color: var(--muted); }
.request-summary strong { color: var(--blue); }
.workflow-card { margin: 20px 0; padding: 20px; border-radius: 20px; border: 1px solid var(--line); background: #fff; box-shadow: 0 8px 24px rgba(23, 63, 95, .06); }
.workflow-card h2 { margin: 0 0 4px; color: var(--blue); }
.workflow-card > p { margin: 2px 0 16px; color: var(--muted); }
.workflow-card button { margin-top: 16px; }
.workflow-card.observation { border-left: 5px solid #e27a38; }
.workflow-card.correction { border-left: 5px solid var(--mint); }
.detail-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 16px 0 24px; }
.audit-timeline article span { display: block; color: var(--muted); font-size: .88rem; }
.supervision-fieldset { margin: 4px 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.supervision-fieldset legend { padding: 0 6px; color: var(--blue); font-weight: 800; }
.supervision-fieldset > small { display: block; margin-bottom: 10px; color: var(--muted); }
.checkbox-list { display: grid; gap: 8px; max-height: 190px; overflow: auto; }
.checkbox-list label { display: flex; align-items: center; gap: 9px; font-weight: 650; }
.checkbox-list input { width: 17px; height: 17px; margin: 0; }
.fiscal-fields { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #f7fbfc; }
.replacement-notice { margin-bottom: 18px; padding: 15px 18px; border: 1px solid #e8c98d; border-radius: 14px; background: #fffaf0; color: #6f531a; }
.document-warning { margin: 5px 0 0; color: #9b5b17; font-size: .92rem; }
.financial-document { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 14px; background: #f9fbfc; }
.financial-document > div:first-child { display: grid; gap: 4px; min-width: 0; }
.financial-document strong { overflow-wrap: anywhere; color: var(--ink); }
.financial-document small { color: var(--muted); }
.document-type { width: max-content; padding: 4px 8px; border-radius: 999px; background: #e6f5f1; color: #147d6f; font-size: .76rem; font-weight: 850; text-transform: uppercase; }
.document-actions { display: grid; gap: 7px; justify-items: end; flex: 0 0 auto; }
.document-actions a { color: var(--mint); font-weight: 800; text-decoration: none; }
.previous-version { opacity: .72; background: #f1f3f4; }
.version-badge { padding: 4px 8px; border-radius: 999px; background: #e5e8ea; color: #5f6d76; font-size: .75rem; font-weight: 800; }

@media (max-width: 700px) {
    .reimbursement-detail .payment-summary { grid-template-columns: 1fr 1fr; }
    .workflow-card { padding: 16px; }
    .detail-actions a { width: 100%; text-align: center; }
    .financial-document { align-items: flex-start; flex-direction: column; }
    .document-actions { width: 100%; grid-auto-flow: column; justify-content: start; justify-items: start; }
}
