@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Cormorant+Garamond:wght@500;600;700&display=swap');

:root {
    color-scheme: dark;
    --bg: #0b1220;
    --bg-raised: #101a2a;
    --panel: rgba(18, 29, 46, .82);
    --panel-solid: #121d2e;
    --panel-soft: rgba(28, 42, 63, .62);
    --border: rgba(183, 205, 232, .12);
    --border-strong: rgba(183, 205, 232, .21);
    --text: #eef4fc;
    --text-soft: #bac7d8;
    --muted: #8291a6;
    --blue: #67a9ff;
    --blue-strong: #3e8bf1;
    --green: #4cdaa0;
    --danger: #ff7183;
    --shadow: 0 24px 70px rgba(0, 0, 0, .28);
    --radius: 20px;
    --font: 'DM Sans', system-ui, sans-serif;
    --display: 'Manrope', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { position: relative; min-height: 100vh; margin: 0; overflow-x: hidden; color: var(--text); background: radial-gradient(ellipse at 50% -30%, #1b2c48 0, var(--bg) 60%); font: 14px/1.55 var(--font); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
.ambient { position: fixed; z-index: -1; width: 420px; height: 420px; border-radius: 50%; filter: blur(100px); opacity: .14; pointer-events: none; }
.ambient-one { top: 10%; left: -270px; background: #2888f5; }
.ambient-two { right: -290px; bottom: 5%; background: #36cda2; }
.topbar { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; height: 78px; padding: 0 max(28px, calc((100vw - 1320px) / 2)); border-bottom: 1px solid rgba(183,205,232,.08); background: rgba(8, 15, 27, .52); backdrop-filter: blur(18px); }
.brand { display: inline-flex; gap: 11px; align-items: center; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid rgba(103,169,255,.35); border-radius: 12px; color: #9bc8ff; background: linear-gradient(145deg, rgba(71,145,239,.24), rgba(71,145,239,.08)); font-size: 22px; font-weight: 700; }
.brand strong { display: block; font: 800 15px/1.3 var(--display); letter-spacing: .02em; }
.brand-accent { color: var(--blue); }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .17em; }
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-link { padding: 9px 14px; border: 1px solid transparent; border-radius: 10px; color: var(--muted); font-size: 13px; transition: .18s ease; }
.nav-link:hover, .nav-link.active { border-color: var(--border); color: var(--text); background: rgba(255,255,255,.045); }
.nav-link.active { color: #a5ceff; }
.secure-label { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; }
.status-dot, .required-note i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px rgba(76,218,160,.45); }
.page-wrap { width: min(1320px, calc(100% - 56px)); margin: 0 auto; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 48px 0 30px; }
.eyebrow { display: flex; align-items: center; gap: 9px; margin: 0 0 11px; color: #91a3bb; font-size: 10px; font-weight: 700; letter-spacing: .16em; }
.eyebrow-line { width: 18px; height: 1px; background: var(--blue); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font: 800 clamp(30px, 4vw, 39px)/1.2 var(--display); letter-spacing: -.04em; }
.text-gradient { color: #75b3ff; background: linear-gradient(100deg, #86bdff 0%, #57a2ff 55%, #8bd6cd 100%); background-clip: text; -webkit-text-fill-color: transparent; }
.page-subtitle { max-width: 590px; margin: 0; color: var(--muted); font-size: 14px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 9px 15px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 12px; white-space: nowrap; transition: background .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:focus-visible, .text-button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.button:disabled { cursor: wait; opacity: .62; }
.button-primary { border-color: rgba(130,187,255,.42); color: #fff; background: linear-gradient(135deg, #3b8be9, #2869c5); box-shadow: 0 7px 20px rgba(31,111,211,.23); }
.button-primary:hover:not(:disabled) { background: linear-gradient(135deg, #519df5, #347ad8); box-shadow: 0 9px 24px rgba(31,111,211,.34); }
.button-secondary { border-color: rgba(103,169,255,.23); color: #a9d0ff; background: rgba(55,122,204,.12); }
.button-secondary:hover:not(:disabled) { background: rgba(55,122,204,.2); }
.button-ghost, .button-subtle { border-color: var(--border); color: var(--text-soft); background: rgba(255,255,255,.035); }
.button-ghost:hover, .button-subtle:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text); background: rgba(255,255,255,.075); }
.button-subtle { min-height: 36px; padding: 7px 11px; font-size: 11px; }
.button-danger { border-color: rgba(255,113,131,.35); color: #fff; background: #bd4056; }
.button-danger:hover:not(:disabled) { background: #d34b63; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 285px; gap: 18px; align-items: start; }
.panel { border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(145deg, rgba(19,31,49,.91), rgba(14,23,37,.92)); box-shadow: var(--shadow); backdrop-filter: blur(20px); }
.form-panel { padding: 23px 25px 0; }
.panel-header { display: flex; align-items: center; gap: 13px; margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.panel-icon, .side-card-icon { display: grid; flex: 0 0 auto; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(103,169,255,.22); border-radius: 13px; color: #98c7ff; background: rgba(57,126,204,.13); font-size: 19px; }
.panel-header h2 { margin: 0 0 3px; font: 700 15px var(--display); letter-spacing: -.02em; }
.panel-header p { margin: 0; color: var(--muted); font-size: 12px; }
.required-note { display: flex; align-items: center; gap: 7px; margin-left: auto; color: var(--muted); font-size: 10px; }
.required-note i { width: 6px; height: 6px; background: var(--danger); box-shadow: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; }
.field { min-width: 0; }
.field-full { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 7px; color: #d5dfed; font-size: 11px; font-weight: 600; }
.required { color: var(--danger); }
.optional { margin-left: 5px; color: var(--muted); font-size: 10px; font-weight: 400; }
.field input, .field select, .field textarea, .filter-group input, .filter-group select, .search-field input { width: 100%; min-width: 0; border: 1px solid rgba(183,205,232,.13); border-radius: 9px; color: var(--text); background: rgba(6,13,23,.43); transition: border-color .18s ease, background .18s ease, box-shadow .18s ease; }
.field input, .field select { height: 42px; padding: 0 12px; }
.field textarea { display: block; min-height: 88px; padding: 11px 12px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder, .search-field input::placeholder { color: #65748a; }
.field input:hover, .field select:hover, .field textarea:hover, .filter-group input:hover, .filter-group select:hover, .search-field input:hover { border-color: rgba(183,205,232,.24); }
.field input:focus, .field select:focus, .field textarea:focus, .filter-group input:focus, .filter-group select:focus, .search-field input:focus { border-color: rgba(103,169,255,.65); outline: 0; background: rgba(8,17,30,.7); box-shadow: 0 0 0 3px rgba(70,145,236,.12); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #8a9db5 50%), linear-gradient(135deg, #8a9db5 50%, transparent 50%); background-position: calc(100% - 15px) 18px, calc(100% - 11px) 18px; background-repeat: no-repeat; background-size: 4px 4px, 4px 4px; padding-right: 30px !important; }
select option { color: var(--text); background: var(--panel-solid); }
.input-with-action { display: flex; gap: 8px; }
.input-with-action input { flex: 1; }
.field-hint { display: block; margin-top: 6px; color: #78889e; font-size: 10px; }
.signature-heading { display: flex; align-items: baseline; justify-content: space-between; }
.signature-heading label { margin-bottom: 7px; }
.text-button { padding: 4px 0; border: 0; color: #80b8ff; background: transparent; cursor: pointer; font-size: 11px; font-weight: 600; }
.text-button:hover { color: #b4d7ff; }
.signature-pad { position: relative; height: 116px; overflow: hidden; border: 1px dashed rgba(183,205,232,.23); border-radius: 10px; background: rgba(6,13,23,.35); touch-action: none; }
.signature-pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.signature-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: #64748a; font-size: 12px; pointer-events: none; }
.signature-pad.has-signature .signature-placeholder { display: none; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 24px -25px 0; padding: 16px 25px; border-top: 1px solid var(--border); background: rgba(5,11,20,.18); border-radius: 0 0 var(--radius) var(--radius); }
.form-footnote { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; }
.form-footnote .status-dot { width: 6px; height: 6px; }
.button-group { display: flex; gap: 8px; }
.side-column { display: grid; gap: 15px; }
.side-card { padding: 20px; }
.side-card-icon { width: 36px; height: 36px; margin-bottom: 19px; font-size: 18px; }
.side-card-icon.blue { color: #99c8ff; background: rgba(57,126,204,.15); }
.side-card-icon.green { color: #7ae2b7; border-color: rgba(76,218,160,.2); background: rgba(42,164,116,.12); }
.side-card .eyebrow { margin-bottom: 8px; font-size: 9px; }
.side-card h3 { margin: 0 0 9px; font: 700 17px/1.4 var(--display); letter-spacing: -.025em; }
.side-card > p:not(.eyebrow), .side-card-compact p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.mini-steps { display: grid; gap: 0; margin-top: 19px; }
.mini-steps div { display: flex; align-items: center; gap: 12px; min-height: 39px; border-top: 1px solid rgba(183,205,232,.08); }
.mini-steps span { color: #79b5ff; font: 600 10px var(--display); }
.mini-steps p { margin: 0; color: #c1cddd; font-size: 10px; }
.side-card-compact { display: flex; align-items: center; gap: 12px; padding: 16px; }
.side-card-compact .side-card-icon { margin: 0; }
.side-card-compact h3 { margin-bottom: 2px; font-size: 12px; }
.side-card-compact p { font-size: 10px; }
.page-footer { display: flex; justify-content: space-between; padding: 25px 3px 28px; color: #65758b; font-size: 10px; }
.history-panel { padding: 19px 21px 12px; }
.history-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 17px; }
.search-field { display: flex; flex: 1 1 260px; align-items: center; gap: 9px; max-width: 370px; padding-left: 12px; border: 1px solid rgba(183,205,232,.13); border-radius: 9px; color: #8295ae; background: rgba(6,13,23,.43); }
.search-field input { height: 39px; padding: 0 12px 0 0; border: 0; outline: 0; background: transparent; font-size: 11px; }
.search-field:focus-within { border-color: rgba(103,169,255,.65); box-shadow: 0 0 0 3px rgba(70,145,236,.12); }
.filter-group { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.filter-group input, .filter-group select { width: auto; height: 37px; padding: 0 9px; font-size: 10px; }
.filter-group input { color-scheme: dark; }
.filter-group select { min-width: 120px; }
.table-meta { display: flex; align-items: center; justify-content: space-between; min-height: 39px; padding: 0 2px; border-top: 1px solid var(--border); color: var(--muted); font-size: 10px; }
.table-scroll { overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th { padding: 11px 10px; border-bottom: 1px solid var(--border); color: #8393a9; font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 12px 10px; border-bottom: 1px solid rgba(183,205,232,.07); color: #c4d0df; font-size: 11px; vertical-align: middle; }
.data-table tbody tr:hover { background: rgba(255,255,255,.025); }
.data-table td:first-child { color: #77879d; }
.reference-cell { color: #a5ceff !important; font: 600 10px var(--display) !important; white-space: nowrap; }
.date-cell { min-width: 118px; white-space: nowrap; }
.date-cell small { display: block; color: #73839a; font-size: 9px; }
.vehicle-cell { font-family: var(--display); font-weight: 700; white-space: nowrap; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid rgba(76,218,160,.17); border-radius: 999px; color: #7de0b7; background: rgba(42,164,116,.09); font-size: 9px; white-space: nowrap; }
.status-pill::before { width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; }
.status-pending { border-color: rgba(255,192,94,.2); color: #ffd080; background: rgba(191,133,44,.1); }
.status-cancelled { border-color: rgba(255,113,131,.2); color: #ff8b9a; background: rgba(194,54,75,.1); }
.row-actions { display: flex; gap: 6px; align-items: center; }
.icon-button { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 8px; color: #94bff1; background: rgba(255,255,255,.025); cursor: pointer; font-size: 13px; }
.icon-button:hover { border-color: rgba(103,169,255,.38); background: rgba(103,169,255,.1); }
.icon-button.delete { color: #ff8492; }
.icon-button.delete:hover { border-color: rgba(255,113,131,.38); background: rgba(255,113,131,.1); }
.empty-state { padding: 36px 12px !important; color: var(--muted) !important; text-align: center; }
.pagination { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; color: var(--muted); font-size: 10px; }
.pagination-actions { display: flex; gap: 7px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; clip-path: inset(50%); }
.toast-region { position: fixed; z-index: 10; right: 22px; bottom: 22px; display: grid; gap: 9px; width: min(360px, calc(100% - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 13px 15px; border: 1px solid var(--border-strong); border-radius: 12px; color: var(--text); background: #18273a; box-shadow: 0 14px 36px rgba(0,0,0,.3); animation: toast-in .2s ease both; font-size: 12px; }
.toast-success { border-color: rgba(76,218,160,.3); }
.toast-error { border-color: rgba(255,113,131,.35); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.confirm-dialog { width: min(430px, calc(100% - 32px)); padding: 0; border: 1px solid var(--border-strong); border-radius: 17px; color: var(--text); background: var(--panel-solid); box-shadow: var(--shadow); }
.confirm-dialog::backdrop { background: rgba(0,0,0,.68); backdrop-filter: blur(4px); }
.confirm-dialog form { padding: 24px; }
.dialog-icon { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 15px; border: 1px solid rgba(255,113,131,.26); border-radius: 12px; color: var(--danger); background: rgba(255,113,131,.1); font-size: 19px; font-weight: 700; }
.confirm-dialog h2 { margin-bottom: 7px; font: 700 17px var(--display); }
.confirm-dialog p { margin-bottom: 22px; color: var(--muted); font-size: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.loading-spinner { display: inline-block; width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.print-body { min-height: 100vh; padding: 0 18px 40px; background: #101827; }
.print-toolbar { display: flex; align-items: center; gap: 14px; width: min(850px, 100%); margin: 0 auto; padding: 17px 0; }
.print-toolbar-title { flex: 1; color: var(--muted); font-size: 12px; }
.print-sheet { width: min(850px, 100%); min-height: 900px; margin: 12px auto; padding: 52px 58px; color: #17202c; background: white; box-shadow: 0 18px 60px rgba(0,0,0,.3); font: 12px/1.6 Arial, sans-serif; }
.print-loading { padding: 60px 0; color: #576273; text-align: center; }
.print-company { padding-bottom: 19px; border-bottom: 3px solid #183c70; }
.print-company h1 { margin: 0; color: #193c6d; font: 700 20px Arial,sans-serif; letter-spacing: .02em; }
.print-company p { margin: 2px 0 0; color: #566171; font-size: 10px; }
.print-title { margin: 27px 0 18px; text-align: center; }
.print-title h2 { margin: 0 0 4px; font: 700 17px Arial,sans-serif; letter-spacing: .1em; }
.print-title p { margin: 0; color: #536171; font-size: 11px; }
.print-ref { margin: 0 0 22px; text-align: center; font-weight: 700; }
.print-details { display: grid; grid-template-columns: 1fr 1fr; gap: 0 34px; margin-bottom: 22px; }
.print-detail { display: grid; grid-template-columns: 124px 1fr; gap: 8px; padding: 9px 0; border-bottom: 1px solid #e2e6eb; }
.print-detail span:first-child { color: #596575; }
.print-section-title { margin: 20px 0 8px; font-weight: 700; }
.print-table { width: 100%; border-collapse: collapse; }
.print-table td, .print-table th { padding: 9px 10px; border: 1px solid #cbd2dc; text-align: left; }
.print-table th { width: 34%; background: #f3f6f9; }
.print-notes { min-height: 74px; padding: 10px; border: 1px solid #cbd2dc; white-space: pre-wrap; }
.signature-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 42px; text-align: center; }
.signature-box { display: flex; min-height: 147px; flex-direction: column; align-items: center; justify-content: space-between; }
.signature-box img { max-width: 150px; max-height: 70px; object-fit: contain; }
.signature-label { width: 100%; padding-top: 8px; border-top: 1px solid #697382; }
.print-footnote { margin-top: 25px; color: #7a8490; font-size: 9px; text-align: center; }
@media (max-width: 900px) {
    .content-grid { grid-template-columns: minmax(0, 1fr) 240px; }
    .form-panel { padding-right: 20px; padding-left: 20px; }
    .form-footer { margin-right: -20px; margin-left: -20px; padding-right: 20px; padding-left: 20px; }
    .filter-group input { max-width: 140px; }
}
@media (max-width: 720px) {
    .topbar { height: 66px; padding: 0 18px; }
    .secure-label { display: none; }
    .nav-link { padding: 8px 10px; font-size: 11px; }
    .page-wrap { width: calc(100% - 32px); }
    .page-heading { align-items: flex-start; padding: 34px 0 23px; }
    .page-heading > .button { margin-top: 18px; }
    .page-subtitle { max-width: 420px; font-size: 12px; }
    .content-grid { grid-template-columns: 1fr; }
    .side-column { grid-template-columns: 1fr 1fr; }
    .side-card-compact { align-items: flex-start; flex-direction: column; }
    .history-panel { padding: 14px; }
    .history-tools { align-items: stretch; }
    .search-field { max-width: none; }
    .filter-group { display: grid; grid-template-columns: 1fr 1fr; }
    .filter-group select, .filter-group input { width: 100%; max-width: none; }
    .filter-group .button { grid-column: 1/-1; }
    .table-scroll { margin: 0 -14px; padding: 0 14px; }
    .data-table { min-width: 850px; }
}
@media (max-width: 520px) {
    .topbar { padding: 0 13px; }
    .brand { gap: 8px; }
    .brand-mark { width: 34px; height: 34px; }
    .brand strong { font-size: 13px; }
    .brand small { font-size: 8px; }
    .nav-links { gap: 0; }
    .nav-link { padding: 7px 8px; font-size: 10px; }
    .page-wrap { width: calc(100% - 26px); }
    .page-heading { gap: 8px; }
    .page-heading > .button { min-height: 35px; margin-top: 21px; padding: 7px 9px; font-size: 10px; }
    h1 { font-size: 28px; }
    .eyebrow { font-size: 9px; }
    .form-panel { padding: 17px 15px 0; }
    .panel-header { align-items: flex-start; gap: 10px; margin-bottom: 18px; }
    .panel-icon { width: 36px; height: 36px; }
    .panel-header h2 { font-size: 13px; }
    .panel-header p { max-width: 180px; font-size: 10px; }
    .required-note { gap: 5px; font-size: 9px; }
    .form-grid { grid-template-columns: 1fr; gap: 14px; }
    .field-full { grid-column: auto; }
    .field input, .field select { height: 41px; }
    .form-footer { align-items: stretch; flex-direction: column; margin: 19px -15px 0; padding: 14px 15px; }
    .form-footnote { order: 2; }
    .button-group { display: grid; grid-template-columns: 1fr 1fr; }
    .button-group .button { padding: 8px 6px; font-size: 10px; }
    .side-column { grid-template-columns: 1fr; }
    .side-card { padding: 16px; }
    .side-card-compact { align-items: center; flex-direction: row; }
    .page-footer { font-size: 9px; }
    .pagination { align-items: flex-start; flex-direction: column; gap: 10px; }
    .pagination-actions { width: 100%; }
    .pagination-actions .button { flex: 1; }
    .print-body { padding: 0 8px 24px; }
    .print-toolbar { gap: 7px; }
    .print-toolbar-title { font-size: 10px; }
    .print-toolbar .button { min-height: 36px; padding: 7px 9px; font-size: 10px; }
    .print-sheet { min-height: 0; padding: 28px 22px; }
    .print-details { grid-template-columns: 1fr; }
    .print-detail { grid-template-columns: 115px 1fr; }
    .signature-row { gap: 9px; }
}
@media print {
    @page { size: A4 portrait; margin: 14mm; }
    :root { color-scheme: light; }
    html, body, .print-body { min-height: 0; margin: 0; padding: 0; background: #fff !important; }
    .no-print, .ambient { display: none !important; }
    .print-sheet { width: 100%; min-height: 0; margin: 0; padding: 0; box-shadow: none; }
    .print-company, .print-title, .print-details, .print-table, .print-notes, .signature-row { break-inside: avoid; }
    .print-company h1 { color: #193c6d !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .print-table th { background: #f3f6f9 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.login-screen { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.login-card { width: min(460px, 100%); padding: 34px; }
.login-brand { margin-bottom: 34px; }
.login-card h1 { margin-bottom: 8px; }
.login-form { display: grid; gap: 18px; margin-top: 27px; }
.login-submit { width: 100%; min-height: 46px; margin-top: 2px; }
.login-foot { display: flex; align-items: center; gap: 8px; margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--border); color: var(--muted); font-size: 10px; }
.form-error { margin: 0; padding: 10px 12px; border: 1px solid rgba(255,113,131,.3); border-radius: 9px; color: #ff9aa7; background: rgba(194,54,75,.1); font-size: 11px; }
.account-tools { display: flex; align-items: center; gap: 14px; }
.portal-tabs .nav-link { border: 1px solid transparent; color: var(--muted); background: transparent; cursor: pointer; }
.portal-tabs .nav-link.active { border-color: var(--border); color: #a5ceff; background: rgba(255,255,255,.045); }
.letter-summary { display: grid; gap: 4px; min-width: 230px; padding: 12px 15px; border: 1px solid var(--border); border-radius: 12px; background: rgba(18,29,46,.72); }
.summary-label { color: var(--muted); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.letter-summary strong { color: #abd0ff; font: 700 12px var(--display); overflow-wrap: anywhere; }
.letter-controls { display: flex; align-items: flex-end; gap: 12px; margin: 0 0 19px; }
.letter-controls .field { flex: 1; }
.letter-controls .button { flex: 0 0 auto; margin-bottom: 23px; }
.field-hint { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; }
.operator-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, .55fr); align-items: end; gap: 15px; margin-bottom: 21px; padding: 15px; border: 1px solid var(--border); border-radius: 13px; background: rgba(255,255,255,.018); }
.operator-row .field { min-width: 0; }
.operator-row input[readonly] { color: #a9d0ff; background: rgba(6,13,23,.32); }
.sequence-box { display: flex; height: 42px; align-items: center; gap: 10px; padding: 0 12px; border: 1px solid rgba(183,205,232,.13); border-radius: 9px; background: rgba(6,13,23,.32); }
.sequence-box span { color: #8bc6ff; font: 800 15px var(--display); }
.sequence-box small { color: var(--muted); font-size: 10px; }
.lock-badge { align-self: center; color: #ffd080; font-size: 10px; }
.letter-controls input:read-only { border-color: rgba(255,192,94,.25); color: #ffd080; }
.revision-notice { color: #ffd080; }
.current-items-panel { margin-top: 20px; }
.current-items-panel .data-table { min-width: 760px; }
.current-items-panel .data-table td:nth-child(4) { max-width: 320px; white-space: pre-wrap; }
.item-action { min-height: 30px; margin: 2px 3px 2px 0; padding: 5px 9px; font-size: 10px; }
.item-delete { color: #ff9aa7; }
.form-footer #cancel-item-edit[hidden] { display: none; }
.print-details-panel { margin-top: 25px; padding-top: 21px; border-top: 1px solid var(--border); }
.print-letter-meta { margin-bottom: 17px; color: #abd0ff; font: 700 13px var(--display); overflow-wrap: anywhere; }
.receipt-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; max-width: 720px; }
.receipt-fields input[readonly] { opacity: .78; }
.print-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 18px 0; }
.print-actions .form-footnote { color: var(--muted); font-size: 10px; }
.print-sheet { width: 100%; min-height: auto; margin: 20px 0 0; padding: 34px; border-radius: 12px; box-shadow: 0 10px 32px rgba(0,0,0,.18); font-size: 10px; }
.print-company { display: flex; align-items: center; gap: 13px; padding-bottom: 14px; }
.print-logo { display: grid; flex: 0 0 auto; place-items: center; width: 39px; height: 39px; border: 2px solid #1f5ec7; border-radius: 10px; color: #1f5ec7; font-weight: 800; }
.print-company h1 { font-size: 16px; }
.print-company p { font-size: 9px; }
.print-title { margin: 20px 0 15px; }
.print-title h2 { font-size: 14px; }
.print-title p { font-size: 9px; }
.print-letter-info { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; margin-bottom: 18px; }
.print-letter-info > div { display: grid; grid-template-columns: 105px 1fr; gap: 7px; padding: 6px 0; border-bottom: 1px solid #e2e6eb; }
.print-letter-info span { color: #596575; }
.print-letter-info strong { overflow-wrap: anywhere; }
.print-table { table-layout: fixed; font-size: 7.3px; line-height: 1.35; }
.print-table td, .print-table th { padding: 5px 4px; border: 1px solid #cbd2dc; vertical-align: top; overflow-wrap: anywhere; }
.print-table th { width: auto; background: #f3f6f9; text-align: center; }
.print-detail-text { white-space: pre-wrap; }
.print-revision { display: block; margin-top: 3px; color: #a65e00; font-size: 7px; }
.print-table .amount { text-align: right; }
.print-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 50px; margin: 36px 20px 0; text-align: center; }
.print-signatures > div { display: flex; min-height: 126px; flex-direction: column; align-items: center; }
.print-signatures p { margin: 0; }
.print-signatures strong { width: 100%; padding-top: 6px; border-top: 1px solid #697382; }
.print-signatures span { color: #596575; font-size: 9px; }
.signature-space { flex: 1; min-height: 62px; }
.print-footnote { display: flex; justify-content: space-between; margin-top: 20px; padding-top: 8px; border-top: 1px solid #dce1e8; text-align: left; }
#login-screen[hidden], #portal-shell[hidden], [data-panel][hidden], #print-details-panel[hidden] { display: none !important; }
@media (max-width: 900px) {
    .topbar { padding-right: 20px; padding-left: 20px; }
    .account-tools { gap: 8px; }
    .account-tools .secure-label { max-width: 135px; overflow: hidden; }
    .letter-summary { min-width: 190px; }
}
@media (max-width: 720px) {
    .topbar { height: auto; min-height: 66px; flex-wrap: wrap; gap: 8px; padding-top: 9px; padding-bottom: 9px; }
    .portal-tabs { order: 3; width: 100%; justify-content: center; }
    .portal-tabs .nav-link { flex: 1; padding: 8px 5px; font-size: 10px; }
    .account-tools .secure-label { display: none; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .letter-summary { width: 100%; }
    .content-grid { grid-template-columns: 1fr; }
    .letter-controls { align-items: stretch; flex-direction: column; }
    .letter-controls .button { align-self: flex-start; margin: 0; }
    .operator-row { grid-template-columns: 1fr 1fr; }
    .lock-badge { grid-column: 1 / -1; }
    .receipt-fields { grid-template-columns: 1fr; }
    .print-actions { align-items: stretch; flex-direction: column; }
    .print-sheet { overflow-x: auto; padding: 22px 17px; }
    .data-table { min-width: 940px; }
}
@media (max-width: 520px) {
    .login-screen { padding: 15px; }
    .login-card { padding: 23px 20px; }
    .account-tools .button { min-height: 33px; padding: 6px 9px; }
    .page-heading { padding-top: 27px; }
    .operator-row { grid-template-columns: 1fr; }
    .lock-badge { grid-column: auto; }
    .print-table { min-width: 760px; }
    .print-letter-info { grid-template-columns: 1fr; }
    .print-signatures { gap: 20px; margin-right: 0; margin-left: 0; }
    .page-footer { gap: 10px; }
}
@media print {
    @page { size: A4 portrait; margin: 10mm; }
    html, body { width: 190mm; min-width: 0; min-height: 0; margin: 0; padding: 0; background: #fff !important; }
    body { color: #17202c; }
    .ambient, #login-screen, .topbar, .page-heading, .tab-panel:not([data-panel="print"]),
    .print-workspace > .panel-header, .print-search, .print-error, .print-letter-meta,
    .receipt-fields, .print-actions, .page-footer, .toast-region { display: none !important; }
    .portal-shell, .page-wrap, .tab-panel[data-panel="print"], .print-workspace, #print-details-panel {
        display: block !important; width: 100%; margin: 0; padding: 0; border: 0; background: #fff !important; box-shadow: none;
    }
    #print-details-panel { visibility: visible; }
    .print-sheet { display: block !important; width: 100%; min-height: 0; margin: 0; padding: 0; overflow: visible; border-radius: 0; box-shadow: none; color: #17202c; font: 8pt/1.35 Arial, sans-serif; }
    .print-company, .print-title, .print-letter-info, .print-signatures, .print-table tr { break-inside: avoid; }
    .print-company { border-bottom: 2px solid #1f5ec7; }
    .print-company h1 { color: #193c6d !important; font-size: 14pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .print-title { margin: 14px 0 10px; }
    .print-title h2 { color: #17202c; font-size: 11pt; }
    .print-letter-info { font-size: 8pt; }
    .print-table { width: 100%; min-width: 0; font-size: 6.4pt; }
    .print-table td, .print-table th { padding: 3px 2px; }
    .print-table th { background: #f3f6f9 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .print-signatures { margin-top: 23px; }
    .signature-space { min-height: 48px; }
    .print-footnote { color: #657080; }
}

@media screen {
    :root {
        color-scheme: light;
        --bg: #edf3f7;
        --bg-raised: #f7faff;
        --panel: rgba(255,255,255,.9);
        --panel-solid: #fff;
        --panel-soft: rgba(240,246,252,.8);
        --border: rgba(17,32,52,.12);
        --border-strong: rgba(17,32,52,.18);
        --text: #111827;
        --text-soft: #374151;
        --muted: #667085;
        --blue: #1f5ec7;
        --blue-strong: #0f2d5c;
        --green: #16a34a;
        --shadow: 0 18px 36px rgba(17,24,39,.1);
        --font: 'Plus Jakarta Sans', system-ui, sans-serif;
        --display: 'Plus Jakarta Sans', system-ui, sans-serif;
    }
    body {
        color: var(--text);
        background:
            radial-gradient(circle at top left, rgba(90,169,255,.2), transparent 28%),
            radial-gradient(circle at bottom right, rgba(16,24,32,.06), transparent 28%),
            linear-gradient(135deg, #edf3f7 0%, #dfeaf2 100%);
        font-size: 13px;
        letter-spacing: -.01em;
        -webkit-font-smoothing: antialiased;
    }
    .ambient { opacity: .06; }
    .topbar {
        border-bottom-color: rgba(17,32,52,.1);
        background: rgba(255,255,255,.82);
        box-shadow: 0 8px 20px rgba(15,45,92,.04);
        backdrop-filter: blur(18px);
    }
    .brand-mark {
        border-color: rgba(31,94,199,.18);
        color: #1f5ec7;
        background: linear-gradient(145deg, #eaf3ff, #cfe2ff);
    }
    .portal-logo {
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
        padding: 6px;
        border: 1px solid rgba(31,94,199,.12);
        border-radius: 12px;
        object-fit: contain;
        background: rgba(255,255,255,.86);
        box-shadow: 0 8px 16px rgba(90,169,255,.13);
    }
    .brand strong { color: #123d87; }
    .brand-accent { color: #1f5ec7; }
    .brand small { color: #667085; }
    .nav-link { color: #667085; }
    .nav-link:hover, .nav-link.active {
        border-color: rgba(31,94,199,.15);
        color: #123d87;
        background: rgba(31,94,199,.07);
    }
    .portal-tabs .nav-link.active {
        border-color: rgba(31,94,199,.2);
        color: #0f2d5c;
        background: linear-gradient(135deg, rgba(90,169,255,.14), rgba(31,94,199,.08));
    }
    .secure-label { color: #667085; }
    .page-heading h1 { color: #111827; }
    .text-gradient {
        color: #123d87;
        background-image: linear-gradient(90deg, #0d1b2a 0%, #123d87 48%, #0ea5e9 100%);
    }
    .eyebrow { color: #667085; }
    .page-subtitle { color: #667085; }
    .panel {
        border-color: rgba(17,32,52,.1);
        background: rgba(255,255,255,.9);
        box-shadow: 0 12px 28px rgba(13,30,56,.05);
        backdrop-filter: blur(12px);
    }
    .panel-header { border-bottom-color: rgba(17,32,52,.1); }
    .panel-header h2, .side-card h3, .side-card-compact h3 { color: #111827; }
    .panel-header p, .side-card > p:not(.eyebrow), .side-card-compact p { color: #667085; }
    .panel-icon, .side-card-icon {
        border-color: rgba(31,94,199,.15);
        color: #1f5ec7;
        background: rgba(31,94,199,.08);
    }
    .side-card-icon.green { color: #16a34a; background: rgba(22,163,74,.08); }
    .field label { color: #374151; }
    .field input, .field select, .field textarea, .filter-group input, .filter-group select, .search-field input {
        border-color: rgba(17,32,52,.14);
        color: #111827;
        background-color: rgba(255,255,255,.95);
    }
    .field input::placeholder, .field textarea::placeholder, .search-field input::placeholder { color: #98a2b3; }
    .field input:hover, .field select:hover, .field textarea:hover, .search-field:hover { border-color: rgba(31,94,199,.32); }
    .field input:focus, .field select:focus, .field textarea:focus, .search-field:focus-within {
        border-color: rgba(31,94,199,.55);
        background: #fff;
        box-shadow: 0 0 0 3px rgba(31,94,199,.1);
    }
    .field select { color-scheme: light; }
    .field-hint, .form-footnote { color: #667085; }
    .button-primary {
        border-color: transparent;
        color: #fff;
        background: linear-gradient(135deg, #0f2d5c 0%, #1f5ec7 58%, #5aa9ff 100%);
        box-shadow: 0 10px 20px rgba(31,94,199,.2);
    }
    .button-primary:hover:not(:disabled) {
        background: linear-gradient(135deg, #123d87, #1f5ec7 58%, #5aa9ff);
        box-shadow: 0 12px 24px rgba(31,94,199,.24);
    }
    .button-secondary, .button-subtle, .button-ghost {
        border-color: rgba(17,32,52,.12);
        color: #374151;
        background: rgba(241,246,252,.9);
    }
    .button-secondary:hover:not(:disabled), .button-subtle:hover:not(:disabled), .button-ghost:hover:not(:disabled) {
        border-color: rgba(31,94,199,.22);
        color: #123d87;
        background: rgba(31,94,199,.07);
    }
    .form-footer { border-top-color: rgba(17,32,52,.1); background: rgba(241,246,252,.62); }
    .letter-summary { border-color: rgba(17,32,52,.1); background: rgba(255,255,255,.78); }
    .summary-label { color: #667085; }
    .letter-summary strong { color: #123d87; }
    .operator-row, .sequence-box { border-color: rgba(17,32,52,.1); background: rgba(241,246,252,.72); }
    .sequence-box span { color: #1f5ec7; }
    .sequence-box small, .lock-badge { color: #667085; }
    .operator-row input[readonly] { color: #123d87; background: rgba(241,246,252,.9); }
    .letter-controls input:read-only { border-color: rgba(217,119,6,.26); color: #9a5c00; }
    .revision-notice { color: #9a5c00; }
    .history-panel { background: rgba(255,255,255,.92); }
    .search-field { border-color: rgba(17,32,52,.13); color: #667085; background: rgba(255,255,255,.96); }
    .table-meta { border-top-color: rgba(17,32,52,.1); color: #667085; }
    .data-table th { border-bottom-color: rgba(17,32,52,.12); color: #667085; }
    .data-table td { border-bottom-color: rgba(17,32,52,.07); color: #374151; }
    .data-table tbody tr:hover { background: rgba(31,94,199,.035); }
    .reference-cell { color: #123d87 !important; }
    .date-cell small { color: #667085; }
    .empty-state { color: #667085 !important; }
    .status-pill { border-color: rgba(22,163,74,.2); color: #15803d; background: rgba(22,163,74,.07); }
    .status-pending { border-color: rgba(217,119,6,.2); color: #9a5c00; background: rgba(217,119,6,.08); }
    .status-cancelled { border-color: rgba(220,38,38,.2); color: #b91c1c; background: rgba(220,38,38,.07); }
    .login-card { background: rgba(255,255,255,.92); }
    .login-brand { width: 100%; padding: 0 0 18px; border-bottom: 1px solid rgba(17,32,52,.1); }
    .login-foot { border-top-color: rgba(17,32,52,.1); color: #667085; }
    .page-footer { color: #667085; }
    .username-input {
        display: flex;
        min-width: 0;
        height: 42px;
        align-items: center;
        border: 1px solid rgba(17,32,52,.14);
        border-radius: 9px;
        background: rgba(255,255,255,.95);
    }
    .username-input:focus-within {
        border-color: rgba(31,94,199,.55);
        box-shadow: 0 0 0 3px rgba(31,94,199,.1);
    }
    .username-input > span { padding-left: 11px; color: #123d87; font-weight: 700; }
    .username-input input {
        min-width: 0;
        height: 40px;
        flex: 1;
        padding: 0 10px 0 2px;
        border: 0;
        outline: 0;
        color: #111827;
        background: transparent;
        box-shadow: none !important;
    }
    .account-list-panel { margin-top: 18px; }
    .account-list-panel .panel-header { margin-bottom: 12px; }
    .account-list-panel .panel-header > button { margin-left: auto; }
}

.letter-flow {
    margin-bottom: 18px;
    padding: 22px 24px;
}
.letter-flow-heading {
    display: flex;
    align-items: flex-start;
    gap: 13px;
}
.letter-flow-icon {
    display: grid;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    place-items: center;
    border: 1px solid rgba(31,94,199,.16);
    border-radius: 12px;
    color: #1f5ec7;
    background: rgba(31,94,199,.07);
    font-size: 19px;
}
.letter-flow-heading .eyebrow { margin-bottom: 4px; }
.letter-flow-heading h2 {
    margin: 0 0 4px;
    color: #111827;
    font: 700 16px/1.4 var(--display);
    letter-spacing: -.02em;
}
.letter-flow-intro {
    margin: 0;
    color: #667085;
    font-size: 12px;
}
.current-items-panel .panel-header { flex-wrap: wrap; }
.spreadsheet-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-left: auto;
}
.spreadsheet-actions .button { min-height: 36px; padding: 7px 10px; }
.spreadsheet-actions .text-button { padding: 7px 5px; }
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
}
.letter-flow-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 20px 0 0;
    padding: 0;
    list-style: none;
}
.letter-flow-step {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px 2px 0;
    border-top: 1px solid rgba(17,32,52,.1);
}
.letter-flow-step + .letter-flow-step {
    padding-left: 18px;
    border-left: 1px solid rgba(17,32,52,.1);
}
.letter-flow-number {
    display: grid;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid rgba(31,94,199,.17);
    border-radius: 50%;
    color: #1f5ec7;
    background: rgba(31,94,199,.06);
    font: 700 10px var(--display);
}
.letter-flow-step h3 {
    margin: 1px 0 4px;
    color: #1f2937;
    font: 700 13px/1.4 var(--display);
}
.letter-flow-step p {
    margin: 0;
    color: #667085;
    font-size: 11px;
    line-height: 1.6;
}
@media (max-width: 720px) {
    .letter-flow { padding: 18px; }
    .letter-flow-steps { grid-template-columns: 1fr; margin-top: 16px; }
    .content-grid { grid-template-columns: minmax(0, 1fr); }
    .form-panel, .current-items-panel { min-width: 0; }
    .spreadsheet-actions { width: 100%; margin-left: 0; }
    .spreadsheet-actions .button { min-height: 42px; flex: 1; }
    .spreadsheet-actions .text-button { min-height: 42px; padding-right: 12px; padding-left: 12px; }
    .letter-flow-step,
    .letter-flow-step + .letter-flow-step {
        gap: 12px;
        padding: 13px 0;
        border-left: 0;
    }
    .letter-flow-step:last-child { padding-bottom: 0; }
}
@media (max-width: 380px) {
    .letter-flow { padding: 15px; }
    .letter-flow-heading { gap: 10px; }
    .letter-flow-icon { flex-basis: 36px; width: 36px; height: 36px; }
    .letter-flow-heading h2 { font-size: 14px; }
    .letter-flow-intro { font-size: 11px; }
}
