:root {
  color-scheme: light;
  --page:           #f9f9f7;
  --surface:        #fcfcfb;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --grid:           #e1e0d9;
  --baseline:       #c3c2b7;
  --border:         rgba(11, 11, 11, 0.10);
  --series-1:       #2a78d6;
  --series-1-soft:  rgba(42, 120, 214, 0.10);
  --good:           #0ca30c;
  --warning:        #fab219;
  --critical:       #d03b3b;
  --delta-up:       #006300;
  --delta-down:     #d03b3b;
  --good-wash:      rgba(12, 163, 12, 0.10);
  --critical-wash:  rgba(208, 59, 59, 0.10);
  --muted-wash:     rgba(137, 135, 129, 0.12);
  /* Kategorik palet — strateji renkleri (sıra sabittir) */
  --cat-1: #2a78d6; --cat-2: #eb6834; --cat-3: #1baf7a; --cat-4: #eda100;
  --cat-5: #e87ba4; --cat-6: #008300; --cat-7: #4a3aa7; --cat-8: #e34948;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page:           #0d0d0d;
    --surface:        #1a1a19;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --grid:           #2c2c2a;
    --baseline:       #383835;
    --border:         rgba(255, 255, 255, 0.10);
    --series-1:       #3987e5;
    --series-1-soft:  rgba(57, 135, 229, 0.14);
    --delta-up:       #0ca30c;
    --delta-down:     #e66767;
    --good-wash:      rgba(12, 163, 12, 0.16);
    --critical-wash:  rgba(230, 103, 103, 0.16);
    --muted-wash:     rgba(137, 135, 129, 0.20);
    --cat-1: #3987e5; --cat-2: #d95926; --cat-3: #199e70; --cat-4: #c98500;
    --cat-5: #d55181; --cat-6: #008300; --cat-7: #9085e9; --cat-8: #e66767;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.wrap { max-width: 1220px; margin: 0 auto; padding: 0 20px 48px; }

/* ── Üst bar ─────────────────────────────────────────── */
header { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 18px 0 10px; }
header h1 { font-size: 19px; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
header .sub { color: var(--text-muted); font-size: 12.5px; }
.spacer { flex: 1; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); border-radius: 999px;
  padding: 3px 11px; font-size: 12px; color: var(--text-secondary);
  background: var(--surface); white-space: nowrap;
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); flex: none; }
.pill.on .dot { background: var(--good); }
.pill.off .dot { background: var(--critical); }
.pill button { all: unset; cursor: pointer; color: var(--text-muted); }
.pill button:hover { color: var(--critical); }

/* ── Sekmeler ────────────────────────────────────────── */
nav.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--grid); margin-bottom: 20px; flex-wrap: wrap; }
nav.tabs button {
  appearance: none; background: none; border: none; cursor: pointer;
  font: inherit; color: var(--text-secondary);
  padding: 9px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
nav.tabs button:hover { color: var(--text-primary); }
nav.tabs button.active { color: var(--text-primary); font-weight: 600; border-bottom-color: var(--series-1); }

/* ── Kartlar & tiles ─────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 18px; margin-bottom: 16px;
}
.card h2 { font-size: 13px; margin: 0 0 12px; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.tile .label { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.tile .value { font-size: 21px; font-weight: 650; margin-top: 3px; }
.tile .hint  { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.tile .value.up   { color: var(--delta-up); }
.tile .value.down { color: var(--delta-down); }

/* ── Tablolar ────────────────────────────────────────── */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; color: var(--text-muted); font-weight: 500;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 6px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap;
}
td { padding: 7px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: var(--series-1-soft); }
.sym { font-weight: 650; cursor: pointer; }
.sym:hover { color: var(--series-1); text-decoration: underline; }
.up   { color: var(--delta-up); }
.down { color: var(--delta-down); }
.mut  { color: var(--text-muted); }

/* ── Rozetler (ikon + etiket) ────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600;
}
.badge.al    { background: var(--good-wash);     color: var(--delta-up); }
.badge.sat   { background: var(--critical-wash); color: var(--delta-down); }
.badge.bekle { background: var(--muted-wash);    color: var(--text-secondary); }
.badge.paused { background: var(--muted-wash);   color: var(--text-secondary); }
.badge.active { background: var(--good-wash);    color: var(--delta-up); }

.dotc { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: baseline; }

/* ── Grafik ──────────────────────────────────────────── */
.chartbox { position: relative; }
.chartbox svg { display: block; width: 100%; height: auto; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 4px 2px 10px; font-size: 12.5px; color: var(--text-secondary); }
.legend .item { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 10px; height: 10px; border-radius: 3px; }
.tooltip {
  position: absolute; pointer-events: none; display: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; font-size: 12px; box-shadow: 0 4px 14px rgba(0,0,0,0.14);
  white-space: nowrap; z-index: 5;
}
.tooltip .t-ts { color: var(--text-muted); font-size: 11px; margin-bottom: 3px; }
.tooltip .t-row { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }

/* ── Strateji kartları ───────────────────────────────── */
.stratgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.strat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; border-top: 3px solid var(--baseline);
}
.strat .head { display: flex; align-items: center; gap: 8px; }
.strat .head b { font-size: 15px; }
.strat .params { color: var(--text-muted); font-size: 12px; margin: 6px 0 10px; line-height: 1.6; }
.strat .kpis { display: flex; gap: 18px; align-items: baseline; margin-bottom: 6px; }
.strat .kpis .big { font-size: 19px; font-weight: 650; }
.strat .actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.spark { width: 100%; height: 42px; margin: 4px 0; }

/* ── Formlar ─────────────────────────────────────────── */
label.field { display: block; margin-bottom: 12px; }
label.field span.name { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
label.field .desc { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
input[type="number"], input[type="text"], input[type="password"], select {
  width: 100%; max-width: 280px; height: 34px;
  background: var(--page); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 7px;
  padding: 0 10px; font: inherit; box-sizing: border-box;
}
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23898781' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
input:focus, select:focus { outline: 2px solid var(--series-1); outline-offset: 0; border-color: transparent; }
.check { display: inline-flex; align-items: center; gap: 7px; margin: 4px 16px 8px 0; font-size: 13px; cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--series-1); }
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 22px; }

button.btn {
  appearance: none; font: inherit; cursor: pointer;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text-primary);
  padding: 7px 16px; font-weight: 600;
}
button.btn:hover { border-color: var(--series-1); color: var(--series-1); }
button.btn.primary { background: var(--series-1); border-color: var(--series-1); color: #fff; }
button.btn.primary:hover { opacity: 0.9; color: #fff; }
button.btn.danger:hover { border-color: var(--critical); color: var(--critical); }
button.btn.small { padding: 3px 10px; font-size: 12px; font-weight: 500; }
button.btn:disabled { opacity: 0.5; cursor: default; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toast {
  position: fixed; bottom: 22px; right: 22px; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--series-1);
  border-radius: 8px; padding: 10px 16px; box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  display: none; max-width: 340px;
}
.toast.err { border-left-color: var(--critical); }

details.reasons summary { cursor: pointer; color: var(--series-1); font-size: 12px; list-style: none; }
details.reasons summary::-webkit-details-marker { display: none; }
details.reasons ul { margin: 6px 0 2px; padding-left: 16px; color: var(--text-secondary); font-size: 12px; white-space: normal; }
.empty { color: var(--text-muted); padding: 18px 4px; text-align: center; }

/* ── İlerleme çubuğu (tarama süpürmesi) ──────────────── */
.progress { height: 6px; border-radius: 3px; background: var(--muted-wash); overflow: hidden; flex: 1; min-width: 120px; }
.progress > div { height: 100%; background: var(--series-1); border-radius: 3px; transition: width .3s; }

/* ── Modal ───────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 40; display: none;
  background: rgba(0,0,0,0.45); align-items: flex-start; justify-content: center;
  overflow-y: auto; padding: 40px 16px;
}
.overlay.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px 22px; width: 100%; max-width: 680px; box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
.modal h3 { margin: 0 0 14px; font-size: 16px; }

/* ── Giriş ekranı ────────────────────────────────────── */
#login-screen {
  position: fixed; inset: 0; z-index: 100; display: none;
  background: var(--page); align-items: center; justify-content: center;
}
#login-screen.open { display: flex; }
#login-screen .box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 30px 34px; width: 320px; text-align: center;
}
#login-screen h2 { margin: 0 0 4px; font-size: 18px; }
#login-screen p { color: var(--text-muted); font-size: 12.5px; margin: 0 0 16px; }
#login-screen input { max-width: none; margin-bottom: 12px; text-align: center; }
#login-screen .err { color: var(--critical); font-size: 12.5px; margin-top: 10px; min-height: 16px; }
