:root {
  --primary: #0F766E;
  --secondary: #134E4A;
  --bg: #F0F4F3;
  --surface: #ffffff;
  --text: #0B1F1C;
  --muted: #5B726C;
  --border: #D5E2DE;
  --danger: #B42318;
  --success: #067647;
  --warning: #B54708;
  --shadow: 0 10px 30px rgba(15, 118, 110, 0.08);
  --radius: 14px;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --sidebar-width: 260px;
  --mobile-bar-h: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 35%),
    linear-gradient(180deg, #E8F2EF 0%, var(--bg) 40%, #E7EEEB 100%);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, var(--secondary), #0B3B37);
  color: #E8FFFB;
  padding: 1.5rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  z-index: 40;
}

.sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.sidebar-close {
  display: none;
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.brand {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: #fff; }

.nav a {
  display: block;
  color: #D7F5F0;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  margin-bottom: 0.25rem;
  text-decoration: none;
}
.nav a:hover, .nav a.active {
  background: rgba(255,255,255,0.12);
  text-decoration: none;
}

.sidebar-user {
  margin-top: 2rem;
  padding: 0.9rem;
  opacity: .85;
  font-size: .85rem;
}

.content { padding: 1.5rem; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.topbar h1 { margin: 0; font-size: 1.5rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}
.stats-compact .stat {
  padding: 0.75rem 0.9rem;
}
.stats-compact .stat .value {
  font-size: 1.35rem;
  margin-top: 0.15rem;
}
.stats-compact .stat .delta,
.stat .delta {
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0.2rem;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.stat .label { color: var(--muted); font-size: 0.8rem; }
.stat .value { font-size: 1.6rem; font-weight: 700; margin-top: 0.35rem; color: var(--secondary); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-weight: 600;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn-secondary { background: #315E57; }
.btn-danger { background: var(--danger); }
.btn-light { background: #E7F2EF; color: var(--secondary); }
.btn-sm { padding: 0.4rem 0.7rem; font-size: 0.85rem; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-size: 0.85rem; font-weight: 600; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
label { display: block; font-size: 0.9rem; margin-bottom: 0.35rem; color: var(--muted); }
input, select, textarea {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font: inherit;
}
textarea { min-height: 110px; resize: vertical; }

input[type="color"],
.color-input {
  width: 100%;
  height: 56px;
  min-height: 56px;
  padding: 0.35rem;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  -webkit-appearance: none;
  appearance: none;
}
input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 8px;
}
input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 8px;
}

.alert {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
}
.alert-success { background: #E8F8EF; color: var(--success); border: 1px solid #A6E3C0; }
.alert-error { background: #FEE4E2; color: var(--danger); border: 1px solid #FECDCA; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-active { background: #DCFCE7; color: #166534; }
.badge-inactive { background: #FEE4E2; color: #991B1B; }

.actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.muted { color: var(--muted); }
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 2rem;
}
.login-card h1 { margin-top: 0; }

/* Mobile bar + hamburger — desktop gizli */
.mobile-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--mobile-bar-h);
  padding: 0 0.85rem;
  align-items: center;
  gap: 0.75rem;
  background: linear-gradient(90deg, var(--secondary), #0B3B37);
  color: #E8FFFB;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mobile-brand img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: contain;
  background: #fff;
}

.hamburger {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 10px;
  background: rgba(255,255,255,0.12);
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  flex-shrink: 0;
}
.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}
body.menu-open .hamburger span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
body.menu-open .hamburger span:nth-child(2) {
  opacity: 0;
}
body.menu-open .hamburger span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8, 24, 22, 0.45);
  z-index: 35;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

@media (max-width: 900px) {
  .mobile-bar { display: flex; }

  .layout {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 1rem;
    padding-top: 1rem;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(86vw, 300px);
    height: 100vh;
    height: 100dvh;
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 8px 0 30px rgba(0,0,0,0.25);
    padding-top: 1rem;
  }

  body.menu-open .sidebar {
    transform: translateX(0);
  }

  body.menu-open .sidebar-overlay {
    display: block;
  }

  .sidebar-close { display: inline-flex; align-items: center; justify-content: center; }

  .brand { margin-bottom: 1rem; }

  body.menu-open {
    overflow: hidden;
  }
}

.progress {
  height: 8px;
  background: #E2EDE9;
  border-radius: 999px;
  overflow: hidden;
  min-width: 120px;
}
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #14B8A6);
  border-radius: inherit;
  transition: width .3s ease;
}
.progress-lg { height: 12px; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.msg-preview {
  background: #F7FBFA;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font);
  font-size: .95rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.form-grid label,
label { display: block; font-weight: 600; font-size: .92rem; }
.form-grid input,
.form-grid select,
.form-grid textarea,
label input,
label select,
label textarea {
  display: block;
  width: 100%;
  margin-top: .35rem;
  font-weight: 400;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
}
.btn-danger:hover { filter: brightness(1.05); text-decoration: none; }

.confirm-box {
  background: #FFF8F0;
  border: 1px solid #F5D0A9;
  border-radius: 10px;
  padding: .85rem 1rem;
  font-weight: 400;
}
.confirm-box input { width: auto; margin-top: .2rem; }

.dash-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1rem;
}
@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr; }
}
.dash-main {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(220px, 0.75fr);
  gap: 0.75rem;
  margin-top: 0.75rem;
  align-items: stretch;
}
@media (max-width: 900px) {
  .dash-main { grid-template-columns: 1fr; }
}
.chart-card {
  padding: 1rem 1.1rem;
  margin-bottom: 0.75rem;
}
.chart-card h2 {
  font-size: 1rem;
  margin: 0;
  font-weight: 700;
}
.chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.chart-head .muted { font-size: 0.8rem; }
.chart-wrap { position: relative; width: 100%; }
.chart-daily { height: 220px; }
.chart-aff { height: 160px; }
.dash-aff { margin-top: 0; }

.funnel-bars { display: flex; flex-direction: column; gap: 0.85rem; }
.funnel-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
}
.funnel-meta span { color: var(--muted); }
.funnel-meta strong { color: var(--secondary); font-size: 0.95rem; }
.funnel-meta em {
  font-style: normal;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  margin-left: 0.25rem;
}
.funnel-track {
  height: 10px;
  background: #E8F0EE;
  border-radius: 999px;
  overflow: hidden;
}
.funnel-track > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #14B8A6);
  border-radius: inherit;
  min-width: 0;
}
.funnel-track > span.fn-join { background: linear-gradient(90deg, #0D9488, #14B8A6); }
.funnel-track > span.fn-site { background: linear-gradient(90deg, #B45309, #D97706); }

