:root {
  --bg: #0b1220;
  --surface: #111a2e;
  --surface-2: #17223a;
  --border: #24314d;
  --text: #e6ebf5;
  --muted: #8d9bb8;
  --accent: #2dd4bf;
  --accent-ink: #04201d;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --radius: 12px;
  --series-1: #3987e5;
  --series-2: #d95926;
  --sidebar: 236px;
  --topbar: 60px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --border: #d9e0ec;
  --text: #142036;
  --muted: #5b6982;
  --accent: #0d9488;
  --accent-ink: #ffffff;
  --ok: #059669;
  --warn: #b45309;
  --err: #dc2626;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #eef2f8;
    --border: #d9e0ec;
    --text: #142036;
    --muted: #5b6982;
    --accent: #0d9488;
    --accent-ink: #ffffff;
    --ok: #059669;
    --warn: #b45309;
    --err: #dc2626;
    --series-1: #2a78d6;
    --series-2: #eb6834;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 28px; margin: 4px 0 6px; }
h2 { font-size: 18px; margin: 28px 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.accent { color: var(--accent); }
.error { color: var(--err); }
.eyebrow { color: var(--muted); font-size: 12px; letter-spacing: .08em; margin: 0; }
.spacer { flex: 1; }

/* üst çubuk */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar); z-index: 20;
  display: flex; align-items: center; gap: 14px; padding: 0 18px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 20px; font-weight: 600; }
.brand:hover { text-decoration: none; }
.brand b { color: var(--accent); }
.brand-lg { font-size: 26px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.balance {
  padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-2); font-variant-numeric: tabular-nums; font-weight: 600;
}
.balance.neg, .stat-value.neg { color: var(--err); }
.user { color: var(--muted); font-size: 14px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); cursor: pointer; font-size: 16px;
}
.menu-btn { display: none; }

/* yan menü */
.sidebar {
  position: fixed; top: var(--topbar); bottom: 0; left: 0; width: var(--sidebar); z-index: 10;
  overflow-y: auto; padding: 14px 10px 24px;
  background: var(--surface); border-right: 1px solid var(--border);
}
.nav-group { color: var(--muted); font-size: 11px; letter-spacing: .1em; margin: 18px 12px 6px; }
.nav-group:first-child { margin-top: 4px; }
.nav-link { display: block; padding: 8px 12px; border-radius: 8px; color: var(--text); }
.nav-link:hover { background: var(--surface-2); text-decoration: none; }
.nav-link.active { background: var(--surface-2); color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.tag {
  margin-left: 8px; padding: 1px 7px; border-radius: 999px; font-size: 11px; vertical-align: 1px;
  color: var(--accent); border: 1px solid var(--accent);
}
.crawl-links { white-space: nowrap; }

.content {
  margin: var(--topbar) 0 0 var(--sidebar); padding: 28px 32px 60px;
  max-width: calc(1280px + var(--sidebar)); outline: none;
}

/* kartlar */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 16px;
}
.cards .card { margin-bottom: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-title { margin: 0 0 12px; font-size: 17px; }
.card-head .card-title { margin: 0; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.module-card { display: flex; flex-direction: column; gap: 6px; color: var(--text); }
.module-card:hover { border-color: var(--accent); text-decoration: none; }

/* segment / sekme */
.seg { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.seg-btn {
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 14px; cursor: pointer;
}
.seg-btn:hover { text-decoration: none; border-color: var(--accent); }
.seg-btn.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.path { display: inline-block; font-size: 13px; color: var(--muted); }
.note { margin: 10px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-size: 14px; }

/* form */
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px 18px; margin-top: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.field-wide { grid-column: 1 / -1; }
.field-check { flex-direction: row; align-items: center; gap: 10px; align-self: end; padding-bottom: 10px; }
.req { color: var(--err); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; width: 100%;
}
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
textarea { resize: vertical; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

.btn {
  font: inherit; font-weight: 600; padding: 9px 18px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 12px; font-size: 13px; }

.code {
  margin: 14px 0 0; padding: 14px; border-radius: 8px; overflow: auto; max-height: 520px;
  background: var(--bg); border: 1px solid var(--border); font: 13px/1.5 ui-monospace, Consolas, monospace;
}

/* sonuç */
.meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.badge { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid currentColor; }
.badge-ok { color: var(--ok); }
.badge-err { color: var(--err); }
.badge-warn { color: var(--warn); }
.summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 12px; }
.summary:empty { display: none; }
.kv { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); overflow-wrap: anywhere; }
.table-wrap { overflow: auto; max-height: 640px; border: 1px solid var(--border); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { position: sticky; top: 0; background: var(--surface-2); font-weight: 600; white-space: nowrap; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.trunc { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }
.card > .table-wrap { border: 0; }

/* giriş */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 30px 28px;
}
.login-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }

/* projeler */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.project-card { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.project-name { font-size: 19px; font-weight: 700; color: var(--text); }
.score-row { display: flex; gap: 18px; align-items: center; }
.big-score { display: flex; flex-direction: column; align-items: center; min-width: 96px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.big-score strong { font-size: 34px; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--text); }
.score-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.lh-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lh-label { width: 70px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); font-size: 13px; }
.pill strong { font-variant-numeric: tabular-nums; }
.pill-label { color: var(--muted); }
.pill::before, .big-score::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.big-score::before { margin-bottom: 4px; }
.lvl-good::before { background: var(--ok); }
.lvl-warn::before { background: var(--warn); border-radius: 2px; }
.lvl-bad::before { background: var(--err); border-radius: 0; transform: rotate(45deg); }
.stat-value.lvl-good, .stat-value.lvl-warn, .stat-value.lvl-bad, .stat-value.lvl-none { display: flex; align-items: center; gap: 8px; }
.stat-value::before { display: none; }
.chg { font-size: 12px; font-weight: 600; white-space: nowrap; }
.chg-up { color: var(--ok); }
.chg-down { color: var(--err); }
.chg-flat { color: var(--muted); }
.issue-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.issue-list li { display: flex; gap: 10px; align-items: baseline; }
.issue-list li span:first-child { flex: 1; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head .actions { margin-top: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 16px 0; }
.tiles .card { margin: 0; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.inline-select { width: auto; max-width: 260px; padding: 5px 9px; font-size: 13px; }
.eyebrow a { color: var(--muted); }

/* grafikler */
.chart-wrap { position: relative; margin-top: 8px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .direct { font-size: 12px; fill: var(--text); }
.chart .crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .hit { fill: transparent; cursor: crosshair; }
.s1 .line, .spark.s1 .line { stroke: var(--series-1); }
.s1 .dot { fill: var(--series-1); }
.s2 .line { stroke: var(--series-2); }
.s2 .dot { fill: var(--series-2); }
.spark { width: 120px; height: 32px; }
.spark .line { fill: none; stroke-width: 2; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--text); margin-bottom: 4px; }
.key { display: inline-flex; align-items: center; gap: 6px; }
.key i, .tip-row i { display: inline-block; width: 14px; height: 2px; border-radius: 1px; }
.key.s1 i, .tip-row.s1 i { background: var(--series-1); }
.key.s2 i, .tip-row.s2 i { background: var(--series-2); }
.tip {
  position: absolute; top: 4px; transform: translateX(-50%); pointer-events: none; z-index: 2;
  padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25); font-size: 13px; min-width: 110px;
}
.tip-date { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 6px; }
.chart-empty { padding: 30px 0; text-align: center; }

@media (max-width: 860px) {
  .menu-btn { display: inline-block; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .nav-open .sidebar { transform: none; box-shadow: 0 10px 40px rgba(0, 0, 0, .4); }
  .content { margin-left: 0; padding: 20px 16px 48px; }
  .user, #demo-badge { display: none; }
  h1 { font-size: 23px; }
}
