:root {
  --bg: #f6f7f9; --panel: #ffffff; --panel-2: #f1f3f6; --border: #e3e6eb; --text: #1b1f24; --muted: #667080;
  --accent: #c8102e; --accent-2: #8a0b20; --link: #1f5fbf;
  --ok: #1f9d55; --ok-bg: #e5f6ec; --fail: #d93025; --fail-bg: #fdecea; --warn: #c77700; --warn-bg: #fff4e0;
  --info: #2a6fdb; --info-bg: #e8f0fd; --skip: #9aa3ae; --none: #d6dbe1;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 10px;
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%23667080' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216; --panel: #171b21; --panel-2: #1e232b; --border: #2a313b; --text: #e6e9ee; --muted: #8b95a3;
    --link: #7fb0ff; --ok-bg: #12301f; --fail-bg: #3a1714; --warn-bg: #3a2a0d; --info-bg: #13253f; --none: #333b46;
    --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%238b95a3' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
pre { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; overflow: auto; max-height: 420px; margin: 6px 0; white-space: pre-wrap; word-break: break-word; }

.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
nav.side { background: var(--panel); border-right: 1px solid var(--border); padding: 16px 10px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 700; }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 13px; }
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }
nav.side a { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--text); margin-bottom: 2px; }
nav.side a:hover { background: var(--panel-2); text-decoration: none; }
nav.side a.active { background: var(--panel-2); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
nav.side .count { background: var(--fail); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 7px; font-weight: 600; }
nav.side .count.warn { background: var(--warn); }
nav.side .group { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; margin: 16px 10px 6px; }

main { padding: 22px 28px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card h2 { font-size: 15px; margin: 0 0 12px; }
.card h3 { font-size: 13.5px; margin: 14px 0 8px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .value { font-size: 26px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--muted); font-size: 12px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--panel-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-pass { background: var(--ok-bg); color: var(--ok); }
.b-fail, .b-error, .b-breaking { background: var(--fail-bg); color: var(--fail); }
.b-warning, .b-skipped { background: var(--warn-bg); color: var(--warn); }
.b-info, .b-manual, .b-detected { background: var(--info-bg); color: var(--info); }
.b-muted { background: var(--panel-2); color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--none); flex: none; }
.dot.pass { background: var(--ok); } .dot.fail, .dot.error { background: var(--fail); } .dot.skipped { background: var(--warn); }

/* Tablolar kartın içinde kalır; sığmazsa kart içinde yatay kayar (sayfa kaymaz) */
.table-wrap { overflow-x: auto; max-width: 100%; }
.matrix td.cell { min-width: 150px; cursor: pointer; }
.matrix td.cell:hover { background: var(--panel-2); }
/* İlk sütun (test adı) yatay kaydırmada solda sabit kalır */
.matrix th:first-child, .matrix td:first-child { position: sticky; left: 0; z-index: 1; background: var(--panel); min-width: 200px; max-width: 280px; box-shadow: 1px 0 0 var(--border); }
.matrix tr:hover td:first-child { background: var(--panel); }
.cellrow { display: flex; align-items: center; gap: 8px; }
/* Gruplu tablolar: alan başlık satırı (aç/kapat), özet sağında */
tr.grp td { background: var(--panel-2); padding: 7px 10px; }
.matrix tr.grp td:first-child { position: static; min-width: 0; max-width: none; box-shadow: none; background: var(--panel-2); }
.grp-head { position: sticky; left: 10px; display: inline-flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.grp-toggle { border: 0; background: none; padding: 2px 0; font: inherit; font-weight: 650; color: var(--text); display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.grp-toggle:focus-visible { outline: 2px solid var(--series-1, #2a78d6); outline-offset: 2px; border-radius: 4px; }
.grp-caret { width: 12px; color: var(--muted); }
.grp-count { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel); border: 1px solid var(--border); border-radius: 99px; padding: 0 7px; }
.grp-sum { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; }
.grp-meter .meter { min-width: 160px; }
.grp-tools { display: flex; gap: 6px; justify-content: flex-end; margin: -4px 0 6px; }
/* Son koşular çubuğu hücreyle daralır: çubuk en fazla 4px, en az 1.5px */
.spark { display: flex; gap: 1.5px; align-items: flex-end; height: 22px; margin-top: 6px; max-width: 220px; min-width: 0; }
.spark i { flex: 1 1 0; min-width: 1.5px; max-width: 4px; border-radius: 1px; background: var(--none); }
.spark i.pass { background: var(--ok); } .spark i.fail, .spark i.error { background: var(--fail); }
.muted { color: var(--muted); }
.small { font-size: 12px; }

button, .btn { font: inherit; border: 1px solid var(--border); background: var(--panel); color: var(--text); padding: 6px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
button:hover { background: var(--panel-2); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-2); }
button.danger { color: var(--fail); }
button.sm { padding: 3px 8px; font-size: 12px; }
button:disabled { opacity: .55; cursor: progress; }

input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 6px 9px; width: 100%; }
/* Seçiciler tarayıcının yerel (Safari'de parlak) görünümü yerine panelin stiliyle; ok işareti temaya göre */
select:not([multiple]) { -webkit-appearance: none; appearance: none; background-image: var(--chev); background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; padding-right: 30px; cursor: pointer; line-height: 1.4; }
select:hover, input:hover, textarea:hover { border-color: color-mix(in srgb, var(--border) 60%, var(--muted)); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid color-mix(in srgb, var(--link) 55%, transparent); outline-offset: 1px; border-color: var(--link); }
select:disabled { opacity: .6; cursor: not-allowed; }
textarea { font-family: var(--mono); font-size: 12.5px; min-height: 90px; resize: vertical; }
input[type=checkbox] { width: auto; }
label.f { display: block; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
label.f > input, label.f > select, label.f > textarea { margin-top: 3px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid4 { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { min-width: 0; }
.row > select, .row > button { flex: none; width: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--border); border-radius: 99px; padding: 3px 10px; cursor: pointer; font-size: 12.5px; user-select: none; }
.chip.on { background: var(--info-bg); border-color: var(--info); color: var(--info); }

.step { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; background: var(--panel); }
.step-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--panel-2); border-radius: var(--radius) var(--radius) 0 0; }
.step-head .idx { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.step-body { padding: 12px; }
.mini-table td, .mini-table th { padding: 4px 6px; border: 0; }
.mini-table input, .mini-table select { padding: 4px 7px; }

.diff-removed { color: var(--fail); } .diff-added { color: var(--ok); } .diff-type { color: var(--warn); }
.diff-list { font-family: var(--mono); font-size: 12.5px; margin: 6px 0; padding-left: 0; list-style: none; }
.diff-list li { padding: 2px 0; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.tl-day { font-weight: 700; margin: 16px 0 8px -22px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.tl-item { position: relative; margin-bottom: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; }
.tl-item::before { content: ''; position: absolute; left: -20px; top: 12px; width: 12px; height: 12px; border-radius: 50%; background: var(--none); border: 2px solid var(--bg); }
.tl-item.release::before { background: var(--info); } .tl-item.change::before { background: var(--warn); }
.tl-item.failed::before { background: var(--fail); } .tl-item.recovered::before { background: var(--ok); }
.tl-item .when { color: var(--muted); font-size: 12px; margin-right: 8px; font-variant-numeric: tabular-nums; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 12px; color: var(--muted); }
.tabs button.on { border-bottom-color: var(--accent); color: var(--text); font-weight: 600; }

.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.notice { border: 1px solid var(--border); border-left: 4px solid var(--info); background: var(--info-bg); padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.notice.warn { border-left-color: var(--warn); background: var(--warn-bg); }
#toast { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 10; }
#toast div { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 8px; box-shadow: 0 4px 18px rgba(0,0,0,.2); max-width: 420px; }
#toast div.err { background: var(--fail); color: #fff; }
details summary { cursor: pointer; color: var(--muted); font-size: 12.5px; margin: 6px 0; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  nav.side { position: static; height: auto; display: flex; flex-wrap: wrap; gap: 4px; }
  nav.side .group, .brand small { display: none; }
  main { padding: 16px; }
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
}

/* ---------- Grafikler & raporlar ---------- */
:root {
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a;
  --st-good: #0ca30c; --st-warning: #fab219; --st-critical: #d03b3b; --st-none: #e8e7e3;
  --grid: #ebeae6; --axis: #6b6a66;
}
@media (prefers-color-scheme: dark) {
  :root {
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
    --st-none: #2c2c2a; --grid: #2a2f37; --axis: #9aa3ae;
  }
}
.chart { position: relative; }
.chart-host { width: 100%; }
.chart-host svg { display: block; overflow: visible; }
.chart-grid { stroke: var(--grid); stroke-width: 1; }
.chart-ref { stroke: var(--axis); stroke-width: 1; opacity: .7; }
.chart-axis { fill: var(--axis); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-value { fill: var(--text); font-size: 12px; font-weight: 600; }
.chart-end { stroke: var(--panel); stroke-width: 2; }
.chart-cross { stroke: var(--axis); stroke-width: 1; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.chart-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.chart-key-line { width: 14px; height: 2px; border-radius: 2px; flex: none; }
.chart-tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; box-shadow: 0 6px 20px rgba(0,0,0,.12); font-size: 12px; min-width: 150px; z-index: 2; }
.chart-tip-title { color: var(--muted); margin-bottom: 4px; }
.chart-tip-row { display: flex; align-items: center; gap: 8px; }
.chart-tip-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-tip-name { color: var(--muted); }
.spark-svg { display: block; }

.barlist { display: flex; flex-direction: column; gap: 8px; }
.barlist-row { display: grid; grid-template-columns: minmax(96px, max-content) 1fr auto; gap: 10px; align-items: center; font-size: 13px; outline-offset: 2px; }
.barlist-track { min-width: 40px; }
.barlist-bar { height: 14px; border-radius: 0 4px 4px 0; }
.barlist-val { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; white-space: nowrap; }

.heat-grid { display: grid; gap: 2px; align-items: center; }
.heat-col { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: visible; }
.heat-row-label { font-size: 12.5px; padding-right: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.heat-cell { height: 22px; border-radius: 3px; background: var(--st-none); }
.heat-cell.st-good { background: var(--st-good); } .heat-cell.st-warning { background: var(--st-warning); } .heat-cell.st-critical { background: var(--st-critical); }
.heat-cell:hover, .heat-cell:focus { outline: 2px solid var(--text); outline-offset: 1px; }
.status-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 10px; }
.status-legend span { display: inline-flex; gap: 6px; align-items: center; }
.status-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filters .seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; max-width: 100%; }
.filters .seg button { border: 0; border-radius: 0; border-right: 1px solid var(--border); }
.filters .seg button:last-child { border-right: 0; }
.filters .seg button.on { background: var(--text); color: var(--bg); font-weight: 600; }
.filters select, .filters input { width: auto; }
.loading { opacity: .5; transition: opacity .15s; }
/* Yükleme iskeleti: gerçek düzeni taklit eden bloklar + kayan parıltı */
.sk { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--panel-2) 25%, var(--border) 37%, var(--panel-2) 63%); background-size: 400% 100%; animation: sk-shimmer 1.4s ease infinite; }
.sk + .sk { margin-top: 8px; }
@keyframes sk-shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

.hero-row { display: grid; grid-template-columns: minmax(260px, 1.2fr) 3fr; gap: 12px; margin-bottom: 16px; }
.hero { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.hero .label { color: var(--muted); font-size: 13px; }
.hero .big { font-size: 52px; font-weight: 700; line-height: 1.1; margin: 4px 0; letter-spacing: -.02em; }
.hero .sub { font-size: 13px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.kpis.tight { margin-bottom: 0; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpis.tight .value { font-size: 22px; font-variant-numeric: normal; }
.delta-up { color: var(--ok); font-weight: 600; } .delta-down { color: var(--fail); font-weight: 600; } .delta-flat { color: var(--muted); }
.st-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; white-space: nowrap; }
.st-pill.good { background: var(--ok-bg); color: var(--ok); } .st-pill.warning { background: var(--warn-bg); color: var(--warn); } .st-pill.critical { background: var(--fail-bg); color: var(--fail); }
.meter { display: flex; align-items: center; gap: 8px; min-width: 140px; }
.nowrap { white-space: nowrap; }
.clip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter-track { flex: 1; height: 8px; border-radius: 4px; background: var(--panel-2); position: relative; overflow: hidden; }
.meter-fill { position: absolute; inset: 0 auto 0 0; border-radius: 4px; }
.meter-target { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--text); opacity: .55; }
.grid-charts { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.grid-charts > .card { margin-bottom: 0; min-width: 0; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
.print-only { display: none; }

@media (max-width: 1100px) { .hero-row, .grid-charts { grid-template-columns: 1fr; } }
@media print {
  nav.side, .filters, .no-print, #toast { display: none !important; }
  .layout { display: block; }
  main { padding: 0; }
  body { background: #fff; color: #000; }
  .card, .hero, .kpi { break-inside: avoid; box-shadow: none; }
  .print-only { display: block; }
  .chart-tip { display: none; }
}

.linklike { border: 0; background: none; padding: 0; color: var(--link); cursor: pointer; font-size: inherit; }
.linklike:hover { text-decoration: underline; background: none; }
button.chip { font: inherit; font-size: 12.5px; color: inherit; }
button.chip.on { color: var(--info); }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* ---------- Giriş ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; padding: 24px; }
.login-card .brand { margin-bottom: 6px; }
.login-card input { width: 100%; }
.login-card button { width: 100%; padding: 9px 12px; }
.nav-user { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
