/* ─── MTDR FORENSIC ANALYZER — STYLESHEET v5 — LIGHT EDITORIAL ─────────── */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=DM+Sans:wght@300;400;500;600&display=swap');

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f5f0e8;
  --bg2: #ffffff;
  --bg3: #f0ebe3;
  --bg4: #e8e3db;
  --bg5: #ddd8d0;
  --border: rgba(184, 149, 42, 0.15);
  --border2: rgba(184, 149, 42, 0.25);
  --border3: rgba(184, 149, 42, 0.35);
  --text: #0f0f0f;
  --text2: #6b6356;
  --text3: #9e9b94;
  --gold: #b8952a;
  --gold2: #d4af5a;
  --gold-dim: rgba(184, 149, 42, 0.07);
  --gold-glow: 0 0 28px rgba(184, 149, 42, 0.18);
  --red: #9b1c1c;
  --red-dim: rgba(155, 28, 28, 0.07);
  --red-glow: 0 0 24px rgba(155, 28, 28, 0.12);
  --green: #1a5c35;
  --green-dim: rgba(26, 92, 53, 0.07);
  --blue: #2b6a8a;
  --blue-dim: rgba(43, 106, 138, 0.07);
  --orange: #a3541a;
  --purple: #6b4fa0;
  --ok-bg: rgba(26, 92, 53, 0.05);
  --under-bg: rgba(155, 28, 28, 0.05);
  --over-bg: rgba(43, 106, 138, 0.05);
  --font: 'DM Sans', sans-serif;
  --mono: 'Consolas', 'Courier New', monospace;
  --display: 'Cormorant Garamond', Georgia, serif;
  --radius: 2px;
  --radius-lg: 2px;
  --radius-xl: 4px;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  font-weight: 400;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
}

/* ─── LAYOUT ─────────────────────────────────────────────────────────────── */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 26px 22px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo h1 {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.sidebar-logo p {
  font-size: 10.5px;
  color: var(--text3);
  margin-top: 3px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.nav-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--text3);
  padding: 14px 22px 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--text2);
  transition: all 0.18s;
  border-left: 2px solid transparent;
  user-select: none;
  letter-spacing: 0.1px;
}

.nav-item:hover {
  background: var(--bg3);
  color: var(--text);
}

.nav-item.active {
  background: linear-gradient(90deg, var(--gold-dim), transparent);
  color: var(--gold);
  border-left-color: var(--gold);
  font-weight: 500;
}

.nav-item .icon {
  width: 18px;
  text-align: center;
  font-style: normal;
  opacity: 0.7;
}

.nav-item.active .icon {
  opacity: 1;
}

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-family: var(--mono);
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(224, 92, 92, 0.18);
  color: var(--red);
  border: 1px solid rgba(224, 92, 92, 0.25);
}

.main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ─── TOPBAR ─────────────────────────────────────────────────────────────── */
.topbar {
  padding: 22px 36px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(245, 240, 232, 0.92);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
  flex: 1;
  color: var(--text);
  letter-spacing: 0.2px;
}

.topbar-sub {
  font-size: 12px;
  color: var(--text3);
  margin-top: 3px;
  letter-spacing: 0.3px;
}

.content {
  padding: 32px 36px;
  flex: 1;
}

/* ─── PANELS ──────────────────────────────────────────────────────────────── */
.panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
  transition: border-color 0.2s;
}

.panel:hover {
  border-color: var(--border2);
}

.panel-head {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg3);
}

.panel-head h2 {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
  color: var(--text);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.panel-body {
  padding: 22px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

/* ─── STAT CARDS ─────────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border2);
  transition: background 0.2s;
}

.stat-card:hover {
  border-color: var(--border2);
  transform: translateY(-1px);
}

.stat-card.red {
  background: var(--red-dim);
  border-color: rgba(224, 92, 92, 0.2);
}

.stat-card.red::after {
  background: var(--red);
}

.stat-card.green {
  background: var(--green-dim);
  border-color: rgba(92, 184, 122, 0.2);
}

.stat-card.green::after {
  background: var(--green);
}

.stat-card.blue {
  background: var(--blue-dim);
  border-color: rgba(91, 163, 201, 0.2);
}

.stat-card.blue::after {
  background: var(--blue);
}

.stat-label {
  font-size: 9.5px;
  color: var(--text3);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 8px;
  font-weight: 600;
}

.stat-val {
  font-size: 24px;
  font-weight: 600;
  font-family: var(--mono);
  line-height: 1;
}

.stat-card.red .stat-val {
  color: var(--red);
}

.stat-card.green .stat-val {
  color: var(--green);
}

.stat-card.blue .stat-val {
  color: var(--blue);
}

/* ─── BUTTONS ─────────────────────────────────────────────────────────────── */
button,
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text);
  letter-spacing: 0.2px;
}

button:hover,
.btn:hover {
  background: var(--bg4);
  border-color: var(--border3);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #000;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--gold2);
  border-color: var(--gold2);
}

.btn-danger {
  background: var(--red-dim);
  border-color: rgba(224, 92, 92, 0.3);
  color: var(--red);
}

.btn-danger:hover {
  background: rgba(224, 92, 92, 0.18);
}

.btn-sm {
  padding: 6px 13px;
  font-size: 12px;
}

.btn-green {
  background: var(--green-dim);
  border-color: rgba(92, 184, 122, 0.3);
  color: var(--green);
}

/* ─── FORMS ──────────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  font-size: 11px;
  color: var(--text2);
  letter-spacing: 0.8px;
  margin-bottom: 7px;
  display: block;
  font-weight: 600;
  text-transform: uppercase;
}

input[type=text],
input[type=number],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  transition: all 0.18s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.12);
  background: var(--bg4);
}

select option {
  background: var(--bg3);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ─── DROP ZONE ─────────────────────────────────────────────────────────── */
.drop-zone {
  border: 1.5px dashed var(--border2);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg3);
}

.drop-zone:hover,
.drop-zone.drag {
  border-color: var(--gold);
  background: var(--gold-dim);
  box-shadow: var(--gold-glow);
}

.drop-zone .dz-icon {
  font-size: 28px;
  margin-bottom: 10px;
  opacity: 0.5;
}

.drop-zone .dz-title {
  font-size: 14px;
  color: var(--text2);
  font-weight: 500;
}

.drop-zone .dz-sub {
  font-size: 11.5px;
  color: var(--text3);
  margin-top: 5px;
}

.drop-zone.success {
  border-color: var(--green);
  background: var(--green-dim);
}

.drop-zone.success .dz-title {
  color: var(--green);
}

/* ─── TABLE ──────────────────────────────────────────────────────────────── */
.tbl-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 220px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

/* Sticky table header */
thead { position: sticky; top: 0; z-index: 10; }
th { position: sticky; top: 0; background: var(--bg2) !important; z-index: 10; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

/* Sticky first two columns */
table th:nth-child(1),
table td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--bg);
  min-width: 100px;
}
table th:nth-child(2),
table td:nth-child(2) {
  position: sticky;
  left: 100px;
  z-index: 2;
  background: var(--bg);
  min-width: 110px;
  border-right: 2px solid var(--border);
}
table tr:hover td:nth-child(1),
table tr:hover td:nth-child(2) { background: var(--bg2); }
.tr-under td:nth-child(1),
.tr-under td:nth-child(2) { background: var(--red-dim, #fff5f5); }
.tr-over td:nth-child(1),
.tr-over td:nth-child(2)  { background: #f0f8ff; }
.tr-ok td:nth-child(1),
.tr-ok td:nth-child(2)    { background: #f5fff5; }
.tr-enhance td:nth-child(1),
.tr-enhance td:nth-child(2){ background: #fff8f0; }

thead th {
  padding: 12px 16px;
  background: rgba(184, 149, 42, 0.08);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text2);
  border-bottom: 1px solid var(--border2);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

thead th:hover {
  color: var(--gold);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--bg3);
}

td {
  padding: 12px 16px;
  vertical-align: middle;
  font-size: 13px;
}

td.mono {
  font-family: var(--mono);
}

td.right {
  text-align: right;
}

.tr-under {
  background: rgba(224, 92, 92, 0.05);
  border-left: 3px solid var(--red);
}

.tr-over {
  background: rgba(91, 163, 201, 0.05);
  border-left: 3px solid var(--blue);
}

.tr-ok {
  background: rgba(92, 184, 122, 0.04);
  border-left: 3px solid var(--green);
}

.tr-enhance {
  background: rgba(212, 132, 90, 0.05);
  border-left: 3px solid var(--orange);
}

.tr-partial {
  background: rgba(155, 127, 212, 0.04);
  border-left: 3px solid var(--purple);
}

.tr-norate {
  border-left: 3px solid var(--text3);
}

/* ─── TABLE EXPLANATION ROWS ─────────────────────────────────────────────── */
.explain-row td {
  padding: 12px 16px 16px 28px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
}

.explain-verdict {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 20px;
  margin-top: 7px;
  letter-spacing: 0.3px;
  border: 1px solid;
}

.verdict-ok {
  color: var(--green);
  border-color: rgba(92, 184, 122, 0.4);
  background: var(--green-dim);
}

.verdict-under {
  color: var(--red);
  border-color: rgba(224, 92, 92, 0.4);
  background: var(--red-dim);
}

.verdict-over {
  color: var(--blue);
  border-color: rgba(91, 163, 201, 0.4);
  background: var(--blue-dim);
}

.verdict-norate {
  color: var(--text3);
  border-color: var(--border2);
  background: var(--bg4);
}

.verdict-partial {
  color: var(--purple);
  border-color: rgba(155, 127, 212, 0.4);
  background: rgba(155, 127, 212, 0.08);
}

.verdict-enhance {
  color: var(--orange);
  border-color: rgba(212, 132, 90, 0.4);
  background: rgba(212, 132, 90, 0.08);
}

/* ─── BADGES ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 4px;
  letter-spacing: 0.6px;
  font-family: var(--mono);
  border: 1px solid;
}

.badge-ok {
  background: var(--green-dim);
  color: var(--green);
  border-color: rgba(92, 184, 122, 0.3);
}

.badge-under {
  background: var(--red-dim);
  color: var(--red);
  border-color: rgba(224, 92, 92, 0.3);
}

.badge-over {
  background: var(--blue-dim);
  color: var(--blue);
  border-color: rgba(91, 163, 201, 0.3);
}

.badge-partial {
  background: rgba(155, 127, 212, 0.1);
  color: var(--purple);
  border-color: rgba(155, 127, 212, 0.3);
}

.badge-enhance {
  background: rgba(212, 132, 90, 0.1);
  color: var(--orange);
  border-color: rgba(212, 132, 90, 0.3);
}

.badge-norate {
  background: var(--bg4);
  color: var(--text3);
  border-color: var(--border2);
}

.badge-info {
  background: var(--gold-dim);
  color: var(--gold);
  border-color: rgba(201, 168, 76, 0.3);
}

/* ─── FILTER BAR ─────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}

.filter-bar select {
  width: auto;
  min-width: 160px;
}

/* ─── ALERTS ─────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-left: 3px solid;
}

.alert-err {
  background: var(--red-dim);
  border-color: var(--red);
  color: #f5a0a0;
}

.alert-ok {
  background: var(--green-dim);
  border-color: var(--green);
  color: #90d4aa;
}

.alert-info {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold2);
}

.alert-warn {
  background: rgba(212, 132, 90, 0.1);
  border-color: var(--orange);
  color: #e8a888;
}

/* ─── FINDINGS ───────────────────────────────────────────────────────────── */
.finding {
  padding: 14px 18px;
  border-radius: var(--radius);
  border-left: 3px solid var(--red);
  background: var(--red-dim);
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.7;
}

.finding strong {
  color: var(--text);
}

.finding .diff-amt {
  color: var(--red);
  font-family: var(--mono);
  font-weight: 700;
}

/* ─── EMPTY STATE ────────────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--text3);
  font-size: 13.5px;
}

.empty .empty-icon {
  font-size: 36px;
  margin-bottom: 14px;
  opacity: 0.3;
}

/* ─── TOAST ──────────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 13px 20px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  z-index: 1000;
  transition: opacity 0.3s, transform 0.3s;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  max-width: 340px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

#toast.toast-ok {
  border-color: rgba(92, 184, 122, 0.5);
  color: var(--green);
}

#toast.toast-err {
  border-color: rgba(224, 92, 92, 0.5);
  color: var(--red);
}

/* ─── SPINNER ────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ─── SCROLLBAR ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--bg5);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text3);
}

/* ─── MISC ───────────────────────────────────────────────────────────────── */
.sep {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

.text-sm {
  font-size: 13px;
  color: var(--text2);
}

.text-xs {
  font-size: 11.5px;
  color: var(--text3);
}

.text-mono {
  font-family: var(--mono);
}

.text-right {
  text-align: right;
}

.text-green {
  color: var(--green);
}

.text-red {
  color: var(--red);
}

.text-accent {
  color: var(--gold);
}

.text-orange {
  color: var(--orange);
}

.flex-1 {
  flex: 1;
}

.mt-2 {
  margin-top: 8px;
}

.hidden {
  display: none !important;
}

.page {
  display: block;
}

/* ─── SUMMARY REPORT ──────────────────────────────────────────────────────── */
.sum-banner {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.sum-banner-item {
  flex: 1;
  min-width: 160px;
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  border: 1px solid var(--border);
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.sum-banner-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
}

.sum-banner-item.red {
  background: var(--red-dim);
  border-color: rgba(224, 92, 92, 0.2);
}

.sum-banner-item.red::before {
  background: var(--red);
}

.sum-banner-item.orange {
  background: rgba(212, 132, 90, 0.08);
  border-color: rgba(212, 132, 90, 0.2);
}

.sum-banner-item.orange::before {
  background: var(--orange);
}

.sum-banner-item.blue {
  background: var(--blue-dim);
  border-color: rgba(91, 163, 201, 0.2);
}

.sum-banner-item.blue::before {
  background: var(--blue);
}

.sum-banner-item.green {
  background: var(--green-dim);
  border-color: rgba(92, 184, 122, 0.2);
}

.sum-banner-item.green::before {
  background: var(--green);
}

.sum-banner-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  opacity: .5;
  margin-bottom: 8px;
  font-weight: 700;
}

.sum-banner-val {
  font-size: 26px;
  font-weight: 600;
  font-family: var(--mono);
  margin-bottom: 4px;
}

.sum-banner-sub {
  font-size: 11px;
  opacity: .45;
}

.sum-banner-item.red .sum-banner-val {
  color: var(--red);
}

.sum-banner-item.orange .sum-banner-val {
  color: var(--orange);
}

.sum-banner-item.blue .sum-banner-val {
  color: var(--blue);
}

.sum-banner-item.green .sum-banner-val {
  color: var(--green);
}

.sum-card {
  background: var(--bg2);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 14px;
  overflow: hidden;
  transition: all 0.2s;
}

.sum-card:hover {
  border-color: var(--border2);
  transform: translateY(-1px);
}

.sum-card-red {
  border-left: 4px solid var(--red);
}

.sum-card-blue {
  border-left: 4px solid var(--blue);
}

.sum-card-orange {
  border-left: 4px solid var(--orange);
}

.sum-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
}

.sum-card-rank {
  font-size: 11px;
  font-weight: 700;
  opacity: .3;
  min-width: 26px;
  text-align: center;
  font-family: var(--mono);
}

.sum-card-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sum-card-impact {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--mono);
}

.sum-card-body {
  padding: 16px 20px;
}

.sum-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13.5px;
  line-height: 1.7;
}

.sum-row-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  opacity: .4;
  padding-top: 3px;
}

.sum-card-numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.sum-num {
  background: var(--bg3);
  border-radius: var(--radius);
  padding: 10px 16px;
  min-width: 110px;
  border: 1px solid var(--border);
}

.sum-num.red {
  background: var(--red-dim);
  border-color: rgba(224, 92, 92, 0.2);
}

.sum-num.green {
  background: var(--green-dim);
  border-color: rgba(92, 184, 122, 0.2);
}

.sum-num.orange {
  background: rgba(212, 132, 90, 0.08);
  border-color: rgba(212, 132, 90, 0.2);
}

.sum-num-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .8px;
  opacity: .45;
  margin-bottom: 3px;
  font-weight: 700;
}

.sum-num-val {
  font-size: 14px;
  font-weight: 600;
  font-family: var(--mono);
}

.sum-num.red .sum-num-val {
  color: var(--red);
}

.sum-num.green .sum-num-val {
  color: var(--green);
}

.sum-num.orange .sum-num-val {
  color: var(--orange);
}

.sum-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 20px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 13.5px;
  margin-top: 8px;
}

/* ─── MODAL ──────────────────────────────────────────────────────────────── */
#rate-entries-modal>div {
  background: var(--bg2) !important;
  border: 1px solid var(--border2) !important;
  border-radius: var(--radius-xl) !important;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15) !important;
}
/* ── COVERAGE BADGES ──────────────────────────────────────────────────────── */
.coverage-badge {
  font-size: 10px; font-weight: 600; padding: 2px 7px;
  border-radius: 10px; border: 1px solid; white-space: nowrap;
}
.coverage-full { background: rgba(26,92,53,0.08); color: var(--green); border-color: rgba(26,92,53,0.2); }
.coverage-ok   { background: rgba(180,140,0,0.08); color: #7a5c00; border-color: rgba(180,140,0,0.25); }
.coverage-warn { background: rgba(155,28,28,0.08); color: var(--red); border-color: rgba(155,28,28,0.2); }

/* ── PARTIAL COVERAGE BANNER ─────────────────────────────────────────────── */
.coverage-banner {
  background: rgba(155,28,28,0.06);
  border: 1px solid rgba(155,28,28,0.2);
  border-left: 4px solid var(--red);
  border-radius: 8px; padding: 12px 16px;
  font-size: 13px; line-height: 1.6;
  margin-bottom: 16px; color: var(--text);
}
.coverage-banner strong { color: var(--red); }

/* ── SUMMARY SECTION HEADERS ─────────────────────────────────────────────── */
.sum-section-head {
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 2px solid var(--border2);
}
.sum-section-title {
  font-size: 15px; font-weight: 700; display: flex;
  align-items: center; gap: 10px; margin-bottom: 4px;
}
.sum-section-count {
  background: var(--red-dim); color: var(--red);
  font-size: 11px; font-weight: 700; padding: 2px 8px;
  border-radius: 10px;
}
.sum-section-sub { font-size: 12px; color: var(--text2); line-height: 1.5; }

/* ── MISSING DATA BANNER ─────────────────────────────────────────────────── */
.missing-data-banner {
  background: rgba(184,149,42,0.06);
  border: 1px solid rgba(184,149,42,0.25);
  border-left: 4px solid var(--gold);
  border-radius: 8px; padding: 12px 16px;
  font-size: 13px; line-height: 1.6;
  margin-top: 12px; color: var(--text);
}
.missing-data-banner strong { color: var(--gold); }
.text-orange { color: var(--orange, #a3541a); }

/* ── MERGE NOTE (year-end split explanation) ─────────────────────────────── */
.merge-note {
  background: rgba(184,149,42,0.06);
  border: 1px solid rgba(184,149,42,0.2);
  border-left: 3px solid var(--gold, #b8952a);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.7;
  margin-bottom: 10px;
  color: var(--text2);
}
.merge-note strong { color: var(--text); }

/* ── FINAL RATE MISSING NOTE ─────────────────────────────────────────────── */
.final-missing-note {
  display: inline-block;
  background: rgba(180,140,0,0.08);
  border: 1px solid rgba(180,140,0,0.25);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  color: #7a5c00;
  margin-top: 4px;
}
.text-gray { color: var(--text3); }

/* ── VIEW TABS (Analysis Report) ─────────────────────────────────────────── */
.view-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}
.view-tab {
  padding: 6px 16px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.view-tab:hover { background: var(--bg2); color: var(--text); }
.view-tab.active {
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ── FULLSCREEN TABLE VIEW ───────────────────────────────────────────────────── */
body.tbl-fullscreen .sidebar  { display: none !important; }
body.tbl-fullscreen .main     { margin-left: 0 !important; width: 100vw !important; max-width: 100vw !important; }
body.tbl-fullscreen .topbar   { left: 0 !important; width: 100vw !important; }
body.tbl-fullscreen .content  { padding: 8px 12px !important; }
body.tbl-fullscreen .tbl-wrap { width: 100% !important; overflow-x: auto !important; max-height: calc(100vh - 130px) !important; }
body.tbl-fullscreen table     { font-size: 12px !important; min-width: 900px !important; width: 100% !important; table-layout: fixed !important; }
body.tbl-fullscreen th:nth-child(1),
body.tbl-fullscreen td:nth-child(1),
body.tbl-fullscreen th:nth-child(2),
body.tbl-fullscreen td:nth-child(2) { position: static !important; border-right: none !important; }
body.tbl-fullscreen th        { padding: 5px 6px !important; white-space: nowrap !important; overflow: hidden !important; }
body.tbl-fullscreen td        { padding: 4px 6px !important; white-space: nowrap !important; }
/* Column widths in fullscreen — balanced to fit all 10 columns */
body.tbl-fullscreen th:nth-child(1),
body.tbl-fullscreen td:nth-child(1) { width: 88px  !important; } /* Date */
body.tbl-fullscreen th:nth-child(2),
body.tbl-fullscreen td:nth-child(2) { width: 95px  !important; } /* Account */
body.tbl-fullscreen th:nth-child(3),
body.tbl-fullscreen td:nth-child(3) { width: 85px  !important; text-align:right; } /* Principal */
body.tbl-fullscreen th:nth-child(4),
body.tbl-fullscreen td:nth-child(4) { width: 85px  !important; text-align:right; } /* Applied Rate */
body.tbl-fullscreen th:nth-child(5),
body.tbl-fullscreen td:nth-child(5) { width: 105px !important; text-align:right; } /* Sheet Rate */
body.tbl-fullscreen th:nth-child(6),
body.tbl-fullscreen td:nth-child(6) { width: 85px  !important; text-align:right; } /* Bank Paid */
body.tbl-fullscreen th:nth-child(7),
body.tbl-fullscreen td:nth-child(7) { width: 105px !important; text-align:right; } /* Expected */
body.tbl-fullscreen th:nth-child(8),
body.tbl-fullscreen td:nth-child(8) { width: 90px  !important; text-align:right; } /* Difference */
body.tbl-fullscreen th:nth-child(9),
body.tbl-fullscreen td:nth-child(9) { width: 65px  !important; text-align:right; } /* Tax */
body.tbl-fullscreen th:nth-child(10),
body.tbl-fullscreen td:nth-child(10){ width: 85px  !important; } /* Status */

/* Expand row in fullscreen — full width, vertical wrap */
body.tbl-fullscreen .explain-row td {
  white-space: normal !important;
  word-wrap: break-word !important;
  overflow: visible !important;
  text-overflow: unset !important;
  padding: 10px 16px !important;
  font-size: 12px !important;
  line-height: 1.7 !important;
  background: var(--bg2) !important;
  border-top: 1px solid var(--border) !important;
  width: auto !important;
  max-width: none !important;
  /* Break out of fixed column width constraint */
  position: relative !important;
}
body.tbl-fullscreen .explain-row > td > div {
  display: block !important;
  width: calc(100vw - 40px) !important;
  max-width: calc(100vw - 40px) !important;
  white-space: normal !important;
  word-wrap: break-word !important;
}
body.tbl-fullscreen .explain-verdict {
  display: inline-block !important;
  margin-top: 8px !important;
  float: right !important;
}