:root {
  --bg: #f4f7fa;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #111827;
  --muted: #64748b;
  --line: #d9e2ea;
  --nav: #172331;
  --teal: #0f766e;
  --blue: #2563eb;
  --green: #15803d;
  --amber: #b45309;
  --red: #b91c1c;
  --violet: #6d5bd0;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 8px 20px rgba(15, 23, 42, 0.06);
  --ring: rgba(37, 99, 235, 0.18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button, input, select { font: inherit; }
input, select, textarea { max-width: 100%; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  box-shadow: 0 10px 28px rgba(18, 32, 47, 0.08);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  font-weight: 900;
}

.brand-logo-mark {
  overflow: hidden;
  background: #111827;
}

.brand-logo-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand strong, .brand span { display: block; }
.brand span { color: var(--muted); font-size: 12px; margin-top: 3px; }

.nav {
  display: flex;
  flex: 1;
  gap: 8px;
  justify-content: center;
}

.nav-item {
  width: auto;
  display: grid;
  grid-template-columns: 24px auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: #516274;
  text-align: left;
  font-weight: 750;
}

.nav-item span {
  color: #8a9bad;
  font-size: 11px;
  font-weight: 900;
}

.nav-item:hover { background: #f3f7fb; }
.nav-item.active { background: var(--blue); border-color: var(--blue); color: white; }
.nav-item.active span { color: #dbeafe; }

.source-box {
  margin-top: 0;
  min-width: 230px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafc;
}

.source-box .label, .source-box small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.source-box strong { display: block; margin: 7px 0; }
.source-box strong.negative { color: var(--red); }
.source-box strong.positive { color: var(--green); }

.workspace {
  margin-left: 0;
  min-height: 100vh;
  padding: 22px;
  max-width: 1640px;
  margin-right: auto;
  margin-left: auto;
}

.topbar {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  min-height: 74px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
}

.topbar h1 { font-size: 27px; letter-spacing: 0; }
.topbar p, .panel-heading p, .muted { color: var(--muted); }
.topbar p, .panel-heading p { margin-top: 4px; font-size: 13px; }

.top-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.company-select-wrap {
  display: grid;
  gap: 4px;
  min-width: 190px;
}

.company-select-wrap span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.company-select-wrap select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 34px 0 12px;
  background: white;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  font-size: 12px;
  font-weight: 850;
}

.status-badge.ok { color: var(--green); border-color: rgba(22, 131, 79, 0.25); }
.status-badge.warn, .status-badge.checking { color: var(--amber); border-color: rgba(183, 121, 31, 0.25); }
.status-badge.neutral { color: var(--blue); border-color: rgba(37, 99, 235, 0.20); }

.icon-button {
  width: 38px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.session-button {
  min-height: 38px;
  border: 1px solid #111827;
  border-radius: 8px;
  padding: 0 15px;
  background: #111827;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.14);
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(7, minmax(96px, 1fr)) minmax(260px, 1.65fr);
  gap: 10px;
  padding: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 9px 28px rgba(18, 32, 47, 0.07);
}

.toolbar label { display: grid; gap: 5px; }
.toolbar .wide { min-width: 0; }
.toolbar span, .stat-label, .label { color: var(--muted); font-size: 12px; }

.toolbar input, .toolbar select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: white;
  color: var(--ink);
}

.view { display: none; }
.view.active { display: block; }

.operator-grid {
  display: grid;
  grid-template-columns: minmax(280px, .72fr) minmax(520px, 1.28fr);
  gap: 16px;
}

.operator-hero {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr);
  gap: 16px;
  align-items: stretch;
  min-height: 178px;
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.operator-hero h2 {
  margin-top: 8px;
  font-size: 30px;
}

.operator-hero p {
  margin-top: 8px;
  max-width: 620px;
  color: var(--muted);
  line-height: 1.45;
}

#operator-import-panel,
#operator-bank-panel,
#operator-import-preview-panel {
  grid-column: 1;
}

.operator-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.mini-stat {
  min-height: 124px;
  padding: 14px;
  border: 1px solid #e7eef4;
  border-top: 4px solid var(--teal);
  border-radius: 8px;
  background: var(--surface-soft);
}

.mini-stat,
.stat-card,
.operation-card,
.approval-metric,
.analysis-box,
.queue-footer-block,
.compact-item,
.source-item,
.timeline-item {
  min-width: 0;
  overflow-wrap: anywhere;
}

.mini-stat.green { border-top-color: var(--green); }
.mini-stat.red { border-top-color: var(--red); }
.mini-stat.amber { border-top-color: var(--amber); }
.mini-stat.teal { border-top-color: var(--teal); }
.mini-stat span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.mini-stat strong {
  display: block;
  margin-top: 10px;
  font-size: 24px;
}
.mini-stat small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.35;
}

.operator-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 16px;
}

.operator-status-grid div {
  min-height: 82px;
  padding: 12px;
  border: 1px solid #e7eef4;
  border-radius: 8px;
  background: var(--surface-soft);
}

.operator-status-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.operator-status-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 15px;
}

.operator-wide {
  display: flex;
  flex-direction: column;
  grid-column: 2;
  grid-row: 2 / span 3;
  min-height: calc(100vh - 190px);
}
.operator-wide .panel-heading { flex: 0 0 auto; }
.operator-wide .operator-table {
  flex: 0 1 auto;
  max-height: calc(100vh - 450px);
  min-height: 0;
}
.operator-queue-footer {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  min-height: 220px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: #f7fafc;
}

.queue-footer-block {
  min-height: 100%;
  padding: 12px;
  border: 1px solid #e0e8ef;
  border-radius: 8px;
  background: white;
}

.queue-footer-block h3 {
  margin-bottom: 8px;
  font-size: 12px;
  color: #405064;
  text-transform: uppercase;
}

.queue-footer-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #edf2f7;
}

.queue-footer-line:last-child { border-bottom: 0; }
.queue-footer-line small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.queue-footer-line strong {
  min-width: 84px;
  text-align: right;
  font-size: 12px;
}
.compact-action {
  min-height: 34px;
  padding: 0 12px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(175px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.cockpit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .8fr);
  gap: 16px;
  margin-bottom: 16px;
}

.operation-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 16px;
}

.operation-card {
  min-height: 98px;
  padding: 12px;
  border: 1px solid #e7eef4;
  border-top: 3px solid var(--teal);
  border-radius: 8px;
  background: var(--surface-soft);
}

.operation-card.green { border-top-color: var(--green); }
.operation-card.amber { border-top-color: var(--amber); }
.operation-card.red { border-top-color: var(--red); }
.operation-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.operation-card strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

.operation-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.mini-timeline {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.mini-event {
  padding: 10px 12px;
  border-left: 3px solid var(--blue);
  border-radius: 6px;
  background: var(--surface-soft);
}

.mini-event strong {
  display: block;
  font-size: 12px;
}

.mini-event span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.stat-card {
  min-height: 122px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.stat-card[data-tone="green"] { border-left-color: var(--green); }
.stat-card[data-tone="red"] { border-left-color: var(--red); }
.stat-card[data-tone="amber"] { border-left-color: var(--amber); }
.stat-card[data-tone="teal"] { border-left-color: var(--teal); }

.stat-value {
  margin-top: 9px;
  font-size: 25px;
  font-weight: 900;
}

.stat-hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.dashboard-grid, .import-grid, .source-layout {
  display: grid;
  gap: 16px;
}

.dashboard-grid { grid-template-columns: 1fr; }
.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}
.decision-sidebar {
  display: grid;
  gap: 16px;
  align-content: start;
}
.import-grid, .source-layout { grid-template-columns: minmax(0, 1fr) 420px; margin-bottom: 16px; }

.data-panel, .diagram-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 { font-size: 15px; }
.compact-heading { padding: 14px; }

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.analysis-box {
  min-height: 236px;
  padding: 14px;
  border: 1px solid #e7eef4;
  border-radius: 8px;
  background: var(--surface-soft);
}

.analysis-box h3 {
  margin-bottom: 10px;
  font-size: 13px;
  text-transform: uppercase;
  color: #405064;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #e4ebf1;
}

.metric-row:last-child { border-bottom: 0; }
.metric-row small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.metric-row strong { font-size: 13px; text-align: right; }

.bar {
  height: 7px;
  overflow: hidden;
  margin: 1px 0 7px;
  border-radius: 99px;
  background: #e2e8f0;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--amber));
}

.risk-line {
  display: grid;
  grid-template-columns: 82px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid #e4ebf1;
}

.risk-line small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.risk-line b { font-size: 12px; text-align: right; }

.segmented {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3f7;
}

.segmented button {
  border: 0;
  border-radius: 6px;
  padding: 7px 10px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.segmented button.active {
  background: white;
  color: var(--ink);
  box-shadow: 0 2px 7px rgba(18, 32, 47, 0.10);
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 430px);
}

.import-table { max-height: 420px; }

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 12px;
  text-align: left;
  color: var(--muted);
  background: #f7fafc;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  text-transform: uppercase;
}

td {
  padding: 11px 12px;
  border-bottom: 1px solid #edf2f7;
  vertical-align: top;
}

tbody tr:hover { background: #f8fbfc; }
.company-row td {
  position: sticky;
  top: 38px;
  z-index: 1;
  background: #eaf1f6;
  color: #223345;
  font-weight: 900;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.company-row span {
  margin-left: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.num { text-align: right; font-variant-numeric: tabular-nums; }
.strong { font-weight: 800; }

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  border: 1px solid transparent;
}

.pill.green { color: var(--green); background: rgba(22, 131, 79, 0.11); }
.pill.red { color: var(--red); background: rgba(194, 65, 53, 0.11); }
.pill.amber { color: var(--amber); background: rgba(183, 121, 31, 0.13); }
.pill.neutral { color: var(--muted); background: #edf2f7; }
.pill.teal { color: var(--teal); background: rgba(15, 139, 141, 0.11); }
.pill.reason-red { color: var(--red); background: rgba(194, 65, 53, 0.13); }
.pill.reason-yellow { color: var(--amber); background: rgba(183, 121, 31, 0.15); }
.pill.reason-orange { color: #c05621; background: rgba(234, 88, 12, 0.14); }
.pill.reason-blue { color: var(--blue); background: rgba(37, 99, 235, 0.12); }
.pill.reason-dark { color: #172331; background: rgba(23, 35, 49, 0.14); }
.pill.reason-neutral { color: #516274; background: #edf2f7; }

.import-drop {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 10px;
  padding: 16px;
  align-items: center;
}

.import-drop p { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.import-drop input {
  min-height: 42px;
  padding: 9px;
  border: 1px dashed #b9c8d6;
  border-radius: 8px;
  background: #f9fbfd;
}

.primary-button {
  min-height: 42px;
  border: 1px solid var(--blue);
  border-radius: 8px;
  background: var(--blue);
  color: white;
  font-weight: 900;
}

.primary-button:disabled { opacity: .65; cursor: wait; }

.import-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 0 16px 16px;
}

.import-summary div {
  padding: 12px;
  border: 1px solid #e7eef4;
  border-radius: 8px;
  background: var(--surface-soft);
}

.import-summary span { display: block; color: var(--muted); font-size: 11px; }
.import-summary strong { display: block; margin-top: 5px; font-size: 15px; }

.compact-list, .source-list, .timeline {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.compact-item, .source-item, .timeline-item {
  padding: 12px;
  border: 1px solid #e7eef4;
  border-radius: 8px;
  background: white;
}

.compact-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.compact-item small { display: block; color: var(--muted); margin-top: 3px; }
.bank-edit-row label {
  display: grid;
  justify-items: end;
  gap: 4px;
  min-width: 168px;
}

.bank-edit-row input {
  width: 150px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  text-align: right;
  font-weight: 850;
}

.bank-edit-row small {
  font-size: 11px;
}
.text-red { color: var(--red); font-weight: 900; }
.text-green { color: var(--green); font-weight: 900; }

.approval-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(292px, 1fr));
  gap: 12px;
}

.approval-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
  gap: 16px;
  margin-bottom: 16px;
}

.approval-command .approval-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.approval-summary {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.approval-metric {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 82px;
  padding: 12px;
  border: 1px solid #e7eef4;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  text-align: left;
}

.approval-metric span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.approval-metric strong {
  font-size: 22px;
  font-weight: 900;
}

.approval-metric small {
  color: var(--muted);
  font-size: 11px;
}

.approval-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.approval-card h2 { margin-top: 10px; font-size: 16px; }

.approval-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.approval-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.approval-actions button[data-action="approve"] { color: var(--green); }
.approval-actions button[data-action="skip"] { color: var(--red); }
.approval-actions button[data-action="defer"] { color: var(--amber); }
.approval-actions button[data-action="watch"] { color: var(--violet); }

.controller-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.controller-layout .kpi-grid,
.controller-wide {
  grid-column: 1 / -1;
}

.controller-layout .kpi-grid {
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  margin-bottom: 0;
}

.analysis-box.flush {
  min-height: 310px;
  border: 0;
  border-radius: 0 0 8px 8px;
}

.controller-bars {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.controller-bar-row {
  display: grid;
  grid-template-columns: 130px minmax(160px, 1fr) 120px;
  gap: 12px;
  align-items: center;
}

.controller-bar-row span {
  font-weight: 850;
}

.controller-bar-row small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.controller-bar-row strong {
  text-align: right;
}

.controller-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5edf4;
}

.controller-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.controller-bar.positive i { background: var(--green); }
.controller-bar.negative i { background: var(--red); }

.source-item {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 12px;
}

.diagram-panel { padding: 16px; }
.diagram-panel img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  margin-top: 12px;
  border-radius: 8px;
  background: #111820;
}

.timeline-item strong { display: block; margin-top: 8px; }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 380px;
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 14px;
  border-radius: 8px;
  background: #172331;
  color: white;
  box-shadow: var(--shadow);
  transition: opacity .2s, transform .2s;
}

.toast.show { opacity: 1; transform: translateY(0); }

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(18, 32, 47, 0.48);
  z-index: 40;
}

.modal.show { display: flex; }

.modal-content {
  position: relative;
  width: min(520px, 100%);
  padding: 22px;
  border-radius: 8px;
  background: white;
  box-shadow: 0 28px 70px rgba(18, 32, 47, 0.28);
}

.modal-content h2 {
  margin-bottom: 14px;
  font-size: 20px;
}

.close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  font-weight: 900;
}

.modal-info {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #e7eef4;
  border-radius: 8px;
  background: var(--surface-soft);
}

.modal-info span {
  color: var(--muted);
  font-size: 12px;
}

.modal-content label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.modal-content label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.modal-content select,
.modal-content input,
.modal-content textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  background: white;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.modal-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: white;
  font-weight: 850;
}

/* Professional UI layer */
.sidebar {
  min-height: 78px;
  padding: 12px 24px;
  border-bottom-color: rgba(148, 163, 184, 0.28);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04), 0 10px 30px rgba(15, 23, 42, 0.05);
}

.brand-mark {
  width: 44px;
  background: #111827;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.10);
}

.brand strong {
  font-size: 15px;
  letter-spacing: 0;
}

.nav {
  gap: 4px;
}

.nav-item {
  min-height: 42px;
  grid-template-columns: 22px auto;
  border-radius: 8px;
  padding: 0 13px;
  color: #475569;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.nav-item:hover {
  background: #f1f5f9;
}

.nav-item.active {
  background: #111827;
  border-color: #111827;
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.16);
}

.source-box {
  min-width: 250px;
  border-color: rgba(148, 163, 184, 0.32);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.source-box strong {
  font-size: 17px;
  line-height: 1.15;
}

.workspace {
  padding: 24px;
}

.topbar,
.toolbar,
.data-panel,
.diagram-panel,
.operator-hero,
.stat-card,
.approval-card {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-soft);
}

.topbar {
  min-height: 88px;
  padding: 20px 22px;
}

.topbar h1 {
  font-size: 28px;
  line-height: 1.1;
}

.topbar p,
.panel-heading p {
  color: #64748b;
}

.top-actions {
  gap: 10px;
}

.company-select-wrap select,
.toolbar input,
.toolbar select,
.modal-content select,
.modal-content input,
.modal-content textarea {
  border-color: #cfdbe6;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.02);
  transition: border-color .16s ease, box-shadow .16s ease;
}

.company-select-wrap select:focus,
.toolbar input:focus,
.toolbar select:focus,
.modal-content select:focus,
.modal-content input:focus,
.modal-content textarea:focus,
.bank-edit-row input:focus {
  outline: 0;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--ring);
}

.status-badge {
  background: #ffffff;
  border-color: #d8e2eb;
}

.icon-button {
  background: #111827;
  border-color: #111827;
  color: white;
}

.toolbar {
  align-items: end;
  padding: 14px;
  margin-bottom: 18px;
}

.toolbar span,
.stat-label,
.label {
  color: #64748b;
  font-weight: 800;
}

.toolbar input,
.toolbar select {
  min-height: 42px;
}

.operator-grid,
.cockpit-grid,
.main-grid,
.approval-dashboard,
.controller-layout,
.dashboard-grid,
.import-grid,
.source-layout {
  gap: 18px;
}

.operator-hero {
  min-height: 168px;
  border-left: 0;
  position: relative;
}

.operator-hero::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 8px 0 0 8px;
  background: var(--blue);
}

.operator-hero h2 {
  font-size: 31px;
  line-height: 1.1;
}

.mini-stat,
.operation-card,
.approval-metric,
.analysis-box,
.operator-status-grid div,
.queue-footer-block,
.compact-item,
.source-item,
.timeline-item,
.mini-event {
  border-color: rgba(148, 163, 184, 0.24);
  background: #ffffff;
}

.mini-stat,
.operation-card {
  border-top-width: 0;
  border-left: 4px solid var(--teal);
}

.mini-stat.green,
.operation-card.green { border-left-color: var(--green); }
.mini-stat.red,
.operation-card.red { border-left-color: var(--red); }
.mini-stat.amber,
.operation-card.amber { border-left-color: var(--amber); }
.mini-stat.teal { border-left-color: var(--teal); }

.mini-stat strong,
.operation-card strong,
.stat-value,
.approval-metric strong {
  letter-spacing: 0;
}

.data-panel {
  overflow: hidden;
}

.panel-heading {
  padding: 16px 18px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.panel-heading h2 {
  font-size: 15px;
  letter-spacing: 0;
}

.table-wrap {
  background: #ffffff;
}

table {
  font-size: 12.5px;
}

th {
  background: #f8fafc;
  color: #64748b;
  font-size: 10.5px;
  letter-spacing: .02em;
}

td {
  border-bottom-color: #edf2f7;
}

tbody tr:hover {
  background: #f8fafc;
}

.company-row td {
  background: #eef4fa;
}

.pill {
  min-height: 23px;
  border-radius: 6px;
  letter-spacing: 0;
}

.primary-button {
  border-color: #111827;
  background: #111827;
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.14);
}

.primary-button:hover,
.icon-button:hover,
.session-button:hover,
.approval-actions button:hover,
.modal-actions button:hover {
  filter: brightness(.98);
}

.approval-card {
  gap: 14px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.07);
}

.approval-card h2 {
  font-size: 15px;
  line-height: 1.28;
}

.approval-actions {
  gap: 8px;
}

.approval-actions button {
  min-height: 38px;
  background: #f8fafc;
  border-color: #dbe4ec;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.approval-actions button:hover {
  background: #ffffff;
  border-color: #b9c8d6;
  transform: translateY(-1px);
}

.approval-actions button[data-action="approve"] {
  background: rgba(21, 128, 61, 0.08);
  border-color: rgba(21, 128, 61, 0.24);
}

.approval-actions button[data-action="skip"] {
  background: rgba(185, 28, 28, 0.07);
  border-color: rgba(185, 28, 28, 0.20);
}

.approval-actions button[data-action="defer"] {
  background: rgba(180, 83, 9, 0.08);
  border-color: rgba(180, 83, 9, 0.22);
}

.approval-actions button[data-action="watch"] {
  background: rgba(109, 91, 208, 0.08);
  border-color: rgba(109, 91, 208, 0.22);
}

.controller-bar {
  height: 10px;
}

.toast,
.modal-content {
  box-shadow: 0 22px 55px rgba(15, 23, 42, 0.24);
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(140deg, rgba(17, 24, 39, 0.88), rgba(15, 23, 42, 0.72)),
    var(--bg);
}

.login-card {
  width: min(430px, 100%);
  display: grid;
  gap: 15px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: white;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.28);
}

.login-logo-wrap {
  display: grid;
  place-items: center;
  min-height: 178px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
}

.login-logo-wrap img {
  display: block;
  width: 100%;
  max-width: 390px;
  max-height: 158px;
  object-fit: contain;
}

.login-card h1 {
  font-size: 24px;
  line-height: 1.15;
}

.login-card p,
.login-card small {
  color: var(--muted);
}

.login-card label,
.user-modal-content label {
  display: grid;
  gap: 6px;
}

.login-card label span,
.modal-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.login-card input {
  min-height: 42px;
  border: 1px solid #cfdbe6;
  border-radius: 8px;
  padding: 0 12px;
}

.users-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  gap: 18px;
}

.users-list {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.user-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: white;
}

.user-card h3 {
  margin-top: 8px;
  font-size: 17px;
}

.menu-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.menu-tags span,
.menu-access-list span {
  color: var(--muted);
  font-size: 12px;
}

.menu-tags span {
  padding: 4px 7px;
  border-radius: 6px;
  background: #f1f5f9;
}

.menu-access-list {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.menu-access-list div {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  background: #ffffff;
}

.user-menu-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.inline-check {
  display: flex !important;
  align-items: center;
  gap: 8px;
  margin-bottom: 0 !important;
  color: var(--ink);
}

.inline-check input {
  width: 16px;
  min-width: 16px;
  accent-color: var(--blue);
}

/* Operational density refinements */
.topbar {
  min-height: 76px;
  padding: 16px 18px;
}

.topbar h1 {
  font-size: 25px;
}

.topbar p {
  max-width: 680px;
}

.topbar > div:first-child {
  min-width: 0;
}

.toolbar {
  padding: 12px;
}

.operator-hero {
  grid-template-columns: minmax(250px, .56fr) minmax(0, 1.44fr);
  min-height: 142px;
  padding: 16px 18px;
}

.operator-hero h2 {
  margin-top: 6px;
  font-size: 28px;
}

.operator-hero p {
  font-size: 14px;
}

.operator-kpis {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.mini-stat {
  min-height: 104px;
  padding: 12px;
}

.mini-stat strong {
  margin-top: 8px;
  font-size: 21px;
}

.mini-stat small {
  margin-top: 6px;
  font-size: 11px;
}

.mini-stat.red,
.approval-metric:has(span) {
  box-shadow: inset 0 0 0 1px rgba(185, 28, 28, 0.02);
}

.approval-dashboard {
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr);
}

.approval-summary {
  gap: 8px;
  padding: 12px;
}

.approval-metric {
  min-height: 74px;
  padding: 11px;
}

.approval-card {
  padding: 14px;
}

.approval-card .stat-value {
  margin-top: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
}

.approval-actions button[data-action="approve"] {
  color: white;
  background: var(--green);
  border-color: var(--green);
}

@media (max-width: 1280px) {
  .analysis-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid { grid-template-columns: repeat(2, minmax(170px, 1fr)); }
  .cockpit-grid { grid-template-columns: 1fr; }
  .operator-grid, .operator-hero, .approval-dashboard, .controller-layout { grid-template-columns: 1fr; }
  .operator-hero { grid-template-columns: minmax(250px, .56fr) minmax(0, 1.44fr); }
  .operator-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  #operator-import-panel, #operator-bank-panel, #operator-import-preview-panel, .operator-wide {
    grid-column: auto;
    grid-row: auto;
  }
  .operator-hero { order: 1; }
  .operator-wide { order: 2; }
  #operator-import-panel { order: 3; }
  #operator-bank-panel { order: 4; }
  #operator-import-preview-panel { order: 5; }
  .controller-layout .kpi-grid, .controller-wide { grid-column: auto; }
  .controller-layout .kpi-grid { grid-template-columns: repeat(2, minmax(170px, 1fr)); }
  .operation-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .main-grid { grid-template-columns: 1fr; }
  .import-grid, .source-layout { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .sidebar {
    position: sticky;
    width: auto;
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding: 10px 12px;
  }
  .brand { gap: 10px; }
  .brand-mark { width: 40px; }
  .nav {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }
  .nav-item {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0 13px;
    scroll-snap-align: start;
  }
  .source-box { width: 100%; }
  .workspace { margin-left: 0; padding: 14px; }
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    min-height: auto;
  }
  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .company-select-wrap { width: 100%; }
  .company-select-wrap select { min-height: 42px; }
  .status-badge { min-height: 38px; }
  .icon-button {
    width: 42px;
    min-width: 42px;
  }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar .wide { grid-column: 1 / -1; }
  .analysis-grid, .kpi-grid, .import-summary { grid-template-columns: 1fr; }
  .operator-kpis, .operator-status-grid, .approval-command .approval-summary, .controller-layout .kpi-grid { grid-template-columns: 1fr; }
  .operator-hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 16px;
  }
  .operator-hero h2 { font-size: 26px; }
  .operator-wide {
    min-height: auto;
  }
  .operator-wide .operator-table,
  .table-wrap {
    max-height: 62vh;
  }
  .operator-queue-footer { grid-template-columns: 1fr; }
  .controller-bar-row { grid-template-columns: 1fr; }
  .controller-bar-row strong { text-align: left; }
  .operation-cards { grid-template-columns: 1fr; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .import-drop { grid-template-columns: 1fr; }
  .approval-actions { grid-template-columns: repeat(2, 1fr); }
  .approval-actions button {
    min-height: 42px;
  }
  .approval-actions button[data-action="approve"] {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  body {
    background: var(--bg);
  }

  .sidebar {
    top: 0;
    border-bottom-color: #d2dde7;
  }

  .brand strong { font-size: 15px; }
  .brand span { font-size: 11px; }

  .source-box {
    min-width: 0;
    padding: 8px 10px;
  }

  .source-box strong {
    margin: 4px 0;
    font-size: 14px;
  }

  .workspace {
    padding: 10px;
  }

  .topbar {
    gap: 14px;
    padding: 13px;
    margin-bottom: 12px;
  }

  .topbar > div:first-child {
    width: 100%;
  }

  .topbar h1 {
    font-size: 22px;
    line-height: 1.15;
  }

  .topbar p {
    font-size: 12px;
    line-height: 1.4;
    max-width: 100%;
    overflow-wrap: anywhere;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .top-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 7px;
  }

  .company-select-wrap {
    grid-column: 1 / -1;
  }

  .status-badge {
    min-width: 0;
    flex: none;
    justify-content: center;
    padding: 0 8px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .session-button {
    min-height: 42px;
  }

  #refresh-btn {
    display: none;
  }

  .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
    margin-bottom: 12px;
  }

  .approval-dashboard {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 10px;
  }

  .approval-command .approval-summary,
  .approval-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .approval-metric {
    min-height: 70px;
    padding: 10px;
  }

  .approval-metric strong {
    font-size: 18px;
  }

  .toolbar label:nth-child(n + 3) {
    grid-column: 1 / -1;
  }

  .toolbar input,
  .toolbar select {
    min-height: 42px;
    font-size: 15px;
  }

  .toolbar-company {
    display: none;
  }

  .operator-grid,
  .dashboard-grid,
  .approval-dashboard,
  .controller-layout,
  .main-grid,
  .import-grid,
  .source-layout,
  .users-layout {
    gap: 12px;
  }

  .operator-hero {
    gap: 14px;
    border-left-width: 4px;
  }

  .operator-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mini-stat,
  .stat-card,
  .approval-card {
    box-shadow: 0 9px 24px rgba(18, 32, 47, 0.08);
  }

  .mini-stat {
    min-height: 112px;
    padding: 12px;
  }

  .mini-stat strong,
  .stat-value {
    font-size: 21px;
  }

  .stat-card,
  .operation-card,
  .approval-metric {
    min-height: auto;
  }

  .panel-heading,
  .compact-list,
  .source-list,
  .timeline,
  .mini-timeline,
  .analysis-grid,
  .operation-cards,
  .controller-bars,
  .approval-summary {
    padding: 12px;
  }

  .compact-item {
    align-items: stretch;
    flex-direction: column;
  }

  .bank-edit-row label {
    width: 100%;
    min-width: 0;
    justify-items: stretch;
  }

  .bank-edit-row input {
    width: 100%;
    min-height: 40px;
  }

  .table-wrap {
    border-top: 1px solid var(--line);
    max-height: 58vh;
    box-shadow: inset -18px 0 22px -24px rgba(18, 32, 47, 0.75);
  }

  table {
    min-width: 780px;
    font-size: 12px;
  }

  th,
  td {
    padding: 10px;
  }

  .operator-table table {
    min-width: 720px;
  }

  .approval-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .approval-card {
    gap: 10px;
    padding: 14px;
    box-shadow: 0 5px 16px rgba(15, 23, 42, 0.07);
  }

  .approval-card h2 {
    margin-top: 8px;
    font-size: 15px;
    line-height: 1.25;
  }

  .approval-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .approval-actions button,
  .primary-button,
  .modal-actions button {
    min-height: 46px;
  }

  .approval-actions button[data-action="approve"] {
    grid-column: 1 / -1;
    min-height: 48px;
    font-size: 13px;
  }

  .approval-metric strong {
    font-size: 20px;
  }

  .analysis-box {
    min-height: auto;
  }

  .risk-line,
  .source-item {
    grid-template-columns: 1fr;
  }

  .metric-row,
  .queue-footer-line {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-row strong,
  .queue-footer-line strong {
    min-width: 0;
    text-align: left;
  }

  .toast {
    right: 10px;
    bottom: 10px;
    left: 10px;
    max-width: none;
  }

  .modal {
    align-items: flex-end;
    padding: 10px;
  }

  .modal-content {
    width: 100%;
    max-height: calc(100vh - 20px);
    overflow: auto;
    padding: 18px;
  }

  .modal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .users-layout,
  .user-card,
  .user-menu-options {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 20px;
  }
}

@media (max-width: 420px) {
  .workspace {
    padding: 8px;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .toolbar label {
    grid-column: 1 / -1;
  }

  .operator-kpis,
  .approval-actions {
    grid-template-columns: 1fr 1fr;
  }

  .nav-item {
    grid-template-columns: 20px auto;
    padding: 0 10px;
  }
}
