/* Güvenlik özeti */

/* Komuta paneli: durum, göstergeler ve canlı akış tek koyu yüzeyde. data-theme="dark" değişkenleri bu alan için değiştirir. */
.deck {
  --panel: #101a2b;
  --panel2: #142136;
  --line: #1f2d43;
  --line-strong: #30415b;
  margin: 0 calc(var(--sp-5) * -1) var(--sp-4);
  padding: var(--sp-4) var(--sp-5) 0;
  background: var(--nav-bg);
  color: var(--text);
  border-bottom: 1px solid var(--nav-line);
}
.main > .deck:first-child { margin-top: calc(var(--sp-5) * -1); }
.deck-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3) var(--sp-5); }
.deck-state { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.deck-ico { display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; flex: 0 0 auto; border-radius: var(--radius); background: var(--ok-soft); color: var(--ok); }
.deck-state.is-warn .deck-ico { background: var(--warn-soft); color: var(--warn); }
.deck-state.is-crit .deck-ico { background: var(--bad-soft); color: var(--bad); }
.deck-ico svg { width: 20px; height: 20px; }
.deck-kicker { font-size: var(--fs-xs); font-weight: 500; color: var(--muted); letter-spacing: 0; }
.deck-verdict { margin: 0; font-size: 1.375rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.015em; }
.deck-controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.deck .mail-seg { background: transparent; }
.deck-meta { display: flex; flex-wrap: wrap; gap: 0.125rem var(--sp-4); margin-top: 0.625rem; font-size: var(--fs-xs); color: var(--muted); }
.deck-meta b { color: var(--text); font-weight: 500; }
.deck-queue { display: flex; flex-wrap: wrap; gap: 0.25rem 0.375rem; list-style: none; margin: 0.625rem 0 0; padding: 0; }
.posture-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
  font-size: var(--fs-xs);
  font-weight: 500;
  white-space: nowrap;
}
.posture-item:hover { background: var(--panel2); text-decoration: none; }
.posture-item i { width: 7px; height: 7px; border-radius: 2px; background: var(--info); }
.posture-item.tone-warn i { background: var(--warn); }
.posture-item.tone-crit i { background: var(--bad); }

/* Göstergeler */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-top: var(--sp-4);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.kpi {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0.75rem var(--sp-4) 0.625rem;
  border-inline-start: 1px solid var(--line);
  color: inherit;
}
.kpi:first-child { border-inline-start: 0; padding-inline-start: 0; }
.kpi:hover { background: var(--panel); text-decoration: none; }
.kpi-label { display: flex; align-items: center; gap: 0.3125rem; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kdot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 2px; }
.sw-ok { background: var(--ok); }
.kpi-row { display: flex; align-items: baseline; gap: 0.5rem; margin-top: 0.25rem; min-width: 0; }
.kpi-value { font-size: var(--fs-kpi); font-weight: 500; letter-spacing: -0.025em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-delta { font-size: var(--fs-2xs); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.kpi-sub { margin-top: 0.125rem; font-size: var(--fs-2xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spark { display: block; width: 100%; height: 22px; margin-top: 0.375rem; fill: none; stroke: var(--line-strong); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.kpi:hover .spark { stroke: var(--accent); }
.spark-base { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
@media (max-width: 1200px) {
  .kpi-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(3n + 1) { border-inline-start: 0; padding-inline-start: 0; }
  .kpi:nth-child(n + 4) { border-top: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .deck { margin-inline-start: calc(var(--sp-3) * -1); margin-inline-end: calc(var(--sp-3) * -1); padding: var(--sp-3) var(--sp-3) 0; }
  .main > .deck:first-child { margin-top: calc(var(--sp-4) * -1); }
  .deck-verdict { font-size: 1.125rem; }
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { border-inline-start: 1px solid var(--line) !important; padding: 0.625rem 0.75rem; }
  .kpi:nth-child(2n) { padding-inline-start: 0.75rem; }
  .kpi:nth-child(2n + 1) { border-inline-start: 0 !important; padding-inline-start: 0; }
  .kpi:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .kpi-value { font-size: 1.375rem; }
  .kpi-sub { white-space: normal; }
}
@media (min-width: 641px) and (max-width: 960px) {
  .deck { margin-inline-start: calc(var(--sp-3) * -1); margin-inline-end: calc(var(--sp-3) * -1); padding-inline-start: var(--sp-3); padding-inline-end: var(--sp-3); }
  .main > .deck:first-child { margin-top: calc(var(--sp-4) * -1); }
}

/* Izgara */
.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--sp-4); margin-bottom: var(--sp-4); align-items: start; }
.dash-grid > .card { margin-bottom: 0; }
.dash-grid > .dash-threats { align-self: stretch; }
.dash-side { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.dash-side .card { margin: 0; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }

/* Trafik grafiği: yığılmış sütun, tek eksen */
.legend { display: flex; flex-wrap: wrap; gap: 0.25rem 0.875rem; list-style: none; margin: 0; padding: 0; font-size: var(--fs-xs); color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 0.3125rem; white-space: nowrap; }
.legend b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.legend i { width: 9px; height: 9px; border-radius: 2px; }
.sw-clean { background: var(--series-clean); }
.sw-hold { background: var(--series-hold); }
.sw-block { background: var(--series-block); }
.sw-fail { background: var(--series-fail); }

.tchart { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 0.5rem; height: 15rem; }
.tchart-y { display: flex; flex-direction: column; justify-content: space-between; height: calc(100% - 1.375rem); font-size: var(--fs-2xs); color: var(--muted); text-align: end; font-variant-numeric: tabular-nums; }
.tchart-y span { line-height: 0; }
.tchart-plot { position: relative; min-width: 0; height: 100%; }
.tchart-grid { position: absolute; inset-inline-start: 0; inset-inline-end: 0; top: 0; bottom: 1.375rem; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.tchart-grid i { display: block; height: 1px; background: var(--grid); }
.tchart-cols { position: absolute; inset: 0; display: flex; align-items: stretch; }
.tcol { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: 1.375rem; color: inherit; }
.tcol:hover { text-decoration: none; background: var(--accent-soft); border-radius: 4px 4px 0 0; }
.tcol-stack { display: flex; flex-direction: column; gap: 2px; width: min(62%, 24px); margin: 0 auto; }
.tcol-stack i { display: block; min-height: 1px; }
.tcol-stack i:first-child { border-radius: 3px 3px 0 0; }
.tcol-x { position: absolute; inset-inline-start: 50%; bottom: 0.25rem; transform: translateX(-50%); font-size: var(--fs-2xs); color: var(--muted); white-space: nowrap; }
.tcol-x.is-hidden { display: none; }
.tcol-tip {
  position: absolute;
  z-index: 5;
  bottom: calc(100% - 3rem);
  inset-inline-start: 50%;
  display: none;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 11rem;
  padding: 0.5rem 0.625rem;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-size: var(--fs-xs);
  pointer-events: none;
}
.tcol.tip-left .tcol-tip { inset-inline-start: auto; inset-inline-end: 50%; }
.tcol:hover .tcol-tip, .tcol:focus-visible .tcol-tip { display: flex; }
.tcol-tip b { font-weight: 600; margin-bottom: 0.125rem; }
.tcol-tip span { display: flex; align-items: center; gap: 0.375rem; color: var(--muted); }
.tcol-tip span i { width: 8px; height: 8px; border-radius: 2px; }
.tcol-tip em { margin-inline-start: auto; font-style: normal; color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.dash-tableview { margin-top: var(--sp-2); font-size: var(--fs-xs); }
.dash-tableview summary { color: var(--muted); }
.dash-tableview-scroll { margin-top: var(--sp-2); max-height: 15rem; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.dash-tableview table { font-size: var(--fs-xs); }
.dash-tableview td { padding: 0.25rem 0.625rem; }

/* Tespit dağılımı */
.hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.hbars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.25rem 0.5rem; font-size: var(--fs-sm); }
.hbars-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbars-n { font-weight: 600; font-variant-numeric: tabular-nums; }
.hbars-track { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--neutral-soft); overflow: hidden; }
.hbars-track i { display: block; height: 100%; min-width: 1px; background: var(--series-clean); border-radius: 0 3px 3px 0; }

/* Olay listesi */
.dash-events { overflow: hidden; }
.dash-events-scroll { overflow-x: auto; }
.dash-events .ml-table { min-width: 42rem; }
.dash-events .ml-table th { position: static; }

/* Sistem durumu */
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.375rem var(--sp-3); margin: 0; font-size: var(--fs-sm); }
.kv dt { color: var(--muted); white-space: nowrap; }
.kv dd { margin: 0; text-align: end; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.kv-title { margin: var(--sp-3) 0 var(--sp-2); padding-top: var(--sp-3); border-top: 1px solid var(--line); font-size: var(--fs-xs); font-weight: 500; color: var(--muted); }
.layers { display: flex; flex-wrap: wrap; gap: 0.25rem; list-style: none; margin: 0; padding: 0; }
.layers li {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding-block: 0; padding-inline: 0.25rem 0.375rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: var(--fs-2xs);
  font-weight: 500;
  line-height: 1.25rem;
}
.layers svg { width: 12px; height: 12px; }
.layers .is-on svg { color: var(--ok); }
.layers .is-off { color: var(--faint); }
.usage { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.625rem; }
.usage li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.25rem 0.5rem; font-size: var(--fs-sm); }
.usage-label { color: var(--muted); }
.usage-val { font-weight: 500; font-variant-numeric: tabular-nums; }
.usage .bar { grid-column: 1 / -1; }

/* YZ yüzeyi: sistem verisinden görsel olarak ayrı */
.ai-surface { border-color: var(--ai-line); background: linear-gradient(var(--ai-soft), var(--ai-soft)) top / 100% 3px no-repeat, var(--panel); }
.ai-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.1875rem;
  color: var(--ai);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.ai-tag svg { width: 12px; height: 12px; }
.ai-text { font-size: var(--fs-sm); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-meta { margin-top: var(--sp-2); font-size: var(--fs-2xs); color: var(--muted); }
.ai-note { margin-top: 0.25rem; font-size: var(--fs-2xs); color: var(--muted); }
.ai-loading { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.25rem 0; }
.ai-loading .skeleton:nth-child(2) { width: 88%; }
.ai-loading .skeleton:nth-child(3) { width: 64%; }

/* Canlı posta akışı */
.flow { padding: 0; margin: 0; overflow: hidden; background: transparent; border: 0; border-radius: 0; }
.flow-head { padding: 0.75rem 0; margin: 0; border-bottom: 1px solid var(--line); }
.flow-head-right { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); font-size: var(--fs-xs); color: var(--muted); }
.flow-stat b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.flow-live { display: inline-flex; align-items: center; gap: 0.375rem; font-weight: 500; }
.flow-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.flow-live.is-busy { color: var(--text); }
.flow-live.is-busy i { animation: sg-pulse 0.9s ease-in-out infinite; }
.flow-live.is-paused i { background: var(--faint); }
.flow-live.is-off { color: var(--bad); }
.flow-live.is-off i { background: var(--bad); }

.flow-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 23rem); min-width: 0; }
.flow-map { position: relative; padding: 0.75rem var(--sp-5) var(--sp-4) 0; min-width: 0; }
.flow-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.flow-now { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.5rem; min-height: 2.5rem; font-size: var(--fs-sm); margin-bottom: 0.625rem; }
.flow-head h2 { font-size: var(--fs-md); }
.flow-head .card-sub { display: none; }
.flow-now strong { font-weight: 600; max-width: 22rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-now-dir { font-size: var(--fs-2xs); font-weight: 600; color: var(--muted); }
.flow-now-rcpt { font-size: var(--fs-xs); color: var(--muted); }
.flow-now-subj { flex: 1 0 100%; font-size: var(--fs-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 11.5rem; gap: 3.5rem; align-items: stretch; }
.flow-stages { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-2); list-style: none; margin: 0; padding: 0; }
.flow-stage { position: relative; display: flex; flex-direction: column; align-items: flex-start; min-width: 0; padding-top: 1.625rem; }
.flow-node {
  position: absolute;
  top: 0.3125rem;
  inset-inline-start: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--panel);
  border: 2px solid var(--line-strong);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.flow-stage.is-active .flow-node { border-color: var(--accent); background: var(--accent); }
.flow-stage[data-result="ok"] .flow-node { border-color: var(--ok); }
.flow-stage[data-result="warn"] .flow-node { border-color: var(--warn); }
.flow-stage[data-result="bad"] .flow-node { border-color: var(--bad); }
.flow-stage strong { display: flex; align-items: center; gap: 0.3125rem; font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.flow-stage strong svg { width: 13px; height: 13px; color: var(--muted); flex: 0 0 auto; }
.flow-detail { display: flex; flex-wrap: wrap; gap: 0.1875rem; margin-top: 0.3125rem; min-height: 2.625rem; align-content: flex-start; font-size: var(--fs-2xs); padding-inline-end: 0.5rem; min-width: 0; }
.flow-hint { color: var(--faint); }
.flow-tag { display: inline-flex; padding: 0 0.3125rem; border-radius: 3px; background: var(--panel); line-height: 1.0625rem; font-weight: 500; color: var(--muted); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.flow-tag.tone-ok { color: var(--ok); background: var(--ok-soft); }
.flow-tag.tone-warn { color: var(--warn); background: var(--warn-soft); }
.flow-tag.tone-bad { color: var(--bad); background: var(--bad-soft); }
.flow-text { color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.flow-outs { position: relative; display: flex; flex-direction: column; gap: 0.3125rem; }
.flow-outs-title { font-size: var(--fs-2xs); color: var(--muted); }
.flow-out {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: 0.25rem 0.5rem;
  background: var(--panel);
  border-inline-start: 3px solid var(--ok);
  border-radius: 3px;
  color: inherit;
  font-size: var(--fs-xs);
  transition: background 0.2s ease;
}
.flow-out:hover { background: var(--panel2); text-decoration: none; }
.flow-out b { font-family: var(--font-mono); font-weight: 500; font-size: var(--fs-xs); }
.flow-out.tone-warn { border-inline-start-color: var(--series-hold); }
.flow-out.tone-bad { border-inline-start-color: var(--series-block); }
.flow-out.tone-fail { border-inline-start-color: var(--series-fail); }
.flow-out.is-hit { background: var(--accent-soft); }

/* SVG: hat ve hareket eden posta */
.flow-rail { fill: none; stroke: var(--line-strong); stroke-width: 1.5; }
.flow-trail { fill: none; stroke-width: 2.5; stroke-linecap: round; }
.flow-dot { stroke: var(--panel); stroke-width: 2; }
.flow-c-scan { stroke: var(--series-clean); }
.flow-c-clean { stroke: var(--ok); }
.flow-c-hold { stroke: var(--series-hold); }
.flow-c-block { stroke: var(--series-block); }
.flow-c-fail { stroke: var(--series-fail); }
.flow-f-scan { fill: var(--series-clean); }
.flow-f-clean { fill: var(--ok); }
.flow-f-hold { fill: var(--series-hold); }
.flow-f-block { fill: var(--series-block); }
.flow-f-fail { fill: var(--series-fail); }

/* Olay günlüğü */
.flow-log { display: flex; flex-direction: column; min-width: 0; border-inline-start: 1px solid var(--line); }
.flow-log-head { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0.75rem; font-size: var(--fs-xs); border-bottom: 1px solid var(--line); }
.flow-log-head strong { font-weight: 600; }
.flow-log-list { flex: 1 1 0; min-height: 11.5rem; max-height: 14rem; overflow-y: auto; list-style: none; margin: 0; padding: 0; }
.flow-log-empty { padding: var(--sp-4); text-align: center; font-size: var(--fs-xs); color: var(--muted); }
.flow-ev { border-bottom: 1px solid var(--line); }
.flow-ev.is-new { animation: flow-in 0.4s ease; }
@keyframes flow-in { from { background: var(--accent-soft); } to { background: transparent; } }
.flow-ev a { display: grid; grid-template-columns: 3.25rem minmax(0, 1fr) auto; gap: 0 0.5rem; align-items: center; padding: 0.3125rem 0.75rem; color: inherit; font-size: var(--fs-xs); }
.flow-ev a:hover { background: var(--panel2); text-decoration: none; }
.flow-ev-time { color: var(--muted); font-size: var(--fs-2xs); font-variant-numeric: tabular-nums; }
.flow-ev-main { min-width: 0; }
.flow-ev-sender { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-ev-subj { display: block; color: var(--muted); font-size: var(--fs-2xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-ev-verdict { display: inline-flex; align-items: center; gap: 0.25rem; font-size: var(--fs-2xs); font-weight: 500; white-space: nowrap; }
.flow-ev-verdict i { width: 7px; height: 7px; border-radius: 2px; background: var(--faint); }
.flow-ev-verdict.b-clean i { background: var(--ok); }
.flow-ev-verdict.b-hold i { background: var(--series-hold); }
.flow-ev-verdict.b-block i { background: var(--series-block); }
.flow-ev-verdict.b-fail i { background: var(--series-fail); }

@media (max-width: 1280px) {
  .flow-body { grid-template-columns: minmax(0, 1fr); }
  .flow-map { padding-inline-end: 0; }
  .flow-log { border-inline-start: 0; border-top: 1px solid var(--line); margin: 0 calc(var(--sp-5) * -1); }
  .flow-log-list { flex: 0 0 auto; }
}
@media (max-width: 760px) {
  .flow-svg { display: none; }
  .flow-grid { grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); }
  .flow-stages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow-stage strong { white-space: normal; }
  .flow-outs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow-outs-title { grid-column: 1 / -1; }
}

/* Komuta panelinin altı: içerik sakin ve seyrek */
.dash-grid .card { box-shadow: none; }
.dash-traffic .tchart { height: 13.5rem; }
