:root {
  --bg: #0b0b0a;
  --bg2: #141412;
  --line: #26251f;
  --fg: #ece8dc;
  --mut: #8f8b80;
  --lime: #c6f24e;
  --lime-d: rgba(198, 242, 78, .14);
  --red: #ff7a59;
  --r: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body {
  font: 15px/1.45 "Inter Tight", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
}
button, input { font: inherit; color: inherit; }
.muted { color: var(--mut); font-size: 13px; }

/* marka */
.brand { display: flex; align-items: baseline; gap: 8px; }
.logo { font-weight: 700; letter-spacing: -.03em; font-size: 22px; background: var(--fg); color: var(--bg); padding: 2px 9px 4px; border-radius: 9px; line-height: 1.1; }
.brand-sub { color: var(--lime); font-weight: 600; letter-spacing: .02em; }

/* üst çubuk */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  max-width: 1200px; margin: 0 auto; padding: 14px 0 12px; background: linear-gradient(var(--bg) 80%, transparent); }
.conn { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--mut); }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--mut); }
.conn.ok i { background: var(--lime); box-shadow: 0 0 0 0 rgba(198, 242, 78, .6); animation: pulse 2s infinite; }
.conn.ok span { color: var(--fg); }
.conn.bad i { background: var(--red); }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(198, 242, 78, 0); } 100% { box-shadow: 0 0 0 0 rgba(198, 242, 78, 0); } }
.tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.seg button { background: none; border: 0; padding: 5px 11px; border-radius: 999px; cursor: pointer; color: var(--mut); font-size: 13px; font-weight: 600; }
.seg button.on { background: var(--lime); color: #111; }
.logout { margin: 0; }
.logout button { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 13px; }
.logout button:hover { border-color: var(--fg); }

main { max-width: 1200px; margin: 0 auto; display: grid; gap: 14px; }

/* sayaçlar */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.kpi { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 2px; min-width: 0; }
.kpi b { font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: -.02em; overflow-wrap: anywhere; }
.kpi.hot { border-color: rgba(198, 242, 78, .45); background: linear-gradient(160deg, var(--lime-d), var(--bg2) 60%); }
.kpi.hot b { color: var(--lime); }
.k-lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--mut); font-weight: 600; }
.k-sub { font-size: 12.5px; color: var(--mut); }
.kpi b.flash { animation: flash .8s; }
@keyframes flash { from { color: var(--lime); } }

/* kartlar */
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; min-width: 0; }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
h2 { margin: 0; font-size: 15px; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; }

/* grafik */
.chart { height: 200px; position: relative; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .ax { fill: var(--mut); font-size: 10px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .bar { fill: rgba(236, 232, 220, .22); }
.chart .bar.now { fill: rgba(236, 232, 220, .4); }
.chart .ln { fill: none; stroke: var(--lime); stroke-width: 2; stroke-linejoin: round; }
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--mut); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 5px; vertical-align: -1px; border-radius: 2px; }
.lg-bar::before { background: rgba(236, 232, 220, .35); }
.lg-line::before { background: var(--lime); height: 3px !important; vertical-align: 3px !important; }

/* tablolar */
.tbl-wrap { overflow-x: auto; margin: 0 -4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--mut); font-weight: 600; padding: 6px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 8px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .n { text-align: right; white-space: nowrap; }
.tbl .app-name { font-weight: 600; overflow-wrap: anywhere; }
.tbl .pkg { display: block; font-size: 11.5px; color: var(--mut); overflow-wrap: anywhere; }
.tbl .act { color: var(--lime); font-weight: 700; }
.tbl .zero { color: var(--mut); }
.tbl .flag { font-size: 18px; margin-right: 6px; vertical-align: -2px; }
.tbl .cur { color: var(--mut); font-size: 11.5px; margin-left: 2px; }
.empty { color: var(--mut); text-align: center; padding: 14px 0 !important; }

/* akış */
.feed { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; font-size: 13.5px; }
.feed li { display: grid; grid-template-columns: 62px 22px 1fr auto; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed li.empty { display: block; }
.feed li.new { animation: newrow 1.4s; }
@keyframes newrow { from { background: var(--lime-d); } }
.feed time { color: var(--mut); font-size: 12px; }
.feed .what { overflow-wrap: anywhere; }
.feed .val { color: var(--lime); font-weight: 600; white-space: nowrap; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); margin-right: 6px; }
.tag.ad_paid, .tag.ad_imp { border-color: rgba(198, 242, 78, .5); color: var(--lime); }
.tag.ad_fail { border-color: rgba(255, 122, 89, .5); color: var(--red); }
.tag.start { background: var(--fg); color: var(--bg); border-color: var(--fg); }

.note { color: var(--mut); font-size: 12.5px; text-align: center; margin: 4px auto 0; max-width: 640px; }

/* giriş */
body.login { display: grid; place-items: center; min-height: 100vh; }
.login-box { width: 100%; max-width: 360px; background: var(--bg2); border: 1px solid var(--line); border-radius: 20px; padding: 28px 24px; }
.login-box h1 { font-size: 26px; margin: 18px 0 14px; letter-spacing: -.02em; }
.login-box form { display: grid; gap: 12px; }
.login-box label { display: grid; gap: 5px; font-size: 13px; color: var(--mut); }
.login-box input { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; font-size: 16px; }
.login-box input:focus { outline: 2px solid var(--lime); outline-offset: 1px; border-color: transparent; }
.login-box button { margin-top: 6px; background: var(--lime); color: #111; border: 0; border-radius: 10px; padding: 12px; font-weight: 700; cursor: pointer; font-size: 16px; }
.err { background: rgba(255, 122, 89, .12); border: 1px solid rgba(255, 122, 89, .4); color: #ffb39f; border-radius: 10px; padding: 9px 12px; font-size: 14px; margin: 0 0 12px; }
.fine { font-size: 12px; color: var(--mut); margin: 18px 0 0; text-align: center; }

@media (max-width: 900px) {
  .grid2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
  body { font-size: 14px; }
  .kpi { padding: 12px; }
  .kpi b { font-size: 27px; }
  .chart { height: 170px; }
  .conn span { display: none; }
  .tbl { font-size: 13px; }
}

/* ---- raporlar ---- */
.nav { display: flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.nav a { padding: 5px 13px; border-radius: 999px; color: var(--mut); text-decoration: none; font-size: 13px; font-weight: 600; }
.nav a:hover { color: var(--fg); }
.nav a.on { background: var(--lime); color: #111; }

.rp-main { align-content: start; }
body:not([data-mode="list"]) .rp-tools, body:not([data-mode="list"]) #rp-list { display: none; }
.rp-tools { display: flex; align-items: center; gap: 12px; }
.rp-tools input { flex: 1; min-width: 0; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; font-size: 16px; }
.rp-tools input:focus { outline: 2px solid var(--lime); outline-offset: 1px; border-color: transparent; }
.rp-tools .muted { white-space: nowrap; }
.rp-group { margin-bottom: 18px; }
.rp-group h2 { margin: 6px 0 10px; font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--mut); }
.rp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; }
.rp-card { display: grid; gap: 4px; align-content: start; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 13px 15px; color: var(--fg); text-decoration: none; min-width: 0; }
.rp-card:hover, .rp-card:focus-visible { border-color: rgba(198, 242, 78, .55); outline: 0; }
.rp-card-top { display: flex; justify-content: space-between; align-items: center; }
.rp-title { font-size: 16px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.rp-type { margin: 0; }
.rp-empty { color: var(--mut); text-align: center; padding: 28px 0; }

.rp-head { display: grid; gap: 4px; margin-bottom: 12px; }
.rp-head h1 { margin: 2px 0 0; font-size: 24px; line-height: 1.25; letter-spacing: -.02em; overflow-wrap: anywhere; }
.rp-head p { margin: 0; overflow-wrap: anywhere; }
.rp-back, .rp-actions a { color: var(--lime); text-decoration: none; font-size: 14px; font-weight: 600; }
.rp-back:hover, .rp-actions a:hover { text-decoration: underline; }
.rp-frame { width: 100%; height: calc(100vh - 210px); height: calc(100dvh - 210px); min-height: 480px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }

/* genel bakış: dünya haritası */
.gn-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.gn-info { min-height: 44px; padding: 6px 0 8px; font-size: 15px; overflow-wrap: anywhere; }
.gn-info .val { color: var(--lime); }
.gn-map svg { width: 100%; height: auto; display: block; }
.gn-map path { stroke: #0b0b0a; stroke-width: .6; cursor: pointer; }
.gn-map path:hover { stroke: var(--fg); }
.gn-map path.sel { stroke: var(--lime); stroke-width: 1.6; }
.gn-legend { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--mut); margin-top: 6px; }
.gn-grad { flex: 1; max-width: 240px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #26251f, #c6f24e); }
.gn-nodata { background: rgba(255, 122, 89, .1); border: 1px solid rgba(255, 122, 89, .4); color: #ffb39f; border-radius: 10px; padding: 9px 12px; font-size: 14px; margin-bottom: 8px; }
.gn-nodata[hidden] { display: none; }
.gn-status { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.gn-status .err-note { color: #ffb39f; }
.gn-map-card .note { margin-top: 10px; }

/* Markdown gövdesi */
.md { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; overflow-wrap: anywhere; line-height: 1.6; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { line-height: 1.25; margin: 1.5em 0 .5em; letter-spacing: -.01em; }
.md h1 { font-size: 24px; }
.md h2 { font-size: 20px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.md h3 { font-size: 17px; }
.md h4, .md h5, .md h6 { font-size: 15px; }
.md p, .md ul, .md ol, .md pre, .md blockquote, .md .md-table { margin: 0 0 12px; }
.md ul, .md ol { padding-left: 1.4em; }
.md li { margin: 3px 0; }
.md li.task { list-style: none; margin-left: -1.2em; }
.md a { color: var(--lime); }
.md code { background: rgba(236, 232, 220, .1); border-radius: 6px; padding: 1px 6px; font: 13px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; }
.md pre { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow-x: auto; }
.md pre code { background: none; padding: 0; white-space: pre; overflow-wrap: normal; }
.md blockquote { border-left: 3px solid var(--lime); background: var(--lime-d); border-radius: 0 10px 10px 0; padding: 8px 14px; color: var(--fg); }
.md blockquote > :last-child { margin-bottom: 0; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.md .md-table { overflow-x: auto; }
.md table { border-collapse: collapse; font-size: 14px; min-width: 100%; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.md th { background: rgba(236, 232, 220, .06); white-space: nowrap; }
.md .al-r { text-align: right; }
.md .al-c { text-align: center; }
.md .md-img { color: var(--mut); font-style: italic; }

@media (max-width: 420px) {
  .md { padding: 14px 13px; }
  .rp-head h1 { font-size: 21px; }
  .rp-frame { height: calc(100vh - 230px); height: calc(100dvh - 230px); min-height: 420px; }
  .nav a { padding: 5px 11px; }
}
