:root {
  --navy: #182847;
  --navy-deep: #0d1930;
  --red: #9b211a;
  --red-bright: #c6453c;
  --cream: #f7f5f1;
  --white: #ffffff;
  --ink: #17233a;
  --muted: #687289;
  --line: #dfe3ea;
  --green: #167a50;
  --amber: #a05b00;
  --shadow: 0 16px 50px rgba(16, 32, 61, .11);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--cream); }
body { margin: 0; min-height: 100vh; color: var(--ink); font-family: "Segoe UI", Arial, sans-serif; background: linear-gradient(135deg, #fff 0%, var(--cream) 100%); }
a { color: inherit; }
.hidden { display: none !important; }
.shell { min-height: 100vh; }
.topbar { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px clamp(20px, 4vw, 64px); background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand img { display: block; width: 160px; height: auto; }
.nav-user { display: flex; align-items: center; gap: 16px; }
.nav-user small { display: block; color: var(--muted); }
.nav-links { display: flex; gap: 8px; flex-wrap: wrap; }
.nav-links a { text-decoration: none; padding: 10px 14px; border-radius: 999px; font-weight: 650; color: var(--navy); }
.nav-links a:hover, .nav-links a.active { background: #edf1f7; }
.logout { color: var(--red) !important; }
.container { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 72px; }
.hero-row { display: flex; justify-content: space-between; gap: 28px; align-items: end; margin-bottom: 28px; }
.eyebrow { margin: 0 0 10px; text-transform: uppercase; letter-spacing: .18em; font-size: 12px; font-weight: 800; color: var(--red-bright); }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(34px, 5vw, 58px); line-height: 1; color: var(--navy); margin-bottom: 10px; }
h2 { color: var(--navy); font-size: 25px; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); }
.stat { min-height: 138px; position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; width: 110px; height: 110px; border: 18px solid rgba(155, 33, 26, .06); border-radius: 50%; right: -30px; bottom: -44px; }
.stat strong { display: block; font-size: 38px; color: var(--navy); }
.stat span { color: var(--muted); }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 38px 0 16px; }
.section-head.compact { margin: 0 0 16px; align-items: flex-start; }
.employee-grid { margin-top: 20px; }
.document-card { border-top: 4px solid var(--navy); }
.expiry { padding: 10px 12px; border-radius: 9px; background: #edf1f7; }
.expiry.warning { color: #8a1e19; background: #fdebea; font-weight: 750; }
small.muted { display: block; }
.button, button { appearance: none; border: 0; border-radius: 10px; background: var(--red); color: #fff; padding: 12px 18px; font: inherit; font-weight: 750; cursor: pointer; text-decoration: none; display: inline-flex; justify-content: center; align-items: center; gap: 8px; }
.button:hover, button:hover { background: #7e1813; }
.button.secondary { color: var(--navy); background: #edf1f7; }
.button.success { background: var(--green); }
.button.danger { background: #b3261e; }
.button.small, button.small { padding: 8px 11px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field.full { grid-column: 1 / -1; }
label { color: var(--navy); font-size: 14px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid #cbd2df; border-radius: 10px; padding: 12px 13px; background: #fff; color: var(--ink); font: inherit; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(155, 33, 26, .12); border-color: var(--red); }
.date-control { position:relative; width:100%; }
.date-control > input[data-date-enhanced] { padding-right:52px; }
.native-date-picker { position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; right:18px; bottom:0; }
.calendar-button { position:absolute; right:5px; top:50%; transform:translateY(-50%); width:42px; height:42px; padding:0; color:var(--navy); background:transparent; border-radius:8px; font-size:24px; line-height:1; }
.calendar-button:hover { color:var(--red); background:#edf1f7; }
textarea { min-height: 100px; resize: vertical; }
.alert { border-radius: 12px; padding: 13px 16px; margin-bottom: 20px; background: #edf1f7; }
.alert.success { color: #0f5b3a; background: #e6f6ef; }
.alert.error { color: #8a1e19; background: #fdebea; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 14px 15px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f0f3f8; color: var(--navy); font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
.status { display: inline-flex; border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 800; }
.status.pending { color: var(--amber); background: #fff2dc; }
.status.approved { color: var(--green); background: #e6f6ef; }
.status.rejected { color: #a5211a; background: #fdebea; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: var(--navy-deep); }
.login-art { min-height: 100vh; padding: clamp(48px, 7vw, 100px); display: flex; flex-direction: column; justify-content: space-between; color: white; background: radial-gradient(circle at 70% 70%, rgba(198,69,60,.38), transparent 32%), linear-gradient(145deg, var(--navy) 0%, var(--navy-deep) 75%); position: relative; overflow: hidden; }
.login-art::after { content: "✈"; position: absolute; right: 12%; bottom: 18%; font-size: clamp(80px, 14vw, 190px); color: rgba(255,255,255,.9); transform: rotate(-12deg); text-shadow: 0 0 42px rgba(198,69,60,.8); }
.login-art img { width: 190px; filter: brightness(0) invert(1); position: relative; z-index: 2; }
.login-copy { max-width: 560px; position: relative; z-index: 2; }
.login-copy h1 { color: #fff; font-size: clamp(48px, 7vw, 92px); }
.login-copy em { color: #ef6258; font-weight: 400; }
.login-panel { background: #fff; padding: clamp(32px, 7vw, 100px); display: flex; align-items: center; }
.login-box { width: min(440px, 100%); margin: auto; }
.login-box h2 { font-size: 34px; margin-bottom: 8px; }
.login-box form { display: grid; gap: 18px; margin-top: 30px; }
.review-card { border-left: 5px solid var(--red); }
.review-card header { display: flex; justify-content: space-between; gap: 18px; }
.review-meta { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 14px; margin: 14px 0; }
.inline-form { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: end; }
.footer-note { margin-top: 40px; text-align: center; color: var(--muted); font-size: 13px; }
.portal-choices { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px; }
.portal-choice { min-height: 300px; padding: 34px; border-radius: 22px; color: #fff; text-decoration: none; background: linear-gradient(145deg,var(--navy),var(--navy-deep)); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.portal-choice:nth-child(2) { background: linear-gradient(145deg,#a72d26,#741713); }
.portal-choice::after { content:""; position:absolute; width:210px; height:210px; border:1px solid rgba(255,255,255,.15); border-radius:50%; right:-80px; bottom:-80px; }
.portal-choice span { font-size: 12px; letter-spacing: .18em; opacity: .7; }
.portal-choice h2 { color:#fff; margin-top:70px; font-size:32px; }
.portal-choice p { max-width:420px; color:rgba(255,255,255,.76); line-height:1.65; }
.portal-choice strong { display:block; margin-top:30px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { color:var(--navy); font-size:14px; font-weight:700; margin-bottom:10px; }
.checklist { display:flex; flex-direction:row; flex-wrap:wrap; gap:10px; }
.checklist legend { width:100%; }
.checklist label { border:1px solid var(--line); border-radius:10px; padding:10px 13px; background:#fafbfc; cursor:pointer; }
.checklist input { width:auto; margin-right:7px; }
.payment-status { align-items:center; }
.payment-status small { flex-basis:100%; }
.nested { border:1px solid var(--line); border-radius:14px; padding:18px; background:#f8f9fb; }
.repeat-row { display:grid; grid-template-columns:1fr 1.4fr 1fr auto; gap:10px; margin-bottom:10px; align-items:center; }
.pnr-row { grid-template-columns:minmax(105px,.75fr) minmax(150px,1.15fr) minmax(145px,1fr) minmax(155px,1fr) minmax(155px,1fr) auto; }
.pnr-row { padding-top:24px; }
.compact-date-label { position:absolute; left:2px; top:-22px; color:var(--navy); font-size:13px; font-weight:700; white-space:nowrap; }
.payment-row { grid-template-columns:minmax(170px,1.25fr) minmax(135px,.8fr) minmax(230px,1.35fr) auto; }
.payment-row > input[type="hidden"] { display:none; }
.payment-row .button { min-width:95px; width:auto; }
.receipt-dropzone { min-height:52px; border:1px dashed #aeb9ca; border-radius:10px; padding:9px 12px; display:flex; align-items:center; gap:10px; cursor:pointer; background:#fff; color:var(--muted); line-height:1.25; }
.receipt-dropzone:hover,.receipt-dropzone.dragging,.receipt-dropzone:focus { border-color:var(--red); background:#fff7f6; outline:none; }
.receipt-choose { width:auto; min-height:34px; padding:7px 11px; border-radius:8px; white-space:nowrap; }
.receipt-dropzone small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.receipt-file-input { display:none; }
.totals { display:flex; gap:28px; flex-wrap:wrap; justify-content:flex-end; padding-top:12px; border-top:1px solid var(--line); }
.search-bar { display:grid; grid-template-columns:1fr auto; gap:10px; margin-bottom:16px; }
table.wide { min-width:1450px; }
.container:has(table.wide) { width:min(1680px,calc(100% - 32px)); }
.sales-table { min-width:1320px !important; font-size:13px; }
.sales-table th,.sales-table td { padding:12px 10px; }
.sales-table .contact-number { white-space:nowrap; }
.sales-table .actions { flex-wrap:nowrap; }
.wide:not(.sales-table) { min-width:1180px; font-size:13px; }
.wide:not(.sales-table) th,.wide:not(.sales-table) td { padding:12px 10px; }
.table-controls { display:flex; align-items:center; gap:24px; margin:14px 0 22px; }
.rows-per-page { display:flex; flex:0 0 auto; justify-content:flex-end; align-items:center; gap:10px; margin:0; }
.rows-per-page label { margin:0; }
.rows-per-page select { width:auto; min-width:90px; padding:9px 34px 9px 11px; }
.table-pagination { display:flex; flex:1 1 auto; min-width:0; justify-content:space-between; align-items:center; gap:18px; margin:0; padding:6px; border-radius:11px; background:#4d4d4d; }
.page-numbers,.page-actions { display:flex; align-items:center; gap:2px; }
.page-number,.page-control,.page-ellipsis { min-width:44px; min-height:38px; display:inline-flex; align-items:center; justify-content:center; padding:8px 12px; color:#fff; text-decoration:none; border-radius:6px; }
.page-number:hover,.page-control:hover { background:#666; }
.page-number.active { color:var(--navy); background:#fff; }
.page-control { text-transform:uppercase; letter-spacing:.08em; font-size:12px; background:#fff; color:var(--navy); }
.page-control.disabled { opacity:.48; pointer-events:none; }
.pagination-summary { flex:1 1 auto; margin:0; color:var(--muted); font-size:13px; }
.row-number { color:var(--muted); font-weight:700; white-space:nowrap; }
.container:has(input[value="purge_transaction"]) { width:min(1580px,calc(100% - 32px)); }
.container:has(input[value="purge_transaction"]) .card { padding:24px; }
.container:has(input[value="purge_transaction"]) table { min-width:1080px; }
.container:has(input[value="purge_transaction"]) th,
.container:has(input[value="purge_transaction"]) td { padding:14px 16px; vertical-align:middle; }
.container:has(input[value="purge_transaction"]) td:last-child { min-width:245px; white-space:nowrap; }
.container:has(input[value="purge_transaction"]) td:last-child form { display:inline-block; margin:0 7px 0 0; vertical-align:middle; }
.container:has(input[value="purge_transaction"]) td:last-child button { min-height:40px; }
.negative { color:#a5211a; font-weight:700; }
.details { display:grid; grid-template-columns:1fr 1fr; gap:10px 18px; }
.details dt { color:var(--muted); }.details dd { margin:0; font-weight:700; text-align:right; }
.payment-review { display:grid; grid-template-columns:1fr 1.2fr auto; gap:10px; align-items:center; padding:12px 0; border-bottom:1px solid var(--line); }
.receipt-review { grid-template-columns:minmax(220px,1fr) minmax(280px,1.5fr); }
.compact-totals { margin-top:18px; }
.catalog-list { display:grid; gap:8px; margin-top:18px; }
.catalog-list form { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:9px 0; border-top:1px solid var(--line); }
.stats-filter { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; align-items:end; margin-bottom:20px; }
.sales-list-filter { display:grid; grid-template-columns:repeat(5,minmax(150px,1fr)); gap:14px; align-items:end; margin-bottom:20px; }
.sales-list-filter:not(.expanded) { grid-template-columns:repeat(3,minmax(180px,1fr)) auto auto; }
.sales-list-filter .button { text-align:center; }
.transaction-search-filter { display:grid; grid-template-columns:repeat(4,minmax(190px,1fr)); gap:16px; align-items:end; }
.transaction-search-filter .full { grid-column:1/-1; }
.transaction-search-filter .search-type { display:flex; align-items:center; gap:10px; }
.transaction-search-filter .search-type label { min-width:130px; }
.search-form-actions { grid-column:1/-1; display:flex; justify-content:flex-end; gap:12px; padding-top:4px; }
.search-form-actions .button { text-align:center; }
.search-results-head { margin-top:26px; }
.search-results-wrap { width:100%; }
.search-results-table { min-width:1760px !important; font-size:13px; }
.search-results-table th,.search-results-table td { padding:12px 10px; vertical-align:middle; }
.search-results-table th { white-space:nowrap; line-height:1.25; }
.search-results-table td { line-height:1.4; }
.search-results-table tbody tr:nth-child(even) { background:#fafbfd; }
.search-results-table tbody tr:hover { background:#f3f6fa; }
.search-results-table th:nth-child(1),.search-results-table td:nth-child(1) { width:48px; text-align:center; }
.search-results-table th:nth-child(2),.search-results-table td:nth-child(2),
.search-results-table th:nth-child(3),.search-results-table td:nth-child(3),
.search-results-table th:nth-child(4),.search-results-table td:nth-child(4),
.search-results-table th:nth-child(10),.search-results-table td:nth-child(10),
.search-results-table th:nth-child(11),.search-results-table td:nth-child(11),
.search-results-table th:nth-child(12),.search-results-table td:nth-child(12),
.search-results-table th:nth-child(15),.search-results-table td:nth-child(15),
.search-results-table th:nth-child(16),.search-results-table td:nth-child(16),
.search-results-table th:nth-child(17),.search-results-table td:nth-child(17) { text-align:center; }
.search-results-table th:nth-child(3),.search-results-table td:nth-child(3),
.search-results-table th:nth-child(4),.search-results-table td:nth-child(4),
.search-results-table th:nth-child(11),.search-results-table td:nth-child(11),
.search-results-table th:nth-child(12),.search-results-table td:nth-child(12) { white-space:nowrap; }
.search-results-table th:nth-child(13),.search-results-table td:nth-child(13) { text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
.search-results-table td:nth-child(17) .button { min-width:64px; }
.transaction-kind { display:inline-flex; align-items:center; min-height:28px; padding:5px 9px; border-radius:999px; font-size:12px; font-weight:800; }
.transaction-kind.sale { color:#0b5f45; background:#e1f5ed; }
.transaction-kind.refund { color:#8a271f; background:#fae7e4; }
.sales-table-wrap { width:100%; }
.sales-table { min-width:1540px !important; }
.sales-table th,.sales-table td { padding:11px 8px; }
.sales-table th { white-space:normal; line-height:1.2; }
.refund-review-card { max-width:1100px; margin-inline:auto; }
.refund-review-form { border-top:1px solid var(--line); margin-top:24px; padding-top:24px; }
.refund-review-form .actions.full { grid-column:1/-1; }
.stats-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; }
.charts { margin-top:20px; }
.chart-card { min-height:300px; }
.bar-row { display:grid; grid-template-columns:minmax(150px,1fr) 2fr; gap:16px; align-items:center; padding:10px 0; border-top:1px solid var(--line); }
.bar-row small { display:block; color:var(--muted); margin-top:4px; }
.bar-track { height:14px; border-radius:999px; background:#edf1f7; overflow:hidden; }
.bar-track span { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,var(--red),var(--red-bright)); }
.bar-track.negative-bar span { background:linear-gradient(90deg,#a5211a,#e15b52); }
.trial-banner { display:flex; justify-content:center; align-items:center; gap:16px; padding:10px 18px; color:#fff; background:linear-gradient(90deg,#9b2e2a,#c84238); text-align:center; }
.trial-banner strong { letter-spacing:.12em; }
.b2b-toggle { display:flex !important; align-items:center; gap:9px; margin-top:10px; color:var(--navy); font-weight:800; }
.b2b-toggle input { width:18px; height:18px; margin:0; }
.b2b-details { border-left:5px solid var(--red); background:#fff9f8; }
.b2b-company-list { margin-top:20px; }
.b2b-company-row { display:grid; grid-template-columns:1.25fr 1fr .85fr 1.2fr .8fr .75fr .45fr auto; gap:10px; align-items:end; padding:18px 0; border-top:1px solid var(--line); }
.b2b-company-row .field label { font-size:12px; }
.b2b-company-row .actions { padding-bottom:2px; }

@media (max-width: 820px) {
  .login-page { grid-template-columns: 1fr; }
  .login-art { min-height: 320px; padding: 38px 28px; }
  .login-art img { width: 150px; }
  .login-copy h1 { font-size: 48px; }
  .login-art::after { right: 7%; bottom: 4%; font-size: 110px; }
  .login-panel { padding: 46px 24px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .nav-user { width: 100%; justify-content: space-between; }
  .hero-row { align-items: flex-start; flex-direction: column; }
  .grid.two, .grid.three, .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .inline-form { grid-template-columns: 1fr; }
  .portal-choices { grid-template-columns:1fr; }
  .repeat-row, .pnr-row, .payment-row, .payment-review, .receipt-review { grid-template-columns:1fr; }
  .search-bar { grid-template-columns:1fr; }
  .stats-filter, .stats-grid { grid-template-columns:1fr; }
  .sales-list-filter,.sales-list-filter:not(.expanded) { grid-template-columns:1fr; }
  .transaction-search-filter { grid-template-columns:1fr; }
  .transaction-search-filter .full,.search-form-actions { grid-column:auto; }
  .search-form-actions { align-items:stretch; flex-direction:column; }
  .table-controls { align-items:stretch; flex-direction:column; gap:12px; }
  .rows-per-page { justify-content:flex-start; }
  .table-pagination { align-items:stretch; flex-direction:column; }
  .page-numbers { overflow-x:auto; }
  .page-actions { justify-content:flex-end; }
  .bar-row { grid-template-columns:1fr; gap:7px; }
  .trial-banner { align-items:flex-start; flex-direction:column; gap:2px; text-align:left; }
  .b2b-company-row { grid-template-columns:1fr; }
}
