/* ============================================================
   CONQUER NATION — BROKER DASHBOARD
   Dark navy theme — denser data-heavy layout
   ============================================================ */

:root {
  --bg-base:        #050b18;
  --bg-deep:        #07101f;
  --bg-panel:       #0d1b30;
  --bg-panel-soft:  #112644;
  --bg-elevated:    #16304f;
  --bg-row-hover:   #102036;

  --line:           rgba(255, 255, 255, 0.08);
  --line-strong:    rgba(255, 255, 255, 0.14);

  --text:           #e8eef7;
  --text-muted:     #8ea2bf;
  --text-soft:      #5d7493;

  --accent:         #4d9eff;
  --accent-bright:  #6fb4ff;
  --accent-deep:    #1a6fd9;
  --accent-glow:    rgba(77, 158, 255, 0.35);

  --good:           #22c55e;
  --good-soft:      rgba(34, 197, 94, 0.12);
  --warn:           #f59e0b;
  --warn-soft:      rgba(245, 158, 11, 0.12);
  --bad:            #ef4444;
  --bad-soft:       rgba(239, 68, 68, 0.12);

  --money:          #c4f0d3;

  --font-sans:      'Sora', system-ui, sans-serif;
  --font-mono:      'JetBrains Mono', 'SF Mono', monospace;

  --radius-sm:      8px;
  --radius:         14px;
  --radius-lg:      20px;

  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, 0.7),
               0 10px 30px -10px rgba(77, 158, 255, 0.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(26, 111, 217, 0.18) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(77, 158, 255, 0.08) 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-base) 0%, var(--bg-deep) 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; }

/* ===== BACKGROUND ===== */
.bg-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}
.bg-glow {
  position: fixed; pointer-events: none; z-index: 0;
  width: 600px; height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.5;
}
.bg-glow--1 { top: -200px; left: -200px; background: var(--accent-deep); }
.bg-glow--2 { bottom: -200px; right: -200px; background: #2c4d8c; opacity: 0.3; }

/* ===== HEADER ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 36px;
  /* Blends into body — subtle top-glow gradient, no bottom border */
  background:
    linear-gradient(180deg,
      rgba(91, 161, 255, 0.06) 0%,
      rgba(91, 161, 255, 0.02) 40%,
      transparent 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: none;
}
.brand {
  display: flex; align-items: center; gap: 14px;
}
.brand__logo {
  height: 36px;
  width: auto;
  filter: brightness(1.1);
}
.brand__pill {
  padding: 4px 10px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--warn);
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
}
.brand__pill--readonly {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--bad);
}

.site-nav {
  display: flex; align-items: center; gap: 20px;
}
.site-nav__meta {
  display: flex; flex-direction: column; align-items: flex-end;
}
.meta-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.meta-value {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.refresh-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: white;
  font-weight: 600;
  font-size: 13px;
  border-radius: 100px;
  box-shadow: 0 4px 16px var(--accent-glow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.refresh-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--accent-glow);
}
.refresh-btn:active { transform: translateY(0); }
.refresh-btn[disabled] { opacity: 0.6; cursor: not-allowed; transform: none; }
.refresh-btn.spinning .refresh-icon {
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== LAYOUT ===== */
.view {
  position: relative; z-index: 1;
  flex: 1;
  padding: 32px 36px 48px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  animation: fadeIn 0.5s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== HERO ===== */
.hero { margin-bottom: 28px; }
.hero__head { margin-bottom: 24px; }
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  background: rgba(77, 158, 255, 0.08);
  border: 1px solid rgba(77, 158, 255, 0.2);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-bright);
  margin-bottom: 14px;
}
.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-bright);
  box-shadow: 0 0 12px var(--accent-bright);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.hero__title {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* ===== KPIs ===== */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.kpi {
  padding: 20px 22px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}
.kpi:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}
.kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: var(--text-muted);
}
.kpi--accent::before { background: var(--accent); }
.kpi--money::before  { background: var(--good); }
.kpi--warn::before   { background: var(--warn); }

.kpi__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 12px;
}
.kpi__value {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}
.kpi--money .kpi__value { color: var(--money); }
.kpi--warn .kpi__value  { color: var(--warn); }
.kpi__sub {
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 8px;
}

/* ===== CONTROLS ===== */
.controls {
  display: flex; gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.controls__search {
  flex: 1; min-width: 280px;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text-muted);
  transition: border-color 0.2s;
}
.controls__search:focus-within { border-color: var(--accent); }
.controls__search input {
  background: none; border: none; outline: none;
  color: var(--text);
  font-size: 14px;
  flex: 1;
}
.controls__search input::placeholder { color: var(--text-soft); }

.filters { display: flex; gap: 10px; }
.filter-select {
  padding: 12px 18px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%238ea2bf' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.filter-select:hover { border-color: var(--line-strong); }
.filter-select:focus { border-color: var(--accent); outline: none; }
.filter-select option {
  background: var(--bg-panel);
  color: var(--text);
}

/* ===== TABLE ===== */
.table-wrap {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.table-scroll {
  overflow-x: auto;
  max-width: 100%;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table thead {
  background: var(--bg-panel-soft);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1;
}
.table th {
  padding: 14px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.table th[data-sort]:hover { color: var(--text); }
.table th.num { text-align: right; }
.table th.sorted-asc::after,
.table th.sorted-desc::after {
  content: '';
  display: inline-block;
  margin-left: 6px;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}
.table th.sorted-asc::after  { border-bottom: 5px solid var(--accent-bright); }
.table th.sorted-desc::after { border-top: 5px solid var(--accent-bright); }

.table tbody tr {
  border-bottom: 1px solid var(--line);
  transition: background 0.15s;
  cursor: pointer;
}
.table tbody tr:last-child { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-row-hover); }

.table td {
  padding: 14px 16px;
  color: var(--text);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.table td.num { text-align: right; font-family: var(--font-mono); }
.table td.muted { color: var(--text-soft); }
.table td.reference {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-bright);
}
.table td.invoice {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}
.table td.money {
  color: var(--money);
  font-weight: 600;
}
.table td.status-cell { white-space: nowrap; }

.row-arrow {
  display: inline-flex;
  width: 24px; height: 24px;
  align-items: center; justify-content: center;
  border-radius: 6px;
  color: var(--text-soft);
  transition: all 0.15s;
}
.table tbody tr:hover .row-arrow {
  background: var(--accent-deep);
  color: white;
}

.status-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.status-pill--good { background: var(--good-soft); color: var(--good); }
.status-pill--warn { background: var(--warn-soft); color: var(--warn); }
.status-pill--bad  { background: var(--bad-soft); color: var(--bad); }
.status-pill--neutral { background: rgba(255,255,255,0.06); color: var(--text-muted); }

.status-bar {
  display: inline-flex; gap: 4px; align-items: center;
}
.status-bar__seg {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}
.status-bar__seg.returned  { background: var(--good-soft); color: var(--good); }
.status-bar__seg.in-transit { background: var(--warn-soft); color: var(--warn); }

.table-empty {
  padding: 64px 32px;
  text-align: center;
  color: var(--text-soft);
  font-size: 14px;
}

/* ===== DRAWER (detail view) ===== */
.drawer {
  position: fixed; inset: 0; z-index: 100;
  animation: fadeIn 0.2s ease-out;
}
.drawer__overlay {
  position: absolute; inset: 0;
  background: rgba(5, 11, 24, 0.7);
  backdrop-filter: blur(8px);
}
.drawer__panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(1200px, 95vw);
  background: var(--bg-deep);
  border-left: 1px solid var(--line-strong);
  box-shadow: -30px 0 80px -20px rgba(0, 0, 0, 0.6);
  display: flex; flex-direction: column;
  animation: slideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideIn {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

.drawer__head {
  padding: 28px 32px 24px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.drawer__close {
  position: absolute;
  top: 24px; right: 24px;
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  transition: all 0.15s;
}
.drawer__close:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}
.drawer__tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-bright);
  margin-bottom: 6px;
}
.drawer__ref {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.drawer__sub {
  font-size: 14px;
  color: var(--text-muted);
}
.drawer__divider {
  margin: 0 10px;
  color: var(--text-soft);
}

.drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px 32px;
}

/* Totals card */
.totals {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin-bottom: 24px;
}
.totals__head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 16px;
}
.totals__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px 22px;
  margin-bottom: 18px;
}
.totals__item {
  display: flex; flex-direction: column; gap: 4px;
}
.totals__item-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  text-transform: uppercase;
}
.totals__item-val {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.totals__item-val.empty { color: var(--text-soft); font-weight: 400; }
.totals__grand {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.totals__grand > span:first-child {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.totals__grand-val {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--money);
  letter-spacing: -0.01em;
}

/* Container detail table */
.containers__head {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 12px;
}
.containers__head h3 {
  font-size: 16px;
  font-weight: 600;
}
.containers__count {
  padding: 3px 10px;
  background: rgba(77, 158, 255, 0.12);
  color: var(--accent-bright);
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}
.containers__scroll {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
}
.ctable {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.ctable thead {
  background: var(--bg-panel-soft);
  border-bottom: 1px solid var(--line);
}
.ctable th {
  padding: 12px 12px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
  white-space: nowrap;
}
.ctable th.num { text-align: right; }
.ctable tbody tr {
  border-bottom: 1px solid var(--line);
}
.ctable tbody tr:last-child { border-bottom: none; }
.ctable tbody tr:hover { background: rgba(255,255,255,0.02); }
.ctable td {
  padding: 10px 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.ctable td.num { text-align: right; font-family: var(--font-mono); }
.ctable td.muted { color: var(--text-soft); }
.ctable td.container-no {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-bright);
}
.ctable td.money { color: var(--money); font-family: var(--font-mono); font-weight: 600; }

/* ===== REFRESH OVERLAY ===== */
.refresh-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(5, 11, 24, 0.85);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s;
}
.refresh-overlay__card {
  background: var(--bg-elevated);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 40px 56px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  min-width: 440px;
}
.refresh-overlay__spinner {
  width: 48px; height: 48px;
  border: 3px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}
.refresh-overlay__title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
}
.refresh-overlay__steps {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 18px;
  text-align: left;
}
.refresh-step {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-muted);
  transition: all 0.3s;
}
.refresh-step.active {
  background: rgba(77, 158, 255, 0.1);
  color: var(--text);
}
.refresh-step.done {
  color: var(--good);
}
.refresh-step__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-soft);
  flex-shrink: 0;
}
.refresh-step.active .refresh-step__dot {
  background: var(--accent-bright);
  box-shadow: 0 0 10px var(--accent-bright);
  animation: pulse 1.5s ease-in-out infinite;
}
.refresh-step.done .refresh-step__dot { background: var(--good); }
.refresh-overlay__hint {
  font-size: 12px;
  color: var(--text-soft);
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 300;
  padding: 14px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 380px;
}
.toast--ok { border-left: 3px solid var(--good); }
.toast--err { border-left: 3px solid var(--bad); }
@keyframes toastIn {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ===== FOOTER ===== */
.site-footer {
  position: relative; z-index: 1;
  padding: 18px 36px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px;
  color: var(--text-soft);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .site-header { padding: 14px 16px; }
  .refresh-btn__label { display: none; }
  .refresh-btn { padding: 10px; }
  .site-nav__meta { display: none; }
  .view { padding: 20px 16px 32px; }
  .hero__title { font-size: 24px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi__value { font-size: 22px; }
  .controls { flex-direction: column; }
  .filters { flex-wrap: wrap; }
  .drawer__panel { width: 100vw; }
  .drawer__head { padding: 20px 20px 18px; }
  .drawer__body { padding: 16px 20px 24px; }
  .drawer__ref { font-size: 26px; }
  .refresh-overlay__card { min-width: 0; width: calc(100vw - 32px); padding: 32px 24px; }
  .site-footer { padding: 16px; flex-direction: column; gap: 6px; }
}

/* ============================================================
   OPERATIONS PAGE — Access World risk dashboard
   ============================================================ */

/* ----- Tab navigation ----- */
.page-tabs {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 4px;
  padding: 0 48px;
  margin-top: -12px;
  margin-bottom: 12px;
  border-bottom: none;
}
.page-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  background: transparent;
  border: none;
  color: var(--text-soft);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: color 0.15s;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.page-tab:hover { color: var(--text); }
.page-tab.is-active {
  color: var(--accent-bright);
  border-bottom-color: var(--accent);
}
.page-tab svg { opacity: 0.85; }
.page-tab__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  background: var(--bad);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 9px;
  margin-left: 2px;
}
@media (max-width: 700px) {
  .page-tabs { padding: 0 20px; overflow-x: auto; }
}

/* ----- Ops KPI cards ----- */
.ops-kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-top: 20px;
}
.ops-kpi {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  font-family: inherit;
  color: inherit;
}
.ops-kpi:hover { transform: translateY(-2px); }
.ops-kpi.is-active {
  background: var(--bg-panel-soft);
  border-color: rgba(91,161,255,0.4);
  box-shadow: 0 0 0 1px rgba(91,161,255,0.25);
}
.ops-kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--text-muted);
}
.ops-kpi__icon {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.ops-kpi__body { min-width: 0; flex: 1; }
.ops-kpi__value {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}
.ops-kpi__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 2px;
}
.ops-kpi__sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Tone-specific styling */
.ops-kpi--critical::before { background: var(--bad); }
.ops-kpi--critical .ops-kpi__icon { background: rgba(255,90,90,0.14); color: var(--bad); }
.ops-kpi--critical .ops-kpi__value { color: var(--bad); }

.ops-kpi--high::before { background: var(--warn); }
.ops-kpi--high .ops-kpi__icon { background: rgba(255,176,79,0.14); color: var(--warn); }
.ops-kpi--high .ops-kpi__value { color: var(--warn); }

.ops-kpi--medium::before { background: #f5d23b; }
.ops-kpi--medium .ops-kpi__icon { background: rgba(245,210,59,0.14); color: #f5d23b; }
.ops-kpi--medium .ops-kpi__value { color: #f5d23b; }

.ops-kpi--info::before { background: var(--accent-bright); }
.ops-kpi--info .ops-kpi__icon { background: rgba(91,161,255,0.14); color: var(--accent-bright); }
.ops-kpi--info .ops-kpi__value { color: var(--accent-bright); }

.ops-kpi--hot::before { background: #d946ef; }
.ops-kpi--hot .ops-kpi__icon { background: rgba(217,70,239,0.14); color: #d946ef; }
.ops-kpi--hot .ops-kpi__value { color: #d946ef; }

.ops-kpi--stuck::before { background: #94a3b8; }
.ops-kpi--stuck .ops-kpi__icon { background: rgba(148,163,184,0.14); color: #94a3b8; }
.ops-kpi--stuck .ops-kpi__value { color: #94a3b8; }

@media (max-width: 1100px) { .ops-kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px)  { .ops-kpis { grid-template-columns: repeat(2, 1fr); } }

/* ----- Aging section ----- */
.aging-section {
  margin-top: 24px;
  padding: 18px 20px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.aging-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.aging-section__title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.aging-section__total {
  font-size: 13px;
  color: var(--text-soft);
}
.aging-section__total strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 700;
  margin-right: 4px;
}
.aging-bar {
  display: flex;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255,255,255,0.04);
  margin-bottom: 12px;
}
.aging-bar__seg {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(0,0,0,0.7);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  transition: width 0.4s ease, opacity 0.2s;
  min-width: 0;
  overflow: hidden;
}
.aging-bar__seg:hover { opacity: 0.85; }
.aging-bar__seg--neutral  { background: #4b5563; color: rgba(255,255,255,0.85); }
.aging-bar__seg--good     { background: var(--good); }
.aging-bar__seg--info     { background: var(--accent-bright); }
.aging-bar__seg--medium   { background: #f5d23b; }
.aging-bar__seg--critical { background: var(--bad); color: rgba(255,255,255,0.95); }
.aging-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.aging-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-soft);
}
.aging-legend__dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}
.aging-legend__item--neutral  .aging-legend__dot { background: #4b5563; }
.aging-legend__item--good     .aging-legend__dot { background: var(--good); }
.aging-legend__item--info     .aging-legend__dot { background: var(--accent-bright); }
.aging-legend__item--medium   .aging-legend__dot { background: #f5d23b; }
.aging-legend__item--critical .aging-legend__dot { background: var(--bad); }
.aging-legend__count {
  font-family: var(--font-mono);
  color: var(--text);
  font-weight: 600;
}

/* ----- Controls (search + active filter) ----- */
.ops-controls {
  display: flex;
  gap: 16px;
  align-items: center;
  margin: 20px 0 12px;
}
.ops-controls__search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text-soft);
}
.ops-controls__search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}
.ops-controls__search input::placeholder { color: var(--text-muted); }
.ops-active-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.ops-active-filter__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
}
.ops-active-filter__clear {
  background: none;
  border: 1px solid var(--line);
  color: var(--text-soft);
  border-radius: 50%;
  width: 22px; height: 22px;
  display: inline-flex;
  align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ops-active-filter__clear:hover { background: rgba(255,255,255,0.06); color: var(--text); }

/* ----- Table ----- */
.ops-table-wrap {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.ops-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ops-table thead {
  background: var(--bg-panel-soft);
  border-bottom: 1px solid var(--line);
}
.ops-th {
  padding: 12px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
  white-space: nowrap;
  user-select: none;
}
.ops-th--sortable {
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ops-th--sortable:hover { color: var(--text); background: rgba(255,255,255,0.025); }
.ops-th__label { display: inline-block; vertical-align: middle; }
.ops-th__sort {
  display: inline-block;
  margin-left: 6px;
  vertical-align: middle;
  opacity: 0.35;
  transition: opacity 0.15s;
}
.ops-th--sortable:hover .ops-th__sort { opacity: 0.7; }
.ops-th__sort-up, .ops-th__sort-down { fill: currentColor; opacity: 0.5; }
.ops-th--sort-asc { color: var(--accent-bright); }
.ops-th--sort-asc .ops-th__sort { opacity: 1; }
.ops-th--sort-asc .ops-th__sort-up { opacity: 1; }
.ops-th--sort-asc .ops-th__sort-down { opacity: 0.25; }
.ops-th--sort-desc { color: var(--accent-bright); }
.ops-th--sort-desc .ops-th__sort { opacity: 1; }
.ops-th--sort-desc .ops-th__sort-down { opacity: 1; }
.ops-th--sort-desc .ops-th__sort-up { opacity: 0.25; }

.ops-tr {
  transition: background 0.18s ease;
  opacity: 0;
  animation: opsRowIn 0.4s ease forwards;
}
.ops-tr:nth-child(even) { background: rgba(255,255,255,0.012); }
.ops-tr:hover { background: rgba(91,161,255,0.06); }
.ops-tr--critical { box-shadow: inset 3px 0 0 0 var(--bad); }
.ops-tr--high     { box-shadow: inset 3px 0 0 0 var(--warn); }
.ops-tr--medium   { box-shadow: inset 3px 0 0 0 #f5d23b; }
.ops-tr--stuck    { box-shadow: inset 3px 0 0 0 #94a3b8; }
@keyframes opsRowIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ops-table td {
  padding: 12px 14px;
  white-space: nowrap;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.ops-table td.muted { color: var(--text-soft); }
.ops-table td.mono { font-family: var(--font-mono); font-size: 12px; }
.col-container { font-family: var(--font-mono); font-weight: 600; }
.col-container .mono { color: var(--accent-bright); }
.col-project a {
  color: var(--accent-bright);
  font-family: var(--font-mono);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.15s;
}
.col-project a:hover { border-bottom-color: var(--accent-bright); }
.col-num { font-family: var(--font-mono); }
.col-date { font-family: var(--font-mono); }
.col-flags { white-space: normal; max-width: 280px; }

.dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  background: var(--text-muted);
}
.dot--critical { background: var(--bad);  box-shadow: 0 0 8px rgba(255,90,90,0.6); }
.dot--high     { background: var(--warn); box-shadow: 0 0 8px rgba(255,176,79,0.5); }
.dot--medium   { background: #f5d23b;     box-shadow: 0 0 8px rgba(245,210,59,0.5); }
.dot--info     { background: var(--accent-bright); box-shadow: 0 0 8px rgba(91,161,255,0.5); }
.dot--hot      { background: #d946ef;     box-shadow: 0 0 8px rgba(217,70,239,0.5); }
.dot--stuck    { background: #94a3b8;     box-shadow: 0 0 8px rgba(148,163,184,0.4); }
.dot--neutral  { background: var(--text-muted); }

.days {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}
.days--neg     { background: rgba(255,90,90,0.14);  color: var(--bad); }
.days--warn    { background: rgba(255,176,79,0.14); color: var(--warn); }
.days--neutral { background: rgba(245,210,59,0.12); color: #f5d23b; }
.days--ok      { background: rgba(56,210,140,0.12); color: var(--good); }

/* ----- Flag chips ----- */
.flag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin: 2px 4px 2px 0;
  white-space: nowrap;
}
.flag-chip__icon {
  width: 11px; height: 11px;
  display: inline-flex;
  align-items: center; justify-content: center;
}
.flag-chip__icon svg { width: 100%; height: 100%; display: block; }
.flag-chip--critical { background: rgba(255,90,90,0.14);  color: var(--bad); }
.flag-chip--high     { background: rgba(255,176,79,0.14); color: var(--warn); }
.flag-chip--medium   { background: rgba(245,210,59,0.14); color: #f5d23b; }
.flag-chip--info     { background: rgba(91,161,255,0.14); color: var(--accent-bright); }
.flag-chip--hot      { background: rgba(217,70,239,0.16); color: #e879f9; }
.flag-chip--stuck    { background: rgba(148,163,184,0.16); color: #cbd5e1; }

/* ----- Empty state ----- */
.ops-empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--text-soft);
}
.ops-empty svg {
  margin-bottom: 12px;
  color: var(--good);
}

/* ----- Pagination (shared) ----- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--bg-panel-soft);
  font-size: 12px;
  flex-wrap: wrap;
  gap: 12px;
}
.pagination__info { color: var(--text-soft); font-variant-numeric: tabular-nums; }
.pagination__controls { display: flex; align-items: center; gap: 18px; }
.pagination__pp { display: flex; align-items: center; gap: 8px; color: var(--text-soft); }
.pagination__pp select {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.pagination__pp select:hover { border-color: var(--line-strong); }
.pagination__nav { display: flex; align-items: center; gap: 4px; }
.pag-btn {
  min-width: 30px; height: 30px;
  padding: 0 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pag-btn:not(:disabled):hover { background: rgba(255,255,255,0.04); color: var(--text); }
.pag-btn.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pag-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.pag-btn--icon { font-size: 16px; line-height: 1; }
.pag-dots { color: var(--text-muted); padding: 0 4px; }

@media (max-width: 700px) {
  .pagination { flex-direction: column; align-items: stretch; }
  .pagination__controls { justify-content: space-between; }
  .ops-controls { flex-direction: column; align-items: stretch; }
  .col-flags { max-width: none; }
}

/* ----- Data quality banner ----- */
.data-issue-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  margin-top: 16px;
  background: rgba(148,163,184,0.08);
  border: 1px solid rgba(148,163,184,0.25);
  border-left: 3px solid #94a3b8;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
}
.data-issue-banner__icon {
  flex-shrink: 0;
  color: #cbd5e1;
}
.data-issue-banner__body { flex: 1; line-height: 1.5; }
.data-issue-banner__body strong { color: var(--text); }
.data-issue-banner__body code {
  background: rgba(255,255,255,0.06);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.data-issue-banner__link {
  background: none;
  border: none;
  color: var(--accent-bright);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  padding: 0;
  margin-left: 4px;
}
.data-issue-banner__link:hover { text-decoration: underline; }

/* Bad LFD indicator in table */
.lfd-bad {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(148,163,184,0.18);
  color: #cbd5e1;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  cursor: help;
}