:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-2: #fafbfc;
  --border: #e2e5ea;
  --border-strong: #cfd4dc;
  --text: #1c2230;
  --muted: #667085;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --accent-weak: #e9f0fe;
  --ok: #15803d;
  --ok-weak: #e7f6ec;
  --warn: #b45309;
  --warn-weak: #fdf3e2;
  --err: #c62828;
  --err-weak: #fdecec;
  --code-bg: #f3f4f7;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --mono: ui-monospace, "Cascadia Code", Consolas, "SFMono-Regular", Menlo, monospace;
  --radius: 8px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --panel: #171a21;
    --panel-2: #1b1f27;
    --border: #2a303b;
    --border-strong: #3a4250;
    --text: #e6e8ec;
    --muted: #9aa3b2;
    --accent: #5b8cff;
    --accent-text: #0b1020;
    --accent-weak: #1d2842;
    --ok: #4ade80;
    --ok-weak: #13281b;
    --warn: #fbbf24;
    --warn-weak: #2c2412;
    --err: #f87171;
    --err-weak: #2e1617;
    --code-bg: #11141a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
code, .mono { font-family: var(--mono); font-size: 12px; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- üst bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: 17px; flex: none;
}
.brand-title { font-weight: 650; font-size: 14px; }
.brand-sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.dirty { color: var(--warn); font-size: 12px; font-weight: 600; }

/* ---------------------------------------------------------------- iskelet */
.shell { display: grid; grid-template-columns: 196px minmax(0, 1fr); min-height: calc(100vh - 54px); }
.nav {
  border-right: 1px solid var(--border); background: var(--panel); padding: 12px 8px;
  display: flex; flex-direction: column; gap: 2px; position: sticky; top: 54px; height: calc(100vh - 54px);
}
.nav button {
  text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 550;
}
.nav button:hover { background: var(--panel-2); color: var(--text); }
.nav button.active { background: var(--accent-weak); color: var(--accent); }
.nav .ico { width: 18px; text-align: center; }
.nav .foot { margin-top: auto; padding: 8px 10px; font-size: 11px; color: var(--muted); }
.main { padding: 20px; min-width: 0; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 6px; }
  .nav .foot { display: none; }
  .nav button { white-space: nowrap; }
  .main { padding: 14px 16px; }
  .brand-sub { display: none; }
}

/* ---------------------------------------------------------------- yapı taşları */
h1 { font-size: 18px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 0; }
h3 { font-size: 13px; margin: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.lead { color: var(--muted); margin: 0; max-width: 820px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row-flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.card + .card { margin-top: 12px; }
.card-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.card-head .title { font-weight: 650; }
.card-body { padding: 14px; }
.card.flat { box-shadow: none; }
.card.sub { background: var(--panel-2); box-shadow: none; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px 14px; }
.form-grid.wide { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
.f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.f > label { font-size: 12px; font-weight: 600; color: var(--muted); }
.f .hint { font-size: 11.5px; color: var(--muted); }
.f.full { grid-column: 1 / -1; }

input[type=text], input[type=password], input[type=number], input:not([type]), select, textarea {
  width: 100%; min-width: 0; height: 30px; padding: 4px 8px; border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--panel); outline: none;
}
textarea { height: auto; min-height: 60px; resize: vertical; padding: 6px 8px; }
input.mono, textarea.mono { font-family: var(--mono); font-size: 12px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--accent); margin: 0; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }

.btn {
  height: 30px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--panel);
  cursor: pointer; font-weight: 550; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { background: var(--panel-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--err); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; }
.btn.icon { width: 26px; height: 26px; padding: 0; justify-content: center; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel-2); border-color: var(--border); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
.badge.ok { background: var(--ok-weak); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-weak); color: var(--warn); border-color: transparent; }
.badge.err { background: var(--err-weak); color: var(--err); border-color: transparent; }
.badge.info { background: var(--accent-weak); color: var(--accent); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); display: inline-block; flex: none; }
.dot.ok { background: var(--ok); }
.dot.run { background: var(--accent); animation: pulse 1.2s infinite; }
.dot.err { background: var(--err); }
@keyframes pulse { 50% { opacity: .35; } }

.banner { border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; border: 1px solid transparent; }
.banner.err { background: var(--err-weak); color: var(--err); }
.banner.warn { background: var(--warn-weak); color: var(--warn); }
.banner.info { background: var(--accent-weak); color: var(--text); }
.banner ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------------------------------------------------------------- sekmeler */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.tabs button {
  border: 0; background: transparent; padding: 8px 12px; cursor: pointer; color: var(--muted); font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs .count { font-weight: 500; font-size: 11px; color: var(--muted); margin-left: 4px; }

/* ---------------------------------------------------------------- tablolar */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th {
  text-align: left; font-size: 11.5px; font-weight: 650; color: var(--muted); padding: 7px 8px; background: var(--panel-2);
  border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0;
}
table.tbl td { padding: 4px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl td.num { color: var(--muted); font-size: 11px; text-align: right; padding-top: 10px; width: 28px; }
table.tbl td.acts { white-space: nowrap; width: 1%; }
table.tbl tr.detail td { background: var(--panel-2); }
table.tbl input, table.tbl select { height: 28px; }
table.tbl.plain td { padding: 8px; vertical-align: middle; }

.kv { display: flex; flex-direction: column; gap: 6px; }
.kv-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(160px, 2fr) auto; gap: 6px; align-items: center; }

/* ---------------------------------------------------------------- metotlar */
.methods { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 16px; align-items: start; }
.mlist { position: sticky; top: 74px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 94px); overflow: auto; }
.mlist .group { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 6px 4px 2px; }
.mitem {
  width: 100%; text-align: left; border: 1px solid var(--border); background: var(--panel); border-radius: var(--radius);
  padding: 8px 10px; cursor: pointer; display: flex; gap: 8px; align-items: flex-start;
}
.mitem:hover { border-color: var(--border-strong); }
.mitem.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.mitem .t { font-weight: 600; }
.mitem .n { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.mitem .dot { margin-top: 5px; }
@media (max-width: 1100px) {
  .methods { grid-template-columns: 1fr; }
  .mlist { position: static; max-height: none; }
}

.flow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.flow .node { padding: 3px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel-2); color: var(--text); }
.flow .arrow { color: var(--muted); }

.step {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel);
}
.step + .step { margin-top: 8px; }
.step-head { display: grid; grid-template-columns: auto auto minmax(110px, 1fr) 170px minmax(120px, 1.4fr) auto; gap: 6px; align-items: center; padding: 6px 8px; }
.step-body { padding: 10px 12px 12px; border-top: 1px dashed var(--border); }
.step.off { opacity: .6; }
.step-type { font-size: 11px; }
@media (max-width: 900px) { .step-head { grid-template-columns: auto auto 1fr; } }

.rowtpl { border-left: 3px solid var(--accent-weak); padding-left: 12px; margin-top: 10px; }
.rowtpl-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.coll { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: var(--panel-2); }
.coll + .coll { margin-top: 10px; }
.sub-title { font-size: 12px; font-weight: 700; color: var(--muted); margin: 12px 0 6px; display: flex; align-items: center; gap: 8px; }

/* ---------------------------------------------------------------- önizleme / json */
pre.json {
  margin: 0; padding: 10px 12px; background: var(--code-bg); border: 1px solid var(--border); border-radius: 6px;
  font: 12px/1.5 var(--mono); overflow: auto; max-height: 460px; white-space: pre;
}
.j-key { color: #7c3aed; }
.j-str { color: #047857; }
.j-num { color: #b45309; }
.j-lit { color: #2563eb; }
@media (prefers-color-scheme: dark) {
  .j-key { color: #c4b5fd; }
  .j-str { color: #86efac; }
  .j-num { color: #fcd34d; }
  .j-lit { color: #93c5fd; }
}
.rec { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.rec + .rec { margin-top: 10px; }
.rec-head { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.rec-body { padding: 10px 12px; display: grid; gap: 10px; }
.notes { margin: 0; padding-left: 18px; color: var(--muted); }

/* ---------------------------------------------------------------- durum */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.stat .k { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.stat .v { font-size: 20px; font-weight: 650; margin-top: 2px; }
.counts { display: inline-flex; gap: 10px; font-variant-numeric: tabular-nums; }
.c-ok { color: var(--ok); } .c-skip { color: var(--muted); } .c-err { color: var(--err); }

/* ---------------------------------------------------------------- loglar */
.log { font: 12px/1.5 var(--mono); }
.log td { white-space: pre-wrap; word-break: break-word; }
.lv-Warning { color: var(--warn); } .lv-Error { color: var(--err); } .lv-Debug { color: var(--muted); }

/* ---------------------------------------------------------------- bildirim */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 8px;
  padding: 10px 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .14); white-space: pre-wrap;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
.toast.warn { border-left-color: var(--warn); }

.empty { padding: 24px; text-align: center; color: var(--muted); }
details > summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 12px; }
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--panel-2); }
.btn.active { color: var(--accent); background: var(--accent-weak); border-color: transparent; }
