:root {
  --bg: #0b0f17;
  --bg-2: #121824;
  --bg-3: #1a2231;
  --border: #253044;
  --text: #e6edf7;
  --muted: #8b9bb4;
  --accent: #4f8ef7;
  --success: #2ecc71;
  --danger: #ff5c5c;
  --warn: #f5a623;
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.grow { flex: 1; min-width: 0; }

/* ------------------------------------------------------------------ giriş */
.login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 30%, #16203180, var(--bg));
}
.login-box {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 16px; padding: 40px 36px; width: 380px;
  display: flex; flex-direction: column; gap: 14px; text-align: center;
}
.login-logo { font-size: 44px; }
.login-box h1 { font-size: 20px; }
.login-error {
  background: #ff5c5c1a; border: 1px solid #ff5c5c55;
  color: var(--danger); padding: 10px; border-radius: var(--radius); font-size: 13px;
}

/* ----------------------------------------------------------- uyari bandi */
.alert-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: #4a1d1d;
  border-bottom: 1px solid #7a2e2e;
  color: #ffd9d9;
  font-size: 13px;
}
.alert-banner[hidden] { display: none; }
.alert-banner.warn { background: #4a3a12; border-bottom-color: #7a5f1e; color: #ffe9b8; }
.alert-icon { font-size: 15px; }
#alert-text { flex: 1; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* -------------------------------------------------- hesap formu / rehber */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 12px;
}
.form-grid label,
label.block { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
label.block { margin-bottom: 12px; }
.btn-danger { background: #4a1d1d; border-color: #7a2e2e; color: #ffd9d9; }
.btn-danger:hover { background: #5c2424; border-color: #963838; }

.guide { font-size: 13px; line-height: 1.65; }
.guide h4 { margin: 16px 0 6px; font-size: 13px; color: var(--accent, #6aa8ff); }
.guide ol, .guide ul { margin: 0 0 8px 20px; }
.guide li { margin-bottom: 4px; }
.guide p { margin: 0 0 8px; }
.guide a { color: #6aa8ff; }
.guide kbd {
  background: #22304a; border: 1px solid #35415c; border-radius: 4px;
  padding: 1px 5px; font-size: 11px; font-family: ui-monospace, monospace;
}
.guide .code { margin: 6px 0; }

/* ----------------------------------------------------------------- topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--bg-2); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.logo { font-size: 26px; }
.topbar h1 { font-size: 16px; font-weight: 600; }

.live-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--muted);
  box-shadow: 0 0 0 0 transparent; transition: .3s;
}
.live-dot.on { background: var(--success); animation: pulse 2s infinite; }
.live-dot.off { background: var(--danger); }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 #2ecc7166; }
  70%  { box-shadow: 0 0 0 8px #2ecc7100; }
  100% { box-shadow: 0 0 0 0 #2ecc7100; }
}

/* ------------------------------------------------------------- form ögeleri */
.btn, .select, .input {
  background: var(--bg-3); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 13px; font-family: inherit;
}
.btn { cursor: pointer; transition: .15s; white-space: nowrap; }
.btn:hover { background: #22304a; border-color: #35415c; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: #3d7ce0; }
.btn-danger { color: var(--danger); border-color: #ff5c5c44; }
.btn-danger:hover { background: #ff5c5c1a; }
.btn-block { width: 100%; padding: 11px; }
.input { width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ------------------------------------------------------------------- tabs */
.tabs {
  display: flex; gap: 4px; padding: 0 24px;
  background: var(--bg-2); border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 12px 16px; font-size: 13px; font-family: inherit;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.badge {
  background: var(--bg-3); border-radius: 10px; padding: 1px 7px;
  font-size: 11px; margin-left: 4px;
}

main { padding: 20px 24px 60px; max-width: 1600px; margin: 0 auto; }
.page { display: none; }
.page.active { display: block; }

/* ------------------------------------------------------------------ kartlar */
.card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.card-head h2 { font-size: 14px; font-weight: 600; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > .card { margin-bottom: 16px; }

.stat-grid {
  display: grid; gap: 12px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.stat-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-left: 3px solid var(--muted);
  border-radius: var(--radius); padding: 14px 16px;
}
.stat-card.success { border-left-color: var(--success); }
.stat-card.danger  { border-left-color: var(--danger); }
.stat-card.accent  { border-left-color: var(--accent); }
.stat-label { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
.stat-value small { font-size: 14px; color: var(--muted); font-weight: 400; }
.stat-sub { color: var(--muted); font-size: 11px; margin-top: 4px; }

/* ------------------------------------------------------------------ grafik */
.chart {
  display: flex; align-items: flex-end; gap: 2px;
  height: 180px; padding-top: 10px;
}
.chart-col {
  flex: 1; min-width: 3px; display: flex; flex-direction: column;
  justify-content: flex-end; gap: 1px; cursor: pointer; position: relative;
}
.chart-col:hover { opacity: .75; }
.chart-bar-ok   { background: var(--success); border-radius: 2px 2px 0 0; min-height: 2px; }
.chart-bar-fail { background: var(--danger);  border-radius: 2px 2px 0 0; }
.chart-empty { color: var(--muted); margin: auto; font-size: 13px; }

/* --------------------------------------------------------------- bar liste */
.bar-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; }
.bar-row { cursor: default; }
.bar-row.clickable { cursor: pointer; }
.bar-row.clickable:hover .bar-label { color: var(--accent); }
.bar-top { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; gap: 10px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 6px; background: var(--bg-3); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }
.bar-fill.success { background: var(--success); }
.bar-fill.danger  { background: var(--danger); }
.bar-fill.warn    { background: var(--warn); }
.empty { color: var(--muted); text-align: center; padding: 24px; font-size: 13px; }

/* ----------------------------------------------------------------- tablolar */
.filters { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.filters .input { flex: 1; min-width: 220px; }
.table-wrap { overflow-x: auto; border-radius: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; color: var(--muted); font-weight: 500; font-size: 11px;
  text-transform: uppercase; letter-spacing: .5px;
  padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 9px 10px; border-bottom: 1px solid #1c2534; white-space: nowrap; }
.table tbody tr { cursor: pointer; transition: background .1s; }
.table tbody tr:hover { background: var(--bg-3); }
.table td.wrap { white-space: normal; word-break: break-all; max-width: 420px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.pill {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.pill-ok    { background: #2ecc711f; color: var(--success); }
.pill-fail  { background: #ff5c5c1f; color: var(--danger); }
.pill-warn  { background: #f5a6231f; color: var(--warn); }
.pill-muted { background: var(--bg-3);  color: var(--muted); }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }

/* --------------------------------------------------------------- canlı akış */
.live-feed { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; }
.live-item {
  display: flex; gap: 10px; align-items: center; padding: 6px 10px;
  background: var(--bg-3); border-radius: 6px; font-size: 12px;
  animation: slide-in .3s ease;
}
@keyframes slide-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.live-item .mono { flex: 1; overflow: hidden; text-overflow: ellipsis; }

/* -------------------------------------------------------------- cookie grid */
.cookie-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.cookie-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-left: 3px solid var(--muted); border-radius: var(--radius); padding: 16px;
}
.cookie-card.healthy { border-left-color: var(--success); }
.cookie-card.broken  { border-left-color: var(--danger); }
.cookie-card h3 { font-size: 14px; margin-bottom: 4px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 12px; border-bottom: 1px solid #1c2534; }
.kv:last-of-type { border-bottom: none; }
.kv span:first-child { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.chip { background: var(--bg-3); border-radius: 5px; padding: 2px 7px; font-size: 11px; color: var(--muted); }
.chip.ok { color: var(--success); }
.cookie-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
textarea.input { min-height: 80px; resize: vertical; font-family: ui-monospace, Menlo, monospace; font-size: 11px; margin-top: 10px; }
.info-bar { background: var(--bg-3); border-radius: 8px; padding: 12px 14px; font-size: 13px; }

/* ----------------------------------------------------------------- çekmece */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer-backdrop { position: absolute; inset: 0; background: #000a; backdrop-filter: blur(2px); }
.drawer-panel {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: min(820px, 100%); background: var(--bg-2);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  animation: slide-left .22s ease;
}
@keyframes slide-left { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.drawer-head h2 { font-size: 15px; }
.drawer-body { padding: 20px; overflow-y: auto; flex: 1; }
.drawer-body h3 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); margin: 20px 0 10px;
}
.drawer-body h3:first-child { margin-top: 0; }
pre.code {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; overflow-x: auto; font-size: 12px; line-height: 1.6;
  font-family: ui-monospace, Menlo, monospace; max-height: 420px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-word;
}
.upstream-item {
  background: var(--bg-3); border-radius: 8px; padding: 12px; margin-bottom: 10px;
  border-left: 3px solid var(--muted);
}
.upstream-item.ok   { border-left-color: var(--success); }
.upstream-item.fail { border-left-color: var(--danger); }
.upstream-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------------- toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--bg-3); border: 1px solid var(--border);
  padding: 12px 20px; border-radius: 8px; z-index: 100; font-size: 13px;
  animation: slide-in .2s ease; max-width: 90vw;
}
.toast.ok   { border-color: #2ecc7166; color: var(--success); }
.toast.err  { border-color: #ff5c5c66; color: var(--danger); }

@media (max-width: 760px) {
  .topbar { flex-direction: column; align-items: stretch; gap: 10px; }
  main { padding: 14px; }
  .drawer-panel { width: 100%; }
}
