:root {
  --app-navy: #082f49;
  --app-navy-strong: #06263c;
  --app-blue: #075985;
  --app-teal: #0f766e;
  --app-yellow: #f4c430;
  --app-bg: #f4f7fa;
  --app-surface: #ffffff;
  --app-border: #dbe3ea;
  --app-text: #172033;
  --app-muted: #667085;
  --app-danger: #b42318;
  --app-sidebar-width: 252px;
  --app-topbar-height: 64px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
}

html { font-size: 14px; min-height: 100%; position: relative; }
body { background: var(--app-bg); color: var(--app-text); margin: 0; min-height: 100vh; overflow-x: hidden; }
a { color: var(--app-blue); }
.bi { fill: currentColor; height: 1em; pointer-events: none; vertical-align: -.125em; width: 1em; }
.btn { align-items: center; border-radius: .5rem; display: inline-flex; font-weight: 650; gap: .45rem; justify-content: center; }
.btn-primary { background: var(--app-blue); border-color: var(--app-blue); }
.btn-primary:hover, .btn-primary:focus { background: #064b70; border-color: #064b70; }
.btn-secondary { background: #fff; border-color: #bcc9d5; color: #344054; }
.btn-light { background: #f8fafc; border-color: #e2e8f0; color: #344054; }
.btn-link { color: var(--app-blue); text-decoration: none; }
.form-control, .form-select { border-color: #c5d0da; border-radius: .5rem; min-height: 40px; }
.form-control:focus, .form-select:focus, .btn:focus-visible, a:focus-visible, button:focus-visible { border-color: var(--app-blue); box-shadow: 0 0 0 .2rem rgba(7, 89, 133, .2); outline: 0; }

.app-shell { display: flex; min-height: 100vh; }
.app-sidebar { background: linear-gradient(180deg, var(--app-navy-strong), var(--app-navy)); color: #fff; display: flex; flex: 0 0 var(--app-sidebar-width); flex-direction: column; height: 100vh; left: 0; overflow-y: auto; position: fixed; top: 0; transition: transform .2s ease, width .2s ease; width: var(--app-sidebar-width); z-index: 1040; }
.app-brand { align-items: center; border-bottom: 1px solid rgba(255,255,255,.1); color: #fff; display: flex; gap: var(--space-3); min-height: var(--app-topbar-height); padding: var(--space-3) var(--space-4); text-decoration: none; }
.app-brand:hover { color: #fff; }
.app-brand strong, .app-brand small { display: block; }
.app-brand strong { font-size: 1rem; line-height: 1.1; }
.app-brand small { color: rgba(255,255,255,.65); font-size: .68rem; letter-spacing: .055em; margin-top: 3px; text-transform: uppercase; }
.brand-mark { align-items: center; background: var(--app-yellow); border-radius: .6rem; color: var(--app-navy); display: inline-flex; flex: 0 0 38px; font-size: .7rem; font-weight: 850; height: 38px; justify-content: center; letter-spacing: .04em; }
.brand-logo { background: #fff; border-radius: .55rem; flex: 0 0 126px; height: 48px; object-fit: cover; object-position: center; width: 126px; }
.login-page { margin: auto; width: min(100%, 460px); }
.login-card { width: 100%; }
.login-card .card-body { padding: clamp(1.75rem, 4vw, 3rem); }
.login-header { margin-bottom: var(--space-6); }
.login-brand-logo { background: #fff; display: block; height: 104px; margin: 0 0 var(--space-4); max-width: 100%; object-fit: cover; object-position: center; width: 260px; }
.sidebar-nav { padding: var(--space-3) var(--space-2) var(--space-8); }
.sidebar-group { margin-bottom: var(--space-3); }
.sidebar-heading { color: rgba(255,255,255,.48); font-size: .68rem; font-weight: 750; letter-spacing: .075em; padding: var(--space-3) var(--space-3) var(--space-1); text-transform: uppercase; }
.sidebar-link, .sidebar-sublink { border-radius: .5rem; color: rgba(255,255,255,.78); display: flex; font-size: .86rem; font-weight: 620; gap: var(--space-3); margin: 2px 0; padding: 9px var(--space-3); text-decoration: none; }
.sidebar-link .bi { flex: 0 0 18px; font-size: 1.1rem; }
.sidebar-sublink { font-size: .78rem; font-weight: 520; padding: 6px 12px 6px 42px; }
.sidebar-link:hover, .sidebar-sublink:hover, .sidebar-link:focus, .sidebar-sublink:focus { background: rgba(255,255,255,.09); color: #fff; }
.sidebar-link.active { background: rgba(244,196,48,.16); color: #fff; }
.sidebar-link.active .bi { color: var(--app-yellow); }
.app-main { display: flex; flex: 1; flex-direction: column; margin-left: var(--app-sidebar-width); min-width: 0; min-height: 100vh; transition: margin-left .2s ease; }
.app-topbar { align-items: center; background: rgba(255,255,255,.98); border-bottom: 1px solid var(--app-border); display: flex; gap: var(--space-4); height: var(--app-topbar-height); padding: 0 var(--space-6); position: sticky; top: 0; z-index: 1020; }
.icon-button { align-items: center; background: transparent; border: 0; border-radius: .5rem; color: #475467; display: inline-flex; flex: 0 0 40px; height: 40px; justify-content: center; text-decoration: none; }
.icon-button:hover { background: #eef3f7; color: var(--app-navy); }
.icon-button .bi { font-size: 1.25rem; }
.global-search { align-items: center; background: #f3f6f8; border: 1px solid transparent; border-radius: .55rem; display: flex; flex: 1; gap: var(--space-2); max-width: 680px; padding: 0 var(--space-3); }
.global-search:focus-within { background: #fff; border-color: var(--app-blue); box-shadow: 0 0 0 .2rem rgba(7,89,133,.12); }
.global-search input { background: transparent; border: 0; color: var(--app-text); flex: 1; height: 40px; min-width: 0; outline: 0; }
.global-search kbd { background: #fff; border: 1px solid #d0d5dd; color: #667085; font-size: .68rem; }
.topbar-actions { align-items: center; display: flex; gap: var(--space-2); margin-left: auto; }
.user-button { align-items: center; background: transparent; border: 0; border-radius: .55rem; color: var(--app-text); display: flex; gap: var(--space-2); max-width: 235px; padding: 5px 8px; text-align: left; }
.user-button:hover { background: #f3f6f8; }
.user-button strong, .user-button small { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-button strong { font-size: .78rem; }.user-button small { color: var(--app-muted); font-size: .67rem; }
.user-avatar { align-items: center; background: var(--app-yellow); border-radius: 50%; color: var(--app-navy); display: inline-flex; flex: 0 0 34px; font-weight: 800; height: 34px; justify-content: center; }
.dropdown-item { align-items: center; display: flex; gap: var(--space-2); }
.app-content { flex: 1; max-width: 1720px; padding: var(--space-6); width: 100%; }
.app-footer { border-top: 1px solid var(--app-border); color: var(--app-muted); display: flex; font-size: .72rem; justify-content: space-between; padding: var(--space-3) var(--space-6); }
.sidebar-backdrop { display: none; }
.public-shell { align-items: center; display: flex; justify-content: center; min-height: 100vh; padding: var(--space-6); width: 100%; }

.app-breadcrumb { align-items: center; color: var(--app-muted); display: flex; flex-wrap: wrap; font-size: .75rem; gap: var(--space-2); margin-bottom: var(--space-2); }
.app-breadcrumb a { color: var(--app-muted); text-decoration: none; }
.app-breadcrumb a:hover { color: var(--app-blue); }
.page-header { align-items: flex-start; display: flex; gap: var(--space-4); justify-content: space-between; margin-bottom: var(--space-6); }
.page-header h1, .account-workspace-header h1 { color: #101828; font-size: 1.55rem; font-weight: 750; letter-spacing: -.02em; margin: 0; }
.page-header p, .account-workspace-header p { color: var(--app-muted); font-size: .82rem; margin: 3px 0 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.master-card-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(4, minmax(0, 1fr)); }
.master-card { align-items: center; background: var(--app-surface); border: 1px solid var(--app-border); border-radius: .75rem; box-shadow: 0 1px 2px rgba(16,24,40,.03); color: var(--app-text); display: grid; gap: var(--space-3); grid-template-columns: 38px 1fr auto; min-height: 92px; padding: var(--space-4); text-decoration: none; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.master-card > .bi { background: #e8f2f6; border-radius: .6rem; color: var(--app-blue); height: 38px; padding: 9px; width: 38px; }
.master-card strong, .master-card small { display: block; }
.master-card strong { font-size: .88rem; }.master-card small { color: var(--app-muted); font-size: .72rem; margin-top: 3px; }
.master-card .card-open { color: var(--app-blue); font-size: .72rem; font-weight: 700; }
.master-card:hover { border-color: #9bb6c8; box-shadow: 0 8px 24px rgba(8,47,73,.09); color: var(--app-text); transform: translateY(-1px); }

.filter-bar { align-items: center; background: #fff; border: 1px solid var(--app-border); border-radius: .7rem; display: flex; gap: var(--space-2); margin-bottom: var(--space-4); padding: var(--space-3); }
.filter-bar .form-select { max-width: 190px; }
.filter-search { align-items: center; display: flex; flex: 1; min-width: 220px; position: relative; }
.filter-search .bi { color: #667085; left: 12px; position: absolute; }
.filter-search .form-control { padding-left: 36px; }
.account-filter-bar { flex-wrap: wrap; }
.account-filter-bar .filter-search { min-width: 280px; }
.data-surface { background: #fff; border: 1px solid var(--app-border); border-radius: .75rem; box-shadow: 0 1px 3px rgba(16,24,40,.04); overflow: hidden; }
.enterprise-table { font-size: .78rem; }
.enterprise-table thead th { background: #f8fafc; border-bottom: 1px solid var(--app-border); color: #475467; font-size: .7rem; font-weight: 750; letter-spacing: .025em; padding: 11px 12px; text-transform: uppercase; white-space: nowrap; }
.enterprise-table tbody td { border-color: #edf1f4; padding: 11px 12px; vertical-align: middle; }
.enterprise-table tbody tr:hover { background: #fbfdfe; }
.table-secondary-text { color: var(--app-muted); display: block; font-size: .68rem; margin-top: 2px; }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; min-width: 150px; white-space: nowrap; }
.table-actions form { margin: 0; }
.return-form { align-items: center; display: flex; gap: 4px; margin-top: 5px !important; }
.return-form .form-control { max-width: 150px; min-height: 31px; }
.status-badge { border-radius: 999px; display: inline-flex; font-size: .68rem; font-weight: 700; padding: 4px 9px; white-space: nowrap; }
.status-success { background: #dcfce7; color: #166534; }.status-info { background: #e0f2fe; color: #075985; }.status-danger { background: #fee4e2; color: #b42318; }.status-neutral { background: #eef2f6; color: #475467; }
.empty-state { align-items: center; color: var(--app-muted); display: flex; flex-direction: column; gap: var(--space-2); justify-content: center; min-height: 210px; padding: var(--space-8); text-align: center; }
.empty-state .bi { color: #98a2b3; font-size: 2rem; }.empty-state strong { color: #344054; font-size: .9rem; }.empty-state span { font-size: .75rem; }
.content-panel { background: #fff; border: 1px solid var(--app-border); border-radius: .75rem; box-shadow: 0 1px 3px rgba(16,24,40,.04); overflow: hidden; }
.content-panel-header { align-items: flex-start; border-bottom: 1px solid var(--app-border); display: flex; gap: var(--space-3); justify-content: space-between; padding: var(--space-4); }
.content-panel-header h2 { color: #344054; font-size: .94rem; font-weight: 750; margin: 0; }.content-panel-header p { color: var(--app-muted); font-size: .72rem; margin: 3px 0 0; }
.content-panel-body { padding: var(--space-4); }.content-panel-body .entity-form { max-width: none; }
.content-panel-footer { align-items: center; border-top: 1px solid var(--app-border); display: flex; gap: var(--space-2); justify-content: flex-end; padding: var(--space-3) var(--space-4); }
.filter-bar form { width: 100%; }.filter-grid { align-items: end; display: flex; gap: var(--space-3); width: 100%; }.filter-grow { flex: 1; }.filter-actions { display: flex; gap: var(--space-2); }
.workflow-inline-form { display: flex; flex-wrap: wrap; gap: 5px; min-width: 240px; }.workflow-inline-form .form-control { flex: 1 1 150px; }
.process-stepper { display: grid; gap: 2px; grid-template-columns: repeat(4,minmax(0,1fr)); list-style: none; margin: 0 0 var(--space-6); padding: 0; }
.process-stepper li { align-items: center; background: #eef2f6; color: #667085; display: flex; font-size: .72rem; font-weight: 650; gap: var(--space-2); min-height: 42px; padding: var(--space-2) var(--space-3); }
.process-stepper li:first-child { border-radius: .55rem 0 0 .55rem; }.process-stepper li:last-child { border-radius: 0 .55rem .55rem 0; }
.process-stepper li.active { background: var(--app-blue); color: #fff; }.process-stepper li.complete { background: #dff4ed; color: #136c5b; }
.process-stepper .step-number { align-items: center; background: rgba(255,255,255,.75); border-radius: 999px; color: #344054; display: inline-flex; height: 22px; justify-content: center; width: 22px; }
.kpi-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(4,minmax(0,1fr)); margin-bottom: var(--space-6); }
.kpi-card { background: #fff; border: 1px solid var(--app-border); border-radius: .75rem; min-height: 118px; padding: var(--space-4); position: relative; }.kpi-card .bi { color: var(--app-blue); height: 20px; width: 20px; }
.kpi-card-label { color: var(--app-muted); display: block; font-size: .7rem; font-weight: 650; margin-top: var(--space-3); }.kpi-card-value { color: #101828; display: block; font-size: 1.55rem; font-weight: 750; line-height: 1.2; }.kpi-card-unit { color: var(--app-muted); font-size: .68rem; }

.entity-form { margin: 0 auto; max-width: 1100px; }
.form-required-note, .required-field-key { color: var(--app-muted); font-size: .75rem; margin-bottom: var(--space-2); text-align: right; }
.form-required-note span, .required-field-marker, .required-field-key span { color: var(--app-danger); font-weight: 750; }
.form-section { background: #fff; border: 1px solid var(--app-border); border-radius: .75rem; margin-bottom: var(--space-4); padding: var(--space-6); }
.form-section h2, .info-panel h2 { color: #344054; font-size: .92rem; font-weight: 750; margin: 0 0 var(--space-4); }
.form-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-wide { grid-column: 1 / -1; }
.form-label { color: #344054; font-size: .75rem; font-weight: 650; margin-bottom: 5px; }
.workflow-action-bar { align-items: center; background: rgba(255,255,255,.96); border: 1px solid var(--app-border); border-radius: .7rem; bottom: var(--space-3); box-shadow: 0 -2px 16px rgba(16,24,40,.06); display: flex; gap: var(--space-2); justify-content: flex-end; padding: var(--space-3); position: sticky; z-index: 100; }
.onboarding-wizard { overflow: hidden; padding: 0; }
.wizard-progress { background: #f8fafc; border-bottom: 1px solid var(--app-border); display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); }
.wizard-step { align-items: center; background: transparent; border: 0; border-bottom: 3px solid transparent; color: #667085; display: flex; font-size: .74rem; font-weight: 650; gap: .5rem; justify-content: center; padding: 1rem .5rem; }
.wizard-step span { align-items: center; background: #e4e7ec; border-radius: 50%; color: #475467; display: inline-flex; height: 1.55rem; justify-content: center; width: 1.55rem; }
.wizard-step.active { border-bottom-color: var(--app-blue); color: var(--app-blue); }
.wizard-step.active span { background: var(--app-blue); color: #fff; }
.wizard-step.optional-step:not(.active) { opacity: .62; }
.wizard-form { padding: var(--space-6); }
.wizard-panel { border: 0; margin: 0; min-height: 360px; padding: 0; }
.wizard-panel legend { color: #1d2939; font-size: 1.05rem; font-weight: 750; }
.section-help { color: var(--app-muted); font-size: .76rem; margin-bottom: var(--space-5); }
.form-grid > div > label:not(.form-check-label) { color: #344054; display: block; font-size: .75rem; font-weight: 650; margin-bottom: 5px; }
.span-2 { grid-column: 1 / -1; }
.wizard-actions { align-items: center; border-top: 1px solid var(--app-border); display: flex; gap: var(--space-2); margin-top: var(--space-6); padding-top: var(--space-4); }
.review-callout { background: #eff8ff; border: 1px solid #b2ddff; border-radius: .65rem; color: #1849a9; margin-bottom: var(--space-4); padding: var(--space-4); }
.review-callout p { color: #475467; margin: .35rem 0 0; }
.wizard-review { display: grid; gap: 0; grid-template-columns: repeat(2,minmax(0,1fr)); }
.wizard-review > div { border-bottom: 1px solid #edf1f4; display: grid; grid-template-columns: 130px 1fr; padding: .65rem 0; }
.wizard-review dt { color: var(--app-muted); font-size: .72rem; }.wizard-review dd { font-size: .76rem; margin: 0; }
.data-table td small { color: var(--app-muted); display: block; font-size: .68rem; }.action-cell { min-width: 190px; }.return-form { align-items: center; display: inline-flex !important; gap: .25rem; margin-top: .25rem; }.return-form input { width: 130px; }

.account-workspace-header { align-items: flex-start; background: #fff; border: 1px solid var(--app-border); border-radius: .75rem .75rem 0 0; display: flex; justify-content: space-between; padding: var(--space-6); }
.account-title-row { align-items: center; display: flex; gap: var(--space-3); }
.account-meta { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.account-meta span { background: #f1f5f9; border-radius: 999px; color: #475467; font-size: .68rem; padding: 4px 9px; }
.context-tabs { background: #fff; border: 1px solid var(--app-border); border-top: 0; display: flex; gap: var(--space-1); margin-bottom: var(--space-4); overflow-x: auto; padding: 0 var(--space-4); }
.context-tabs a { border-bottom: 2px solid transparent; color: #667085; font-size: .74rem; font-weight: 650; padding: 11px 9px; text-decoration: none; white-space: nowrap; }
.context-tabs a:hover, .context-tabs a.active { border-color: var(--app-blue); color: var(--app-blue); }
.workspace-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(3, minmax(0,1fr)); }
.info-panel { background: #fff; border: 1px solid var(--app-border); border-radius: .75rem; padding: var(--space-4); }
.info-panel dl { margin: 0; }.info-panel dl > div { border-bottom: 1px solid #edf1f4; display: grid; gap: var(--space-2); grid-template-columns: 110px 1fr; padding: 7px 0; }.info-panel dl > div:last-child { border-bottom: 0; }
.info-panel dt { color: var(--app-muted); font-size: .69rem; font-weight: 550; }.info-panel dd { color: #344054; font-size: .75rem; margin: 0; overflow-wrap: anywhere; }
.compact-empty { color: var(--app-muted); font-size: .75rem; padding: var(--space-4) 0; }.compact-empty a { display: block; margin-top: var(--space-2); }
.compact-list { list-style: none; margin: 0; padding: 0; }.compact-list li { border-bottom: 1px solid #edf1f4; display: flex; flex-direction: column; padding: 7px 0; }.compact-list li:last-child { border: 0; }.compact-list strong { font-size: .75rem; }.compact-list span { color: var(--app-muted); font-size: .69rem; }
.quick-link-grid { display: grid; gap: var(--space-2); grid-template-columns: repeat(2,minmax(0,1fr)); }.quick-link-grid a { align-items: center; background: #f6f9fb; border-radius: .5rem; display: flex; font-size: .72rem; gap: var(--space-2); padding: var(--space-3); text-decoration: none; }
.back-to-results { font-size: .75rem; margin-top: var(--space-4); }.back-to-results a { align-items: center; display: inline-flex; gap: var(--space-2); text-decoration: none; }

.card { border-color: var(--app-border); border-radius: .75rem; }
.card.shadow-sm { box-shadow: 0 1px 4px rgba(16,24,40,.05) !important; }
.table > :not(caption) > * > * { padding: .6rem .65rem; }
.alert { border-radius: .6rem; font-size: .78rem; }

body.sidebar-collapsed .app-sidebar { transform: translateX(calc(-1 * var(--app-sidebar-width))); }
body.sidebar-collapsed .app-main { margin-left: 0; }

@media (max-width: 1279.98px) {
  .master-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .workspace-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023.98px) {
  .app-sidebar { box-shadow: 12px 0 28px rgba(0,0,0,.18); transform: translateX(-100%); }
  .app-main { margin-left: 0; }
  body.sidebar-open .app-sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { background: rgba(15,23,42,.42); border: 0; display: block; inset: 0; position: fixed; z-index: 1030; }
  .master-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .app-content { padding: var(--space-4); }
  .filter-bar { align-items: stretch; flex-wrap: wrap; }
  .filter-search { flex-basis: 100%; }
  .filter-bar .form-select { flex: 1; max-width: none; min-width: 160px; }
}
@media (max-width: 767.98px) {
  html { font-size: 15px; }
  .app-topbar { gap: var(--space-2); padding: 0 var(--space-3); }
  .global-search kbd, .user-button > span:not(.user-avatar) { display: none; }
  .global-search { max-width: none; }
  .page-header, .account-workspace-header { align-items: stretch; flex-direction: column; }
  .filter-grid { align-items: stretch; flex-direction: column; }.filter-actions { width: 100%; }.filter-actions .btn { flex: 1; }
  .process-stepper { grid-template-columns: 1fr; }.process-stepper li, .process-stepper li:first-child, .process-stepper li:last-child { border-radius: .4rem; }
  .page-header .btn, .page-actions .btn { width: 100%; }
  .master-card-grid, .workspace-grid, .form-grid { grid-template-columns: 1fr; }
  .form-grid-wide { grid-column: auto; }
  .form-section { padding: var(--space-4); }
  .wizard-progress { display: flex; overflow-x: auto; }.wizard-step { flex: 0 0 auto; padding-inline: .75rem; }.wizard-form { padding: var(--space-4); }.wizard-review { grid-template-columns: 1fr; }.wizard-actions { flex-wrap: wrap; }.wizard-actions .flex-grow-1 { display: none; }
  .filter-bar > .btn, .filter-bar > .btn-link { flex: 1; }
  .table-actions { justify-content: flex-start; }
  .workflow-action-bar { bottom: 0; }
  .app-footer { align-items: center; flex-direction: column; gap: var(--space-1); text-align: center; }
}
@media (max-width: 479.98px) {
  .public-shell { padding: var(--space-3); }
  .login-card .card-body { padding: var(--space-6); }
  .login-brand-logo { height: 88px; width: 220px; }
  .master-card-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr; }
  .app-content { padding: var(--space-3); }
  .global-search input::placeholder { color: transparent; }
}

@media print {
  .app-sidebar, .app-topbar, .app-footer, .workflow-action-bar, .page-actions, .filter-bar { display: none !important; }
  .app-main { margin: 0; }.app-content { max-width: none; padding: 0; }.data-surface, .info-panel { box-shadow: none; }
}
