@import url("https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700;800&display=swap");

:root {
  --bg: #061014;
  --bg-deep: #03080b;
  --surface: #091820;
  --surface-2: #0c2029;
  --surface-3: #102a34;
  --line: rgba(86, 124, 135, 0.34);
  --line-soft: rgba(86, 124, 135, 0.2);
  --text: #eef7f8;
  --muted: #8d9aa4;
  --faint: #61727c;
  --gold: #ffc72c;
  --green: #44e46b;
  --red: #ff594e;
  --cyan: #22d7f3;
  --orange: #ff9e2c;
  --panel-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --brand-font: "Rajdhani", "Bahnschrift Condensed", "Agency FB", "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "Cascadia Mono", "JetBrains Mono", Consolas, "SFMono-Regular", monospace;
  --sans: "Segoe UI", Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% 4%, rgba(34, 215, 243, 0.08), transparent 340px),
    linear-gradient(180deg, #061116 0%, #031014 48%, #03090d 100%);
  color: var(--text);
  font-family: var(--sans);
  letter-spacing: 0;
  overflow-x: hidden;
}

button {
  font: inherit;
}

svg {
  display: block;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

.terminal-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr) 48px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px);
  background-size: 42px 42px;
}

.terminal-header {
  min-width: 0;
  height: 58px;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr) 148px;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  background: rgba(4, 13, 17, 0.96);
  border-bottom: 1px solid rgba(255, 199, 44, 0.54);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.34);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo,
.brand-glyph {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  color: var(--gold);
  filter: drop-shadow(0 0 10px rgba(255, 199, 44, 0.18));
}

.brand h1 {
  margin: 0;
  font-family: var(--brand-font);
  font-size: 31px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.045em;
  color: #fbfbfc;
  white-space: nowrap;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.12);
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  height: 29px;
  padding: 0 12px;
  border: 1px solid rgba(255, 199, 44, 0.38);
  border-radius: 6px;
  background: rgba(255, 199, 44, 0.07);
  color: var(--gold);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.header-status {
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  scrollbar-width: none;
}

.header-status::-webkit-scrollbar {
  display: none;
}

.header-status span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 0 20px;
  border-right: 1px solid rgba(143, 162, 170, 0.32);
}

.inline-binance {
  width: 15px;
  height: 15px;
  color: var(--gold);
  filter: drop-shadow(0 0 8px rgba(255, 199, 44, 0.2));
}

.header-status span:last-child {
  border-right: 0;
}

.header-status b,
.terminal-footer b {
  font-weight: 800;
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
}

.header-actions button {
  position: relative;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #aebbc0;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.header-actions button:hover {
  color: var(--cyan);
  background: rgba(34, 215, 243, 0.08);
}

.header-actions svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.notify-dot {
  position: absolute;
  top: -4px;
  right: -2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: #091015;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 900;
}

.terminal-body {
  min-width: 0;
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr);
}

.sidebar {
  min-width: 0;
  padding: 16px 8px;
  background: linear-gradient(180deg, rgba(4, 15, 19, 0.96), rgba(2, 11, 14, 0.96));
  border-right: 1px solid var(--line-soft);
}

.sidebar nav {
  display: grid;
  gap: 9px;
}

.sidebar a {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #9aa7ae;
  text-decoration: none;
  font-size: 12px;
  line-height: 1.15;
}

.sidebar a:hover,
.sidebar a.active {
  color: var(--gold);
  background: rgba(255, 199, 44, 0.07);
  border-color: rgba(255, 199, 44, 0.56);
  box-shadow: inset 3px 0 0 var(--gold);
}

.sidebar svg {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  fill: currentColor;
}

.content {
  min-width: 0;
  padding: 13px 14px 26px;
  display: grid;
  gap: 12px;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(8, minmax(122px, 1fr));
  gap: 8px;
}

.kpi {
  min-width: 0;
  height: 108px;
  padding: 12px 10px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: center;
  justify-items: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012)),
    rgba(11, 29, 36, 0.88);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--panel-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.kpi.accent {
  border-color: rgba(34, 215, 243, 0.42);
}

.kpi > .kpi-label,
.kpi > small {
  min-width: 0;
  width: 100%;
  color: #9caab1;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
}

.kpi > small {
  font-size: 12px;
  text-transform: none;
}

.kpi-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.kpi-label span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-symbol {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--gold);
  stroke-width: 1.9;
  filter: drop-shadow(0 0 8px rgba(255, 199, 44, 0.12));
}

.kpi.accent .card-symbol {
  color: var(--cyan);
  filter: drop-shadow(0 0 8px rgba(34, 215, 243, 0.16));
}

.kpi strong {
  min-width: 0;
  width: 100%;
  color: #f4fbfc;
  font-family: var(--mono);
  font-size: clamp(18px, 1.45vw, 25px);
  line-height: 1.15;
  font-weight: 800;
  text-align: center;
  overflow-wrap: anywhere;
}

.kpi.accent strong {
  color: var(--cyan);
}

.matrix {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(520px, 1.48fr) minmax(300px, 0.78fr) minmax(320px, 0.9fr);
  gap: 8px;
}

.bottom-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(250px, 0.78fr) minmax(250px, 0.78fr) minmax(560px, 2.1fr);
  gap: 8px;
}

.analytics-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr;
}

.panel {
  min-width: 0;
  min-height: 0;
  background:
    linear-gradient(180deg, rgba(23, 72, 83, 0.16), rgba(8, 25, 31, 0.74)),
    rgba(7, 20, 25, 0.92);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--panel-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.035);
  overflow: hidden;
}

.panel-title {
  height: 37px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-title.compact {
  height: 35px;
}

.panel-title h2 {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #f2f7f8;
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.panel-title h2 > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-title h2 small {
  color: #9aa7ad;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
}

.sentinela-card .panel-title h2 {
  gap: 6px;
  flex: 0 0 auto;
  font-size: 14px;
}

.sentinela-card .section-symbol {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
}

.sentinela-card .panel-title > span {
  font-size: 8px;
}

.section-symbol {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  color: #dce7ea;
  filter: drop-shadow(0 0 8px rgba(34, 215, 243, 0.12));
}

.panel-title > span {
  color: #82939c;
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
}

.table-shell {
  overflow: auto;
  padding: 0 7px 7px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--mono);
}

th,
td {
  height: 33px;
  padding: 7px 10px;
  border-bottom: 1px solid rgba(100, 132, 142, 0.16);
  text-align: left;
  white-space: nowrap;
  font-size: 12px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 31px;
  color: #8997a0;
  background: rgba(8, 24, 30, 0.98);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
}

td {
  color: #e8f1f2;
}

tbody tr:hover {
  background: rgba(34, 215, 243, 0.045);
}

.panel-radar .table-shell {
  max-height: 286px;
}

.dna-shell {
  max-height: 300px;
}

.rank {
  color: #d9e1e3;
}

.asset {
  color: #f8fbfb;
  font-weight: 800;
}

.signal,
.trend,
.status-chip,
.shadow-status {
  font-weight: 900;
}

.dot-text {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.dot-text::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.legend {
  min-height: 38px;
  margin: 0 7px 7px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #b9c4c9;
  background: rgba(5, 16, 20, 0.58);
  font-family: var(--mono);
  font-size: 10px;
}

.legend b {
  font-weight: 900;
}

.insight-table {
  display: grid;
  padding: 7px;
}

.insight-row {
  min-height: 30px;
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 0 9px;
  border-bottom: 1px solid rgba(100, 132, 142, 0.18);
  font-family: var(--mono);
  font-size: 12px;
}

.insight-icon {
  width: 18px;
  height: 18px;
  color: #bbc7cc;
}

.insight-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
}

.insight-label {
  min-width: 0;
  color: #b6c1c7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insight-value {
  justify-self: end;
  text-align: right;
  font-weight: 900;
}

.summary-box {
  margin: 7px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid rgba(34, 215, 243, 0.18);
  border-radius: 6px;
  background: rgba(3, 16, 21, 0.72);
  color: var(--green);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.35;
}

.summary-box.compact {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #edf7f8;
}

.metric-lines {
  padding: 7px 10px 10px;
  display: grid;
}

.metric-line {
  min-height: 27px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(100, 132, 142, 0.16);
  font-family: var(--mono);
  font-size: 12px;
}

.metric-line span:first-child {
  color: #a3b0b6;
}

.metric-line strong {
  min-width: 0;
  color: #edf7f8;
  font-size: 12px;
  text-align: right;
  overflow-wrap: anywhere;
}

.health {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.health i {
  width: 8px;
  height: 11px;
  background: rgba(68, 228, 107, 0.42);
}

.health i.on {
  background: var(--green);
}

.shadow-table .table-shell {
  max-height: 320px;
}

.shadow-table table {
  min-width: 0;
  table-layout: fixed;
}

.shadow-table th,
.shadow-table td {
  padding-right: 6px;
  padding-left: 6px;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shadow-table th:nth-child(1),
.shadow-table td:nth-child(1) {
  width: 30%;
}

.shadow-table th:nth-child(2),
.shadow-table td:nth-child(2) {
  width: 12%;
}

.shadow-table th:nth-child(3),
.shadow-table td:nth-child(3) {
  width: 14%;
}

.shadow-table th:nth-child(4),
.shadow-table td:nth-child(4) {
  width: 12%;
}

.shadow-table th:nth-child(5),
.shadow-table td:nth-child(5) {
  width: 9%;
}

.shadow-table th:nth-child(6),
.shadow-table td:nth-child(6) {
  width: 11%;
}

.shadow-table th:nth-child(7),
.shadow-table td:nth-child(7) {
  width: 12%;
}

.shadow-table th {
  font-size: 9px;
}

.shadow-row-primary {
  outline: 1px solid rgba(34, 215, 243, 0.85);
  outline-offset: -1px;
  background: rgba(34, 215, 243, 0.055);
}

.shadow-name {
  display: grid;
  gap: 3px;
  color: var(--cyan);
  font-weight: 900;
  min-width: 0;
}

.shadow-experiment {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.shadow-row-icon {
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  display: grid;
  place-items: center;
  color: #aebbc0;
}

.shadow-row-primary .shadow-row-icon {
  color: var(--cyan);
}

.shadow-row-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
}

.shadow-name small {
  color: #8deffc;
  font-size: 10px;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shadow-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shadow-analytics-panel {
  min-height: 280px;
}

.analytics-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(118px, 1fr));
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--line-soft);
}

.quality-card {
  min-width: 0;
  min-height: 78px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(100, 132, 142, 0.22);
  border-radius: 7px;
  background: rgba(2, 13, 17, 0.54);
  font-family: var(--mono);
}

.quality-card span,
.quality-card small {
  min-width: 0;
  color: #91a1a9;
  font-size: 10px;
  line-height: 1.15;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quality-card strong {
  min-width: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quality-card small {
  text-transform: none;
}

.diagnostic-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(560px, 1.18fr);
  gap: 8px;
  padding: 8px;
}

.backtest-block {
  min-width: 0;
  padding: 0 8px 8px;
}

.backtest-title {
  padding: 8px 4px 7px;
}

.diagnostic-list {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
}

.diagnostic-alert {
  min-width: 0;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(100, 132, 142, 0.22);
  border-radius: 7px;
  background: rgba(2, 13, 17, 0.56);
  font-family: var(--mono);
}

.diagnostic-alert::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--muted);
}

.diagnostic-alert.positive::before {
  background: var(--green);
}

.diagnostic-alert.warning::before {
  background: var(--gold);
}

.diagnostic-alert.negative::before {
  background: var(--red);
}

.diagnostic-alert b,
.diagnostic-alert span {
  grid-column: 2;
  min-width: 0;
}

.diagnostic-alert b {
  color: var(--text);
  font-size: 12px;
}

.diagnostic-alert span {
  color: #9cacb4;
  font-size: 11px;
  line-height: 1.35;
}

.open-diagnostics {
  padding: 0;
  border: 1px solid rgba(100, 132, 142, 0.2);
  border-radius: 7px;
  background: rgba(2, 13, 17, 0.32);
}

.open-diagnostics table {
  min-width: 680px;
}

.open-diagnostics th,
.open-diagnostics td {
  height: 31px;
  font-size: 11px;
}

.green,
.positive,
.positive-text {
  color: var(--green) !important;
}

.red,
.negative,
.negative-text {
  color: var(--red) !important;
}

.gold,
.warning,
.gold-text {
  color: var(--gold) !important;
}

.cyan,
.accent,
.cyan-text {
  color: var(--cyan) !important;
}

.neutral,
.muted {
  color: var(--muted) !important;
}

.orange {
  color: var(--orange) !important;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px rgba(68, 228, 107, 0.8);
}

.empty {
  height: 46px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
}

.terminal-footer {
  min-width: 0;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 22px;
  color: #798991;
  background: rgba(4, 13, 17, 0.96);
  border-top: 1px solid rgba(255, 199, 44, 0.42);
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
}

.terminal-footer span {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.utility-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.34);
}

.utility-panel {
  position: fixed;
  z-index: 31;
  top: 68px;
  right: 14px;
  width: min(430px, calc(100vw - 28px));
  max-height: calc(100vh - 92px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background:
    linear-gradient(180deg, rgba(23, 72, 83, 0.2), rgba(7, 20, 25, 0.96)),
    rgba(5, 16, 20, 0.98);
  border: 1px solid rgba(34, 215, 243, 0.38);
  border-radius: 7px;
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transform: translateX(calc(100% + 34px));
  opacity: 0;
  pointer-events: none;
  transition: transform 180ms ease, opacity 180ms ease;
  overflow: hidden;
}

.utility-panel.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.utility-head {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.utility-head span {
  display: block;
  margin-bottom: 5px;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.utility-head h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: 0.04em;
}

.utility-head button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  color: #b9c4ca;
  cursor: pointer;
}

.utility-head button:hover {
  color: var(--cyan);
  border-color: rgba(34, 215, 243, 0.4);
}

.utility-head svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.utility-body {
  min-height: 0;
  overflow: auto;
  padding: 12px;
  font-family: var(--mono);
}

.utility-section {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.utility-section h3 {
  margin: 0 0 2px;
  color: #c7d2d7;
  font-size: 12px;
  text-transform: uppercase;
}

.utility-row,
.alert-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid rgba(100, 132, 142, 0.2);
  border-radius: 6px;
  background: rgba(2, 13, 17, 0.56);
  color: #d8e3e7;
  font-size: 12px;
}

.utility-row span,
.alert-row span {
  min-width: 0;
  color: #95a5ad;
}

.utility-row strong,
.alert-row strong {
  justify-self: end;
  color: var(--text);
  text-align: right;
  overflow-wrap: anywhere;
}

.alert-row {
  grid-template-columns: 8px minmax(0, 1fr);
}

.alert-row::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
}

.alert-row.negative::before {
  background: var(--red);
}

.alert-row.warning::before {
  background: var(--gold);
}

.alert-row.positive::before {
  background: var(--green);
}

.alert-row div {
  display: grid;
  gap: 4px;
}

.alert-row b {
  color: var(--text);
  font-size: 12px;
}

.alert-row small {
  color: #95a5ad;
  font-size: 11px;
  line-height: 1.35;
}

.utility-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.utility-action {
  min-height: 36px;
  border: 1px solid rgba(34, 215, 243, 0.34);
  border-radius: 6px;
  background: rgba(34, 215, 243, 0.07);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.utility-action:hover {
  background: rgba(34, 215, 243, 0.13);
}

.utility-action.warning {
  border-color: rgba(255, 199, 44, 0.4);
  color: var(--gold);
  background: rgba(255, 199, 44, 0.07);
}

.utility-note {
  padding: 10px;
  border-left: 3px solid var(--gold);
  background: rgba(255, 199, 44, 0.06);
  color: #b9c4c9;
  font-size: 11px;
  line-height: 1.45;
}

.privacy-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 8, 11, 0.96);
}

.privacy-box {
  width: min(420px, 100%);
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 34px 24px;
  border: 1px solid rgba(255, 199, 44, 0.48);
  border-radius: 7px;
  background: rgba(7, 20, 25, 0.96);
  box-shadow: var(--panel-shadow);
  text-align: center;
}

.privacy-box h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: 20px;
}

.privacy-box p {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
}

.privacy-box button {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid rgba(34, 215, 243, 0.42);
  border-radius: 6px;
  background: rgba(34, 215, 243, 0.08);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

@media (max-width: 1320px) {
  .terminal-header {
    grid-template-columns: 320px minmax(0, 1fr) 124px;
  }

  .header-status {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .kpis {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
  }

  .matrix,
  .bottom-grid,
  .diagnostic-grid {
    grid-template-columns: 1fr;
  }

  .analytics-cards {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }

  .panel-radar .table-shell,
  .shadow-table .table-shell {
    max-height: none;
  }
}

@media (max-width: 860px) {
  .terminal-shell {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .terminal-header {
    height: auto;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

  .brand {
    justify-content: space-between;
  }

  .header-status {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
    gap: 5px;
    padding-bottom: 0;
    overflow: visible;
    white-space: normal;
  }

  .header-status span {
    padding: 0;
    margin-right: 0;
    border-right: 0;
    font-size: 11px;
    line-height: 1.2;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .terminal-body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding: 9px;
    overflow-x: auto;
  }

  .sidebar nav {
    display: flex;
    min-width: max-content;
  }

  .sidebar a {
    min-height: 38px;
  }

  .content {
    padding: 10px;
  }

  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi {
    height: 96px;
  }

  .matrix,
  .bottom-grid {
    gap: 10px;
  }

  .analytics-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  table {
    min-width: 760px;
  }

  .dna-shell table {
    min-width: 100%;
  }

  .terminal-footer {
    height: auto;
    min-height: 48px;
    flex-wrap: wrap;
    justify-content: flex-start;
    padding: 12px;
  }

  .utility-panel {
    top: auto;
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
    max-height: min(76vh, 620px);
  }
}

@media (max-width: 520px) {
  .brand h1 {
    font-size: 24px;
  }

  .mode-pill {
    min-width: 70px;
  }

  .kpis {
    grid-template-columns: 1fr;
  }

  .summary-box.compact {
    display: grid;
    gap: 6px;
  }

  .analytics-cards {
    grid-template-columns: 1fr;
  }
}
