/* XAU Bot dashboard — terminal aurit pe grafit */
:root {
  --bg: #0e0f12;          /* grafit albăstrui, nu negru pur */
  --panel: #16181d;
  --panel-2: #1c1f26;
  --line: #262a33;
  --text: #d9dce3;
  --muted: #7c828f;
  --gold: #d9a441;        /* XAU */
  --gold-soft: rgba(217, 164, 65, 0.14);
  --win: #3ecf8e;
  --loss: #e5544b;
  --radius: 10px;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --display: 'Archivo', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  min-height: 100vh;
}

/* ---------- header ---------- */
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  font-family: var(--display); font-weight: 700; font-size: 15px;
  color: var(--bg); background: var(--gold);
  width: 34px; height: 34px; border-radius: 8px;
  display: grid; place-items: center;
}
h1 { font-family: var(--display); font-size: 16px; font-weight: 600; letter-spacing: 0.3px; }
h2 { font-family: var(--display); font-size: 13px; font-weight: 600; color: var(--text); }
.sub { color: var(--muted); font-size: 11px; }
.header-right { display: flex; align-items: center; gap: 16px; }
.price-block { text-align: right; }
.price { font-size: 18px; font-weight: 600; color: var(--gold); display: block; }
.status-pill {
  padding: 5px 12px; border-radius: 999px; font-size: 11px;
  border: 1px solid var(--line); color: var(--muted);
}
.status-pill.scanning { color: var(--gold); border-color: var(--gold); }
.status-pill.in_trade { color: var(--win); border-color: var(--win); }
.status-pill.circuit_breaker { color: var(--loss); border-color: var(--loss); }

/* ---------- layout ---------- */
main {
  display: grid; gap: 14px; padding: 16px 20px;
  grid-template-columns: repeat(12, 1fr);
  max-width: 1500px; margin: 0 auto;
}
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; grid-column: span 4;
}
.chart-card { grid-column: span 8; grid-row: span 2; }
.wide { grid-column: span 12; }
@media (max-width: 1000px) {
  .card, .chart-card, .wide { grid-column: span 12; }
}
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; gap: 8px; flex-wrap: wrap;
}

/* ---------- chart ---------- */
#chart { width: 100%; height: 420px; }
.tf-switch button {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  padding: 4px 12px; font-family: var(--mono); font-size: 11px; cursor: pointer;
}
.tf-switch button:first-child { border-radius: 6px 0 0 6px; }
.tf-switch button:last-child { border-radius: 0 6px 6px 0; }
.tf-switch button.active { background: var(--gold-soft); color: var(--gold); border-color: var(--gold); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 11px; color: var(--muted); }
.legend span::before {
  content: ''; display: inline-block; width: 10px; height: 10px;
  border-radius: 2px; margin-right: 5px; vertical-align: -1px;
}
.legend .ob::before { background: rgba(217,164,65,0.35); }
.legend .fvg::before { background: rgba(120,140,255,0.35); }
.legend .sr::before { background: transparent; border-bottom: 2px dashed var(--muted); height: 4px; }

/* ---------- confluence meter (signature) ---------- */
#confluence-meter .layer { margin-bottom: 10px; }
#confluence-meter .layer-head {
  display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 3px;
}
#confluence-meter .layer-head .name { color: var(--muted); }
#confluence-meter .bar {
  height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden;
  position: relative;
}
#confluence-meter .bar .fill {
  height: 100%; background: var(--gold); border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
#confluence-meter .bar .weight-tick {
  position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--text);
  opacity: 0.5;
}
.score-line {
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; font-size: 12px;
}
.score-line b { color: var(--gold); }

/* ---------- position ---------- */
#position-panel .row { display: flex; justify-content: space-between; padding: 4px 0; }
#position-panel .row .k { color: var(--muted); }
.pnl-pos { color: var(--win); font-weight: 600; }
.pnl-neg { color: var(--loss); font-weight: 600; }
.dir-long { color: var(--win); }
.dir-short { color: var(--loss); }
.empty { color: var(--muted); font-size: 12px; padding: 8px 0; }

/* ---------- stats ---------- */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--panel-2); border-radius: 8px; padding: 10px; }
.stat .v { font-size: 17px; font-weight: 600; color: var(--gold); }
.stat .k { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.ml-status { margin-top: 10px; font-size: 11px; color: var(--muted); }
.ml-status .active { color: var(--win); }

/* ---------- weights ---------- */
#weights-panel .w-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
#weights-panel .w-name { width: 130px; color: var(--muted); font-size: 11px; }
#weights-panel .w-bar { flex: 1; height: 6px; background: var(--panel-2); border-radius: 3px; }
#weights-panel .w-bar i { display: block; height: 100%; background: var(--gold); border-radius: 3px; }
#weights-panel .w-val { width: 44px; text-align: right; font-size: 11px; }
#weights-history { width: 100%; margin-top: 10px; }

/* ---------- breaker ---------- */
#breaker-panel .ev {
  border-left: 3px solid var(--loss); padding: 8px 10px; margin-bottom: 8px;
  background: var(--panel-2); border-radius: 0 8px 8px 0; font-size: 11px;
}
#breaker-panel .ev .when { color: var(--muted); }
#breaker-panel .ev pre {
  white-space: pre-wrap; color: var(--muted); margin-top: 5px; font-size: 10px;
}

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th {
  text-align: left; color: var(--muted); font-weight: 500; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 6px 10px; border-bottom: 1px solid var(--line);
}
td { padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr:hover td { background: var(--panel-2); }
.badge {
  padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 600;
}
.badge.win { background: rgba(62,207,142,0.15); color: var(--win); }
.badge.loss { background: rgba(229,84,75,0.15); color: var(--loss); }
.conf-tags span {
  background: var(--gold-soft); color: var(--gold); border-radius: 4px;
  padding: 1px 6px; margin-right: 4px; font-size: 10px;
}
.filters select {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 4px 8px; font-family: var(--mono); font-size: 11px;
}

/* ---------- signals ---------- */
#signals-panel .sig {
  display: flex; gap: 12px; align-items: baseline; padding: 6px 0;
  border-bottom: 1px solid var(--line); font-size: 11px; flex-wrap: wrap;
}
#signals-panel .sig:last-child { border-bottom: none; }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(10,10,12,0.85);
  display: none; place-items: center; z-index: 100;
}
.modal.show { display: grid; }
.modal-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 24px; width: min(420px, 92vw); display: flex; flex-direction: column; gap: 12px;
}
.modal-box input {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); padding: 10px 12px; font-family: var(--mono); font-size: 12px;
}
.modal-box button {
  background: var(--gold); color: var(--bg); border: none; border-radius: 8px;
  padding: 10px; font-family: var(--display); font-weight: 600; cursor: pointer;
}
.modal-box p, .modal-box code { color: var(--muted); font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
