:root {
  --bg: #0b0b0e;
  --panel: #131317;
  --panel-2: #191a1f;
  --line: #26272e;
  --text: #ededef;
  --text-2: #a4a4ad;
  --text-3: #8a8a95;
  --accent: #f5c518;
  --accent-ink: #0a0a0b;
  --good: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --info: #60a5fa;
  --radius: 14px;
  --font-sans: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font-sans); }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Giriş ─────────────────────────────────────────────────────────────── */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 32px 28px; }
.login-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 22px; display: grid; place-items: center; margin-bottom: 18px; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-sub { color: var(--text-2); margin: 0 0 20px; }
.login-card input { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); margin-bottom: 12px; }
.login-card input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.login-card button { width: 100%; padding: 12px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer; }
.login-card button:disabled { opacity: .6; cursor: default; }
.login-err { color: var(--bad); font-size: 13px; min-height: 20px; margin: 10px 0 0; }

/* ── Yerleşim ──────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 16px; }
.brand .mark { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-weight: 700; display: grid; place-items: center; }
.brand b { font-size: 15px; }
.brand small { display: block; color: var(--text-3); font-size: 11px; }
.side-label { color: var(--text-3); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding: 10px 10px 4px; }
.app-btn { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 10px; border: 0; background: transparent; border-radius: 10px; cursor: pointer; color: var(--text-2); }
.app-btn:hover { background: var(--panel-2); color: var(--text); }
.app-btn.on { background: var(--panel-2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.ico { width: 28px; height: 28px; border-radius: 8px; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #0a0a0b; overflow: hidden; }
.ico img { width: 100%; height: 100%; object-fit: cover; }
.app-btn .nm { flex: 1; min-width: 0; }
.app-btn .nm b { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-btn .nm small { color: var(--text-3); font-size: 11px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.ok { background: var(--good); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.side-foot button { padding: 8px 10px; border: 1px solid var(--line); background: transparent; border-radius: 9px; cursor: pointer; color: var(--text-2); text-align: left; font-size: 13px; }
.side-foot button:hover { color: var(--text); border-color: var(--text-3); }

.main { padding: 22px 28px 60px; min-width: 0; }
.top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.top h1 { margin: 0; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.top h1 .ico { width: 32px; height: 32px; }
.top .tag { color: var(--text-3); font-size: 13px; }
.top .sp { flex: 1; }
.top .meta { color: var(--text-3); font-size: 12px; font-family: var(--font-mono); }
.btn { padding: 8px 12px; border: 1px solid var(--line); background: var(--panel); border-radius: 9px; cursor: pointer; color: var(--text); font-size: 13px; }
.btn:hover { border-color: var(--text-3); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { padding: 9px 12px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar select, .toolbar input { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); }

/* ── Bileşenler ─────────────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-bottom: 20px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px; min-width: 0; }
.kpi .v { font-size: 22px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .l { color: var(--text-2); font-size: 12px; margin-top: 2px; }
.kpi .s { color: var(--text-3); font-size: 11px; margin-top: 4px; }
.kpi.good .v { color: var(--good); } .kpi.warn .v { color: var(--warn); } .kpi.bad .v { color: var(--bad); }
.kpi .delta { font-size: 11px; margin-left: 6px; font-weight: 600; }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; min-width: 0; }
.card > h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card > h2 .sub { text-transform: none; letter-spacing: 0; color: var(--text-3); font-weight: 400; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.grid2 > .card { margin-bottom: 0; }
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; vertical-align: top; }
.tbl th { color: var(--text-2); font-weight: 600; background: var(--panel-2); position: sticky; top: 0; font-size: 12px; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.wrap { white-space: normal; }
.tbl td.mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }
.tbl tr.bad td { background: rgba(248,113,113,.06); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: var(--panel-2); color: var(--text-2); border: 1px solid var(--line); }
.pill.good { color: var(--good); border-color: rgba(74,222,128,.3); } .pill.bad { color: var(--bad); border-color: rgba(248,113,113,.3); } .pill.warn { color: var(--warn); border-color: rgba(251,191,36,.3); } .pill.info { color: var(--info); border-color: rgba(96,165,250,.3); }
.bars { width: 100%; height: auto; display: block; }
.bars rect.a { fill: var(--accent); } .bars rect.b { fill: var(--info); opacity: .85; }
.bars text { fill: var(--text-3); font-size: 12px; font-family: var(--font-mono); }
.lines path.l0 { stroke: var(--accent); } .lines path.l1 { stroke: var(--info); } .lines path.l2 { stroke: var(--bad); }
.lines path { fill: none; stroke-width: 2; stroke-linejoin: round; }
.lines text { fill: var(--text-3); font-size: 12px; font-family: var(--font-mono); }
.legend { display: flex; gap: 14px; color: var(--text-3); font-size: 12px; margin-top: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 90px; gap: 10px; align-items: center; margin: 5px 0; font-size: 13px; }
.hbar .lab { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.hbar .bar { height: 10px; background: var(--panel-2); border-radius: 6px; overflow: hidden; }
.hbar .bar i { display: block; height: 100%; background: var(--accent); }
.hbar .val { text-align: right; color: var(--text-3); font-family: var(--font-mono); font-size: 12px; }
.heat { display: grid; grid-template-columns: 34px repeat(24, 1fr); gap: 2px; font-size: 10px; color: var(--text-3); }
.heat .c { aspect-ratio: 1; border-radius: 3px; background: var(--panel-2); }
.heat .r { align-self: center; font-family: var(--font-mono); }
.heat .h { text-align: center; font-family: var(--font-mono); }
.funnel { list-style: none; margin: 0; padding: 0; }
.funnel li { display: grid; grid-template-columns: 180px 1fr 70px 60px; gap: 10px; align-items: center; margin: 6px 0; font-size: 13px; }
.funnel .bar { height: 14px; background: var(--panel-2); border-radius: 7px; overflow: hidden; }
.funnel .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #ffd95a); }
.funnel b { text-align: right; font-variant-numeric: tabular-nums; } .funnel small { color: var(--text-3); text-align: right; }
.empty { color: var(--text-3); padding: 14px; text-align: center; border: 1px dashed var(--line); border-radius: 10px; }
.err { color: var(--bad); background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.3); border-radius: 10px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.err .btn { margin-left: auto; }
.note { color: var(--text-3); font-size: 12px; margin: 8px 0 0; }
.skeleton { display: grid; gap: 10px; }
.skeleton i { display: block; height: 72px; border-radius: var(--radius); background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 50%, var(--panel) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { from { background-position: 200% 0 } to { background-position: -200% 0 } }
.frame { width: 100%; height: calc(100vh - 120px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.form { display: grid; gap: 10px; max-width: 420px; }
.form input, .form textarea, .form select { padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); width: 100%; }
.form label { display: grid; gap: 4px; font-size: 13px; color: var(--text-2); }
.msg { font-size: 13px; margin-top: 6px; min-height: 18px; }
.msg.good { color: var(--good); } .msg.bad { color: var(--bad); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sr-only { position: absolute; left: -9999px; }
.health-list { display: grid; gap: 8px; }
.health-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.health-row .nm { flex: 1; }
.health-row .ms { color: var(--text-3); font-family: var(--font-mono); font-size: 12px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px; }
  .side-foot { flex-direction: row; }
  .main { padding: 16px; }
  .funnel li { grid-template-columns: 120px 1fr 60px 50px; }
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Tablo araçları, sıralama ───────────────────────────────────────────── */
.tbl-box { display: grid; gap: 8px; }
.tbl-tools { display: flex; gap: 8px; align-items: center; }
.tbl-tools input[type="search"] { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); min-width: 160px; }
.tbl-tools .meta { margin-left: auto; }
.btn.mini { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--text); }
.tbl th.asc::after { content: " ▲"; color: var(--accent); font-size: 10px; }
.tbl th.desc::after { content: " ▼"; color: var(--accent); font-size: 10px; }
.tbl tfoot td { text-align: center; background: var(--panel-2); }
.tbl td a { color: var(--info); text-decoration: none; }
.tbl td a:hover { text-decoration: underline; }

/* ── Grafik ızgarası, sparkline ─────────────────────────────────────────── */
.bars line.grid, .lines line.grid { stroke: var(--line); stroke-width: 1; }
.bars line.guide, .lines line.guide { stroke: var(--text-3); stroke-dasharray: 3 3; pointer-events: none; }
.chart { position: relative; }
.chart-tip { position: absolute; pointer-events: none; transform: translate(12px, -50%); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; font-size: 12px; white-space: nowrap; box-shadow: 0 8px 24px rgba(0,0,0,.45); z-index: 5; }
.chart-tip.flip { transform: translate(calc(-100% - 12px), -50%); }
.lines circle.l0 { fill: var(--accent); } .lines circle.l1 { fill: var(--info); } .lines circle.l2 { fill: var(--bad); }
.spark { width: 100%; max-width: 140px; height: 26px; display: block; margin-top: 6px; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; }

/* ── Diyaloglar, toast ─────────────────────────────────────────────────── */
dialog.dlg { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 20px; width: min(440px, calc(100vw - 32px)); font: inherit; }
dialog.dlg::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(2px); }
dialog.dlg p { margin: 0 0 14px; }
dialog.dlg input, dialog.dlg textarea { width: 100%; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); }
dialog.palette { width: min(560px, calc(100vw - 32px)); padding: 10px; }
dialog.palette input { margin-bottom: 8px; }
.palette-list { display: grid; gap: 2px; max-height: 50vh; overflow: auto; }
.palette-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; color: var(--text-2); }
.palette-item.on, .palette-item:hover { background: var(--panel-2); color: var(--text); }
.palette-item .nm b { display: block; font-weight: 600; } .palette-item .nm small { color: var(--text-3); }
#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--good); border-radius: 10px; padding: 10px 14px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.4); transition: opacity .4s, transform .4s; }
.toast.bad { border-left-color: var(--bad); } .toast.warn { border-left-color: var(--warn); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ── Gömülü panel ──────────────────────────────────────────────────────── */
.frame-box { position: relative; }
.frame-overlay { position: absolute; inset: 0; background: var(--bg); border-radius: var(--radius); padding: 16px; }

/* ── Mobil menü ─────────────────────────────────────────────────────────── */
.menu-btn { display: none; }
@media (max-width: 860px) {
  .menu-btn { display: inline-block; }
  .side { display: none; }
  .side.open { display: flex; position: fixed; inset: 0; z-index: 40; overflow: auto; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; }
  .tabs button { white-space: nowrap; }
  .kpis { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .frame { height: calc(100vh - 140px); }
  /* Başlık: 1. satır menü + ad, 2. satır araçlar; süre/ms bilgisi en sona */
  .top { gap: 8px 10px; }
  .top h1 { font-size: 19px; }
  .top .tag { display: none; }
  .top > .row { flex-basis: 100%; gap: 6px; }
  .top > .row .meta { display: none; }
  .top .btn, .top select { padding: 7px 10px; font-size: 12px; }
  .main { padding: 14px 12px 40px; }
  .tbl th, .tbl td { max-width: 200px; }
  .tbl-tools { flex-wrap: wrap; }
}
@media print { .side, .top .row, .tabs, .tbl-tools { display: none !important; } .shell { grid-template-columns: 1fr; } body { background: #fff; color: #000; } .card, .kpi { border-color: #ccc; background: #fff; } }

/* ── Genel bakış ────────────────────────────────────────────────────────── */
.ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.ov-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; cursor: pointer; transition: border-color .15s; }
.ov-card:hover { border-color: var(--text-3); }
.ov-card > .row b { font-size: 15px; }
.ov-body { margin-top: 12px; }
.ov-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.ov-kpi b { display: block; font-size: 20px; font-weight: 700; } .ov-kpi small { color: var(--text-3); font-size: 11px; }
.ov-kpi.bad b { color: var(--bad); }
.note.bad { color: var(--bad); }

/* ── Momly: konuşmalar ──────────────────────────────────────────────────── */
.meta { color: var(--text-3); font-size: 12px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; padding: 4px 2px; }
.chk input { accent-color: var(--accent); width: 16px; height: 16px; }
.toolbar input[type="search"] { min-width: 240px; flex: 1 1 240px; max-width: 420px; }
.conv-list { display: flex; flex-direction: column; gap: 8px; }
.conv-item { display: block; width: 100%; text-align: left; background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid transparent; border-radius: 11px; padding: 11px 13px; cursor: pointer; color: var(--text); min-height: 44px; }
.conv-item:hover { border-color: var(--text-3); }
.conv-item.issue { border-left-color: var(--warn); }
.conv-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.conv-top .right { margin-left: auto; font-family: var(--font-mono); }
.conv-q { font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
.conv-a { color: var(--text-2); font-size: 13px; margin-top: 4px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
dialog.conv-dlg { width: min(820px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; overflow: hidden; }
dialog.conv-dlg[open] { display: flex; flex-direction: column; }
.conv-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.conv-head h2 { margin: 0; font-size: 16px; }
.conv-body { padding: 16px 18px 20px; overflow: auto; }
.thread { display: flex; flex-direction: column; gap: 14px; }
.turn { display: flex; flex-direction: column; gap: 8px; padding: 6px; border-radius: 14px; }
.turn.current { background: rgba(245,197,24,.06); outline: 1px solid rgba(245,197,24,.25); }
.bubble { max-width: 88%; padding: 10px 13px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.bubble.user { align-self: flex-end; background: #2a2410; border: 1px solid rgba(245,197,24,.3); border-bottom-right-radius: 4px; }
.bubble.momo { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble.momo.err { border-color: rgba(248,113,113,.4); }
.bubble .who { font-size: 11px; color: var(--text-3); margin-bottom: 4px; white-space: normal; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.bubble .answer.muted { color: var(--text-3); font-style: italic; }
.conv-sec { margin-top: 18px; }
.conv-sec h3 { font-size: 13px; color: var(--text-2); margin: 0 0 8px; font-weight: 600; }
.src-list { margin: 0; padding-left: 18px; font-size: 13px; }
.src-list li { margin: 3px 0; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; margin: 0; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; font-size: 12px; color: var(--text-2); }
@media (max-width: 640px) {
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .bubble { max-width: 100%; }
  .toolbar input[type="search"] { min-width: 0; flex-basis: 100%; max-width: none; }
}
