:root {
  --navy: #10233f;
  --blue: #2457d6;
  --blue-soft: #eaf0ff;
  --ink: #172033;
  --muted: #68758b;
  --line: #dfe5ef;
  --surface: #ffffff;
  --background: #f3f6fb;
  --green: #198754;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--background);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
.login-screen { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, #10233f, #2457d6); }
.login-screen.hidden { display: none; }
.login-card { width: min(430px, 100%); background: white; border-radius: 18px; padding: 34px; box-shadow: 0 30px 100px rgba(0,0,0,.3); display: grid; gap: 17px; }
.login-brand { color: var(--navy); padding: 0 0 14px; }
.login-copy { color: var(--muted); margin: -8px 0 0; }
.login-card .primary { width: 100%; }
.demo-login { text-align: center; color: var(--muted); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 250px; background: var(--navy); color: white;
  display: flex; flex-direction: column; padding: 28px 18px 20px; z-index: 2;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 30px; }
.brand-mark { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: #ffb34d; color: var(--navy); font-weight: 900; }
.brand strong, .brand small, .user-card strong, .user-card small { display: block; }
.brand small { color: #9fb0c8; margin-top: 2px; }
nav { display: grid; gap: 5px; }
.nav-item { border: 0; background: transparent; color: #c8d2e1; padding: 12px 14px; border-radius: 9px; text-align: left; cursor: pointer; }
.nav-item:hover, .nav-item.active { color: white; background: rgba(255,255,255,.1); }
.nav-item.active { box-shadow: inset 3px 0 #ffb34d; }
.nav-item.muted { opacity: .45; cursor: default; }
.nav-heading { color: #71839c; text-transform: uppercase; letter-spacing: .12em; font-size: 10px; padding: 24px 14px 8px; }
.user-card { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding: 20px 8px 0; display: flex; gap: 10px; align-items: center; font-size: 13px; }
.user-card small { color: #91a3bd; margin-top: 3px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #2d4770; font-weight: 800; }
.logout-button { margin-left: auto; border: 0; color: #afbdd0; background: transparent; font-size: 20px; }
main { margin-left: 250px; padding: 0 42px 55px; max-width: 1600px; }
header { height: 116px; display: flex; align-items: center; justify-content: space-between; }
.eyebrow { color: var(--muted); text-transform: uppercase; letter-spacing: .11em; font-size: 11px; font-weight: 800; margin: 0 0 5px; }
h1 { margin: 0; font-size: 28px; }
h2, h3, p { margin-top: 0; }
button { cursor: pointer; }
.primary, .secondary, .light-button, .link-button { border-radius: 9px; padding: 11px 17px; border: 1px solid transparent; font-weight: 750; text-decoration: none; display: inline-flex; justify-content: center; align-items: center; }
.primary { color: white; background: var(--blue); }
.primary:hover { background: #1949bf; }
.secondary { background: white; color: var(--ink); border-color: var(--line); }
.view { display: none; }
.view.active { display: block; }
.hero { min-height: 270px; padding: 44px 48px; border-radius: 18px; color: white; background: linear-gradient(125deg,#183760 0%,#2457d6 65%,#4f7aeb 100%); display: flex; align-items: flex-end; justify-content: space-between; box-shadow: 0 14px 40px rgba(20,49,94,.16); }
.hero h2 { font-size: clamp(30px, 4vw, 48px); line-height: 1.04; margin: 18px 0 16px; }
.hero p { color: #d7e2ff; max-width: 650px; margin-bottom: 0; }
.pill { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; background: rgba(255,255,255,.13); padding: 8px 10px; border-radius: 999px; }
.light-button { color: var(--blue); background: white; white-space: nowrap; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 22px 0; }
.metrics article, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 3px 14px rgba(17,34,67,.04); }
.metrics article { padding: 20px 22px; }
.metrics span, .metrics small { color: var(--muted); display: block; }
.metrics span { font-size: 13px; font-weight: 700; }
.metrics strong { display: block; font-size: 26px; margin: 9px 0 4px; }
.metrics small { font-size: 11px; }
.budget-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: -6px 0 22px; }
.budget-summary article { padding: 18px 22px; border-radius: 12px; background: #eef4ff; border: 1px solid #d6e2ff; }
.budget-summary span, .budget-summary small { display: block; color: var(--muted); }
.budget-summary span { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.budget-summary strong { display: block; font-size: 23px; margin: 7px 0 3px; color: var(--navy); }
.budget-summary small { font-size: 11px; }
.panel { overflow: hidden; }
.panel-heading { padding: 21px 24px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); gap: 20px; }
.panel-heading h3 { margin: 0 0 5px; font-size: 17px; }
.panel-heading p { color: var(--muted); margin: 0; font-size: 13px; }
.text-button { color: var(--blue); border: 0; background: transparent; font-weight: 800; }
table { width: 100%; border-collapse: collapse; }
th { color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-size: 10px; text-align: left; background: #fafbfe; }
th, td { padding: 14px 24px; border-bottom: 1px solid #edf0f5; }
tr:last-child td { border-bottom: 0; }
td { font-size: 13px; }
.request-id { color: var(--blue); font-weight: 800; }
.status { display: inline-flex; border-radius: 999px; padding: 5px 9px; font-size: 10px; font-weight: 800; text-transform: uppercase; background: #fff4d9; color: #936800; }
.status.completed { background: #e3f6eb; color: #137347; }
.empty { color: var(--muted); text-align: center; padding: 45px; }
.request-types { display: grid; grid-template-columns: repeat(2, minmax(260px, 1fr)); gap: 13px; margin-bottom: 18px; }
.type-card { border: 1px solid var(--line); background: white; border-radius: 12px; padding: 18px; text-align: left; min-height: 130px; }
.type-card:hover, .type-card.selected { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-soft); }
.type-card span { display: grid; place-items: center; width: 37px; height: 37px; background: var(--blue-soft); color: var(--blue); border-radius: 9px; font-size: 11px; font-weight: 900; margin-bottom: 13px; }
.type-card strong, .type-card small { display: block; }
.type-card small { color: var(--muted); margin-top: 5px; line-height: 1.35; }
.form-panel { overflow: visible; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 17px; padding: 24px; }
label { display: grid; gap: 7px; font-size: 12px; font-weight: 750; color: #405069; }
input, select, textarea { width: 100%; border: 1px solid #cfd7e5; border-radius: 8px; padding: 11px 12px; background: white; color: var(--ink); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
input[readonly] { background: #f2f5fa; color: #526078; cursor: not-allowed; }
textarea { min-height: 92px; resize: vertical; }
.wide { grid-column: 1 / -1; }
.preview { margin: 0 24px 20px; background: #f7f9fd; border: 1px dashed #bdc9da; border-radius: 10px; padding: 17px; }
.preview span { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: 10px; font-weight: 900; }
.preview strong { display: block; margin-top: 7px; }
.preview p { white-space: pre-wrap; color: var(--muted); font-size: 12px; line-height: 1.55; margin: 10px 0 0; max-height: 130px; overflow: auto; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); padding: 18px 24px; }
.error { margin: 0 24px 18px; padding: 12px; border-radius: 8px; background: #fff0f0; color: #a52929; font-size: 13px; }
.documents { margin: 0 24px 20px; border: 1px solid var(--line); border-radius: 11px; padding: 18px; }
.documents-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.documents-heading h3 { margin: 0 0 5px; font-size: 15px; }
.documents-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.add-files { display: inline-flex; background: var(--blue-soft); color: var(--blue); padding: 10px 13px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.add-files input { display: none; }
.document-list { display: grid; gap: 8px; margin-top: 15px; }
.document-empty { color: var(--muted); padding: 12px; text-align: center; background: #f8fafd; border-radius: 8px; font-size: 12px; }
.document-row { display: grid; grid-template-columns: minmax(160px, 1fr) 190px auto; gap: 10px; align-items: center; padding: 10px; background: #f8fafd; border-radius: 8px; }
.document-name { overflow: hidden; }
.document-name strong, .document-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-name small, .upload-note { color: var(--muted); font-size: 10px; }
.remove-file { border: 0; background: transparent; color: #b03737; font-weight: 800; }
.upload-note { display: block; margin-top: 10px; }
.search { max-width: 360px; }
.reference-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 18px; align-items: start; }
.reference-form-panel { position: sticky; top: 20px; }
#reference-form { display: grid; gap: 15px; padding: 22px; }
.active-check { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 9px; }
.active-check input { width: auto; }
.reference-actions { display: flex; justify-content: flex-end; gap: 9px; }
.reference-heading { align-items: flex-end; }
.reference-filters { display: flex; gap: 9px; }
.reference-filters select { min-width: 170px; }
.row-actions { display: flex; gap: 7px; }
.small-action { border: 1px solid var(--line); background: white; color: var(--blue); border-radius: 7px; padding: 6px 9px; font-size: 11px; font-weight: 800; }
.small-action.danger { color: #a52929; }
.order-actions { display: flex; gap: 4px; }
.order-button { min-width: 30px; font-size: 15px; padding: 4px 7px; line-height: 1; }
.order-button:disabled { opacity: .3; cursor: default; }
.payment-linked { color: var(--green); font-weight: 750; }
.payment-pending { color: #986b00; font-weight: 750; }
.create-payment { white-space: nowrap; background: var(--blue-soft); border-color: #c8d6ff; }
.lifecycle-subtitle { display: block; color: var(--muted); margin-top: 4px; }
.linked-records { margin-top: 8px; color: var(--muted); font-size: 11px; }
.linked-records summary { color: var(--blue); cursor: pointer; font-weight: 750; }
.linked-records div { margin-top: 4px; }
.inactive-row { opacity: .5; }
.template-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 18px; align-items: start; }
.template-list-panel { position: sticky; top: 20px; }
.template-list { display: grid; padding: 10px; gap: 6px; }
.template-list button { border: 0; background: transparent; text-align: left; border-radius: 8px; padding: 12px; color: var(--ink); }
.template-list button:hover, .template-list button.selected { background: var(--blue-soft); color: var(--blue); }
.template-list strong, .template-list small { display: block; }
.template-list small { color: var(--muted); margin-top: 4px; line-height: 1.35; }
.template-fields { display: grid; gap: 17px; padding: 23px; }
.template-fields label small { color: var(--muted); font-weight: 400; }
.recipient-field { min-height: 65px; }
.subject-field { min-height: 70px; }
.body-template-field { min-height: 310px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.5; }
.token-panel { background: #f7f9fd; border: 1px solid var(--line); border-radius: 9px; padding: 15px; }
.token-panel p { color: var(--muted); font-size: 12px; margin: 5px 0 12px; }
.template-tokens { display: flex; flex-wrap: wrap; gap: 7px; }
.template-token { border: 1px solid #cbd8f7; background: white; color: var(--blue); border-radius: 999px; padding: 6px 9px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.template-preview { background: var(--navy); color: white; border-radius: 10px; padding: 18px; }
.template-preview span { color: #9eb2cf; text-transform: uppercase; letter-spacing: .08em; font-size: 10px; font-weight: 900; }
.template-preview strong { display: block; margin: 8px 0 13px; }
.template-preview pre { margin: 0; white-space: pre-wrap; color: #dce6f5; font-family: inherit; font-size: 12px; line-height: 1.55; max-height: 280px; overflow: auto; }
.billing-entry-form { border-bottom: 1px solid var(--line); }
.billing-import-form { display: grid; grid-template-columns: 180px 180px minmax(260px, 1fr) auto; gap: 14px; padding: 22px; align-items: end; border-bottom: 1px solid var(--line); }
.report-file input { padding: 8px; }
.import-summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; padding: 20px; }
.import-stat { border: 1px solid var(--line); border-radius: 9px; padding: 13px; background: #f8fafd; }
.import-stat span, .import-stat small { display: block; color: var(--muted); }
.import-stat strong { display: block; font-size: 22px; margin: 5px 0; }
.import-actions { display: flex; justify-content: space-between; gap: 12px; padding: 0 20px 20px; align-items: center; }
.import-exceptions { margin: 0 20px 20px; max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; }
.billing-review-panel { margin-top: 18px; overflow-x: auto; }
.billing-table { min-width: 1450px; }
.billing-table input, .billing-table select { min-width: 100px; padding: 7px; font-size: 11px; }
.billing-table td { vertical-align: top; }
.comparison { display: grid; gap: 3px; font-size: 11px; white-space: nowrap; }
.comparison span { color: var(--muted); }
.comparison strong { color: var(--ink); }
.customer-billing-groups { display: grid; gap: 12px; padding: 18px; }
.customer-billing-group { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: white; }
.customer-billing-group summary { display: flex; align-items: center; gap: 12px; padding: 16px 18px; cursor: pointer; background: #f8fafd; list-style: none; }
.customer-billing-group summary::-webkit-details-marker { display: none; }
.customer-billing-group summary strong { font-size: 15px; }
.customer-billing-group summary small { color: var(--muted); }
.client-access-list { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 8px 18px; }
.client-access-list legend { color: var(--muted); font-size: 12px; font-weight: 700; padding: 0 6px; }
.client-access-list label { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: center; gap: 8px; font-size: 13px; min-height: 30px; }
.client-access-list input { width: 16px; height: 16px; margin: 0; }
.approval-metrics { grid-template-columns: repeat(4, 1fr); }
.approval-count { display: inline-flex; min-width: 30px; height: 30px; align-items: center; justify-content: center; border-radius: 999px; font-weight: 800; }
.approval-count.waiting { background: #fff2d6; color: #8a5b00; }
.approval-count.approved { background: #def5e8; color: #147a49; }
#billing-approval-table td small { display: block; color: var(--muted); margin-top: 4px; }
.date-filter { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; }
.date-filter label { min-width: 135px; }
.date-filter input { padding: 8px 10px; }
.table-actions { display: flex; gap: 7px; }
.small-action.danger { color: #a52929; border-color: #efc7c7; }
.map-selection { border: 1px solid #bdd8c9; background: #eefaf3; color: #245d3e; border-radius: 8px; padding: 10px 12px; font-size: 12px; }
.map-selection a { color: var(--blue); font-weight: 750; }
.budget-metrics { padding: 0 22px; }
.budget-entry-panel, #employee-costs .panel + .panel { margin-top: 20px; }
#employee-table td small { display: block; color: var(--muted); margin-top: 3px; }
.group-count { margin-left: auto; border-radius: 999px; padding: 5px 9px; background: var(--blue-soft); color: var(--blue); font-size: 11px; font-weight: 800; }
.billing-call-list { display: grid; }
.billing-call-row { display: grid; grid-template-columns: 130px minmax(180px, 1fr) minmax(140px, 1fr) 120px 130px; gap: 12px; align-items: center; padding: 13px 18px; border-top: 1px solid #edf0f5; cursor: pointer; }
.billing-call-row:hover { background: #f7faff; }
.billing-call-row small { color: var(--muted); display: block; margin-top: 3px; }
.billing-detail-dialog { width: min(980px, calc(100vw - 30px)); max-width: none; padding: 0; text-align: left; }
.billing-detail-shell { margin: 0; }
.billing-detail-header { display: flex; justify-content: space-between; align-items: center; padding: 22px 25px; border-bottom: 1px solid var(--line); }
.billing-detail-header h2 { margin: 0; }
.billing-detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; padding: 22px 25px; }
.billing-detail-card { border: 1px solid var(--line); border-radius: 9px; padding: 14px; background: #f8fafd; }
.billing-detail-card span { color: var(--muted); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.billing-detail-card strong { display: block; margin-top: 6px; }
.billing-detail-notes { padding: 0 25px 20px; display: grid; gap: 12px; }
.billing-detail-editor { border-top: 1px solid var(--line); padding: 20px 25px 25px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.billing-detail-editor .wide { grid-column: 1 / -1; }
.address-search-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.address-results { display: grid; gap: 7px; }
.address-result { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: white; text-align: left; color: var(--ink); }
.address-result:hover { border-color: var(--blue); background: var(--blue-soft); }
.address-result small { display: block; color: var(--muted); margin-top: 3px; }
.upload-progress { padding: 18px 22px; border-top: 1px solid var(--line); }
.upload-progress[hidden] { display: none; }
.progress-track { height: 12px; border-radius: 999px; background: #e5eaf2; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, #2457d6, #62a1ff); transition: width .2s ease; }
.progress-bar.processing { width: 35%; animation: processing-progress 1.2s ease-in-out infinite alternate; }
.progress-label { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 8px; }
@keyframes processing-progress { from { transform: translateX(-80%); } to { transform: translateX(180%); } }
.billing-admin-heading select { max-width: 240px; }
.billing-export-controls { display: flex; gap: 9px; }
.billing-admin-form-empty { padding: 25px; color: var(--muted); }
.role-customer .internal-only, .role-customer .admin-only { display: none !important; }
.role-internal .admin-only { display: none !important; }
dialog { border: 0; border-radius: 16px; padding: 34px; max-width: 430px; text-align: center; box-shadow: 0 24px 80px rgba(16,35,63,.3); }
dialog::backdrop { background: rgba(11,24,44,.55); }
.success-icon { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 50%; color: white; background: var(--green); font-size: 25px; font-weight: 900; }
dialog p { color: var(--muted); line-height: 1.5; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 24px; }
@media (max-width: 1050px) {
  .metrics, .request-types, .budget-summary { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .sidebar { position: static; width: auto; padding: 16px; }
  .brand { padding-bottom: 12px; }
  nav { grid-template-columns: repeat(3, 1fr); }
  .nav-heading, .nav-item.muted, .user-card { display: none; }
  main { margin-left: 0; padding: 0 15px 35px; }
  header { height: 90px; }
  .hero { padding: 30px 25px; display: block; }
  .hero .light-button { margin-top: 25px; }
  .metrics, .request-types, .form-grid, .budget-summary, .client-access-list { grid-template-columns: 1fr; }
  .reference-layout { grid-template-columns: 1fr; }
  .template-layout { grid-template-columns: 1fr; }
  .reference-form-panel { position: static; }
  .template-list-panel { position: static; }
  .reference-heading, .reference-filters { display: block; }
  .reference-filters > * { margin-top: 9px; max-width: none; width: 100%; }
  .documents-heading { display: block; }
  .add-files { margin-top: 14px; }
  .document-row { grid-template-columns: 1fr; }
  .billing-import-form, .import-summary, .billing-detail-grid, .billing-detail-editor { grid-template-columns: 1fr; }
  .billing-call-row { grid-template-columns: 1fr; }
  .address-search-line { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .panel { overflow-x: auto; }
  th, td { padding: 12px 14px; white-space: nowrap; }
}
