:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e2e5ea;
  --text: #16191f;
  --muted: #5d6573;
  --accent: #0f766e;
  --accent-text: #ffffff;
  --ok: #15803d;
  --ok-bg: #e8f6ed;
  --bad: #c2261d;
  --bad-bg: #fdecea;
  --warn: #a35c00;
  --warn-bg: #fdf3e2;
  --info: #1d5fbf;
  --info-bg: #e9f0fc;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #171b21;
    --surface-2: #1e232b;
    --border: #2a313b;
    --text: #e6e9ee;
    --muted: #98a1ae;
    --accent: #2bb3a3;
    --accent-text: #06201d;
    --ok: #4ade80;
    --ok-bg: #12291b;
    --bad: #f87171;
    --bad-bg: #331616;
    --warn: #fbbf24;
    --warn-bg: #2f2410;
    --info: #7cb0ff;
    --info-bg: #142338;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }

/* ---------- Üst bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 15px; }
.brand svg { width: 22px; height: 22px; fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tabs { display: flex; gap: 2px; overflow-x: auto; }
.tabs a {
  padding: 7px 12px; border-radius: 8px;
  color: var(--muted); text-decoration: none; white-space: nowrap; font-weight: 500;
}
.tabs a:hover { background: var(--surface-2); color: var(--text); }
.tabs a.active { background: var(--surface-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }

.userbox { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.userbox:empty { display: none; }

.view { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; }

/* ---------- Yapı taşları ---------- */
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
h1 { font-size: 20px; margin: 0; font-weight: 650; }
h2 { font-size: 15px; margin: 0; font-weight: 650; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-body { padding: 16px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn.link { border: 0; background: none; padding: 0; color: var(--accent); }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-weight: 550; font-size: 13px; }
.field .hint { color: var(--muted); font-size: 12.5px; }
input[type=text], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 0; border-color: var(--accent); }
textarea { resize: vertical; min-height: 220px; }
.check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.check input { margin-top: 3px; }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

/* ---------- Durum rozetleri ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--muted);
}
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.info { background: var(--info-bg); color: var(--info); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); flex: none; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }
.dot.warn { background: var(--warn); }
.dot.running { background: var(--info); animation: pulse 1s infinite alternate; }
@keyframes pulse { from { opacity: 1; } to { opacity: .3; } }

.banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--radius); }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.info { background: var(--info-bg); color: var(--info); }
.banner.bad { background: var(--bad-bg); color: var(--bad); }

/* ---------- Tablolar ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.detail { color: var(--muted); word-break: break-word; }
.detail.bad { color: var(--bad); }
.detail.warn { color: var(--warn); }

/* ---------- Pano ---------- */
.summary { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.stat { padding: 12px 14px; }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.site-title { display: flex; flex-direction: column; min-width: 0; }
.site-title a { color: var(--muted); font-size: 12.5px; word-break: break-all; text-decoration: none; }
.site-title a:hover { text-decoration: underline; }
.history { padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }

/* ---------- Site formu ---------- */
.rules { display: flex; flex-direction: column; gap: 8px; }
.rule { display: grid; gap: 8px; grid-template-columns: minmax(180px, 2fr) minmax(140px, 1fr) minmax(200px, 1.3fr) auto; align-items: center; }
.rotation { padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }

/* ---------- Bildirimler ---------- */
.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 { padding: 10px 14px; border-radius: 8px; background: var(--text); color: var(--bg); box-shadow: 0 6px 20px rgba(0,0,0,.18); white-space: pre-line; }
.toast.bad { background: var(--bad); color: #fff; }

/* ---------- Giriş ---------- */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login { width: min(360px, 100%); padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.error { color: var(--bad); margin: 0; }

@media (max-width: 720px) {
  .topbar { gap: 8px; padding: 10px 16px; }
  .rule { grid-template-columns: 1fr 1fr; }
  .rule > input { grid-column: 1 / -1; }
  th, td { padding: 7px 8px; }
}
