:root {
  --green: #00a884;
  --green-dark: #008069;
  --green-soft: #d9fdd3;
  --ink: #111b21;
  --muted: #667781;
  --line: #e2e8ec;
  --bg: #f0f2f5;
  --card: #fff;
  --field: #fff;
  --field-line: #cfd6dd;
  --hover: #f5f6f6;
  --chip: #e9edef;
  --side: #111b21;
  --red: #d93025;
  --amber: #b26a00;
  --blue: #53bdeb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(11, 20, 26, .08);
}
:root[data-theme=dark] {
  --green-dark: #00a884;
  --green-soft: #0b3b32;
  --ink: #e9edef;
  --muted: #8696a0;
  --line: #2a3942;
  --bg: #0b141a;
  --card: #111b21;
  --field: #202c33;
  --field-line: #2a3942;
  --hover: #202c33;
  --chip: #202c33;
  --side: #0b141a;
  --amber: #f0b849;
  --shadow: none;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); display: flex; }
a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 12px; }
h2 small { font-weight: 400; color: var(--muted); margin-left: 6px; }
h3 { font-size: 13px; margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
code, pre, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
code { background: var(--chip); padding: 1px 5px; border-radius: 4px; }
pre { background: #111b21; color: #e6edf3; padding: 14px; border-radius: 8px; overflow-x: auto; margin: 10px 0; line-height: 1.55; border: 1px solid var(--line); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.pad { padding: 16px; }

/* İskelet */
.side { width: 220px; flex: none; background: var(--side); color: #c9d3dd; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 9px; padding: 20px 18px; font-size: 17px; font-weight: 700; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: #25d366; box-shadow: 0 0 0 4px rgba(37, 211, 102, .2); }
.side nav { flex: 1; padding: 4px 10px; }
.side nav a { display: flex; gap: 11px; align-items: center; padding: 9px 12px; border-radius: 7px; color: #c9d3dd; margin-bottom: 2px; }
.side nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; }
.side nav a.on { background: var(--green); color: #fff; }
.side-foot { padding: 14px 18px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 13px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.side-foot .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.side-foot .link { display: flex; }
.side-foot .link:hover { color: #fff; }
.side-foot .link { color: #c9d3dd; }
.test-flag { width: 100%; background: var(--amber); color: #fff; text-align: center; border-radius: 6px; padding: 3px; font-size: 12px; }
.main { flex: 1; min-width: 0; padding: 22px 28px 40px; }
.top { margin-bottom: 18px; }
.side nav .pill { margin-left: auto; }
.pill { background: #25d366; color: #fff; border-radius: 10px; padding: 0 7px; font-size: 11.5px; font-weight: 600; font-style: normal; min-width: 20px; text-align: center; }
.pill:empty { display: none; }

/* Bileşenler */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card.narrow { max-width: 640px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 18px; align-items: start; }
.cols .card { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.wrap { max-width: 420px; word-break: break-word; }
label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); font-weight: 500; }
input, select, textarea { display: block; width: 100%; margin-top: 5px; padding: 8px 10px; border: 1px solid var(--field-line); border-radius: 7px; font: inherit; background: var(--field); color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(0, 168, 132, .3); border-color: var(--green); }
input[readonly] { background: var(--bg); font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
label.check input { width: auto; margin: 3px 0 0; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 12px; padding: 10px 12px 2px; }
legend { font-size: 12px; color: var(--muted); padding: 0 6px; }
.btn { display: inline-block; padding: 8px 14px; border: 1px solid var(--field-line); border-radius: 7px; background: var(--field); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); }
.btn.danger { color: var(--red); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn.block { width: 100%; margin-top: 6px; }
.link { background: none; border: 0; padding: 0; color: var(--green-dark); cursor: pointer; font: inherit; }
.actions { display: flex; gap: 8px; margin-top: 4px; }
.row-actions { white-space: nowrap; }
.row-actions form { display: inline; }
.filters { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filters select, .filters input { width: auto; margin: 0; }
.filters input[type=search] { flex: 1; min-width: 220px; }
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; word-break: break-word; }
.alert-ok { background: var(--green-soft); border-color: transparent; }
.alert-error { background: #fdecea; border-color: #f5c2bd; color: #8e1c1c; }
.alert-warn { background: #fff6e0; border-color: #f1d9a0; color: #6b4500; }
code.key { display: inline-block; margin-top: 6px; padding: 6px 10px; font-size: 14px; user-select: all; background: var(--card); border: 1px dashed var(--green); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--chip); color: var(--muted); white-space: nowrap; }
.b-sent { background: #e8f0fe; color: #174ea6; }
.b-delivered, .b-approved { background: var(--green-soft); color: var(--green-dark); }
.b-read { background: #d4f1ff; color: #0b5c85; }
.b-failed, .b-rejected { background: #fdecea; color: var(--red); }
.b-queued, .b-sending, .b-pending { background: #fff6e0; color: var(--amber); }
.err { color: var(--red); font-size: 12.5px; margin-top: 3px; }
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--green-dark); border-color: var(--green); font-weight: 600; }
details pre { max-width: 640px; white-space: pre-wrap; word-break: break-all; }
summary { cursor: pointer; }

/* Genel bakış */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 26px; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.bad b { color: var(--red); }
.chart { display: flex; gap: 8px; height: 150px; align-items: flex-end; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar-stack { flex: 1; width: 100%; max-width: 38px; display: flex; flex-direction: column; justify-content: flex-end; }
.bar-stack i { display: block; min-height: 0; }
.bar-stack i:first-child { border-radius: 4px 4px 0 0; }
.bar span { font-size: 11px; color: var(--muted); }
.lg-out { background: var(--green); }
.lg-in { background: #8fd3c4; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 10px; }

/* Pencereler */
dialog { border: 0; border-radius: 12px; padding: 22px; background: var(--card); color: var(--ink); width: min(480px, 92vw); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
dialog::backdrop { background: rgba(23, 33, 43, .5); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.tpl-preview { white-space: pre-wrap; background: var(--green-soft); border-radius: 8px; padding: 10px 12px; margin: 6px 0 12px; word-break: break-word; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.tpl-grid .card { margin: 0; }

/* Giriş / kurulum */
body.auth { align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 100%; max-width: 360px; margin: 0; }
.auth-card.wide { max-width: 520px; }
.auth-card .brand { color: var(--ink); padding: 0 0 16px; }
.docs { max-width: 900px; }

@media (max-width: 860px) {
  body { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; }
  .side nav { display: flex; overflow-x: auto; padding: 0 10px 10px; gap: 4px; }
  .side nav a { white-space: nowrap; gap: 6px; }
  .brand { padding: 14px 18px 10px; }
  .side-foot { display: none; }
  .main { padding: 16px; }
  .card { overflow-x: auto; }
  .cols { grid-template-columns: 1fr; }
}

/* Koyu temada rozet ve uyarı renkleri */
:root[data-theme=dark] .alert-error { background: #3b1513; border-color: #5c211d; color: #ffb4ab; }
:root[data-theme=dark] .alert-warn { background: #3a2c08; border-color: #5a4410; color: #f0d48a; }
:root[data-theme=dark] .b-sent { background: #17324d; color: #9cc8f5; }
:root[data-theme=dark] .b-read { background: #0f3a4d; color: #8fd8f7; }
:root[data-theme=dark] .b-failed, :root[data-theme=dark] .b-rejected { background: #3b1513; color: #ffb4ab; }
:root[data-theme=dark] .b-queued, :root[data-theme=dark] .b-sending, :root[data-theme=dark] .b-pending { background: #3a2c08; color: #f0d48a; }
:root[data-theme=dark] .b-delivered, :root[data-theme=dark] .b-approved { color: #7ee2c5; }
