  :root {
    --bg: #0B0B09;
    --panel: #121210;
    --panel-2: #161613;
    --line: #26261F;
    --text: #E8E6DF;
    --muted: #7A7A70;
    --accent: #FF9F1C;
    --accent-soft: rgba(255,159,28,.08);
    --green: #35C26D;
    --red: #E05252;
    --blue: #5bd7ff;
    --amber: #FF9F1C;
    --scrollbar: #26261F;
  }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 72% 0%, rgba(45, 212, 191, 0.12), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family: "IBM Plex Mono", "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
input[type="number"] { appearance: textfield; }

.shell { min-height: 100vh; display: block; }
.sidebar {
  display: none; position: sticky; top: 0; height: 100vh; padding: 28px 20px;
  border-right: 1px solid var(--line); background: rgba(8, 18, 15, 0.94);
  flex-direction: column;
}
.brand { color: var(--text); text-decoration: none; display: flex; gap: 12px; align-items: center; }
.brand-mark, .exchange-logo {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 0;
  background: var(--accent); color: #06120f; font-weight: 900;
}
.header-icon { width: auto; height: 270px; border-radius: 0; background: none; object-fit: contain; }
img.brand-mark { background: none; border-radius: 0; width: auto; height: 38px; object-fit: contain; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 18px; letter-spacing: -0.02em; }
.brand small { color: var(--muted); margin-top: 2px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
nav { margin-top: 58px; display: grid; gap: 8px; }
nav a {
  color: var(--muted); text-decoration: none; padding: 12px 13px; border-radius: 0;
  display: flex; gap: 13px; align-items: center; font-size: 13px;
}
nav a span { font-size: 10px; color: #59625b; }
nav a:hover, nav a.active { color: var(--text); background: var(--panel-2); }
nav a.active span { color: var(--accent); }
.sidebar-foot {
  margin-top: auto; border-top: 1px solid var(--line); padding: 20px 8px 0;
  display: flex; align-items: center; gap: 10px; font-size: 11px;
}
.sidebar-foot strong, .sidebar-foot small { display: block; }
.sidebar-foot small { color: var(--muted); margin-top: 3px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 15px var(--accent); }

main { width: min(1600px, 100%); margin: 0 auto; padding: 34px 42px 70px; }
.topbar, .panel-head, .section-title, .exchange-top, .dialog-head {
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
}
.topbar { margin-bottom: 10px; }
.header-brand .brand-mark { height: 50px; width: auto; }
.topbar h1 { font-size: clamp(28px, 4vw, 48px); letter-spacing: -.045em; margin: 4px 0 0; }
.header-brand {
  display: inline-flex; align-items: center; gap: 14px; color: var(--text);
  text-decoration: none;
}
.header-brand > span:last-child, .header-brand strong, .header-brand small { display: block; }
.header-brand strong { font-size: 18px; letter-spacing: -.04em; line-height: 1; }
.header-brand small {
  color: var(--muted); margin-top: 3px; font-size: 8px; font-weight: 750;
  letter-spacing: .18em; text-transform: uppercase;
}
.wave-symbol {
  position: relative; width: 54px; height: 54px; flex: 0 0 54px;
  border-radius: 0; background: var(--accent); color: #06120f; overflow: hidden;
}
.wave-symbol b {
  position: absolute; left: 13px; top: 10px; font-size: 28px; font-weight: 950;
  letter-spacing: -.08em; line-height: 1;
}
.wave-symbol i {
  position: absolute; right: 15px; top: 12px; width: 4px; height: 8px;
  border-radius: 0; background: #06120f; box-shadow: 6px 7px 0 #06120f, 12px 15px 0 #06120f;
}
.position-symbol-link { color: inherit; text-decoration: none; }
.eyebrow { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; margin: 0; }
/* Operator request: shift the control-section header block (eyebrow + h2)
   50px right of the panel edge so it doesn't hug the left border. */
.control-section .section-title { padding-left: 50px; }
@media (max-width: 900px) { .control-section .section-title { padding-left: 0; } }
.top-actions { display: flex; gap: 8px; flex-wrap: nowrap; flex-shrink: 0; white-space: nowrap; }
.top-actions .button { padding: 8px 12px; }
.mode-status {
  padding: 4px 2px; display: flex; align-items: center; gap: 8px;
}
.mode-status strong, .mode-status small { display: block; white-space: nowrap; }
.mode-status strong { font-size: 9px; letter-spacing: .08em; }
.mode-status small { color: var(--muted); font-size: 8px; margin-top: 3px; }
.icon-button {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 0; color: var(--text);
  background: transparent; text-decoration: none; font-size: 18px; line-height: 1;
}
.icon-button:hover { color: var(--accent); border-color: rgba(45,212,191,.32); }
.button {
  border: 1px solid var(--accent); border-radius: 0; padding: 11px 15px;
  background: var(--accent); color: #06120f; font-weight: 750; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.button:hover { filter: brightness(1.08); }
.button.ghost { background: transparent; border-color: var(--line); color: var(--text); }
.button.danger { background: rgba(255, 102, 92, .08); border-color: rgba(255, 102, 92, .38); color: #ff918a; }
.button.full { width: 100%; }
.button:disabled { cursor: not-allowed; opacity: .45; }
.market-panel-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.market-panel-actions small { color: var(--muted); font-size: 9px; }
.market-scan-button { min-height: 34px; padding: 7px 11px; font-size: 9px; }
.market-scan-button span { font-size: 15px; line-height: .8; }
.admin-link { margin-top: 14px; border: 1px solid rgba(45,212,191,.18); }
.admin-link::after { content: "ADMIN"; margin-left: auto; color: var(--accent); font-size: 7px; letter-spacing: .06em; }
.admin-topbar { padding-bottom: 4px; }
.admin-tabs {
  margin: 18px 0 0; padding: 5px; display: inline-flex; gap: 4px;
  border: 1px solid var(--line); border-radius: 0; background: #0a1411;
}
.admin-tabs a {
  padding: 9px 14px; border-radius: 0; color: var(--muted);
  text-decoration: none; font-size: 10px; font-weight: 750;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1.2; white-space: nowrap; min-height: 34px;
}
.admin-tabs a:hover, .admin-tabs a:focus { color: var(--text); background: var(--panel-2); }
.notice {
  margin: 0 0 18px; padding: 11px 14px; border: 1px solid rgba(45,212,191,.2);
  background: var(--accent-soft); border-radius: 0; display: flex; align-items: center; gap: 10px;
}
.notice-icon {
  width: 16px; height: 16px; flex: 0 0 16px; display: grid; place-items: center;
  background: var(--accent); color: #06120f; border-radius: 50%; font-size: 10px; font-weight: 900;
}
.notice p { margin: 0; font-size: 11px; flex: 1; color: #bec6bf; }
.notice strong { color: var(--text); }
.badge {
  display: inline-flex; align-items: center; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: 0; color: #aab2ab; font-size: 9px; font-weight: 800; letter-spacing: .06em;
}
.badge.safe { border-color: rgba(45,212,191,.25); color: var(--accent); }
.badge.muted { color: #778079; }

.demo-account {
  display: grid; grid-template-columns: minmax(280px, 1fr) auto auto auto;
  align-items: center; gap: 28px; margin-bottom: 12px; padding: 18px 20px;
  border-color: rgba(91,215,255,.22);
}
.demo-account[hidden] { display: none; }
.demo-account h2 { margin: 4px 0 5px; font-size: 18px; }
.demo-account > div small { color: var(--muted); font-size: 9px; }
.demo-account > p { min-width: 130px; margin: 0; }
.demo-account > p span, .demo-account > p strong { display: block; }
.demo-account > p span { color: var(--muted); font-size: 9px; }
.demo-account > p strong { margin-top: 5px; font-size: 21px; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric, .panel, .exchange-card {
  background: linear-gradient(160deg, rgba(20,38,32,.96), rgba(8,16,13,.98));
  border: 1px solid var(--line); border-radius: var(--radius);
}
.metric { padding: 12px; min-height: 72px; display: flex; flex-direction: column; justify-content: space-between; }
.metric.featured { border-color: rgba(45,212,191,.23); background: linear-gradient(160deg, rgba(26,52,44,.92), rgba(8,16,13,.97)); }
.metric > span { color: var(--muted); font-size: 11px; }
.metric strong { font-size: clamp(14px, 1.3vw, 18px); letter-spacing: -.035em; white-space: nowrap; }
.metric strong em { color: #687169; font-size: 10px; font-style: normal; }
.metric small { color: var(--muted); font-size: 10px; }
.metric small b { color: var(--accent); }

.grid { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(280px, .8fr); grid-template-rows: auto 1fr; gap: 14px; margin-top: 14px; }
.grid > .metrics { grid-column: 1; grid-row: 1; }
.grid > .market-panel { grid-column: 1; grid-row: 2; }
.grid > .allocation { grid-column: 2; grid-row: 1 / -1; }
.market-panel .table-wrap { max-height: 380px; overflow-y: auto; }
.panel { padding: 22px 28px; }
.panel h2, .section-title h2, dialog h2 { margin: 4px 0 0; font-size: 19px; letter-spacing: -.02em; }
.table-wrap { overflow: auto; max-height: calc(var(--scroll-rows, 10) * 48px); }
.table-wrap thead th { position: sticky; top: 0; background: var(--panel-2); z-index: 2; }
#openPositionRows { max-height: calc(var(--scroll-rows, 10) * 48px); overflow-y: auto; }
.position-row.labels { position: sticky; top: 0; background: var(--panel-2); z-index: 2; }
.rows-control { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.rows-control select { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 0; padding: 4px 6px; font-size: 11px; }
.market-row { cursor: pointer; transition: background-color .15s ease; }
.market-row:hover, .market-row:focus-visible {
  outline: 0; background: rgba(91,215,255,.035);
}
.market-row:focus-visible td:first-child { box-shadow: inset 2px 0 0 var(--blue); }
.candidate-reason-trigger {
  border: 0; cursor: pointer; font-family: inherit;
}
.candidate-reason-trigger:hover, .candidate-reason-trigger:focus-visible {
  outline: 1px solid currentColor; outline-offset: 2px;
}
.candidate-diagnostics-row[hidden] { display: none; }
.candidate-diagnostics-row > td { padding: 0 10px 14px; border-top: 0; }
.candidate-diagnostics {
  padding: 15px; border: 1px solid rgba(246,189,75,.22);
  border-radius: 0; background: rgba(246,189,75,.035);
}
.candidate-diagnostics-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.candidate-diagnostics-meta {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
}
.candidate-diagnostics-close {
  flex: 0 0 auto; padding: 0; font-size: 22px; line-height: 1;
}
.candidate-diagnostics-head strong, .candidate-diagnostics-head small { display: block; }
.candidate-diagnostics-head strong { color: var(--text); font-size: 12px; }
.candidate-diagnostics-head small {
  max-width: 780px; margin-top: 5px; color: #aeb5af; font-size: 10px; line-height: 1.4;
}
.candidate-diagnostics code {
  color: #818a82; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 8px; overflow-wrap: anywhere;
}
.candidate-diagnostics ul {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px; margin: 13px 0 0; padding: 0; list-style: none;
}
.candidate-diagnostics li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: start; gap: 6px 10px; padding: 11px;
  border: 1px solid var(--line); border-radius: 0; background: #0a1411;
}
.candidate-diagnostics li strong, .candidate-diagnostics li small { display: block; }
.candidate-diagnostics li strong { font-size: 10px; }
.candidate-diagnostics li small {
  margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.45;
}
.candidate-diagnostics li code { grid-column: 1 / -1; }
.candidate-diagnostics-actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-top: 11px;
}
.candidate-diagnostics-actions p {
  margin: 0; color: #747d75; font-size: 9px; line-height: 1.4;
}
.candidate-diagnostics-actions .button {
  flex: 0 0 auto; padding: 8px 12px; font-size: 9px;
}
.candidate-diagnostics-actions .button:disabled {
  cursor: not-allowed; opacity: .42;
}
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th { color: #687169; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; text-align: left; padding: 0 10px 8px; }
td { border-top: 1px solid var(--line); padding: 9px 10px; font-size: 13px; }
td:first-child { color: #606961; width: 44px; }
td strong, td small { display: block; }
td small { color: var(--muted); font-size: 9px; margin-top: 3px; }
.gain { color: var(--accent); }
.loss { color: var(--ink); }  /* biały, nie czerwony — czerwień działa destrukcyjnie na psychikę (kg. usera 20.09) */
.state { display: inline-flex; border-radius: 0; padding: 5px 7px; font-size: 8px; font-weight: 900; letter-spacing: .08em; white-space: nowrap; }
.state.ready { color: var(--accent); background: var(--accent-soft); }
.state.waiting { color: var(--amber); background: rgba(246,189,75,.1); }
.state.blocked { color: var(--red); background: rgba(255,102,92,.1); }
.state.observe { color: var(--blue); background: rgba(91,215,255,.1); }

.allocation { display: flex; flex-direction: column; }
.donut {
  margin: 26px auto 24px; width: 196px; height: 196px; border-radius: 50%;
  background: conic-gradient(var(--accent) 0 6%, var(--amber) 6% 18.6%, #1c3029 18.6% 100%);
  display: grid; place-items: center;
}
.donut::before { content: ""; grid-area: 1/1; width: 144px; height: 144px; border-radius: 50%; background: #0c1714; }
.donut div { grid-area: 1/1; position: relative; text-align: center; }
.donut strong, .donut span { display: block; }
.donut strong { font-size: 30px; }
.donut span { color: var(--muted); font-size: 10px; margin-top: 4px; }
.donut .donut-stack { display: flex; flex-direction: column; gap: 5px; align-items: center; justify-content: center; }
.donut .donut-stack strong { font-size: 21px; }
.donut .donut-stack span { font-size: 9px; margin-top: 1px; }
.donut .donut-stack > div + div { border-top: 1px solid rgba(255,255,255,.10); padding-top: 5px; }
.legend { margin-top: 4px; }
.legend p { display: flex; align-items: center; color: var(--muted); font-size: 10px; }
.legend p b { margin-left: auto; color: var(--text); }
.dot { width: 7px; height: 7px; border-radius: 50%; margin-right: 8px; }
.dot.lime { background: var(--accent); } .dot.amber { background: var(--amber); } .dot.slate { background: #434b44; }
.symbol-allocation {
  margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line);
}
.symbol-allocation h3 {
  margin: 0; font-size: 12px;
}
.symbol-allocation-note, .symbol-allocation-empty {
  margin: 5px 0 0; color: var(--muted); font-size: 9px; line-height: 1.45;
}
.symbol-allocation-row { margin-top: 13px; }
.symbol-allocation-label {
  display: flex; align-items: baseline; gap: 8px; font-size: 10px;
}
.symbol-allocation-label b { margin-left: auto; }
.symbol-allocation-label small { color: var(--muted); font-size: 8px; }
.symbol-allocation-track {
  height: 7px; margin-top: 6px; overflow: hidden; border-radius: 0; background: #1c3029;
}
.symbol-allocation-fill {
  height: 100%; min-width: 2px; border-radius: inherit; background: var(--accent);
}
.token-donut-svg { width: 196px; height: 196px; display: block; margin: 10px auto 0; max-width: 100%; }
.token-donut-svg circle { transition: stroke-width .12s ease; }
.token-donut-svg circle:nth-child(n+2):hover { stroke-width: 9; }
.token-donut-count { fill: var(--text); font-size: 7px; font-weight: 700; }
.token-donut-count-label { fill: var(--muted); font-size: 3px; }

.positions { margin-top: 14px; }
.text-button { border: 0; background: none; color: var(--accent); font-size: 11px; }
.position-row { display: grid; grid-template-columns: 1.1fr 1.1fr .82fr .7fr .72fr .62fr .72fr; gap: 12px; align-items: center; border-top: 1px solid var(--line); padding: 9px 8px; font-size: 12px; }
.position-row.labels { color: #687169; font-size: 9px; text-transform: uppercase; letter-spacing: .06em; margin-top: 16px; }
.position-row strong, .position-row small { display: block; }
.position-row small { color: var(--muted); font-size: 9px; margin-top: 4px; }
.empty-runtime-row > span { grid-column: 1 / -1; color: var(--muted); padding: 10px 0; }
/* Inline mini price-range chart inside a position row. Four colored lines
   (entry / TP / trailing / mark) sit on a relative bar whose extent is the
   min..max of those prices. Cheap to repaint (divs only, no canvas). */
.position-mini-chart { position: relative; display: block; height: 14px; margin-top: 6px; background: rgba(255,255,255,.04); border-radius: 0; overflow: hidden; }
.position-mini-chart .mini-line { position: absolute; top: 0; bottom: 0; width: 2px; transform: translateX(-1px); }
.position-mini-chart .mini-entry { background: #f5c518; }
.position-mini-chart .mini-tp { background: var(--accent); }
.position-mini-chart .mini-dca { background: #4affe5; }
.position-mini-chart .mini-sl { background: #ff3d4d; width: 3px; transform: translateX(-1.5px); }
.position-mini-chart .mini-liq { background: #6b1a22; width: 2px; }
.position-mini-chart .mini-trailing { background: #4aa8ff; }
.position-mini-chart .mini-mark { background: #ffffff; width: 3px; transform: translateX(-1.5px); }
.dca-count { margin-left: 6px; color: #4affe5; font-weight: 600; }
.open-position-summary { margin-top: 16px; }
.open-summary-note {
  margin: 0 0 10px; padding: 9px 12px; border-left: 2px solid var(--blue);
  color: #8d958e; background: rgba(91,215,255,.045); font-size: 9px; line-height: 1.4;
}
.closed-metrics.open-metrics article { min-height: 64px; background: #0a1411; }
.open-metrics strong em { color: #687169; font-size: 9px; font-style: normal; }
.close-breakdown.open-breakdown {
  margin-top: 8px; padding: 0; border: 0;
}
.close-breakdown.open-breakdown p { background: rgba(12,15,13,.65); }

.closed-positions { padding-top: 40px; scroll-margin-top: 18px; }
.closed-title { align-items: flex-end; }
.closed-filters { display: flex; align-items: flex-end; gap: 8px; }
.closed-filters label {
  min-width: 112px; margin: 0; gap: 5px; color: #687169;
  font-size: 8px; letter-spacing: .08em; text-transform: uppercase;
}
.closed-filters select { min-height: 36px; padding: 8px 30px 8px 10px; font-size: 10px; }
.closed-custom-range { display: flex; align-items: flex-end; gap: 8px; }
.closed-custom-range label {
  min-width: 112px; margin: 0; gap: 5px; color: #687169;
  font-size: 8px; letter-spacing: .08em; text-transform: uppercase;
}
.closed-custom-range input[type="date"] {
  min-height: 36px; padding: 8px 10px; font-size: 10px; width: 100%;
  background: var(--panel); border: 1px solid var(--line); border-radius: 0; color: inherit;
}
.closed-custom-range .button { min-height: 36px; padding: 8px 14px; font-size: 10px; }
.paper-data-note {
  margin: 14px 0 10px; padding: 10px 13px; border-left: 2px solid var(--blue);
  color: #8d958e; background: rgba(91,215,255,.045); font-size: 9px; line-height: 1.4;
}
.closed-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.closed-metrics article {
  min-width: 0; min-height: 56px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 0; background: linear-gradient(160deg, rgba(20,38,32,.96), rgba(8,16,13,.98));
}
.closed-metrics article.featured { border-color: rgba(45,212,191,.23); }
.closed-metrics span, .closed-metrics strong, .closed-metrics small { display: block; }
.closed-metrics span { color: var(--muted); font-size: 9px; }
.closed-metrics strong { margin-top: 6px; font-size: clamp(12px, 1.2vw, 16px); letter-spacing: -.035em; }
.closed-metrics article.featured strong { color: var(--accent); }
.closed-metrics article.featured strong.loss { color: var(--ink); }  /* biały, nie czerwony — czerwień działa destrukcyjnie na psychikę (kg. usera 20.09) */
.closed-metrics small { margin-top: 5px; color: #737c74; font-size: 8px; }
.closed-history { margin-top: 10px; }
.close-breakdown {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
  padding-bottom: 17px; border-bottom: 1px solid var(--line);
}
.close-breakdown p { margin: 0; padding: 6px 8px; border-radius: 0; background: #0a1411; }
.close-breakdown span, .close-breakdown strong { display: block; }
.close-breakdown span { color: var(--muted); font-size: 8px; }
.close-breakdown strong { margin-top: 3px; font-size: 11px; }
.close-breakdown .button { padding: 6px 8px; font-size: 10px; }
.closed-table { min-width: 840px; }
.closed-table td:first-child { width: auto; color: var(--text); }
.closed-table td[hidden] { display: none; }
.table-sort {
  display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0;
  color: inherit; background: transparent; font: inherit; letter-spacing: inherit;
  text-transform: inherit; white-space: nowrap; cursor: pointer;
}
.table-sort i {
  color: #535c55; font-size: 9px; font-style: normal; transition: color .15s ease;
}
.table-sort:hover, .table-sort:focus-visible { color: var(--text); }
.table-sort:hover i, .table-sort:focus-visible i { color: var(--accent); }
[aria-sort="ascending"] .table-sort i,
[aria-sort="descending"] .table-sort i { color: var(--accent); }
#closedPositionsEmpty td {
  padding: 28px 10px; color: var(--muted); text-align: center;
}

/* Accordion (admin panel) */
.accordion-item {
  border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden;
}
.accordion-header {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  padding: 14px 20px; background: var(--panel); border: 0; color: var(--text);
  font-size: 13px; font-weight: 700; cursor: pointer; text-align: left;
}
.accordion-header:hover { background: var(--panel-2); }
.accordion-icon { font-size: 11px; color: var(--muted); transition: transform .2s; }
.accordion-header[aria-expanded="false"] .accordion-icon { transform: rotate(-90deg); }
.accordion-content { max-height: 99999px; overflow: hidden; transition: max-height .25s ease; }
.accordion-item.collapsed .accordion-content { max-height: 0; }

/* Admin tabs — sticky for accordion navigation */
.admin-page .admin-tabs {
  position: sticky; top: 0; z-index: 10; background: var(--bg); overflow-x: auto; white-space: nowrap;
  display: flex; flex-wrap: nowrap; gap: 4px; padding: 5px; margin-left: 0; margin-right: 0;
}
.admin-page .admin-tabs a { flex: 0 0 auto; padding: 9px 14px; }
.section-title > p { color: var(--muted); font-size: 11px; max-width: 390px; text-align: right; line-height: 1.4; }
.connection-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 16px; }
.exchange-card { padding: 20px; }
.exchange-card.primary { border-color: rgba(45,212,191,.28); }
.exchange-card h3 { font-size: 19px; margin: 22px 0 6px; }
.exchange-card > p { color: var(--muted); font-size: 10px; min-height: 30px; line-height: 1.4; }
.card-status { display: flex; align-items: center; gap: 8px; color: var(--accent); font-size: 9px; font-weight: 800; margin: 22px 0 14px; }
.muted-text { color: #626a63; }
.connection-balance {
  display: block; min-height: 14px; margin: -7px 0 12px;
  color: #8f9891; font-size: 8px; line-height: 1.4;
}
.connection-balance[hidden] { display: none; }
#connectionPassphraseField[hidden] { display: none; }
.telegram-card {
  margin-top: 16px; display: flex; align-items: center; justify-content: space-between;
  gap: 22px; border-color: rgba(91,215,255,.22);
}
.telegram-identity { display: flex; align-items: center; gap: 16px; }
.telegram-identity h3 { margin: 4px 0; font-size: 18px; }
.telegram-identity > div > p:last-child {
  margin: 0; color: var(--muted); font-size: 10px; line-height: 1.4;
}
.telegram-logo {
  width: 52px; height: 52px; flex: 0 0 52px; display: grid; place-items: center;
  border-radius: 0; color: #071014; background: var(--blue);
  font-size: 25px; font-weight: 900;
}
.telegram-actions { display: flex; align-items: center; gap: 10px; }
.telegram-security { margin: 10px 3px 0; }
.connection-steps {
  margin: 0 0 16px; padding: 13px 13px 13px 31px; border: 1px solid var(--line);
  border-radius: 0; background: #0a1411; color: #b8c0b9;
  font-size: 10px; line-height: 1.45;
}
.connection-steps a { color: var(--blue); }
.connection-steps code { color: var(--accent); }

.bot-control { margin-top: 16px; padding: 0; overflow: hidden; }
.bot-control-summary {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: rgba(45,212,191,.035);
}
.bot-control-summary > div { display: flex; align-items: center; gap: 10px; }
.bot-control-summary strong, .bot-control-summary small { display: block; }
.bot-control-summary strong { font-size: 12px; }
.bot-control-summary small { color: var(--muted); font-size: 8px; margin-top: 4px; }
.bot-control > fieldset { border: 0; margin: 0; padding: 20px; }
.bot-control > fieldset + fieldset { border-top: 1px solid var(--line); }
.choice-grid { display: grid; gap: 10px; }
.environment-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.policy-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice-card {
  position: relative; margin: 0; padding: 15px 17px; display: flex; grid-template-columns: none;
  flex-direction: row; align-items: flex-start; gap: 10px; border: 1px solid var(--line);
  border-radius: 0; background: #0a1411; cursor: pointer;
}
.choice-card:has(input:checked) {
  border-color: rgba(45,212,191,.42); background: var(--accent-soft);
}
.choice-card.locked { opacity: .55; cursor: not-allowed; }
.choice-card input { width: auto; margin: 2px 0 0; accent-color: var(--accent); }
.choice-card strong, .choice-card small { display: block; }
.choice-card strong { color: var(--text); font-size: 11px; }
.choice-card small { margin-top: 5px; color: var(--muted); font-size: 8px; line-height: 1.4; }
/* Text inside choice cards must not touch the card edges (admin env/policy). */
.choice-card span { min-width: 0; }
.choice-card small { padding-right: 4px; word-break: normal; overflow-wrap: anywhere; }
.bot-control-actions {
  padding: 17px 20px 20px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
}
.bot-control-actions p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.4; }
.bot-control-actions .button { min-width: 210px; }
.bot-control-actions .button.stop {
  color: #ff918a; border-color: rgba(255,102,92,.38); background: rgba(255,102,92,.08);
}

.entry-conditions { margin-top: 16px; padding: 0; overflow: hidden; }
.entry-conditions-head {
  padding: 16px 20px; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; border-bottom: 1px solid var(--line);
  background: rgba(45,212,191,.035);
}
.entry-conditions-head h3 { margin: 4px 0 0; font-size: 17px; }
.entry-condition-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.entry-condition-grid section {
  min-width: 0; padding: 18px 20px; border-right: 1px solid var(--line);
}
.entry-condition-grid section:last-child { border-right: 0; }
.entry-condition-grid span, .entry-condition-grid strong, .entry-condition-grid small {
  display: block;
}
.entry-condition-grid span {
  color: var(--accent); font-size: 8px; font-weight: 850; letter-spacing: .06em;
  text-transform: uppercase;
}
.entry-condition-grid strong {
  margin-top: 10px; color: var(--text); font-size: 11px; line-height: 1.45;
}
.entry-condition-grid small {
  margin-top: 7px; color: var(--muted); font-size: 8px; line-height: 1.4;
}
.saved-profile-summary { border-top: 1px solid var(--line); }
.saved-profile-summary-head {
  padding: 13px 20px; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; background: rgba(45,212,191,.018);
}
.saved-profile-summary-head span, .saved-profile-summary-head strong {
  display: block;
}
.saved-profile-summary-head span {
  color: var(--accent); font-size: 8px; font-weight: 850; letter-spacing: .06em;
  text-transform: uppercase;
}
.saved-profile-summary-head strong { margin-top: 5px; color: var(--text); font-size: 11px; }
.saved-profile-summary-head small {
  color: #8f9891; font-size: 8px; line-height: 1.45; text-align: right;
}
.saved-profile-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}
.saved-profile-grid section {
  min-width: 0; padding: 16px 20px; border-right: 1px solid var(--line);
}
.saved-profile-grid section:last-child { border-right: 0; }
.saved-profile-grid h4 {
  margin: 0 0 10px; color: var(--accent); font-size: 8px; font-weight: 850;
  letter-spacing: .06em; text-transform: uppercase;
}
.saved-profile-grid dl { margin: 0; }
.saved-profile-grid dl div {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 6px 0; border-bottom: 1px solid rgba(43,51,45,.65);
}
.saved-profile-grid dl div:last-child { border-bottom: 0; }
.saved-profile-grid dt { color: var(--muted); font-size: 8px; line-height: 1.35; }
.saved-profile-grid dd {
  margin: 0; color: var(--text); font-size: 9px; font-weight: 750;
  line-height: 1.35; text-align: right;
}
.entry-conditions-note {
  margin: 0; padding: 12px 20px; border-top: 1px solid var(--line);
  color: #8f9891; background: rgba(91,215,255,.025); font-size: 8px; line-height: 1.4;
}
.inactive-setting { opacity: .58; }
.inactive-setting input:disabled { cursor: not-allowed; }

/* Candidate entry-conditions matrix */
.candidate-matrix { width: 100%; border-collapse: collapse; font-size: 9px; }
.candidate-matrix thead th {
  position: sticky; top: 0; z-index: 1; background: var(--panel);
  text-align: center; font-weight: 700; color: var(--muted);
  padding: 7px 4px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.candidate-matrix thead th:nth-child(-n + 4),
.candidate-matrix thead th:nth-last-child(-n + 2) { text-align: left; }
.candidate-matrix td {
  padding: 6px 4px; border-bottom: 1px solid var(--line);
  text-align: center; white-space: nowrap;
}
.candidate-matrix td:nth-child(-n + 4),
.candidate-matrix td:nth-last-child(-n + 2) { text-align: left; }
.candidate-matrix td strong { font-size: 10px; }
.candidate-matrix td.cm-pass { color: var(--accent); font-weight: 800; }
.candidate-matrix td.cm-fail { color: var(--red); font-weight: 800; }
.candidate-matrix td.cm-later { color: var(--amber); font-weight: 800; }
.candidate-matrix td.cm-off,
.candidate-matrix td.cm-na { color: var(--muted); }
.candidate-matrix .cm-force { padding: 4px 8px; font-size: 9px; }
.candidate-matrix tr.cm-row { cursor: pointer; }
.candidate-matrix tr.cm-row:hover { background: rgba(91,215,255,.04); }
/* Entry-conditions matrix rendered inside the price-chart dialog */
.chart-conditions { border-top: 1px solid var(--line); padding: 10px 14px; }
.chart-conditions .candidate-diagnostics { margin: 0; padding: 0; border: 0; }
.chart-conditions .candidate-diagnostics ul {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 6px;
  list-style: none; margin: 6px 0 0; padding: 0;
}
.chart-conditions .candidate-diagnostics li {
  display: flex; flex-direction: column; gap: 2px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 0;
}
.chart-conditions .candidate-diagnostics li small { color: var(--muted); font-size: 9px; }
.chart-conditions .candidate-diagnostics li code { font-size: 8px; color: var(--muted); }
.scan-timing { color: var(--muted); font-size: 9px; white-space: nowrap; }
.wave-footer {
  margin-top: 48px;
  padding: 34px 42px 24px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(12,23,20,.5), transparent 70%);
}
.wave-footer-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1.5fr) repeat(3, 1fr);
  gap: 36px;
  max-width: 1600px;
  margin: 0 auto;
}
.wave-footer-brand-col { display: flex; flex-direction: column; gap: 14px; }
.wave-footer-logo { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.wave-footer-wordmark strong { display: block; font-size: 18px; letter-spacing: -.02em; }
.wave-footer-wordmark small { display: block; color: var(--muted); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; margin-top: 3px; }
.wave-footer-tagline { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; max-width: 340px; }
.wave-footer-social { display: flex; gap: 10px; margin-top: 4px; }
.wave-footer-social a {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%; color: var(--muted);
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.wave-footer-social a:hover { color: var(--accent); border-color: rgba(45,212,191,.4); background: var(--accent-soft); }
.wave-footer-social svg { width: 15px; height: 15px; fill: currentColor; }
.wave-footer-col { display: flex; flex-direction: column; gap: 5px; }
.wave-footer-col h4 { margin: 0 0 3px; color: var(--text); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.wave-footer-col a { color: var(--muted); font-size: 11px; text-decoration: none; transition: color .15s ease; }
.wave-footer-col a:hover { color: var(--accent); }
.wave-footer-bottom {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  max-width: 1600px; margin: 14px auto 0; padding-top: 12px; border-top: 1px solid var(--line);
}
.wave-footer-disclaimer { font-size: 9px; color: var(--muted); line-height: 1.4; }
.wave-footer-copy { font-size: 9px; color: var(--muted); letter-spacing: .03em; }
@media (max-width: 860px) {
  .wave-footer-grid { grid-template-columns: 1fr 1fr; gap: 26px; }
  .wave-footer-brand-col { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .wave-footer-grid { grid-template-columns: 1fr; }
  .wave-footer { padding: 28px 20px 18px; }
}
.avatar-button {
  width: 38px; height: 38px; border-radius: 50%;
  border: 2px solid var(--line); background: var(--panel);
  cursor: pointer; display: grid; place-items: center;
  padding: 0; transition: border-color .2s; margin-left: 6px;
}
.avatar-button:hover { border-color: var(--accent); }
.avatar-circle {
  font-size: 13px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; user-select: none;
}
.avatar-circle.connected { color: var(--accent); }
@media (max-width: 720px) {
  .candidate-matrix { font-size: 8px; }
  .candidate-matrix td strong { font-size: 9px; }
}
/* ===== Mobile responsive (phone + tablet) ===== */
@media (max-width: 1024px) {
  /* Main grid: stack vertically */
  .grid { grid-template-columns: 1fr !important; }
  .grid > .metrics, .grid > .market-panel, .grid > .allocation { grid-column: 1 !important; grid-row: auto !important; }
  /* Metrics: 2 columns instead of 4 */
  .metrics { grid-template-columns: repeat(2, 1fr) !important; gap: 6px; }
  .metric { padding: 8px !important; min-height: 50px; }
  .metric strong { font-size: 13px; }
  .metric > span { font-size: 9px; }
  .metric small { font-size: 9px; }
  /* Allocation: donuts side-by-side */
  .allocation { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .allocation .panel-head { grid-column: 1 / -1; }
  .allocation .donut-block { grid-column: 1; }
  .allocation .symbol-allocation { grid-column: 2; min-width: 0; }
  .donut { width: 130px; height: 130px; margin: 8px auto 4px; }
  .donut::before { width: 94px; height: 94px; }
  .donut strong { font-size: 18px; }
  .donut .donut-stack strong { font-size: 13px; }
  .token-donut-svg { width: 130px; height: 130px; }
  .legend p { font-size: 9px; }
  .symbol-allocation-note { display: none; }
  /* Closed-position filters: wrap */
  .closed-filters { flex-wrap: wrap; gap: 4px; }
  .closed-filters label { min-width: 0 !important; flex: 1 1 calc(50% - 4px); }
  .closed-filters .button { flex: 0 0 auto; }
  /* Strategy form: 2 columns instead of 4 */
  .strategy-form { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .strategy-form > fieldset:nth-of-type(2) { border-right: 0; }
  /* Position rows: fewer columns + smaller */
  .position-row { grid-template-columns: 1.2fr .9fr .7fr .7fr; gap: 4px; font-size: 10px; padding: 5px 3px; }
  .position-row.labels { font-size: 7px; }
  .position-row > span:nth-child(n+5):not(.position-actions) { display: none; }
  /* Topbar: smaller */
  .topbar h1 { font-size: 24px; }
  /* Panels: less padding */
  .panel { padding: 10px; }
  .panel-head { gap: 6px; }
  /* Closed table */
  .closed-table { font-size: 10px; }
}
@media (max-width: 480px) {
  .metrics { grid-template-columns: 1fr !important; }
  .allocation { grid-template-columns: 1fr; }
  .allocation .donut-block { grid-column: 1; }
  .allocation .symbol-allocation { grid-column: 1; }
  .strategy-form { grid-template-columns: 1fr !important; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 20px; }
}

.strategy-form {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 16px; padding: 0; overflow: hidden;
}
.config-status {
  grid-column: 1 / -1;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: rgba(45,212,191,.035);
}
/* Strategy risk presets bar (fixed presets + 3 saveable custom slots) */
.strategy-presets {
  grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 12px 20px; border-bottom: 1px solid var(--line);
  background: rgba(45,212,191,.025);
}
.strategy-presets-label {
  color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; margin-right: 2px;
}
.strategy-presets-divider { width: 1px; align-self: stretch; background: var(--line); margin: 0 4px; }
.preset-btn, .preset-save {
  padding: 6px 11px; border: 1px solid var(--line); border-radius: 0;
  background: var(--panel-2); color: var(--text); font-size: 10px; font-weight: 700;
  cursor: pointer; transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.preset-btn:hover, .preset-save:hover {
  border-color: rgba(45,212,191,.45); color: var(--accent); background: var(--accent-soft);
}
.preset-btn.preset-custom.filled { border-color: rgba(45,212,191,.4); color: var(--accent); }
.preset-save { padding: 6px 9px; font-size: 12px; }
.preset-custom-list { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.preset-name-input {
  width: 132px; padding: 6px 9px; font-size: 10px; font-weight: 600;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 0; color: var(--text);
}
.preset-name-input:focus { border-color: rgba(45,212,191,.5); outline: none; }
.preset-delete {
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 0;
  background: transparent; color: var(--muted); font-size: 11px; cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.preset-delete:hover { color: var(--red); border-color: rgba(255,107,107,.4); }
.preset-empty { color: var(--muted); font-size: 9px; font-style: italic; }
.config-status > div { display: flex; align-items: center; gap: 9px; font-size: 11px; }
.strategy-profile-picker {
  display: flex; align-items: center; gap: 8px; margin-left: auto;
  color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em;
}
.strategy-profile-picker select {
  width: 108px; min-height: 34px; padding: 7px 30px 7px 10px;
  font-size: 10px;
}
.strategy-form > fieldset {
  min-width: 0; border: 0; border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line); padding: 20px; margin: 0;
}
.strategy-form > fieldset:nth-of-type(4) { border-right: 0; }
legend {
  padding: 20px 0 0; color: var(--accent); font-size: 9px; font-weight: 850;
  letter-spacing: .13em; text-transform: uppercase;
}
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px 16px; }
.strategy-form > fieldset .form-grid { grid-template-columns: 1fr; }
.form-grid label { min-width: 0; }
label small { color: #6f7871; font-size: 8px; line-height: 1.45; min-height: 24px; }
.input-unit { position: relative; display: block; }
.input-unit input { padding-right: 42px; }
.input-unit b {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: #69716a; font-size: 10px; pointer-events: none;
}
.paired-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.paired-inputs input:first-child { border-radius: 0 4px 4px 9px; }
.paired-inputs input:last-child { border-radius: 0 9px 9px 4px; }
.form-actions {
  grid-column: 1 / -1; padding: 18px 20px 20px;
  display: flex; align-items: center; gap: 10px;
}
.form-actions small { color: var(--muted); font-size: 9px; margin-left: auto; }
.adaptive-fields { margin-top: 8px; }
/* ATR-DCA parameter labels: hidden unless DCA mode = ATR (the .hidden attr
   already covers basic display:none, this just keeps them out of the grid flow
   so the surrounding form-grid does not leave an empty cell). */
.atr-field[hidden] { display: none !important; }
.setting-warning {
  margin: 16px 0 0; padding: 10px 12px; border-left: 2px solid var(--amber);
  color: #959d96; background: rgba(246,189,75,.045); font-size: 9px; line-height: 1.4;
}
.position-close {
  border: 1px solid rgba(255,102,92,.35); border-radius: 0; padding: 7px 9px;
  color: #ff918a; background: rgba(255,102,92,.07); font-size: 9px; font-weight: 800;
}
.position-actions { display: flex; gap: 4px; align-items: center; justify-content: flex-end; flex-shrink: 0; }
.position-trailing, .close-position, .position-sl, .position-tp, .position-funding-cut, .position-dca {
  width: 26px; height: 26px; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--line); border-radius: 0; background: transparent;
  color: var(--muted); font-size: 12px; line-height: 1; cursor: pointer;
  transition: all .15s;
}
/* Kolory domyślne przycisków akcji zneutralizowane (kg. usera 19.09):
   znaczek SVG jest szary (muted), a jedynym źródłem koloru są klasy stanów
   .icon-on (zielony=ręczne), .icon-auto (żółty pastel=system), .icon-off
   (czerwony=wyłączone). Każdy przycisk miał wcześniej własny kolor
   (tarcza czerwona, strzałka błękitna...), co łamało schemat. */
.position-trailing, .position-sl, .position-tp, .position-dca,
.position-funding-cut { color: var(--muted); border-color: var(--line); }
.position-trailing:hover, .position-sl:hover, .position-dca:hover,
.position-funding-cut:hover { border-color: rgba(91,215,255,.45); }
.position-tp:hover { border-color: rgba(91,215,255,.45); }
.position-tp.icon-off { color: #ff665c; }
.position-actions .icon-on:hover, .position-actions .icon-auto:hover,
.position-actions .icon-off:hover { filter: brightness(1.25); }
.token-info-hint { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.close-position:hover { color: var(--accent); border-color: rgba(45,212,191,.32); }
.close-position:disabled, .position-trailing:disabled, .position-sl:disabled, .position-tp:disabled, .position-funding-cut:disabled {
  color: var(--muted); border-color: var(--line); cursor: default;
}

.calculator-layout {
  display: grid; grid-template-columns: minmax(260px, .68fr) minmax(0, 2fr);
  align-items: start; gap: 14px; margin-top: 16px;
}
.calculator-controls { position: sticky; top: 20px; }
.form-grid.compact { grid-template-columns: 1fr 1fr; }
.form-grid.compact label { margin-top: 4px; }
.formula {
  margin-top: 18px; padding: 15px; border-radius: 0; border: 1px solid rgba(45,212,191,.2);
  background: var(--accent-soft);
}
.formula span, .formula small, .formula strong { display: block; }
.formula span { color: var(--muted); font-size: 9px; }
.formula strong { color: var(--accent); font-size: 22px; margin: 5px 0; }
.formula small { color: #7f8981; font-size: 8px; }
.projection-metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.projection-metrics article {
  min-width: 0; min-height: 72px; padding: 12px; border: 1px solid var(--line);
  border-radius: 0; background: linear-gradient(160deg, rgba(20,38,32,.96), rgba(8,16,13,.98));
}
.projection-metrics span, .projection-metrics strong { display: block; }
.projection-metrics span { color: var(--muted); font-size: 9px; line-height: 1.4; min-height: 26px; }
.projection-metrics strong { color: var(--accent); font-size: clamp(14px, 1.3vw, 19px); margin-top: 6px; white-space: nowrap; }
@media (max-width: 1200px) { .projection-metrics { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .projection-metrics { grid-template-columns: repeat(2, 1fr); } }
.projection-table { margin-top: 10px; padding: 18px; }
.projection-table table { min-width: 720px; }
.projection-table td { white-space: nowrap; }
.projection-table td small { color: var(--muted); display: block; margin-top: 3px; }
.projection-table td:nth-last-child(-n+2) { font-weight: 750; }
.projection-table td:nth-last-child(2) { color: var(--accent); }
.calculator-warning {
  margin: 10px 0 0; padding: 11px 14px; border-left: 2px solid var(--amber);
  color: #8d958e; background: rgba(246,189,75,.045); font-size: 9px; line-height: 1.4;
}

dialog {
  width: min(470px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line);
  border-radius: 0; color: var(--text); background: #0c1714;
}
.chart-dialog { width: min(1180px, calc(100% - 32px)); }
.chart-dialog-content { padding: 24px; }
.chart-loading, .chart-error {
  margin-top: 18px; padding: 34px 18px; border: 1px solid var(--line);
  border-radius: 0; color: var(--muted); background: #0a1411;
  font-size: 10px; text-align: center;
}
.chart-error {
  color: #ff918a; border-color: rgba(255,102,92,.3); background: rgba(255,102,92,.06);
}
.market-chart-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px;
}
.market-chart-grid:not([hidden]) { display: grid; }
/* Volume-profile panel (POC + Value Area) shown beneath the chart cards. */
.market-vp-panel { margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 0; background: #0a1411; }
.market-vp-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.market-vp-head strong { color: var(--text); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.market-vp-head .muted { color: var(--muted); font-size: 9px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.market-vp-chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.vp-chip { display: inline-flex; gap: 5px; align-items: baseline; padding: 3px 9px; border-radius: 0; font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border: 1px solid var(--line); }
.vp-chip b { font-size: 10px; font-weight: 750; }
.vp-chip.poc b { color: #f6bd4b; }
.vp-chip.vah b { color: #5fd7a0; }
.vp-chip.val b { color: #ff8585; }
.market-vp-status { margin: 6px 0 0; color: var(--muted); font-size: 10px; }
.market-vp-status[hidden] { display: none; }
.market-chart-card {
  min-width: 0; padding: 14px; border: 1px solid var(--line);
  border-radius: 0; background: #0a1411;
}
.market-chart-card-head, .rsi-label {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.chart-interval-heading {
  display: flex; align-items: center; gap: 10px; min-width: 0;
}
.chart-interval-switch {
  display: inline-flex; padding: 2px; border: 1px solid var(--line);
  border-radius: 0; background: #091411;
}
.chart-interval-switch button {
  min-width: 34px; padding: 5px 8px; border: 0; border-radius: 0;
  color: var(--muted); background: transparent; font-size: 8px; font-weight: 750;
  text-transform: uppercase;
}
.chart-interval-switch button:hover { color: var(--text); }
.chart-interval-switch button.active {
  color: #06120f; background: var(--accent);
}
.market-chart-card-head strong, .rsi-label strong {
  color: var(--text); font-size: 10px;
}
.market-chart-card-head span, .rsi-label span {
  color: var(--muted); font-size: 9px;
}
.market-chart-card canvas {
  display: block; width: 100%; height: 270px; margin-top: 10px;
}
.market-chart-card .rsi-canvas { height: 112px; margin-top: 5px; }
.rsi-label { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.token-info-panel {
  margin-top: 12px; padding: 14px; border: 1px solid rgba(91,215,255,.24);
  border-radius: 0; background: rgba(91,215,255,.045);
}
.token-info-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.token-info-head strong { color: var(--blue); font-size: 10px; }
.token-info-head span { color: var(--muted); font-size: 8px; text-align: right; }
.token-info-panel pre {
  margin: 11px 0 0; color: #c7cec8; font: 9px/1.65 system-ui, sans-serif;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.chart-dialog-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 14px; color: var(--muted); font-size: 8px;
}
.chart-dialog-foot p { margin: 0; }
.chart-dialog-foot span { color: var(--amber); text-align: right; }
.forced-entry-action {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
}
.forced-entry-action .button {
  flex: 0 0 auto; padding: 8px 12px; font-size: 9px;
}
.forced-entry-action .button:disabled { opacity: .42; cursor: not-allowed; }
dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(5px); }
dialog form { padding: 24px; }
.close { color: var(--muted); border: 0; background: none; font-size: 26px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 10px; margin-top: 16px; }
input, select { width: 100%; color: var(--text); background: #0a1411; border: 1px solid var(--line); border-radius: 0; padding: 12px; outline: none; }
input:focus, select:focus { border-color: var(--accent); }
.security-copy { color: var(--muted); font-size: 9px; line-height: 1.4; margin: 16px 0; }
.danger-warning {
  margin-top: 18px; padding: 14px; border: 1px solid rgba(255,102,92,.32);
  border-radius: 0; background: rgba(255,102,92,.07);
}
.danger-warning strong { color: #ff918a; font-size: 11px; }
.danger-warning p { color: #a9b0aa; font-size: 9px; line-height: 1.4; margin: 7px 0 0; }
.settings-reminder {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px;
}
.settings-reminder p {
  margin: 0; padding: 10px 11px; border: 1px solid var(--line);
  border-radius: 0; background: #0a1411;
}
.settings-reminder span, .settings-reminder strong { display: block; }
.settings-reminder span { color: var(--muted); font-size: 8px; }
.settings-reminder strong { color: var(--text); font-size: 10px; margin-top: 5px; }
.settings-edit-field {
  margin: 0; padding: 9px 11px; gap: 6px; border: 1px solid var(--line);
  border-radius: 0; background: #0a1411; color: var(--muted); font-size: 8px;
}
.settings-edit-field input, .settings-edit-field select {
  padding: 7px 9px; border-radius: 0; font-size: 10px; font-weight: 750;
}
.settings-edit-field .input-unit input { padding-right: 54px; }
.settings-edit-field .input-unit b { right: 9px; font-size: 8px; }
.position-override-note {
  margin: 9px 2px 0; color: var(--blue); font-size: 8px; line-height: 1.4;
}
.confirm-check {
  display: flex; grid-template-columns: none; flex-direction: row; align-items: flex-start;
  gap: 9px; padding: 11px; border: 1px solid var(--line); border-radius: 0;
  color: #bbc2bc; line-height: 1.45;
}
.confirm-check input { width: auto; margin: 1px 0 0; accent-color: var(--accent); }
.connection-feedback {
  margin: 12px 0; padding: 11px 12px; border: 1px solid rgba(255,102,92,.35);
  border-radius: 0; color: #ffaaa4; background: rgba(255,102,92,.08);
  font-size: 10px; line-height: 1.4;
}
.connection-feedback.checking {
  border-color: rgba(91,215,255,.32); color: var(--blue); background: rgba(91,215,255,.07);
}
.connection-feedback.success {
  border-color: rgba(45,212,191,.3); color: var(--accent); background: var(--accent-soft);
}
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 16px; }
.dialog-actions .button { width: 100%; }
.dialog-actions .button:disabled { opacity: .4; cursor: not-allowed; }
.toast { position: fixed; right: 22px; bottom: 22px; opacity: 0; transform: translateY(10px); pointer-events: none; background: #20261f; border: 1px solid #394138; border-radius: 0; padding: 12px 16px; font-size: 11px; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 980px) {
  .shell { grid-template-columns: 76px 1fr; }
  .sidebar { padding: 24px 12px; }
  .brand span:last-child, nav a:not(.active), nav a.active { font-size: 0; }
  nav a { justify-content: center; } nav a span { font-size: 10px; }
  .sidebar-foot div { display: none; }
  main { padding: 28px 24px 60px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .environment-choices { grid-template-columns: 1fr; }
  .calculator-layout { grid-template-columns: 1fr; }
  .calculator-controls { position: static; }
  .projection-metrics { grid-template-columns: repeat(2, 1fr); }
  .closed-title { align-items: flex-start; flex-direction: column; }
  .closed-filters { width: 100%; }
  .closed-filters label { flex: 1; }
  .closed-custom-range { width: 100%; flex-wrap: wrap; }
  .closed-custom-range label { flex: 1; min-width: 130px; }
  .closed-metrics { grid-template-columns: repeat(2, 1fr); }
  .close-breakdown { grid-template-columns: repeat(3, 1fr); }
  .market-chart-grid { grid-template-columns: 1fr; }
  .candidate-diagnostics ul { grid-template-columns: 1fr; }
}
@media (max-width: 1500px) {
  .entry-condition-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entry-condition-grid section:nth-child(even) { border-right: 0; }
  .entry-condition-grid section:last-child {
    grid-column: 1 / -1; border-top: 1px solid var(--line);
  }
  .saved-profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .saved-profile-grid section:nth-child(even) { border-right: 0; }
  .saved-profile-grid section:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .strategy-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strategy-form > fieldset:nth-of-type(even) { border-right: 0; }
}
@media (max-width: 680px) {
  .shell { display: block; }
  .sidebar { display: none; }
  main { padding: 22px 16px 50px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .mode-status { margin-right: auto; }
  .header-brand strong { font-size: 27px; }
  .wave-symbol { width: 48px; height: 48px; flex-basis: 48px; }
  .notice .badge { display: none; }
  .demo-account { grid-template-columns: 1fr 1fr; }
  .demo-account > div { grid-column: 1 / -1; }
  .metrics, .connection-grid { grid-template-columns: 1fr; }
  .entry-conditions-head { align-items: flex-start; }
  .entry-condition-grid { grid-template-columns: 1fr; }
  .entry-condition-grid section, .entry-condition-grid section:nth-child(even) {
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .entry-condition-grid section:last-child {
    grid-column: auto; border-top: 0; border-bottom: 0;
  }
  .saved-profile-summary-head { align-items: flex-start; flex-direction: column; }
  .saved-profile-summary-head small { text-align: left; }
  .saved-profile-grid { grid-template-columns: 1fr; }
  .saved-profile-grid section, .saved-profile-grid section:nth-child(even) {
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .saved-profile-grid section:last-child { border-bottom: 0; }
  .strategy-form { grid-template-columns: 1fr; }
  .strategy-form > fieldset { border-right: 0; }
  .form-grid, .form-grid.compact { grid-template-columns: 1fr; }
  .policy-choices { grid-template-columns: 1fr; }
  .bot-control-actions { align-items: stretch; flex-direction: column; }
  .bot-control-actions .button { width: 100%; }
  .telegram-card, .telegram-actions { align-items: stretch; flex-direction: column; }
  .telegram-actions .button { width: 100%; }
  .projection-metrics { grid-template-columns: 1fr 1fr; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .form-actions small { margin: 2px 0 0; text-align: center; }
  .position-row { grid-template-columns: 1fr 1fr; }
  .position-row span:nth-child(4), .position-row span:nth-child(5), .position-row span:nth-child(6) { display: none; }
  .section-title { align-items: flex-start; flex-direction: column; }
  .section-title > p { text-align: left; }
  .chart-dialog-content { padding: 18px; }
  .candidate-diagnostics-head { flex-direction: column; }
  .candidate-diagnostics-actions { align-items: stretch; flex-direction: column; }
  .candidate-diagnostics-actions .button { width: 100%; }
  .market-panel-actions { align-items: flex-end; flex-wrap: wrap; }
  .market-panel-actions small { width: 100%; text-align: right; }
  .chart-dialog-foot { align-items: flex-start; flex-direction: column; }
  .chart-dialog-foot span { text-align: left; }
  .forced-entry-action { width: 100%; flex-wrap: wrap; }
  .token-info-head { align-items: flex-start; flex-direction: column; }
  .token-info-head span { text-align: left; }
  .closed-filters { display: grid; grid-template-columns: 1fr 1fr; }
  .closed-filters label { min-width: 0; }
  .closed-filters label:first-child { grid-column: 1 / -1; }
  .closed-metrics { grid-template-columns: 1fr 1fr; }
  .close-breakdown { grid-template-columns: 1fr 1fr; }
}

/* Liquidation badge */
.liq-badge {
  display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px;
  border-radius: 0; font-size: 8px; font-weight: 700; margin-top: 4px;
}
.liq-badge.safe { background: rgba(45,212,191,.08); color: var(--accent); }
.liq-badge.warning { background: rgba(246,189,75,.08); color: var(--amber); }
.liq-badge.danger { background: rgba(255,102,92,.12); color: #ff918a; animation: liq-pulse 2s infinite; }
@keyframes liq-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }

/* Currency selector */
.currency-select {
  background: var(--panel); border: 1px solid var(--line); border-radius: 0;
  color: var(--text); font-size: 10px; font-weight: 700; padding: 7px 8px; cursor: pointer;
}
.currency-select:hover { border-color: var(--accent); }

/* Bot instances panel — multi-instance manager */
.instances-panel .instance-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-top: 1px solid var(--line); padding: 12px 8px; font-size: 11px;
}
.instances-panel .instance-row strong { font-size: 12px; }
.instances-panel .instance-row small { display: block; color: var(--muted); font-size: 9px; margin-top: 4px; }
.instances-panel .instance-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.instances-panel form {
  display: flex; gap: 10px; align-items: end; flex-wrap: wrap;
  border-top: 1px solid var(--line); padding: 14px 8px; margin-top: 8px;
}
.instances-panel form label { display: flex; flex-direction: column; gap: 4px; font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.instances-panel form input, .instances-panel form select {
  background: var(--panel); border: 1px solid var(--line); border-radius: 0;
  color: var(--text); font-size: 11px; padding: 7px 8px; min-width: 140px;
}

/* ─────────────────────────────────────────────────────────────
   ZEEEX reskin layer — depth, gradients, gloss
   Appended last so it layers over the rules above at equal
   specificity. Delete this block to revert the visual treatment
   while keeping the teal palette tokens in :root.
   ───────────────────────────────────────────────────────────── */
body {
  background:
    radial-gradient(circle at 78% -10%, rgba(45, 212, 191, .16), transparent 34%),
    radial-gradient(circle at 4% 8%, rgba(45, 212, 191, .06), transparent 28%),
    var(--bg);
  background-attachment: fixed;
}

/* rounded cards with a soft lift; featured cards get an accent halo */
.metric, .panel, .exchange-card,
.closed-metrics article, .projection-metrics article { box-shadow: var(--shadow); }
.metric.featured, .exchange-card.primary,
.closed-metrics article.featured,
.projection-metrics article.featured { box-shadow: var(--shadow-accent); }

/* dialogs float on an accent halo */
dialog { box-shadow: var(--shadow-accent), 0 34px 90px -46px rgba(0, 0, 0, .92); }

/* primary button — teal gloss gradient (ghost / danger keep their own look) */
.button:not(.ghost):not(.danger) {
  background: linear-gradient(180deg, var(--accent-bright), var(--accent));
  border-color: var(--accent-bright);
  box-shadow: 0 12px 28px -16px rgba(45, 212, 191, .65);
}
.button:not(.ghost):not(.danger):hover {
  filter: brightness(1.06);
  box-shadow: 0 14px 32px -16px rgba(45, 212, 191, .8);
}

/* active chart-interval pill — crisp teal with a small glow */
.chart-interval-switch button.active { box-shadow: 0 6px 16px -10px rgba(45, 212, 191, .7); }

/* Instance management (multi-tenant Faza 3) */
.badge.ok { color: var(--accent); }
.instances-section .instance-create { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 12px 0 16px; }
.instances-section .instance-create label { display: flex; flex-direction: column; gap: 4px; font-size: 10px; color: var(--muted); }
.instances-section .instance-create input,
.instances-section .instance-create select { min-width: 140px; }
.instance-list { display: flex; flex-direction: column; gap: 8px; }
.instance-card { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 0; background: #0a1411; }
.instance-info { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 11px; }
.instance-info small { color: var(--muted); font-size: 9px; width: 100%; }
.instance-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.instance-command { margin-top: 12px; padding: 10px; border: 1px dashed var(--line); border-radius: 0; background: #091411; }
.instance-command code { display: block; margin: 6px 0; padding: 6px; background: #060d0b; border-radius: 0; font-size: 9px; word-break: break-all; color: #5fd7a0; }


/* Kill-switch status chip — moved to the admin Bot Control section. */

/* Instance dashboard link chip — visible clickable address per instance. */
.instance-actions a.button { text-decoration: none; font-size: 9px; }

/* Margin-gate status strip (admin top) */
.margin-gate-strip {
  display: flex; align-items: center; gap: 12px;
  margin: 12px 0 0; padding: 10px 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 0;
  font-size: 13px; font-variant-numeric: tabular-nums;
}
.margin-gate-strip .mg-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: 0 0 auto;
}
.margin-gate-strip.ok .mg-dot { background: #5fd7a0; box-shadow: 0 0 8px rgba(95,215,160,.5); }
.margin-gate-strip.frozen .mg-dot { background: #e57373; box-shadow: 0 0 8px rgba(229,115,115,.5); }
.margin-gate-strip strong { color: var(--text); }
.margin-gate-strip span { color: var(--muted); }
.margin-gate-strip.frozen strong { color: #e57373; }

/* Margin live panel (admin) */
.margin-live-panel {
  margin: 12px 0 0; padding: 14px 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 0;
}
.ml-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.ml-head strong { font-size: 13px; }
.ml-controls { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; margin-left: auto; }
.ml-ctrl { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.ml-ctrl b { min-width: 44px; text-align: right; color: #f6bd4b; font-variant-numeric: tabular-nums; }
.ml-ctrl input[type="range"] { width: 130px; accent-color: var(--ok, #5fd7a0); }
.ml-range { display: inline-flex; gap: 4px; }
.ml-range-btn {
  font: 700 11px ui-monospace, Menlo, monospace; letter-spacing: .04em;
  padding: 4px 10px; border-radius: 0; cursor: pointer;
  border: 1px solid rgba(76,86,78,.55); background: transparent; color: var(--muted);
}
.ml-range-btn:hover { color: var(--text, #e8f5ef); border-color: var(--muted); }
.ml-range-btn.active { background: #5bd7ff; border-color: #5bd7ff; color: #06131a; }
#mlChart { width: 100%; height: 240px; display: block; margin-top: 12px; }
#posFlowChart { width: 100%; height: 320px; display: block; margin-top: 12px; cursor: crosshair; }

/* Stany ikon akcji pozycji (kg. usera 19.09): kolor ZNACZKA (SVG stroke na
   currentColor), nie ramki. Szare = normalnie; zielony = włączone/ustawione,
   żółty pastelowy = uzbrojone przez AUTO, czerwony = wyłączone. */
.position-actions .icon-on { color: #6fdca4; }
.position-actions .icon-auto { color: #f6bd4b; }
.position-actions .icon-off { color: #ff665c; }
.ml-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.ml-hint { color: rgba(125,147,139,.75); font-size: 10.5px; }
.ml-legend .sw { display: inline-block; width: 14px; height: 3px; border-radius: 0; margin-right: 5px; vertical-align: middle; }


/* ============================================================
   TERMINAL OVERRIDES — brute force na wszystkie SaaS relikty
   ============================================================ */

/* 1. Wszystkie border-radius → 0 (bez wyjątków) */
*, *::before, *::after {
  border-radius: 0 !important;
}

/* 2. Tło: ciepła czerń wszędzie */
body, .shell, main, section, article, .panel, .grid,
.metric, .donut, .donut-block, .allocation,
.strategy-form, .bot-control, .calculator-controls,
.projection-table, .table-wrap, .chart-canvas {
  background: var(--bg) !important;
}

.panel, .metric, .strategy-form, .bot-control,
.calculator-controls, .projection-table, .table-wrap {
  background: var(--panel) !important;
  border: 1px solid var(--line) !important;
}

/* 3. Button: płaski, bez zaokrągleń, bez gradientów */
button, .button, input[type="submit"], input[type="button"],
.preset-btn, .text-button, .icon-button {
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: color .12s, border-color .12s;
}
button:hover, .button:hover, .icon-button:hover {
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}
.button.filled, button.filled {
  background: var(--accent) !important;
  color: var(--bg) !important;
  border-color: var(--accent) !important;
}
.button.danger, .panic, button.danger {
  background: var(--red) !important;
  color: var(--bg) !important;
  border-color: var(--red) !important;
}

/* 4. Badge/pill → płaski kwadrat */
.badge, .state, .preset-btn, .pill,
.status-dot, .mode-badge span {
  border-radius: 0 !important;
  border: 1px solid var(--line) !important;
  background: transparent !important;
  padding: 1px 6px;
  font-size: 9px;
}

/* 5. Select/Input: płaskie */
select, input[type="text"], input[type="email"],
input[type="password"], input[type="number"],
input[type="month"], input[type="date"],
textarea, .form-grid input, .form-grid select {
  border-radius: 0 !important;
  background: var(--panel) !important;
  border: 1px solid var(--line) !important;
  color: var(--text) !important;
  font-family: inherit !important;
}

/* 6. Table: hairline borders */
table, th, td {
  border-radius: 0 !important;
}
th {
  background: var(--panel-2) !important;
  border-bottom: 1px solid var(--line) !important;
  font-size: 9px !important;
  text-transform: uppercase !important;
  letter-spacing: .06em !important;
  color: var(--muted) !important;
  font-weight: 400 !important;
}
td {
  border-bottom: 1px solid var(--line) !important;
  font-size: 12px !important;
}

/* 7. Donut → kwadrat z legendą */
.donut {
  border-radius: 0 !important;
}

/* 8. Wykresy: bez zaokrągleń na elementach */
canvas, svg {
  border-radius: 0 !important;
}

/* 9. Sidebar: płaski */
.sidebar, aside {
  background: var(--panel) !important;
  border-right: 1px solid var(--line) !important;
}
.sidebar a, .nav-item {
  border-radius: 0 !important;
}

/* 10. Dialog/Modal: płaski */
dialog, .modal, [open] {
  border-radius: 0 !important;
  border: 1px solid var(--line) !important;
  background: var(--panel) !important;
}

/* 11. Scrollbar: cienki */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 0 !important;
}

/* 12. Focus: amber outline */
:focus, :focus-visible {
  outline: 1px solid var(--accent) !important;
  outline-offset: 0 !important;
}

/* 13. Linki: amber underline */
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* 14. Slider: płaski */
input[type="range"] {
  border-radius: 0 !important;
  -webkit-appearance: none;
  height: 2px;
  background: var(--line);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 16px;
  background: var(--accent);
  border-radius: 0 !important;
  cursor: pointer;
}

/* 15. Checkbox: płaski */
input[type="checkbox"] {
  accent-color: var(--accent);
}


/* TERMINAL FIX: niebieskie taby → amber */
.ml-range-btn.active, .ml-range-btn[aria-pressed="true"],
.tab.active, .tab.selected,
button.active:not(.danger) {
  background: var(--accent) !important;
  color: var(--bg) !important;
  border-color: var(--accent) !important;
  border-radius: 0 !important;
}
.ml-range-btn {
  background: transparent !important;
  border: 1px solid var(--line) !important;
  color: var(--muted) !important;
  border-radius: 0 !important;
}

/* TERMINAL FIX: donut — zamień pastele na amber/dim */
.donut {
  background: conic-gradient(
    var(--accent) 0 var(--donut-pct, 30%),
    var(--line) var(--donut-pct, 30%) 100%
  ) !important;
  border-radius: 0 !important;
}
.donut::after {
  border-radius: 0 !important;
  background: var(--panel) !important;
}
.donut .dot, .legend .dot {
  border-radius: 0 !important;
}

/* TERMINAL FIX: legend dots → kwadratowe */
.dot, .sw, .li .dot {
  border-radius: 0 !important;
}

/* TERMINAL FIX: kill wszelkie pozostałe border-radius */
input, select, button, a, div, span, article, section,
label, form, fieldset, nav, aside, main, header, footer,
table, thead, tbody, tr, th, td, ul, ol, li,
dialog, canvas, svg, img, code, pre {
  border-radius: 0 !important;
}

/* TERMINAL FIX: sliders → kwadratowe */
input[type="range"] {
  -webkit-appearance: none !important;
  appearance: none !important;
  height: 2px !important;
  background: var(--line) !important;
  border: none !important;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none !important;
  width: 8px !important;
  height: 18px !important;
  background: var(--accent) !important;
  border: none !important;
  border-radius: 0 !important;
  cursor: pointer !important;
}
input[type="range"]::-moz-range-thumb {
  width: 8px !important;
  height: 18px !important;
  background: var(--accent) !important;
  border: none !important;
  border-radius: 0 !important;
  cursor: pointer !important;
}

/* TERMINAL FIX: badge → text label z ramką */
.badge, .state, .preset-btn {
  border-radius: 0 !important;
  background: transparent !important;
  border: 1px solid var(--line) !important;
  box-shadow: none !important;
}
.badge.safe, .state.ready {
  color: var(--accent) !important;
  border-color: var(--accent) !important;
  background: transparent !important;
}
.badge.muted {
  color: var(--muted) !important;
}


/* TERMINAL: dwa wykresy obok siebie */
@media (min-width: 1100px) {
  .terminal-charts-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1px !important;
    background: var(--line) !important;
    border: 1px solid var(--line) !important;
  }
  .terminal-charts-row > section,
  .terminal-charts-row > article,
  .terminal-charts-row > div {
    margin: 0 !important;
    border: none !important;
  }
}

/* Upewnij się że canvas wypełnia kontener */
.terminal-charts-row canvas {
  width: 100% !important;
}


/* ============================================================
   TERMINAL: MOBILE OPTIMIZATION
   ============================================================ */
@media (max-width: 768px) {
  /* Sidebar: ukryj na mobile (dane w status strip) */
  .sidebar, aside {
    display: none !important;
  }

  /* Shell: pełna szerokość */
  .shell, body {
    display: block !important;
    padding: 0 !important;
  }

  /* Main: bez marginesów */
  main {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }

  /* Topbar: kompaktowy */
  .topbar {
    height: 40px !important;
    padding: 4px 8px !important;
  }

  /* Status strip: przewijalny */
  .terminal-status-strip {
    overflow-x: auto !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .terminal-status-strip::-webkit-scrollbar {
    display: none;
  }

  /* Wykresy: stack + krótsze */
  .terminal-charts-row {
    display: flex !important;
    flex-direction: column !important;
  }
  .terminal-charts-row canvas,
  .terminal-charts-row .chart-canvas {
    height: 160px !important;
  }
  #mlChart, #posFlowChart {
    height: 160px !important;
  }

  /* Metryki: 2 kolumny */
  .metrics, .grid .metrics {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1px !important;
  }
  .metric {
    padding: 8px 12px !important;
  }
  .metric strong {
    font-size: 16px !important;
  }

  /* Tabele: przewijal poziomo */
  .table-wrap, .pos-table, table {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Donut w sidebarze — nie widoczny (sidebar hidden) */
  .allocation, .donut-block, .donut-wrap {
    display: none !important;
  }

  /* Pozycje: kompaktowe */
  .position-row {
    padding: 4px 8px !important;
  }
  .position-actions .act {
    width: 20px !important;
    height: 20px !important;
    font-size: 9px !important;
  }

  /* Kandydaci: bez mini-chart */
  .chart-mini {
    display: none !important;
  }

  /* Content: mniejsze paddingi */
  .content, main > section, .grid {
    padding: 8px !important;
    gap: 6px !important;
  }

  /* Zakładki wykresów: mniejsze */
  .ml-range-btn, .ctrl {
    font-size: 9px !important;
    padding: 1px 6px !important;
  }
  .ml-controls {
    flex-wrap: wrap;
    gap: 4px;
  }

  /* Margin gate: suwaki pod wykresem na mobile */
  .ml-head {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .ml-controls {
    width: 100%;
  }
}
