:root {
  --es-navy: #16325c;
  --es-accent: #0d6efd;
  --es-ok: #198754;
  --es-bad: #dc3545;
  --es-wait: #adb5bd;
  --es-ap: #f0ad00;
}
/* ---------- base: calm, light, few borders ---------- */
body { background: #f6f7f9; font-size: .9rem; color: #1f2933; }
h3, h4, .h3, .h4 { font-weight: 600; letter-spacing: -.01em; }
.es-nav { background: var(--es-navy); padding-top: .35rem; padding-bottom: .35rem; }
.es-nav .nav-link { color: rgba(255,255,255,.72); font-size: .88rem; padding-left: .7rem !important; padding-right: .7rem !important; }
.es-nav .nav-link:hover, .es-nav .nav-link.active { color: #fff; }
.es-nav .nav-link.active { box-shadow: inset 0 -2px 0 rgba(255,255,255,.85); }
.es-logo { display: inline-block; background: #fff; color: var(--es-navy); border-radius: 6px; padding: 0 .35rem; font-weight: 800; margin-right: .25rem; }
.es-brand-img { height: 28px; max-width: 150px; object-fit: contain; background: #fff; border-radius: 4px; padding: 2px 4px; margin-right: .4rem; }
.es-switch { max-width: 320px; }
.es-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .4rem; flex: none; }
.es-company-select { background-color: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.25); max-width: 260px; }
.es-company-select option { color: #000; }
.es-user { color: #fff; border: 1px solid rgba(255,255,255,.25); display: inline-flex; align-items: center; gap: .45rem; }
.es-user:hover, .es-user:focus { color: #fff; background: rgba(255,255,255,.1); }
.es-avatar { width: 1.6rem; height: 1.6rem; border-radius: 50%; background: #fff; color: var(--es-navy); font-size: .7rem; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center; }
.es-bc-dot { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; background: #adb5bd; }
.es-bc-dot.on { background: #3ccf7a; }
.es-user-menu { min-width: 260px; }
.card { border: 1px solid #e6e8ec; border-radius: .6rem; box-shadow: none; }
.card-header { background: #fff; font-weight: 600; border-bottom: 1px solid #eef0f3; padding: .7rem 1rem; }
.card-header:first-child { border-radius: .6rem .6rem 0 0; }
.alert { border-radius: .5rem; font-size: .88rem; }
.table td, .table th { vertical-align: middle; }
.es-table { font-size: .88rem; }
.es-table thead th, .table thead.table-light th { background: #fafbfc; color: #6b7280; font-weight: 600; font-size: .72rem; text-transform: uppercase;
    letter-spacing: .04em; border-bottom: 1px solid #e6e8ec; }
.es-table td { padding-top: .55rem; padding-bottom: .55rem; border-color: #f0f1f4; }
.es-kpi .card-body { padding: .6rem .9rem; }
.es-kpi-label { font-size: .72rem; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; }
.es-kpi-value { font-size: 1.35rem; font-weight: 600; color: #1f2933; }
.queue-tile { text-decoration: none; color: inherit; display: flex; justify-content: space-between; align-items: center;
    padding: .35rem .6rem; border-radius: .4rem; border-left: 3px solid transparent; }
.queue-tile:hover { background: #f1f4f9; }
.queue-tile .count { font-weight: 600; font-size: .85rem; background: #eef1f6; border-radius: 999px; padding: 0 .55rem; min-width: 1.8rem; text-align: center; }
.queue-tile .count.zero { color: #9aa1ab; background: transparent; }
.queue-tile.ap { border-left-color: var(--es-ap); }
.queue-tile.bad { border-left-color: var(--es-bad); }
.queue-tile.ok { border-left-color: var(--es-ok); }
.queue-nav .list-group-item { border: 0; border-radius: .4rem !important; padding: .3rem .6rem; margin-bottom: 1px; background: transparent; }
.queue-nav .list-group-item:hover { background: #eef1f6; }
.queue-nav .list-group-item.active { background: var(--es-navy); border-color: var(--es-navy); }
.queue-nav .badge { font-weight: 600; }
.queue-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: #8a929c; margin: .8rem 0 .2rem .1rem; }

/* ---------- approval stepper ---------- */
.stepper { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; }
.step { position: relative; flex: 1 1 150px; min-width: 150px; max-width: 240px; padding: 0 .5rem 0 0; }
.step .box { border: 1px solid #d5d9df; border-radius: 10px; background: #fff; padding: .55rem .7rem; height: 100%; }
.step .role { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: #6c757d; }
.step .who { font-weight: 600; }
.step .meta { font-size: .75rem; color: #6c757d; }
.step .icon { float: right; font-weight: 700; }
.step:not(:last-child)::after { content: "\2192"; position: absolute; right: -.35rem; top: 40%; color: #6c757d; z-index: 1; font-weight: 700; }
.step.done .box { border-color: var(--es-ok); background: #f1faf4; }
.step.done .icon { color: var(--es-ok); }
.step.rejected .box { border-color: var(--es-bad); background: #fdf1f2; }
.step.rejected .icon { color: var(--es-bad); }
.step.current .box { border-color: var(--es-accent); background: #f3f7ff; box-shadow: 0 0 0 3px rgba(13,110,253,.12); }
.step.current.ap .box { border-color: var(--es-ap); background: #fffaeb; box-shadow: 0 0 0 3px rgba(240,173,0,.15); }
.step.waiting .box { border-style: dashed; color: #6c757d; }
.step.cancelled .box { opacity: .45; text-decoration: line-through; }
.step.forwarded .box { border-color: #6f42c1; background: #f5f0fc; }
.step.forwarded .icon { color: #6f42c1; }
.here { display: inline-block; background: var(--es-accent); color: #fff; font-size: .65rem; border-radius: 4px; padding: 0 .35rem; margin-top: .2rem; }
.step.ap .here { background: var(--es-ap); color: #000; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 4px rgba(13,110,253,.18);} 50% { box-shadow: 0 0 0 7px rgba(13,110,253,.08);} }

/* ---------- rule map (simulator) ---------- */
.rulemap { display: grid; grid-template-columns: minmax(200px, 1fr) 58px minmax(180px, 1fr); gap: .45rem 0; align-items: center; }
.rulemap .node { border: 2px solid #ced4da; border-radius: 8px; padding: .4rem .6rem; background: #fff; font-size: .85rem; color: #6c757d; }
.rulemap .node.decision { border-radius: 20px; font-style: italic; }
.rulemap .node.on { border-color: var(--es-accent); color: #000; background: #eef4ff; font-weight: 600; }
.rulemap .node.end.on { border-color: var(--es-ok); background: #f1faf4; }
.rulemap .node.warn.on { border-color: var(--es-ap); background: #fff8e1; }
.rulemap .node.bad.on { border-color: var(--es-bad); background: #fdf1f2; }
.rulemap .arrow { text-align: center; color: #adb5bd; font-weight: 700; }
.rulemap .arrow.on { color: var(--es-accent); }
.rulemap .down { grid-column: 1; text-align: center; color: #adb5bd; line-height: .6; }
.trace li { margin-bottom: .2rem; }
.pass { color: var(--es-ok); font-weight: 700; }
.fail { color: var(--es-bad); font-weight: 700; }
.pdf-frame { width: 100%; height: 78vh; border: 1px solid #dee2e6; border-radius: 6px; background: #fff; }
.missing { background: #fff3cd; }
.timeline { list-style: none; padding-left: 0; }
.timeline li { border-left: 2px solid #dee2e6; padding: 0 0 .6rem .8rem; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; background: var(--es-navy); border-radius: 50%; }

/* Bootstrap 5.1 has no text-bg-* helpers */
/* soft tints: readable, not shouting */
.text-bg-primary { color: #1d4ed8 !important; background-color: #e6efff !important; }
.text-bg-secondary { color: #4b5563 !important; background-color: #eceef1 !important; }
.text-bg-success { color: #146c43 !important; background-color: #e3f4ea !important; }
.text-bg-danger { color: #b02a37 !important; background-color: #fbe7e9 !important; }
.text-bg-warning { color: #8a5a00 !important; background-color: #fff1cc !important; }
.text-bg-info { color: #0b6e83 !important; background-color: #e0f5fa !important; }
.text-bg-light { color: #374151 !important; background-color: #f1f3f5 !important; }
.badge { font-weight: 600; letter-spacing: .01em; }

/* ---------- simulator PDF drop zone ---------- */
.dropzone { border: 2px dashed #9fb3d1; background: #f8fbff; cursor: pointer; text-align: center; padding: 1.1rem; transition: all .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--es-accent); background: #eaf2ff; }
.dropzone .dz-icon { font-size: 1.8rem; line-height: 1; margin-bottom: .25rem; }
.dropzone .dz-busy { display: none; }
.dropzone.busy .dz-idle { display: none; }
.dropzone.busy .dz-busy { display: block; }

/* ---------- queue list + preview ---------- */
.queue-list { max-height: calc(100vh - 230px); overflow-y: auto; }
.queue-list .sel-row { cursor: pointer; }
.queue-list .sel-row.table-active > td { --bs-table-accent-bg: transparent; background: #e3ecff !important; box-shadow: none; }
.queue-list .sel-row.table-active > td:first-child { box-shadow: inset 4px 0 0 var(--es-accent); }
.preview-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #6c757d; font-weight: 600; margin: .5rem 0 .35rem; }
.queue-list .sel-row:focus { outline: none; }
.preview-sticky { position: sticky; top: 1rem; transition: opacity .15s; }
.preview-pdf { width: 100%; height: calc(100vh - 430px); min-height: 420px; border-top: 1px solid #dee2e6; }
.stepper-compact .step { flex: 1 1 110px; min-width: 110px; }
.stepper-compact .step .box { padding: .35rem .5rem; font-size: .8rem; }
.stepper-compact .step .meta { display: none; }
.stepper-compact .step.current .meta:last-child, .stepper-compact .here { display: inline-block; }
.preview-meta > div { padding-bottom: .35rem; }

/* ---------- PDF.js viewer ---------- */
.es-pdf { display: flex; flex-direction: column; overflow: hidden; background: #e9ecef; }
.es-pdf-bar { display: flex; align-items: center; gap: .5rem; padding: .3rem .5rem; background: #f8f9fa; border-bottom: 1px solid #dee2e6; font-size: .8rem; }
.es-pdf-bar .btn { padding: .05rem .5rem; border: 1px solid #dee2e6; }
.es-pdf-pages { flex: 1; overflow: auto; padding: 8px; text-align: center; }
.es-pdf-page { display: block; margin: 0 auto 8px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); }

/* ---------- bulk actions ---------- */
.bulk-bar { background: #fff8e1; border-bottom: 1px solid #ffe08a; padding: .5rem .75rem; }
.queue-list td.pick { width: 2rem; }

/* ---------- company logos ---------- */
.es-logo-preview { width: 180px; height: 60px; border: 1px dashed #d5d9df; border-radius: .4rem; display: flex; align-items: center; justify-content: center; background: #fff; }
.es-logo-preview img { max-width: 170px; max-height: 52px; object-fit: contain; }
.es-login-logo img { max-height: 48px; max-width: 220px; object-fit: contain; }

/* ---------- validation panel (AP exceptions) ---------- */
.es-validation { font-size: .85rem; }
.es-exception { background: #fffaeb; border: 1px solid #f5e3a8; border-radius: .45rem; padding: .5rem .65rem; }
.es-dl { display: grid; grid-template-columns: max-content 1fr; gap: .1rem .75rem; margin: .35rem 0; }
.es-dl dt { font-weight: 500; color: #6b7280; }
.es-dl dd { margin: 0; }
.es-checks li { padding: .15rem 0; border-bottom: 1px solid #f1f3f5; }
.es-checks li:last-child { border-bottom: 0; }
.es-check-icon { display: inline-block; width: 1.1rem; font-weight: 700; }
.es-checks li.ok .es-check-icon { color: var(--es-ok); }
.es-checks li.bad .es-check-icon { color: var(--es-bad); }
.es-checks li.bad { background: #fff5f5; }
.es-reason { color: #8a5a00; }

/* ---------- queues directory ---------- */
.q-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .15rem .75rem; }
.q-item[hidden] { display: none !important; }
.q-item span:first-child { min-width: 0; }
.es-queue-menu { width: 340px; padding-top: .5rem; }
.es-queue-scroll { max-height: min(60vh, 520px); overflow-y: auto; }
.es-queue-menu .dropdown-header { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; padding-top: .5rem; }
.es-queue-menu .dropdown-item { font-size: .88rem; padding-top: .3rem; padding-bottom: .3rem; }
.es-queue-count { font-size: .75rem; font-weight: 600; background: #eef1f6; border-radius: 999px; padding: 0 .5rem; color: #1f2933; }
.es-queue-count.zero { background: transparent; color: #9aa1ab; }
.dropdown-item.active .es-queue-count { background: rgba(255,255,255,.25); color: #fff; }

/* ---------- department queue list (left of the queue page) ---------- */
.es-dept .card-header { position: sticky; top: 0; z-index: 1; }
.es-dept-list { max-height: calc(100vh - 210px); overflow-y: auto; padding: .35rem .4rem; }
.es-dept-list .queue-tile { font-size: .86rem; }
.es-dept-list .queue-tile.current { background: var(--es-navy); color: #fff; }
.es-dept-list .queue-tile.current .count { background: rgba(255,255,255,.2); color: #fff; }

/* =====================================================================
   Modern theme (v1.10): soft surfaces, rounded controls, clear focus.
   Overrides the base rules above; Inter falls back to the system font.
   ===================================================================== */
:root {
  --es-navy: #0f2747;
  --es-navy-2: #1b3b6b;
  --es-accent: #2563eb;
  --es-accent-soft: #eaf1ff;
  --es-bg: #f4f6fa;
  --es-surface: #ffffff;
  --es-line: #e5e8ef;
  --es-line-soft: #eef1f5;
  --es-text: #172033;
  --es-muted: #667085;
  --es-radius: 14px;
  --es-radius-sm: 9px;
  --es-shadow: 0 1px 2px rgba(16,24,40,.04), 0 2px 8px rgba(16,24,40,.05);
  --es-shadow-lg: 0 10px 30px rgba(16,24,40,.10);
}
body { background: var(--es-bg); color: var(--es-text); font-size: .9rem;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, .h3, .h4 { font-weight: 650; letter-spacing: -.02em; color: var(--es-text); }
h3 { font-size: 1.45rem; }
a { color: var(--es-accent); }
.text-muted { color: var(--es-muted) !important; }

/* navigation: deep gradient, pill links */
.es-nav { background: linear-gradient(90deg, var(--es-navy) 0%, var(--es-navy-2) 100%); padding-top: .45rem; padding-bottom: .45rem;
  box-shadow: 0 2px 10px rgba(15,39,71,.18); }
.es-nav .nav-link { border-radius: 8px; margin: 0 .1rem; transition: background .15s, color .15s; }
.es-nav .nav-link:hover { background: rgba(255,255,255,.08); }
.es-nav .nav-link.active { box-shadow: none; background: rgba(255,255,255,.14); color: #fff; }
.es-logo { border-radius: 8px; padding: .05rem .4rem; }
.dropdown-menu { border: 1px solid var(--es-line); border-radius: 12px; box-shadow: var(--es-shadow-lg); padding: .35rem; }
.dropdown-item { border-radius: 8px; }
.dropdown-item.active, .dropdown-item:active { background: var(--es-accent); }

/* surfaces */
.card { border: 1px solid var(--es-line); border-radius: var(--es-radius); box-shadow: var(--es-shadow); background: var(--es-surface); }
.card-header { background: transparent; border-bottom: 1px solid var(--es-line-soft); padding: .85rem 1.1rem; font-weight: 600; font-size: .95rem; }
.card-header:first-child { border-radius: var(--es-radius) var(--es-radius) 0 0; }
.card-body { padding: 1rem 1.1rem; }
.card-footer { background: #fafbfd; border-top: 1px solid var(--es-line-soft); }
.alert { border: 0; border-radius: 12px; box-shadow: var(--es-shadow); border-left: 4px solid currentColor; }
.alert-success { background: #ecfdf3; color: #067647; }
.alert-danger { background: #fef3f2; color: #b42318; }
.alert-warning { background: #fffaeb; color: #b54708; }
.alert-info { background: #eff8ff; color: #175cd3; }

/* controls */
.btn { border-radius: var(--es-radius-sm); font-weight: 500; padding: .42rem .9rem; transition: background .15s, box-shadow .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn-sm { border-radius: 8px; padding: .25rem .65rem; }
.btn-primary { background: var(--es-accent); border-color: var(--es-accent); box-shadow: 0 1px 2px rgba(37,99,235,.25); }
.btn-primary:hover, .btn-primary:focus { background: #1d4ed8; border-color: #1d4ed8; }
.btn-outline-primary { color: var(--es-accent); border-color: #bcd0fb; }
.btn-outline-primary:hover { background: var(--es-accent-soft); color: #1d4ed8; border-color: #9db9f7; }
.btn-outline-secondary { color: #344054; border-color: #d0d5dd; background: #fff; }
.btn-outline-secondary:hover { background: #f5f7fa; color: #172033; border-color: #c2c8d2; }
.form-control, .form-select { border-radius: var(--es-radius-sm); border-color: #d0d5dd; }
.form-control:focus, .form-select:focus, .btn:focus, .form-check-input:focus { border-color: #84a9f5; box-shadow: 0 0 0 4px rgba(37,99,235,.13); }
.form-control::placeholder { color: #98a2b3; }
.form-label { font-weight: 500; color: #344054; margin-bottom: .3rem; }
.form-text { color: var(--es-muted); }
.input-group > .btn { border-radius: 0 var(--es-radius-sm) var(--es-radius-sm) 0; }
.input-group-text { background: #f8f9fb; border-color: #d0d5dd; color: var(--es-muted); }
.form-check-input:checked { background-color: var(--es-accent); border-color: var(--es-accent); }
.form-switch .form-check-input { width: 2.3em; cursor: pointer; }

/* tables */
.table { --bs-table-hover-bg: #f6f8fc; }
.table > :not(caption) > * > * { border-color: var(--es-line-soft); }
.table-hover tbody tr { transition: background .1s; }
.es-table thead th, .table thead.table-light th { background: #f9fafc; color: var(--es-muted); }
.badge { border-radius: 999px; padding: .32em .65em; }

/* page header used by redesigned pages */
.es-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: 1.1rem; }
.es-page-head h3 { margin: 0; }
.es-eyebrow { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--es-muted); margin-bottom: .15rem; }
.es-section-title { display: flex; align-items: center; gap: .6rem; }
.es-section-icon { width: 2rem; height: 2rem; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--es-accent-soft); color: var(--es-accent); font-size: 1rem; flex: none; }
.es-section-sub { font-weight: 400; font-size: .8rem; color: var(--es-muted); }

/* settings layout: sticky section nav + content */
.es-settings { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.es-settings-nav { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: .1rem; }
.es-settings-nav a { color: #475467; text-decoration: none; padding: .45rem .7rem; border-radius: 9px; font-weight: 500; font-size: .86rem; }
.es-settings-nav a:hover { background: #e9eef7; color: var(--es-text); }
.es-settings-nav a.active { background: var(--es-surface); color: var(--es-accent); box-shadow: var(--es-shadow); }
.es-settings section { scroll-margin-top: 1rem; }
@media (max-width: 991.98px) {
  .es-settings { grid-template-columns: 1fr; }
  .es-settings-nav { position: static; flex-direction: row; flex-wrap: wrap; }
}
.es-savebar { position: sticky; bottom: 0; z-index: 5; margin-top: 1rem; padding: .75rem 1rem; background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px); border: 1px solid var(--es-line); border-radius: var(--es-radius); box-shadow: var(--es-shadow-lg);
  display: flex; align-items: center; gap: .75rem; }
.es-savebar .es-dirty { display: none; color: #b54708; font-size: .82rem; }
.es-savebar.dirty .es-dirty { display: inline; }

/* approval ladder (company thresholds) */
.es-ladder { display: flex; flex-wrap: wrap; align-items: stretch; gap: .5rem; margin-bottom: 1rem; }
.es-rung { position: relative; flex: 1 1 140px; min-width: 140px; border: 1px solid var(--es-line); border-radius: 12px; padding: .65rem .8rem;
  background: #fff; transition: border-color .15s, background .15s; }
.es-rung.on { border-color: #b7cdfa; background: linear-gradient(180deg, #f6f9ff, #fff); }
.es-rung.off { background: #fafbfc; color: #98a2b3; border-style: dashed; }
.es-rung .es-rung-role { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--es-muted); }
.es-rung .es-rung-amount { font-size: 1.1rem; font-weight: 650; margin-top: .1rem; }
.es-rung.off .es-rung-amount { font-size: .9rem; font-weight: 500; }
.es-rung .es-rung-note { font-size: .74rem; color: var(--es-muted); }
.es-rung .es-rung-off { position: absolute; top: .45rem; right: .5rem; border: 0; background: transparent; color: #98a2b3; font-size: .95rem; line-height: 1;
  padding: .1rem .3rem; border-radius: 6px; }
.es-rung .es-rung-off:hover { background: #fee4e2; color: #b42318; }
.es-rung:not(:last-child)::after { content: "\203A"; position: absolute; right: -.45rem; top: 50%; transform: translateY(-50%); color: #98a2b3;
  font-size: 1.2rem; z-index: 1; }
.es-composer { background: #f8fafd; border: 1px solid var(--es-line-soft); border-radius: 12px; padding: .75rem; }
.form-switch .form-check-label { margin-left: .4rem; }

/* ---------- invoice lock ---------- */
fieldset.es-lockable { min-width: 0; }
fieldset.es-lockable:disabled { opacity: .55; filter: grayscale(.6); cursor: not-allowed; }
fieldset.es-lockable:disabled .btn { pointer-events: none; }
.es-lock-banner { border-left-color: #f79009; }
.es-lock-icon { font-size: 1.1rem; }

/* ---------- bulk upload ---------- */
.es-route-preview { border-radius: 10px; padding: .55rem .7rem; border: 1px solid; }
.es-route-preview.ok { background: #ecfdf3; border-color: #abefc6; }
.es-route-preview.bad { background: #fffaeb; border-color: #fedf89; }
.es-route-title { font-weight: 600; font-size: .85rem; }
.es-route-steps { margin: .3rem 0 0; padding-left: 1.2rem; font-size: .85rem; }
.es-route-steps li { padding: .05rem 0; }
.es-upload-drop { border: 2px dashed #9fb3d1; border-radius: var(--es-radius); background: #f8fbff; padding: 2rem 1rem; text-align: center; cursor: pointer; transition: all .15s; }
.es-upload-drop:hover, .es-upload-drop.over { border-color: var(--es-accent); background: var(--es-accent-soft); }
.es-upload-drop .dz-icon { font-size: 2.2rem; line-height: 1; }
.es-upload-list td { vertical-align: middle; }
.es-upload-list .st-wait { color: #98a2b3; }
.es-upload-list .st-busy { color: var(--es-accent); }
.es-upload-list .st-ok { color: #067647; }
.es-upload-list .st-warn { color: #b54708; }
.es-upload-list .st-bad { color: #b42318; }
.es-pred-ok { color: #067647; }
.es-pred-bad { color: #b54708; }

/* ---------- AI usage chart ---------- */
.es-cost-chart { width: 100%; height: 150px; display: block; }
.es-chart-axis { stroke: #d0d5dd; stroke-width: 1; vector-effect: non-scaling-stroke; }
.es-chart-label { font-size: 9px; fill: #667085; }
.es-bar-fill { fill: #2563eb; }
.es-bar-hit { fill: transparent; }
.es-bar:hover .es-bar-fill { fill: #1d4ed8; }
.es-bar:hover .es-bar-hit { fill: rgba(37,99,235,.06); }
.es-chart-x { position: relative; height: 1.1rem; font-size: .72rem; color: #667085; }
.es-chart-x span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.es-chart-x span.first { transform: none; left: 0 !important; }
.es-chart-x span.last { transform: none; left: auto !important; right: 0; }

/* ---------- company settings (overrides) ---------- */
.es-co-setting.own { background: #f6f9ff; box-shadow: inset 3px 0 0 var(--es-accent); }
.es-co-setting .es-val:disabled { background: #f8f9fb; color: #98a2b3; }
.es-nav .nav-link { white-space: nowrap; }
.es-company-select { min-width: 11rem; }

/* ---------- queue PO column ---------- */
.es-po-cell { font-size: .8rem; }
.es-po-cell .font-monospace { font-size: .78rem; letter-spacing: -.01em; }
.queue-list .table td:nth-child(2) { max-width: 320px; }

/* ---------- queue page: one screen, frames scroll inside (large screens) ---------- */
@media (min-width: 992px) {
  .es-queue-page { overflow: hidden; }
  .es-queue-page > [class*="col-"] { height: 100%; display: flex; flex-direction: column; min-height: 0; }
  .es-queue-page .es-dept { max-height: 100%; display: flex; flex-direction: column; }
  .es-queue-page .es-dept-list { max-height: none; flex: 1 1 auto; min-height: 0; }
  .es-queue-mid { gap: 1rem; }
  .es-queue-listcard { flex: 1 1 55%; min-height: 0; display: flex; flex-direction: column; }
  .es-queue-listcard > .card-header, .es-queue-listcard > form, .es-queue-listcard > .es-queue-hint { flex: none; }
  .es-queue-listcard .queue-list { flex: 1 1 auto; min-height: 0; max-height: none; }
  .es-queue-details { flex: 0 1 45%; min-height: 120px; overflow-y: auto; }
  .es-preview-pane { height: 100%; display: flex; flex-direction: column; min-height: 0; }
  .es-preview-pane > * { flex: none; }
  .es-preview-pane > .preview-card { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .es-preview-pane .preview-card > * { flex: none; }
  .es-preview-pane .preview-pdf { flex: 1 1 auto; height: auto; min-height: 0; }
}
.es-queue-details .card-body { padding: .75rem 1rem; }
.es-details-head { margin-bottom: .4rem; }
.queue-list thead th { position: sticky; top: 0; z-index: 1; }
.preview-meta > div { overflow-wrap: anywhere; }
.preview-meta .text-muted + br + * { word-break: normal; }

/* a PO found in Business Craft: greyed out until AP presses Edit PO */
.es-po-locked { background-color: var(--bs-secondary-bg); color: var(--bs-secondary-color); cursor: not-allowed; }

/* invoice search in the menu bar */
.es-nav-search .form-control { background-color: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.25); width: 16rem; }
.es-nav-search .form-control::placeholder { color: rgba(255,255,255,.6); }
.es-nav-search .form-control:focus { background-color: #fff; color: #111; }
@media (max-width: 1399.98px) { .es-nav-search .form-control { width: 11rem; } }

/* ---------- queue page v1.36: list | invoice panel | PDF - each scrolls inside, no page scroll ---------- */
.es-queue-tabs { display: flex; flex-wrap: wrap; gap: .25rem; }
.es-queue-tab { font-size: .82rem; padding: .2rem .6rem; border-radius: 999px; border: 1px solid #dfe3ea; color: #1f2933; text-decoration: none; white-space: nowrap; }
.es-queue-tab:hover { background: #f1f4f9; color: #1f2933; }
.es-queue-tab.current { background: var(--es-navy); border-color: var(--es-navy); color: #fff; }
.es-queue-tab .count { font-size: .72rem; font-weight: 600; background: #eef1f6; color: #1f2933; border-radius: 999px; padding: 0 .4rem; margin-left: .2rem; }
.es-queue-tab .count.zero { background: transparent; color: #9aa1ab; }
.es-queue-tab.current .count { background: rgba(255,255,255,.22); color: #fff; }
.es-queue-pick { max-width: 22rem; }
.es-work-card { padding: .75rem .9rem; }
.es-work { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.es-work-head { padding-bottom: .5rem; margin-bottom: .5rem; border-bottom: 1px solid #edf0f4; }
.es-work-reason { background: #fff8e6; border-left: 3px solid #e0a400; border-radius: .25rem; padding: .35rem .55rem; }
.es-work-actions { margin-bottom: .5rem; }
.es-work-more > summary { list-style: none; }
.es-work-more > summary::-webkit-details-marker { display: none; }
.es-work-more[open] { flex-basis: 100%; }
.es-work-tabs { font-size: .85rem; flex: none; }
.es-work-tabs .nav-link { padding: .35rem .65rem; }
.es-work-body { padding-top: .6rem; }
.es-work-body .form-label { margin-bottom: .1rem; }
.timeline li.es-change > div:first-child strong { color: #8a5a00; }
.min-w-0 { min-width: 0; }
@media (min-width: 992px) {
  .es-queue-page > .es-queue-mid > .es-queue-listcard { flex: 1 1 auto; }
  .es-queue-work .es-work-card { height: 100%; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
  .es-queue-work .es-work-card > .es-work { flex: 1 1 auto; }
  .es-queue-work .es-work-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: .25rem; }
  .es-preview-pane > .es-pdf-part, .es-preview-pane > .card { flex: 1 1 auto; min-height: 0; }
  .es-wide-preview > .es-queue-mid { display: none !important; }
  .es-wide-preview > .es-queue-work { flex: 0 0 40%; max-width: 40%; }
  .es-wide-preview > .es-queue-right { flex: 1 1 0; max-width: none; }
}
.queue-list .table td.es-qrow { max-width: 0; width: 100%; padding-top: .45rem; padding-bottom: .45rem; } /* lets text-truncate work in the table */
.es-work-body .es-meta-actions { position: sticky; bottom: -1px; background: #fff; padding: .5rem 0 .25rem; border-top: 1px solid #edf0f4; z-index: 2; }
@media (max-width: 1399.98px) { .es-nav-search .form-control { width: 9.5rem; } }

/* View Logs pop-up */
.es-logs-btn { line-height: 1; text-decoration: none; }
.es-logs-list { position: relative; }
.es-log { display: flex; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid #f0f2f5; }
.es-log:last-child { border-bottom: 0; }
.es-log-icon { width: 1.4rem; text-align: center; flex: none; }
.es-log-body { min-width: 0; flex: 1; }
.es-log-change > .es-log-body > div:first-child strong { color: #8a5a00; }
.es-log-detail { overflow-wrap: anywhere; }
.es-log-text { background: #f7f8fa; border-radius: .25rem; padding: .35rem .5rem; white-space: pre-wrap; overflow-wrap: anywhere; }

/* accounting bills: one block per line - description on top, numbers and coding below */
.es-bill-lines .es-line { padding: .6rem .9rem; border-bottom: 1px solid #e9ecef; }
.es-bill-lines .es-line:last-child { border-bottom: 0; }
.es-bill-lines .es-line-flag { background: #fff8e1; }
.es-bill-lines .es-line-no { min-width: 1.5rem; padding-top: .3rem; font-size: .8rem; color: #6c757d; text-align: right; }
.es-line-grid { display: grid; grid-template-columns: 5rem 7rem 7rem minmax(10rem, 1.6fr) minmax(8rem, 1fr); gap: .5rem; margin: .4rem 2.4rem 0 2rem; }
.es-line-grid label { font-size: .72rem; color: #6c757d; display: flex; flex-direction: column; gap: .15rem; margin: 0; }
@media (max-width: 767.98px) {
    .es-line-grid { grid-template-columns: repeat(3, 1fr); margin-left: 0; margin-right: 0; }
    .es-line-grid label:nth-child(n+4) { grid-column: span 3; }
}

/* v1.46 - long lists: filter bar, pager, and tables that become stacked cards on phones */
.es-filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.es-filters .form-control, .es-filters .form-select { width: auto; }
.es-filters .es-filter-q { flex: 1 1 14rem; max-width: 22rem; }
.es-sort { color: inherit; text-decoration: none; white-space: nowrap; }
.es-sort:hover, .es-sort:focus-visible { text-decoration: underline; }
.es-chip { display: inline-block; font-size: .75rem; line-height: 1.3; padding: .05rem .45rem; border-radius: 999px; border: 1px solid #dfe3ea; background: #f8f9fb; color: #374151; white-space: nowrap; }
.es-chip.warn { background: #fff8e1; border-color: #f3d27a; color: #7a5a00; }
.es-chip.ms { background: #eef4ff; border-color: #c9dafc; color: #1d4ed8; }
.es-more-toggle { display: none; }
.es-filter-extra { display: contents; }
.es-filter-toggle { display: none; }
@media (max-width: 767.98px) {
    .es-filters .form-control, .es-filters .form-select { flex: 1 1 45%; }
    .es-filters .es-filter-q { flex: 1 1 10rem; max-width: none; }
    .es-filter-toggle { display: inline-block; }
    .es-filter-extra { display: none; }
    .es-filters.open .es-filter-extra { display: flex; flex-wrap: wrap; gap: .5rem; width: 100%; order: 5; }
    .es-stack thead { display: none; }
    .es-stack, .es-stack tbody, .es-stack tr, .es-stack td { display: block; width: 100%; }
    .es-stack tr { border: 1px solid #e5e7eb; border-radius: .6rem; margin: 0 0 .5rem; padding: .55rem .75rem; background: #fff; }
    .es-stack td { border: 0 !important; padding: .1rem 0 !important; }
    .es-stack td[data-label]::before { content: attr(data-label) ": "; color: #6b7280; font-size: .78rem; }
    .es-stack .es-more { display: none !important; }
    .es-stack tr.es-open .es-more { display: block !important; }
    .es-stack .es-more-toggle { display: inline-block; }
    .es-stack .es-actions { display: flex !important; gap: 1rem; align-items: center; padding-top: .35rem !important; }
    .es-stack .es-actions a, .es-stack .es-actions button { min-height: 2.25rem; display: inline-flex; align-items: center; }
    .card:has(> .table-responsive > .es-stack) { background: transparent; border: 0; box-shadow: none; }
}

/* v1.47 - bills: steps that scroll on phones, whole-row links, a sticky action bar clear of the phone's home bar */
.es-steps { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.es-steps .nav-link { white-space: nowrap; }
tr.es-row-link { position: relative; }
.es-row-link .es-above { position: relative; z-index: 2; }
.es-row-link:focus-within { outline: 2px solid var(--es-accent); outline-offset: -2px; }
.es-actionbar { padding-bottom: calc(.75rem + env(safe-area-inset-bottom)); }
.es-results summary { cursor: pointer; }
@media (max-width: 767.98px) {
    .es-bills tr { position: relative; padding-left: 2.4rem !important; }
    .es-bills .es-sel-cell { position: absolute !important; left: .75rem; top: .6rem; width: auto !important; }
    .es-bills .es-logs-cell { position: absolute !important; right: .75rem; top: .5rem; width: auto !important; }
    .es-bills .form-check-input { width: 1.25rem; height: 1.25rem; }
    .es-actionbar { margin-left: -.25rem; margin-right: -.25rem; }
}
.es-pdf-frame { height: 82vh; display: block; }
@media (max-width: 1199.98px) { .es-pdf-frame { height: 70vh; } }

/* v1.49 - company settings: each section's live state in the section list; sections fold away on phones */
.es-state { display: block; font-size: .72rem; font-weight: 400; color: #6b7280; line-height: 1.25; margin-top: .1rem; }
.es-state::before { content: "●"; margin-right: .3rem; font-size: .65rem; vertical-align: .05rem; color: #c3c8d1; }
.es-state-ok::before { color: var(--es-ok); }
.es-state-warn::before { color: #d48806; }
.es-state-bad::before { color: var(--es-bad); }
.es-state-bad { color: #b42318; }
.es-state-chip { margin: 0 0 0 auto; align-self: center; text-align: right; max-width: 45%; }
@media (max-width: 991.98px) {
    .es-settings-nav { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: thin; padding-bottom: .25rem; }
    .es-settings-nav a { white-space: nowrap; }
    .es-settings-nav .es-state { display: none; }
    .es-settings section > .es-section-title { cursor: pointer; }
    .es-settings section > .es-section-title::after { content: "▾"; margin-left: .5rem; color: #9aa1ad; align-self: center; transition: transform .15s; }
    .es-settings section.es-collapsed > .es-section-title::after { transform: rotate(-90deg); }
    .es-settings section.es-collapsed > :not(.es-section-title) { display: none !important; }
    .es-settings section.es-collapsed > .es-section-title { border-bottom: 0; }
}
