/* Debit Balance Write-off Portal. Amazon palette: Squid Ink header, Amazon Orange accent, Amazon Blue data,
   AWS console greys. System fonts only (no external resources). */

/* ═══ DESIGN TOKENS ═══ */
:root {
  --ink: #232f3e; /* Squid Ink */
  --ink-dk: #131921;
  --ink-lt: #37475a;
  --orange: #ff9900; /* Amazon Orange */
  --orange-dk: #e47911;
  --orange-xdk: #c45500;
  --orange-lt: #fff5e6;
  --blue: #146eb4; /* Amazon Blue */
  --blue-lt: #00a8e1;
  --blue-bg: #f1f8fe;
  --link: #0073bb;
  --green: #1d8102;
  --green-bg: #f2f8f0;
  --red: #d13212;
  --red-bg: #fdf3f1;
  --amber-bg: #fff8e6;
  --grey: #879596;
  --surface: #ffffff;
  --surface-dim: #f8f9f9;
  --page: #f2f3f3;
  --border: #e3e6e6;
  --border-strong: #c8ced0;
  --text-heading: #0f1111;
  --text-body: #16191f;
  --text-muted: #545b64;
  /* chart series (semantic) */
  --c-wo: #146eb4;
  --c-ex: #ff9900;
  --c-mr: #232f3e;
  --c-tax: #00a8e1;
  --c-in: #879596;
  --c-young: #aab7b8;
  --c-offset: #d5dbdb;
  --c-ok: #1d8102;
  --c-fail: #d13212;
  --cat-0: #ff9900;
  --cat-1: #e47911;
  --cat-2: #c45500;
  --cat-3: #232f3e;
  --cat-4: #545b64;
  --cat-5: #ffb547;
  --cat-6: #37475a;
  --cat-7: #879596;
  --heat-1: #fff5e6;
  --heat-2: #ffd8a6;
  --heat-3: #ffb547;
  --heat-4: #ff9900;
  --heat-5: #c45500;
  --font: 'Amazon Ember', system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'SF Mono', 'Consolas', monospace;
  --radius: 8px;
  --transition: 0.18s ease;
}

/* ═══ RESET ═══ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
body {
  font-family: var(--font);
  background: var(--page);
  color: var(--text-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a {
  color: inherit;
}
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes sp {
  to {
    transform: rotate(360deg);
  }
}
@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 153, 0, 0.55);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(255, 153, 0, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 153, 0, 0);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 999;
  background: var(--orange);
  color: var(--ink-dk);
  padding: 8px 14px;
  border-radius: 6px;
}
.skip-link:focus {
  left: 8px;
}
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.hidden {
  display: none !important;
}
:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ═══ HEADER (Squid Ink band) ═══ */
.apphead {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 160% at 100% 0%, rgba(255, 153, 0, 0.14) 0%, rgba(255, 153, 0, 0) 45%),
    radial-gradient(110% 150% at 80% 0%, rgba(20, 110, 180, 0.22) 0%, rgba(20, 110, 180, 0) 50%), var(--ink);
  border-bottom: 3px solid var(--orange);
}
.apphead:not(.hero-mode) {
  position: sticky;
  top: 0;
  z-index: 90;
}
.apphead-art {
  position: absolute;
  inset: 0 0 0 auto;
  width: 60%;
  z-index: 1;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 35%);
  mask-image: linear-gradient(to right, transparent 0, #000 35%);
}
.apphead:not(.hero-mode) .apphead-art {
  opacity: 0.35;
}
.apphead-waves {
  width: 100%;
  height: 100%;
  display: block;
}
.apphead-inner {
  position: relative;
  z-index: 2;
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px 36px;
}
.apphead.hero-mode .apphead-inner {
  padding: 12px 36px 40px;
}
.apphead-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.apphead-left {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(255, 153, 0, 0.14);
  border: 1px solid rgba(255, 153, 0, 0.35);
}
.brand-text {
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
}
.version-pill {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--ink-dk);
  background: var(--orange);
  padding: 2px 8px;
  border-radius: 3px;
}
.scope-pill {
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 2px 8px;
  border-radius: 3px;
}
.apphead-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  justify-content: center;
}
.sb-item {
  padding: 8px 14px;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.sb-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}
.sb-item.active {
  color: #fff;
  font-weight: 700;
  border-bottom-color: var(--orange);
  border-radius: 0;
}
.apphead-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.apphead-hero {
  margin-top: 28px;
  max-width: 760px;
}
.apphead:not(.hero-mode) .apphead-hero {
  margin-top: 10px;
}
.apphead:not(.hero-mode) .hero-eyebrow,
.apphead:not(.hero-mode) .hero-sub {
  display: none;
}
.apphead:not(.hero-mode) .hero-title {
  font-size: 1.3rem;
  margin-bottom: 2px;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--orange);
  margin-bottom: 10px;
  text-transform: uppercase;
}
.hero-eyebrow::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
  animation: pulse 2s ease-out infinite;
}
.hero-title {
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  margin-bottom: 10px;
  line-height: 1.12;
}
.hero-sub {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.55;
  max-width: 640px;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  cursor: pointer;
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}
[data-theme='light'] .icon-moon,
[data-theme='dark'] .icon-sun {
  display: none;
}

/* ═══ USER MENU ═══ */
.user-menu {
  position: relative;
}
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 3px 10px 3px 3px;
  cursor: pointer;
}
.user-chip:hover {
  background: rgba(255, 255, 255, 0.16);
}
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--orange);
  color: var(--ink-dk);
  font-weight: 800;
  font-size: 0.76rem;
  flex-shrink: 0;
}
.user-chip .user-name {
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-chip .chev {
  color: rgba(255, 255, 255, 0.7);
  transition: transform var(--transition);
}
.user-chip[aria-expanded='true'] .chev {
  transform: rotate(180deg);
}
.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  padding: 8px;
  z-index: 120;
}
.ud-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 10px 12px;
}
.avatar-lg {
  width: 40px;
  height: 40px;
  font-size: 1rem;
}
.ud-info {
  min-width: 0;
}
.ud-name {
  font-weight: 700;
  color: var(--text-heading);
  font-size: 0.92rem;
}
.ud-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}
.ud-divider {
  height: 1px;
  background: var(--border);
  margin: 2px 4px;
}
.ud-item {
  display: flex;
  width: 100%;
  padding: 10px;
  border: none;
  background: none;
  color: var(--text-body);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  text-align: left;
  text-decoration: none;
  font-family: var(--font);
}
.ud-item:hover {
  background: var(--surface-dim);
}
#logoutBtn:hover {
  background: var(--red-bg);
  color: var(--red);
}
.ud-version {
  text-align: center;
  font-size: 0.68rem;
  color: var(--text-muted);
  padding: 9px 0 4px;
}

/* ═══ LAYOUT ═══ */
.content-area {
  flex: 1;
  padding: 22px 36px 48px;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  outline: none;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.split {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 16px;
}
.grow {
  flex: 1;
}

/* ═══ PANELS ═══ */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 1px 1px rgba(0, 28, 36, 0.06);
  animation: fadeInUp 0.35s ease both;
}
.panel-head {
  padding: 12px 18px;
  min-height: 54px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text-heading);
}
.panel-take {
  margin: 14px 18px 0;
  padding: 9px 12px;
  background: var(--surface-dim);
  border-left: 3px solid var(--orange);
  border-radius: 0 4px 4px 0;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--text-body);
}
.panel-take strong {
  color: var(--text-heading);
}
.panel-hint {
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.panel-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  align-items: center;
  flex-shrink: 0;
}
.panel-body {
  padding: 16px 18px;
}
.panel-desc {
  color: var(--text-muted);
  font-size: 0.86rem;
  margin-bottom: 12px;
  line-height: 1.55;
}
.step-dot {
  display: inline-flex;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  font-weight: 800;
  background: var(--ink);
  color: #fff;
}

/* ═══ FORMS & BUTTONS ═══ */
.form-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.form-group {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 160px;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-body);
  margin-bottom: 10px;
}
input,
select,
textarea {
  width: 100%;
  padding: 8px 11px;
  font-size: 0.88rem;
  font-family: var(--font);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-heading);
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--orange-dk);
  box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.22);
}
textarea {
  resize: vertical;
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--orange);
  color: var(--ink-dk);
  border: 1px solid var(--orange-dk);
  padding: 9px 22px;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition);
}
.btn-primary:hover {
  background: #fa8900;
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font);
  border-radius: 6px;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text-body);
  text-decoration: none;
  transition: all 0.12s;
}
.btn-secondary:hover {
  background: var(--surface-dim);
  border-color: var(--grey);
}
.btn-secondary:disabled {
  opacity: 0.55;
  cursor: wait;
}
.btn-danger {
  color: var(--red);
}
.btn-danger:hover {
  background: var(--red-bg);
  border-color: var(--red);
}
.btn-sm {
  padding: 5px 10px;
  font-size: 0.74rem;
}
.action-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.hint,
.kbd-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
}
.cb-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--text-body);
  cursor: pointer;
  margin-top: 10px;
}
.cb-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--orange-dk);
}
.lnk {
  color: var(--link);
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
}
.lnk:hover {
  text-decoration: underline;
  color: var(--orange-xdk);
}
.mono {
  font-family: var(--mono);
  font-size: 0.78rem;
}
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.filter-bar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 180px;
}
.filter-bar label.narrow {
  min-width: 120px;
}
.scope-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
}
.scope-chip strong {
  font-size: 1rem;
  color: var(--text-heading);
}
.table-filter {
  padding: 6px 12px;
  font-size: 0.8rem;
  width: 200px;
}

/* ═══ PILLS, ALERTS, TOASTS ═══ */
.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: middle;
}
.pill-ok {
  background: var(--green-bg);
  color: var(--green);
}
.pill-warn {
  background: var(--amber-bg);
  color: #8a4b00;
}
.pill-err {
  background: var(--red-bg);
  color: var(--red);
}
.pill-info {
  background: var(--blue-bg);
  color: var(--blue);
}
.pill-ink {
  background: #e9ebed;
  color: var(--ink);
}
.pill-muted {
  background: var(--surface-dim);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge {
  font-size: 0.64rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--surface-dim);
  color: var(--text-muted);
  border: 1px solid var(--border);
  margin-left: 6px;
}
.badge-accent {
  background: var(--orange-lt);
  color: var(--orange-xdk);
  border-color: #ffd8a6;
}
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 0.86rem;
  line-height: 1.5;
  margin: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.alert-err {
  background: var(--red-bg);
  border: 1px solid #f5c6bd;
  border-left: 4px solid var(--red);
  color: #7d1d0b;
}
.alert-info {
  background: var(--blue-bg);
  border: 1px solid #c3dff4;
  border-left: 4px solid var(--blue);
  color: #0b3e66;
}
.alert pre {
  white-space: pre-wrap;
  font-size: 0.75rem;
  margin-top: 6px;
  font-family: var(--mono);
}
.empty-state {
  text-align: center;
  padding: 26px;
  color: var(--text-muted);
  font-size: 0.86rem;
}
.toasts {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 420px;
}
.toast {
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
  transition: opacity 0.3s;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
}
.toast.fade {
  opacity: 0;
}
.toast-ok {
  border-left-color: var(--green);
}
.toast-err {
  border-left-color: var(--red);
  color: #7d1d0b;
}
.ov {
  position: fixed;
  inset: 0;
  background: rgba(19, 25, 33, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}
.ov-box p {
  color: #fff;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(135, 149, 150, 0.35);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: sp 0.6s linear infinite;
  margin: 0 auto 12px;
}
.skeleton-block {
  height: 120px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-dim) 25%, var(--border) 50%, var(--surface-dim) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
}

/* ═══ TABLES ═══ */
.tw {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 620px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
thead th {
  background: var(--surface-dim);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
thead th.sortable {
  cursor: pointer;
}
thead th.sortable:hover {
  color: var(--text-heading);
}
thead th.sorted-desc::after {
  content: ' ▼';
  color: var(--orange-dk);
}
thead th.sorted-asc::after {
  content: ' ▲';
  color: var(--orange-dk);
}
tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  max-width: 380px;
}
tbody tr:hover td {
  background: #f7fafa;
}
tr.clickable {
  cursor: pointer;
}
tr.selected td {
  background: var(--orange-lt) !important;
}
tfoot td {
  padding: 9px 12px;
  font-weight: 700;
  background: var(--surface-dim);
  border-top: 2px solid var(--border-strong);
}
th.num,
td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.delta-up {
  color: var(--green);
  font-weight: 700;
}
.delta-down {
  color: var(--red);
  font-weight: 700;
}
.row-actions {
  display: flex;
  gap: 6px;
}
ul.plain {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.86rem;
}
details summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--link);
  margin-top: 8px;
}
.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ═══ KPI CARDS ═══ */
.kpi-strip {
  display: grid;
  /* 180px keeps all five KPI cards on one row down to a ~1000px window */
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 12px;
  box-shadow: 0 1px 1px rgba(0, 28, 36, 0.06);
  border-left: 4px solid var(--border-strong);
  min-height: 116px;
  animation: fadeInUp 0.35s ease both;
}
.kpi-wo {
  border-left-color: var(--c-wo);
}
.kpi-ex {
  border-left-color: var(--c-ex);
}
.kpi-mr {
  border-left-color: var(--c-mr);
}
.kpi-in {
  border-left-color: var(--c-in);
}
.kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.kpi-value {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.02em;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.kpi-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.kpi-delta {
  font-size: 0.76rem;
  font-weight: 700;
  margin-top: 6px;
}
.kpi-delta.good {
  color: var(--green);
}
.kpi-delta.bad {
  color: var(--red);
}
.kpi-delta.neutral {
  color: var(--text-muted);
}
.kpi-spark {
  width: 72px;
  height: 22px;
  flex-shrink: 0;
  opacity: 0.95;
}
.spark {
  width: 100%;
  height: 100%;
}
.spark-line {
  fill: none;
  stroke-width: 2;
}

/* ═══ HEADLINE ═══ */
.headline {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--orange);
  border-radius: var(--radius);
  box-shadow: 0 1px 1px rgba(0, 28, 36, 0.06);
  padding: 20px 28px 22px;
  margin-bottom: 16px;
  text-align: center;
}
.headline-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange-xdk);
}

/* ═══ HOME ═══ */
.cockpit {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.latest-card .panel-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.latest-top {
  display: flex;
  align-items: flex-end;
  gap: 26px;
  flex-wrap: wrap;
}
.big-number {
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.02em;
  line-height: 1;
}
.big-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.checklist.compact .check {
  grid-template-columns: 1fr auto;
}
.checklist.compact .check-detail {
  grid-column: 1 / 3;
  font-size: 0.78rem;
}
.top-blockers {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.84rem;
}
.top-blockers li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 10px;
}
.top-blockers .meter {
  grid-column: 1 / 3;
}
.mini-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.mini-stat {
  padding: 10px 12px;
  background: var(--surface-dim);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.mini-stat .v {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-heading);
}
.mini-stat .l {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.qa-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-dim);
  text-decoration: none;
  color: var(--text-body);
  transition: all var(--transition);
}
.qa-btn:hover {
  border-color: var(--orange-dk);
  background: var(--orange-lt);
}
.qa-btn strong {
  display: block;
  color: var(--text-heading);
  font-size: 0.9rem;
}
.qa-btn span {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.qa-btn .qa-icon {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--orange);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.quick-actions + div .readiness-head {
  margin-top: 16px;
}
.region-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}
.region-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  border-top: 3px solid var(--ink);
  transition: all var(--transition);
}
.region-card:hover {
  border-top-color: var(--orange);
  box-shadow: 0 6px 18px rgba(0, 28, 36, 0.12);
  transform: translateY(-2px);
}
.rc-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rc-code {
  font-weight: 800;
  color: var(--ink);
  font-size: 0.95rem;
}
.rc-name {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rc-value {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-heading);
  margin-top: 6px;
}
.rc-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.rc-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--border);
  margin: 8px 0 2px;
}
.rc-bar span {
  display: block;
  height: 100%;
}
.rc-bar .wo {
  background: var(--c-wo);
}
.rc-bar .ex {
  background: var(--c-ex);
}
.rc-legend {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.rc-spark {
  height: 30px;
  margin: 4px 0;
}
.rc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 0.74rem;
  color: var(--text-muted);
}
.steps-track {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  list-style: none;
}
.step {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: var(--surface-dim);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.step-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: var(--orange);
  font-weight: 800;
  font-size: 0.8rem;
}
.step-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.step-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-heading);
}
.step-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}
.gate h2 {
  color: var(--text-heading);
  margin-bottom: 8px;
}

/* ═══ UPLOAD ═══ */
.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.seg-btn {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-body);
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  font-family: var(--font);
}
.seg-btn:hover {
  border-color: var(--orange-dk);
}
.seg-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.readiness-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.check {
  display: grid;
  grid-template-columns: 200px 160px 1fr;
  gap: 4px 12px;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--surface-dim);
  border-left: 4px solid var(--border-strong);
  font-size: 0.84rem;
}
.check-ok {
  border-left-color: var(--green);
}
.check-attention {
  border-left-color: var(--orange);
}
.check-blocked {
  border-left-color: var(--red);
}
.check-info {
  border-left-color: var(--blue);
}
.check-name {
  font-weight: 700;
  color: var(--text-heading);
}
.check-status {
  font-weight: 700;
}
.check-ok .check-status {
  color: var(--green);
}
.check-attention .check-status {
  color: var(--orange-xdk);
}
.check-blocked .check-status {
  color: var(--red);
}
.check-detail {
  color: var(--text-muted);
}
.check-action {
  grid-column: 2 / 4;
  color: var(--text-body);
  font-weight: 600;
}
.kind-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 10px;
}
.kind-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  font-family: var(--font);
  color: var(--text-body);
  transition: all var(--transition);
}
.kind-card:hover:not(:disabled) {
  border-color: var(--orange-dk);
}
.kind-card.active {
  border-color: var(--orange-dk);
  background: var(--orange-lt);
  box-shadow: 0 0 0 2px rgba(255, 153, 0, 0.35);
}
.kind-card:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.kind-title {
  font-weight: 700;
  color: var(--text-heading);
  font-size: 0.92rem;
}
.kind-help {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}
.kind-ext {
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--text-muted);
}
.kind-blocked {
  font-size: 0.78rem;
  color: var(--red);
  font-weight: 700;
}
.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 2px dashed var(--border-strong);
  border-radius: 6px;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  background: var(--surface-dim);
  color: var(--text-muted);
  font-size: 0.88rem;
  transition: all var(--transition);
}
.drop:hover,
.drop.over {
  border-color: var(--orange-dk);
  background: var(--orange-lt);
}
.file-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-dim);
}
.file-meta {
  font-size: 0.86rem;
}
.frm {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--text-muted);
  cursor: pointer;
}
.frm:hover {
  color: var(--red);
}
ul.precheck,
ul.warnings {
  margin: 10px 0 0 18px;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
ul.warnings {
  color: #8a4b00;
}
.progress {
  position: relative;
  height: 22px;
  border-radius: 4px;
  background: var(--surface-dim);
  border: 1px solid var(--border);
  overflow: hidden;
  margin: 12px 0;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: var(--orange);
  transition: width 0.2s;
}
.progress span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--ink-dk);
}
.tracker {
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.track-steps {
  list-style: none;
  display: flex;
  margin-bottom: 10px;
}
.track-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  position: relative;
}
.track-step::before {
  content: '';
  position: absolute;
  top: 7px;
  left: -50%;
  right: 50%;
  height: 2px;
  background: var(--border);
}
.track-step:first-child::before {
  display: none;
}
.track-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  z-index: 1;
}
.track-step.done {
  color: var(--green);
}
.track-step.done .track-dot {
  background: var(--green);
  border-color: var(--green);
}
.track-step.done::before {
  background: var(--green);
}
.track-step.active {
  color: var(--orange-xdk);
  font-weight: 700;
}
.track-step.active .track-dot {
  border-color: var(--orange);
  animation: pulse 1.6s infinite;
}
.track-step.fail {
  color: var(--red);
  font-weight: 700;
}
.track-step.fail .track-dot {
  background: var(--red);
  border-color: var(--red);
}
.track-msg {
  font-size: 0.86rem;
}
.preview {
  margin-top: 10px;
}
.preview-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.fact {
  font-size: 0.76rem;
  background: var(--blue-bg);
  color: var(--blue);
  padding: 3px 9px;
  border-radius: 3px;
  font-weight: 700;
}

/* ═══ RUN ANALYSIS ═══ */
.run-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
.run-head-main {
  flex: 1;
  min-width: 320px;
}
.run-title {
  font-size: 0.9rem;
  color: var(--text-muted);
}
.run-title strong {
  color: var(--text-heading);
  font-size: 1.15rem;
}
.run-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 8px 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.run-meta b {
  color: var(--text-heading);
  font-weight: 700;
}
.run-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.timeline {
  list-style: none;
  border-left: 3px solid var(--border);
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.86rem;
}
.compare td.num:last-child {
  font-weight: 700;
}

/* supplier explorer */
.explorer-filters {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.explorer-filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
}
.explorer-summary {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.86rem;
  margin-bottom: 10px;
}
.explorer-summary b {
  color: var(--text-heading);
}
.explorer-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.explorer-layout.with-detail {
  grid-template-columns: 1fr 360px;
}
.supplier-detail {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  background: var(--surface-dim);
  align-self: start;
  position: sticky;
  top: 120px;
}
.supplier-detail h3 {
  font-size: 1rem;
  color: var(--text-heading);
  margin-bottom: 2px;
}
.sd-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}
.sd-grid div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px;
}
.sd-grid .v {
  font-weight: 800;
  color: var(--text-heading);
}
.sd-grid .l {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.sd-reasons {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
}
.sd-reasons li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
}
.sd-reasons .meter {
  grid-column: 1 / 3;
}

/* bars inside cells / cards */
.meter {
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  background: var(--c-ex);
}
.meter-fill.wo {
  background: var(--c-wo);
}
.batch-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.batch-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-dim);
}
.batch-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}
.batch-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-heading);
  margin: 4px 0 8px;
}
.batch-sub,
.batch-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
}
.mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mini {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-dim);
}
.mini-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-heading);
}
.mini-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-body);
}
.mini-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.footnote {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 6px;
}
.print-only {
  display: none;
}

/* ═══ TABS ═══ */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-strong);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 10px 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 700;
  font-family: var(--font);
  margin-bottom: -1px;
}
.tab:hover {
  color: var(--text-heading);
}
.tab.active {
  color: var(--text-heading);
  border-bottom-color: var(--orange);
}

/* ═══ CHARTS ═══ */
.chart {
  position: relative;
  width: 100%;
}
.chart svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}
.chart-empty {
  padding: 34px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.86rem;
  background: var(--surface-dim);
  border-radius: 6px;
  border: 1px dashed var(--border-strong);
}
.chart-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 8px;
}
.ch-label {
  font-size: 12px;
  fill: var(--text-body);
}
.ch-label-strong {
  font-size: 12.5px;
  font-weight: 700;
  fill: var(--text-heading);
}
.ch-sub,
.ch-axis {
  font-size: 11px;
  fill: var(--text-muted);
}
.ch-axis-strong {
  font-size: 11.5px;
  font-weight: 700;
  fill: var(--text-body);
}
.ch-value {
  font-size: 11.5px;
  font-weight: 700;
  fill: var(--text-heading);
}
.ch-legend {
  font-size: 11.5px;
  fill: var(--text-body);
}
.ch-on-bar,
.ch-on-dark {
  font-size: 11.5px;
  font-weight: 700;
  fill: #fff;
  pointer-events: none;
}
.ch-on-light {
  font-size: 11px;
  font-weight: 700;
  fill: var(--ink);
  pointer-events: none;
}
.ch-grid {
  stroke: var(--border);
  stroke-width: 1;
}
.ch-axis-line {
  stroke: var(--border-strong);
  stroke-width: 1;
}
.ch-connector {
  stroke: var(--grey);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.ch-track {
  fill: var(--surface-dim);
}
.ch-ref {
  stroke: var(--red);
  stroke-width: 1.2;
  stroke-dasharray: 5 4;
}
.ch-ref-label {
  font-size: 10.5px;
  fill: var(--red);
  font-weight: 700;
  /* halo so the label stays readable where it crosses a column */
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 4px;
  stroke-linejoin: round;
}
.ch-line {
  fill: none;
  stroke-width: 2.5;
}
.ch-dashed {
  stroke-dasharray: 6 4;
}
.ch-dot {
  stroke: var(--surface);
  stroke-width: 1.5;
}
.ch-mark {
  transition: opacity 0.15s;
  outline: none;
}
.ch-mark:hover,
.ch-mark:focus {
  opacity: 0.78;
}
.ch-click {
  cursor: pointer;
}
.c-wo {
  fill: var(--c-wo);
}
.c-ex {
  fill: var(--c-ex);
}
.c-mr {
  fill: var(--c-mr);
}
.c-tax {
  fill: var(--c-tax);
}
.c-in {
  fill: var(--c-in);
}
.c-young {
  fill: var(--c-young);
}
.c-offset {
  fill: var(--c-offset);
}
.c-ok {
  fill: var(--c-ok);
}
.c-fail {
  fill: var(--c-fail);
}
.c-ink {
  fill: var(--ink);
}
.c-orange-dk {
  fill: var(--orange-xdk);
}
.c-wo-line {
  stroke: var(--c-wo);
}
.c-ex-line {
  stroke: var(--c-ex);
}
.c-mr-line {
  stroke: var(--c-mr);
}
.c-tax-line {
  stroke: var(--c-tax);
}
.c-in-line {
  stroke: var(--c-in);
}
.c-ok-line {
  stroke: var(--c-ok);
}
.c-line-ink,
.c-ink-line {
  stroke: var(--ink);
}
.c-orange-dk-line {
  stroke: var(--orange-xdk);
}
.cat-0 {
  fill: var(--cat-0);
}
.cat-1 {
  fill: var(--cat-1);
}
.cat-2 {
  fill: var(--cat-2);
}
.cat-3 {
  fill: var(--cat-3);
}
.cat-4 {
  fill: var(--cat-4);
}
.cat-5 {
  fill: var(--cat-5);
}
.cat-6 {
  fill: var(--cat-6);
}
.cat-7 {
  fill: var(--cat-7);
}
.heat-0 {
  fill: var(--surface-dim);
}
.heat-1 {
  fill: var(--heat-1);
}
.heat-2 {
  fill: var(--heat-2);
}
.heat-3 {
  fill: var(--heat-3);
}
.heat-4 {
  fill: var(--heat-4);
}
.heat-5 {
  fill: var(--heat-5);
}
.chart-tip {
  position: fixed;
  z-index: 2000;
  pointer-events: none;
  background: var(--ink-dk);
  color: #fff;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 0.78rem;
  line-height: 1.45;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  max-width: 340px;
  border-top: 3px solid var(--orange);
}
.chart-tip .tip-title {
  font-weight: 700;
  margin-bottom: 2px;
}
.legend-inline {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.legend-inline i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: -1px;
}
.sw-wo {
  background: var(--c-wo);
}
.sw-ex {
  background: var(--c-ex);
}
.sw-mr {
  background: var(--c-mr);
}

/* ═══ CALLBACK PAGE ═══ */
body.callback {
  background: var(--ink);
  align-items: center;
  justify-content: center;
  color: #fff;
}
.callback-box {
  text-align: center;
}

/* ═══ DARK MODE ═══ */
[data-theme='dark'] {
  --surface: #1b232d;
  --surface-dim: #161d26;
  --page: #0f141a;
  --border: #2e3a47;
  --border-strong: #414d5c;
  --text-heading: #f2f3f3;
  --text-body: #d5dbdb;
  --text-muted: #95a5a6;
  --ink: #232f3e;
  --c-mr: #8d99a8;
  --c-offset: #414d5c;
  --cat-3: #8d99a8;
  --cat-4: #6c7a89;
  --heat-1: #3a2a12;
  --heat-2: #6b4410;
  --heat-3: #a3600f;
  --heat-4: #e47911;
  --heat-5: #ffb547;
  --green-bg: rgba(29, 129, 2, 0.18);
  --red-bg: rgba(209, 50, 18, 0.18);
  --amber-bg: rgba(255, 153, 0, 0.16);
  --blue-bg: rgba(20, 110, 180, 0.2);
  --orange-lt: rgba(255, 153, 0, 0.12);
  --link: #44b9d6;
}
[data-theme='dark'] .pill-ok,
[data-theme='dark'] .kpi-delta.good,
[data-theme='dark'] .delta-up,
[data-theme='dark'] .is-ok .status-value {
  color: #6bd35f;
}
[data-theme='dark'] .is-blocked .status-value {
  color: #ff7a5c;
}
[data-theme='dark'] .is-attention .status-value {
  color: #ffb547;
}
/* Squid Ink marks (totals, cumulative lines) disappear on the dark surface: draw them light */
[data-theme='dark'] .c-ink {
  fill: #c6ccd2;
}
[data-theme='dark'] .c-line-ink,
[data-theme='dark'] .c-ink-line {
  stroke: #c6ccd2;
}
/* the darkest heat levels become the lightest in dark mode, so their labels need dark text */
[data-theme='dark'] .heat-4 + text,
[data-theme='dark'] .heat-5 + text {
  fill: #0f1111;
}
[data-theme='dark'] .next-step:not(.primary) .next-num {
  background: #2e3a47;
}
[data-theme='dark'] .pill-err,
[data-theme='dark'] .kpi-delta.bad,
[data-theme='dark'] .kind-blocked,
[data-theme='dark'] .delta-down {
  color: #ff7a5c;
}
[data-theme='dark'] .pill-warn,
[data-theme='dark'] ul.warnings {
  color: #ffb547;
}
[data-theme='dark'] .pill-info,
[data-theme='dark'] .fact {
  color: #7cc4f5;
}
[data-theme='dark'] .pill-ink {
  background: #2e3a47;
  color: #d5dbdb;
}
[data-theme='dark'] tbody tr:hover td {
  background: #1f2934;
}
[data-theme='dark'] .alert-err {
  color: #ffc1b3;
}
[data-theme='dark'] .alert-info {
  color: #bfe1fa;
}
[data-theme='dark'] .ch-on-light {
  fill: #fff5e6;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1100px) {
  .grid-2,
  .grid-3,
  .split,
  .cockpit {
    grid-template-columns: 1fr;
  }
  .explorer-filters {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .explorer-layout.with-detail {
    grid-template-columns: 1fr;
  }
  .supplier-detail {
    position: static;
  }
  .steps-track {
    grid-template-columns: 1fr 1fr;
  }
  .sb-item {
    padding: 8px 9px;
    font-size: 0.82rem;
  }
}
@media (max-width: 720px) {
  .apphead-top {
    flex-wrap: wrap;
  }
  .apphead-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .content-area {
    padding: 14px;
  }
  .apphead-inner,
  .apphead.hero-mode .apphead-inner {
    padding: 12px 14px 22px;
  }
  .hero-title {
    font-size: 1.6rem;
  }
  .check {
    grid-template-columns: 1fr;
  }
  .check-action {
    grid-column: auto;
  }
  .batch-grid,
  .mini-grid,
  .steps-track,
  .mini-stats,
  .explorer-filters {
    grid-template-columns: 1fr;
  }
}

/* ═══ PRINT (leadership PDF) ═══ */
@media print {
  .apphead,
  .no-print,
  .toasts,
  .skip-link {
    display: none !important;
  }
  body {
    background: #fff;
  }
  .content-area {
    max-width: none;
    padding: 0;
  }
  .print-only {
    display: block;
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 10px;
    color: #000;
  }
  .panel,
  .kpi {
    break-inside: avoid;
    box-shadow: none;
    animation: none;
  }
  .tw {
    max-height: none;
    overflow: visible;
  }
}

/* ═══ UI REVIEW: shared layout fixes ═══ */
/* Panel headings are centred: title over its hint in the middle, buttons (if any) on the right. The equal side
   columns keep the title on the panel's centre line whether or not there are buttons. */
.panel-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  justify-content: initial;
}
.panel-heading {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  text-align: center;
}
.panel-actions {
  grid-column: 3;
  justify-self: end;
  margin-left: 0;
}
@media (max-width: 900px) {
  .panel-head {
    grid-template-columns: 1fr;
    justify-items: center;
    row-gap: 8px;
  }
  .panel-heading,
  .panel-actions {
    grid-column: 1;
    justify-self: center;
  }
}
.headline-text {
  max-width: 980px;
  margin: 8px auto 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text-heading);
}
.headline-points {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 8px;
  max-width: 1180px;
  margin: 16px auto 0;
  text-align: left;
}
.headline-points li {
  position: relative;
  padding: 8px 12px 8px 26px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-dim);
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text-body);
}
.headline-points li::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 14px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
}
/* equal-height cards in every row; the gap does the spacing */
.grid-2,
.grid-3,
.split,
.cockpit {
  align-items: stretch;
  margin-bottom: 16px;
}
.grid-2 > .panel,
.grid-3 > .panel,
.split > .panel,
.cockpit > .panel {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.grid-2 > .panel > .panel-body,
.grid-3 > .panel > .panel-body,
.split > .panel > .panel-body,
.cockpit > .panel > .panel-body {
  flex: 1;
}
.kpi-valrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-top: 6px;
}
.kpi-valrow .kpi-spark {
  width: auto;
  flex: 0 1 72px;
  min-width: 36px;
}
/* read-only field that lines up with the selects next to it */
.static-field {
  display: flex;
  align-items: center;
  min-height: 36px;
  min-width: 200px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-dim);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-heading);
}
.filter-bar select {
  min-height: 36px;
}
.filter-bar .btn-secondary {
  min-height: 36px;
}
.skeleton-sm {
  height: 150px;
}

/* ═══ HOME COCKPIT ═══ */
.cockpit {
  grid-template-columns: 1.55fr 1fr;
}
.latest-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 28px;
  align-items: center;
}
.latest-main .kpi-delta {
  margin-top: 8px;
}
.latest-split {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rc-bar-lg {
  height: 12px;
  margin: 0;
  border-radius: 6px;
}
.split-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.split-stat {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.split-stat .dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-top: 3px;
  flex-shrink: 0;
}
.split-label,
.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.split-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-heading);
  line-height: 1.25;
}
.split-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
}
.section-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.top-blockers .meter {
  height: 5px;
}
.top-blockers + .lnk {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.86rem;
}
.status-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.status-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 2px 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 0.86rem;
}
.status-row.is-info {
  grid-template-columns: 1fr auto;
}
.status-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  font-weight: 800;
  color: #fff;
  background: var(--grey);
}
.is-ok .status-icon {
  background: var(--green);
}
.is-attention .status-icon {
  background: var(--orange);
  color: var(--ink-dk);
}
.is-blocked .status-icon {
  background: var(--red);
}
.is-info .status-icon {
  background: var(--blue);
}
.status-name {
  font-weight: 600;
  color: var(--text-heading);
}
.status-value {
  font-weight: 700;
  text-align: right;
  color: var(--text-body);
}
.is-ok .status-value {
  color: var(--green);
}
.is-attention .status-value {
  color: var(--orange-xdk);
}
.is-blocked .status-value {
  color: var(--red);
}
.status-action {
  grid-column: 2 / 4;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.next-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}
.next-step {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-body);
  text-decoration: none;
  transition: all var(--transition);
}
.next-step:hover {
  border-color: var(--orange-dk);
  background: var(--orange-lt);
}
.next-step.primary {
  background: var(--orange);
  border-color: var(--orange-dk);
  color: var(--ink-dk);
}
.next-step.primary:hover {
  background: #fa8900;
}
.next-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: var(--orange);
  font-weight: 800;
  font-size: 0.82rem;
}
.next-text strong {
  display: block;
  font-size: 0.92rem;
  color: inherit;
}
.next-step:not(.primary) .next-text strong {
  color: var(--text-heading);
}
.next-text span {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.next-step.primary .next-text span {
  color: var(--ink-lt);
}
.next-go {
  font-size: 1.1rem;
  font-weight: 700;
}
@media (max-width: 1100px) {
  .latest-hero {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}
@media (max-width: 720px) {
  .panel-head {
    flex-wrap: wrap;
  }
  .headline {
    padding: 16px;
  }
}
.rc-link {
  color: var(--link);
  font-weight: 700;
}
/* cards without a trend line (e.g. all-region totals) */
.kpi-valrow .kpi-spark:empty {
  display: none;
}
.kpi-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tw td:first-child,
.tw th {
  white-space: nowrap;
}
.status-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}
.cell-note {
  max-width: 240px;
  font-size: 0.76rem;
  color: var(--red);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell-note.muted {
  color: var(--text-muted);
}
.status-cell .nowrap {
  white-space: nowrap;
}
/* "All runs to date": what is added up and what is "now" */
.scope-note {
  margin: 0 0 16px;
  font-size: 0.84rem;
  line-height: 1.5;
}
