/* Altcoin Trader — Dark "Real-Time Monitoring" theme
   Design system: ui-ux-pro-max (Dark Mode / OLED)
   Primary amber #D97706 · Accent indigo #6366F1 · Background #0F172A · Inter */

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

:root {
  color-scheme: dark;

  /* Surfaces */
  --bg: #0b1120;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, rgba(99, 102, 241, 0.1), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, rgba(217, 119, 6, 0.08), transparent 55%), #0b1120;
  --surface: #111a2e;
  --surface-2: #16213a;
  --surface-3: #1b2742;
  --sidebar: #0a0f1d;

  /* Text */
  --text: #f1f5f9;
  --text-soft: #cbd5e1;
  --muted: #8da2c0;
  --muted-2: #64748b;

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

  /* Brand / semantic */
  --primary: #f59e0b; /* amber – live/time */
  --primary-deep: #d97706;
  --accent: #818cf8; /* indigo – actions/links */
  --accent-deep: #6366f1;
  --green: #34d399;
  --green-deep: #10b981;
  --red: #f87171;
  --red-deep: #ef4444;
  --amber: #fbbf24;
  --blue: #60a5fa;

  --radius: 12px;
  --radius-sm: 9px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.3);
  --ring: 0 0 0 3px rgba(129, 140, 248, 0.45);

  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv05", "ss01";
}

* {
  box-sizing: border-box;
}

/* Tabular figures everywhere numbers matter → no layout shift on refresh */
.num,
td,
.metric-card strong,
.strip-item strong,
.score-val {
  font-variant-numeric: tabular-nums;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: 8px;
}

svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

/* ── Shell ─────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  margin-bottom: 26px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  color: #fff;
  background: linear-gradient(135deg, var(--primary-deep), var(--primary));
  box-shadow: 0 6px 18px rgba(217, 119, 6, 0.35);
}

.brand strong {
  display: block;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

.brand span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-sep {
  height: 1px;
  margin: 10px 6px;
  background: var(--line);
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.22), rgba(99, 102, 241, 0.05));
  box-shadow: inset 2px 0 0 var(--accent);
}

.sidebar-foot {
  margin-top: 18px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.sidebar-foot strong {
  color: var(--text-soft);
}

/* ── Workspace ─────────────────────────────────────────── */
.workspace {
  min-width: 0;
  padding: 24px clamp(16px, 2.4vw, 32px) 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(22px, 2.2vw, 30px);
  font-weight: 700;
  line-height: 1.1;
}

.topbar p,
.panel-header p,
.control-panel p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions,
.control-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Pills / badges ────────────────────────────────────── */
.status-pill,
.count-pill,
.mode-badge,
.state-badge,
.decision-badge,
.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.live {
  border-color: rgba(52, 211, 153, 0.4);
  color: var(--green);
  background: rgba(52, 211, 153, 0.08);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.16);
}

.status-pill.live .dot {
  animation: pulse 1.8s ease-in-out infinite;
}

.dot.muted {
  background: var(--muted-2);
  box-shadow: 0 0 0 4px rgba(100, 116, 139, 0.18);
}

.dot.danger {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.18);
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(52, 211, 153, 0);
  }
}

/* ── Buttons ───────────────────────────────────────────── */
.icon-link,
.ghost-button,
.safe-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.icon-link:hover,
.ghost-button:hover {
  background: var(--surface-3);
  color: var(--text);
}

.icon-link:active,
.ghost-button:active,
.safe-button:active,
.danger-button:active {
  transform: translateY(1px);
}

.icon-link {
  width: 38px;
  padding: 0;
}

.ghost-button,
.safe-button,
.danger-button {
  padding: 0 14px;
}

.safe-button {
  border-color: rgba(52, 211, 153, 0.35);
  color: var(--green);
  background: rgba(52, 211, 153, 0.1);
}

.safe-button:hover {
  background: rgba(52, 211, 153, 0.18);
}

.danger-button {
  border-color: rgba(248, 113, 113, 0.4);
  color: var(--red);
  background: rgba(248, 113, 113, 0.1);
}

.danger-button:hover {
  background: rgba(248, 113, 113, 0.2);
}

/* ── Status strip ──────────────────────────────────────── */
.status-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.strip-item {
  min-width: 0;
  padding: 14px 16px;
  background: var(--surface);
}

.strip-item span,
.metric-card .label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.strip-item strong {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  font-size: 15px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── KPI grid ──────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card,
.control-panel,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.metric-card {
  position: relative;
  min-height: 122px;
  padding: 16px;
  overflow: hidden;
}

.metric-card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--accent);
  opacity: 0.5;
}

.metric-card.pnl::after {
  background: var(--green);
}
.metric-card.kill::after {
  background: var(--red);
}
.metric-card.balance::after {
  background: var(--primary);
}

.metric-card strong {
  display: block;
  margin-top: 12px;
  font-size: clamp(24px, 2.6vw, 32px);
  font-weight: 700;
  line-height: 1;
}

.metric-card small {
  display: block;
  overflow: hidden;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card.pnl.positive strong {
  color: var(--green);
}

.metric-card.pnl.negative strong {
  color: var(--red);
}

.metric-card.kill.enabled strong {
  color: var(--red);
}

.metric-card.kill.enabled::after {
  opacity: 1;
  box-shadow: 0 0 14px var(--red);
}

/* ── Control panel ─────────────────────────────────────── */
.control-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px 18px;
}

.control-panel h2,
.panel-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

/* ── Help / glossary ───────────────────────────────────── */
.help {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.help > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 18px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.help > summary::-webkit-details-marker {
  display: none;
}

.help > summary .chev {
  margin-left: auto;
  transition: transform 0.2s ease;
  color: var(--muted);
}

.help[open] > summary .chev {
  transform: rotate(180deg);
}

.help > summary .tag {
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(129, 140, 248, 0.16);
  color: var(--accent);
  font-size: 11px;
}

/* View router: only the active view is shown */
.view[hidden] {
  display: none;
}

.help-body {
  padding: 18px;
}

.flow {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
  margin: 16px 0 22px;
}

.flow-step {
  flex: 1 1 130px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.flow-step b {
  display: block;
  font-size: 13px;
  color: var(--text);
}

.flow-step span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
}

.flow-arrow {
  align-self: center;
  color: var(--muted-2);
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.glossary-grid h4 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
}

.glossary-grid dl {
  margin: 0;
  display: grid;
  gap: 7px;
}

.glossary-grid dt {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-soft);
}

.glossary-grid dd {
  margin: 1px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.glossary-grid code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--accent);
  font-size: 11px;
}

/* ── Panels / grid ─────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr);
  gap: 16px;
  align-items: start;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.table-panel:first-child {
  grid-column: 1 / -1;
}

.log-panel,
.settings-panel {
  grid-column: 1 / -1;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
}

.panel-header .right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.count-pill {
  min-width: 30px;
  justify-content: center;
}

/* ── Tables ────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface-2);
  white-space: nowrap;
}

th .hint {
  cursor: help;
  border-bottom: 1px dotted var(--muted-2);
}

td {
  color: var(--text-soft);
}

tbody tr {
  transition: background 0.12s ease;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

tr:last-child td {
  border-bottom: 0;
}

.symbol-cell {
  font-weight: 700;
  color: var(--text);
}

.muted-cell {
  color: var(--muted);
}

.time-cell {
  color: var(--muted);
  white-space: nowrap;
}

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

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

.pnl-cell {
  font-weight: 700;
  white-space: nowrap;
}

.pnl-cell .arrow {
  font-size: 11px;
}

/* Score with mini bar */
.score {
  display: grid;
  gap: 5px;
  min-width: 64px;
}

.score-val {
  font-weight: 700;
}

.score-bar {
  height: 4px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.score-bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--green);
}

.score-bar.low > i {
  background: var(--red);
}
.score-bar.mid > i {
  background: var(--amber);
}

/* Target/stop gauge for positions */
.gauge {
  display: grid;
  gap: 4px;
  min-width: 120px;
}

.gauge-track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(248, 113, 113, 0.35), rgba(148, 163, 184, 0.25), rgba(52, 211, 153, 0.35));
}

.gauge-track > i {
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent-deep);
  transform: translate(-50%, -50%);
}

.gauge-legend {
  display: flex;
  justify-content: space-between;
  color: var(--muted-2);
  font-size: 10px;
}

/* ── Badges color states ───────────────────────────────── */
.type-badge.news {
  color: var(--blue);
  background: rgba(96, 165, 250, 0.12);
  border-color: rgba(96, 165, 250, 0.3);
}

.type-badge.momentum {
  color: var(--primary);
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
}

.mode-badge.paper {
  color: var(--blue);
  background: rgba(96, 165, 250, 0.12);
  border-color: rgba(96, 165, 250, 0.3);
}

.mode-badge.live {
  color: var(--primary);
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.35);
}

.decision-badge.approved {
  color: var(--green);
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.32);
}

.decision-badge.ignored {
  color: var(--amber);
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.3);
}

.state-badge.open {
  color: var(--green);
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.3);
}

.state-badge.closed {
  color: var(--muted);
  background: var(--surface-2);
}

/* Reason chips */
.reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 600;
  cursor: help;
}

.chip.bad {
  color: var(--red);
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.25);
}

.chip.good {
  color: var(--green);
  background: rgba(52, 211, 153, 0.08);
  border-color: rgba(52, 211, 153, 0.25);
}

/* ── Segmented control ─────────────────────────────────── */
.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.segmented button {
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.segmented button:hover {
  color: var(--text);
}

.segmented button.selected {
  color: #fff;
  background: var(--accent-deep);
}

/* ── Event / log lists ─────────────────────────────────── */
.event-list,
.log-stream {
  display: grid;
  gap: 8px;
  max-height: 440px;
  overflow: auto;
  padding: 14px;
}

.event-row,
.log-row {
  display: grid;
  gap: 5px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border-left: 3px solid var(--muted-2);
}

.event-row.approved,
.log-row.info {
  border-left-color: var(--accent);
}

.event-row.blocked,
.log-row.error {
  border-left-color: var(--red);
}

.event-row .head,
.log-row .head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.event-row .head .when,
.log-row .head .when {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 600;
}

.event-row span,
.log-row span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 148px;
  padding: 18px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.empty-state .empty-sub {
  color: var(--muted-2);
  font-size: 12px;
}

/* ── Settings form ─────────────────────────────────────── */
.settings-form {
  display: grid;
  gap: 14px;
  padding: 16px 18px;
}

.settings-form fieldset {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.settings-form legend {
  padding: 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.settings-form label,
.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.settings-form input,
.settings-form select,
.auth-form input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #0c1426;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: border-color 0.15s ease;
}

.settings-form input:focus,
.settings-form select:focus,
.auth-form input:focus {
  border-color: var(--accent);
}

.settings-form small {
  min-height: 14px;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 500;
}

.settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 2px;
}

.settings-actions p,
.form-message {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* ── Auth page ─────────────────────────────────────────── */
.auth-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
  background: var(--bg-grad);
  background-attachment: fixed;
}

.auth-card {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-brand {
  margin-bottom: 22px;
}

.auth-card h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
}

.auth-card p {
  margin: 8px 0 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form .safe-button {
  min-height: 44px;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand {
    margin-bottom: 12px;
  }
  .sidebar-foot {
    display: none;
  }
  .nav-list {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .nav-item {
    min-height: 38px;
    white-space: nowrap;
  }
  .workspace {
    padding: 16px;
  }
  .topbar,
  .control-panel {
    align-items: stretch;
    flex-direction: column;
  }
  .topbar-actions,
  .control-actions {
    justify-content: space-between;
  }
  .status-strip,
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .settings-form fieldset {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .status-strip,
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }
  .segmented {
    grid-auto-flow: row;
  }
  .control-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .danger-button,
  .safe-button,
  .ghost-button {
    width: 100%;
  }
  .settings-form fieldset {
    grid-template-columns: 1fr;
  }
  .settings-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
  html {
    scroll-behavior: auto;
  }
}
