:root {
  --bg: #0b0c10;
  --bg-elev: #14161c;
  --bg-soft: #101218;
  --bg-sidebar: #0e1015;
  --line: #2a2d36;
  --line-soft: #1e2129;
  --text: #f2f2f4;
  --muted: #9a9aa3;
  --accent: #ff6b1a;
  --accent-2: #e85a0f;
  --accent-glow: rgba(255, 107, 26, 0.28);
  --danger: #ff4757;
  --ok: #2ed573;
  --warn: #f0c040;
  --radius: 12px;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  --font: "DM Sans", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar-w: 240px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
}
.app-body {
  background:
    radial-gradient(900px 480px at 0% -10%, var(--accent-glow) 0%, transparent 55%),
    radial-gradient(700px 400px at 100% 0%, rgba(255, 107, 26, 0.08) 0%, transparent 50%),
    linear-gradient(180deg, #0f1015 0%, var(--bg) 45%);
}
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
}
button { cursor: pointer; font-weight: 600; }
.btn-primary, button.btn-primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border: none;
  color: #fff;
  box-shadow: 0 6px 18px var(--accent-glow);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost, button.btn-ghost, button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}
.btn-danger, button.btn-danger, button.danger {
  background: linear-gradient(180deg, #e03a4a, #c12938);
  border: none;
  color: #fff;
}
.btn-block { width: 100%; }
label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.85rem;
}
label.checkbox, .row-check {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  display: flex;
}
.label-action { justify-content: flex-end; }

select.protect-mode {
  min-width: 200px;
  max-width: 100%;
  padding: 0.45rem 0.65rem;
  font-size: 0.85rem;
  margin: 0;
}
label.strict-toggle {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.4rem;
  margin: 0 !important;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
label.strict-toggle input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}
td .strict-toggle { vertical-align: middle; }

/* Auth */
.auth-body {
  display: grid;
  place-items: center;
  padding: 1.5rem;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}
.auth-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 500px at 20% 10%, rgba(255, 107, 26, 0.22), transparent 60%),
    radial-gradient(700px 400px at 85% 80%, rgba(255, 107, 26, 0.1), transparent 55%),
    linear-gradient(160deg, #0b0c10, #12141a 55%, #0e1015);
  z-index: 0;
}
.auth-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.75rem;
  box-shadow: var(--shadow);
}
.auth-card .brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.4rem;
}
.brand-logo-img {
  height: 40px;
  width: auto;
  display: block;
}
.auth-card h1 { margin: 0; font-size: 1.35rem; }
.auth-card .brand p { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.88rem; }
.auth-foot { margin-top: 1rem; font-size: 0.85rem; text-align: center; }

/* Shell layout */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--line-soft);
  padding: 1rem 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.35rem 0.55rem 1.1rem;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 0.85rem;
}
.sidebar-brand img { height: 32px; width: auto; }
.sidebar-brand strong { display: block; font-size: 0.95rem; }
.sidebar-brand span { color: var(--muted); font-size: 0.75rem; }
.nav-group { margin-bottom: 0.85rem; }
.nav-group-title {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.35rem 0.65rem;
  margin: 0;
}
.nav-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  margin: 0.12rem 0;
  font-weight: 500;
}
.nav-btn:hover { background: rgba(255, 107, 26, 0.08); border-color: rgba(255, 107, 26, 0.15); }
.nav-btn.active {
  background: rgba(255, 107, 26, 0.16);
  border-color: rgba(255, 107, 26, 0.45);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.main-col { min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(14, 16, 21, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand.compact { display: flex; align-items: center; gap: 0.65rem; }
.brand .logo, .logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 0.45rem;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--accent), #c2410c);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.04em;
  font-size: 0.85rem;
}
.role-chip {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  background: rgba(255, 107, 26, 0.18);
  color: var(--accent);
  border: 1px solid rgba(255, 107, 26, 0.35);
  vertical-align: middle;
}
.role-chip.client { background: rgba(46, 213, 115, 0.12); color: var(--ok); border-color: rgba(46, 213, 115, 0.35); }
.topbar-actions { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; }
.whoami { font-size: 0.88rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 0.86rem; }

.emergency-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 71, 87, 0.16);
  border: 1px solid rgba(255, 71, 87, 0.55);
  color: #ff8a94;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.emergency-badge[hidden] { display: none !important; }
.emergency-pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.6);
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(255, 71, 87, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0); }
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  padding: 1rem 1.25rem 0.25rem;
}
.kpi {
  background: var(--bg-elev);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 0.95rem 1rem;
  box-shadow: var(--shadow);
}
.kpi-label { display: block; color: var(--muted); font-size: 0.78rem; margin-bottom: 0.35rem; }
.kpi strong {
  display: block;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.kpi-sub { display: block; margin-top: 0.25rem; color: var(--muted); font-size: 0.78rem; }
.kpi strong.ok { color: var(--ok); }
.kpi strong.danger { color: var(--danger); }

.layout { padding: 1rem 1.25rem 2rem; }
.panel {
  background: var(--bg-elev);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.panel-head h2 { margin: 0; font-size: 1.05rem; }
.pill {
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--bg-soft);
}
.chart-wrap { position: relative; height: 220px; }
.split-2 {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.55rem 0.45rem; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge.on { background: rgba(46, 213, 115, 0.15); color: var(--ok); border: 1px solid rgba(46, 213, 115, 0.4); }
.badge.off { background: rgba(255, 71, 87, 0.14); color: var(--danger); border: 1px solid rgba(255, 71, 87, 0.4); }
.hint, .help-box {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}
.help-box {
  background: rgba(255, 107, 26, 0.06);
  border: 1px solid rgba(255, 107, 26, 0.2);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  margin: 0.5rem 0 0.9rem;
}
.help-box strong { color: var(--text); }
.error { color: var(--danger); font-size: 0.88rem; }
.ok-msg { color: var(--ok); font-size: 0.88rem; }
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}
.form-inline.grid { align-items: end; }
.stack-form label { margin-bottom: 0.75rem; }
.form-actions { display: flex; gap: 0.6rem; margin-top: 0.5rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.api-key-box {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem;
}
.code-block, pre.code-block {
  background: #0a0b0e;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: #e8e8ea;
}
.steps { margin: 0.5rem 0 0; padding-left: 1.2rem; color: var(--muted); }
.steps li { margin: 0.35rem 0; }
.ip-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.45rem; }
.ip-list li {
  font-family: var(--mono);
  font-size: 0.82rem;
  padding: 0.3rem 0.55rem;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.mobile-nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
}

/* Legacy tabs (fallback; admin’de gizli — display override engeli) */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.75rem 1.25rem 0;
}
.tabs[hidden] { display: none !important; }
.tab {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  font-size: 0.86rem;
}
.tab.active {
  background: rgba(255, 107, 26, 0.16);
  border-color: var(--accent);
  color: #fff;
}

.modal {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
}
.modal[hidden] { display: none !important; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.65); }
.modal-card {
  position: relative;
  width: min(920px, calc(100% - 2rem));
  max-height: min(80vh, 720px);
  overflow: auto;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: var(--shadow);
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: min(280px, 86vw);
    z-index: 40;
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-nav-toggle { display: inline-flex; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-2, .grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .kpi-row { grid-template-columns: 1fr; }
  .topbar { padding: 0.7rem 0.85rem; }
  .layout { padding: 0.85rem; }
}

/* Trafik aralıkları */
.range-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.35rem 0 0.75rem;
}
.range-btn {
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--muted);
}
.range-btn.active, .range-btn:hover {
  color: #fff;
  border-color: var(--accent);
  background: rgba(255, 107, 26, 0.22);
}

/* Ülke / kıta engeli */
.geo-continents { display: flex; flex-direction: column; gap: 0.85rem; margin: 0.75rem 0; }
.geo-continent {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 0.75rem;
  background: var(--bg-soft);
}
.geo-continent-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}
.geo-continent-head strong { color: var(--text); margin-right: auto; }
.geo-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.geo-flag {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--muted);
}
.geo-flag input { position: absolute; opacity: 0; width: 0; height: 0; }
.geo-flag .flag { font-size: 1.15rem; line-height: 1; }
.geo-flag .flag-img {
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
  display: block;
}
.geo-flag .code { font-family: var(--mono); font-size: 0.72rem; }
.geo-flag.on {
  border-color: var(--danger);
  background: rgba(255, 71, 87, 0.14);
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(255, 71, 87, 0.25);
}
