/* ============================================================ WaCRM — tema */
:root {
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar: 248px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

/* Koyu tema (varsayılan): saf siyah yerine yumuşak lacivert-siyah, kontrastı düşürülmüş metin → göz yormaz */
:root, :root[data-theme="dark"] {
  --bg: #0b0d12;
  --bg-2: #0f1218;
  --surface: #13171f;
  --surface-2: #181d27;
  --surface-3: #1f2531;
  --border: #232a37;
  --border-2: #2e3646;
  --fg: #dfe3ea;
  --fg-2: #b4bccb;
  --muted: #7f8899;
  --accent: #25d366;
  --accent-2: #34b7f1;
  --accent-fg: #052e16;
  --accent-soft: rgba(37, 211, 102, .1);
  --glow: 0 0 0 1px rgba(37, 211, 102, .35), 0 0 24px -4px rgba(37, 211, 102, .45);
  --glow-2: 0 0 24px -6px rgba(52, 183, 241, .5);
  --ok: #4ade80;
  --warn: #fbbf5a;
  --err: #ff6b7d;
  --info: #60b6ff;
  --shadow: 0 10px 40px -12px rgba(0, 0, 0, .6);
  --grid-line: rgba(255, 255, 255, .025);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f3f5f8;
  --bg-2: #eceff4;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #edf0f5;
  --border: #e1e5ec;
  --border-2: #d2d8e2;
  --fg: #1a1e26;
  --fg-2: #3f4756;
  --muted: #6b7484;
  --accent: #00a884;
  --accent-2: #0b8fd6;
  --accent-fg: #ffffff;
  --accent-soft: rgba(0, 168, 132, .09);
  --glow: 0 0 0 1px rgba(0, 168, 132, .3), 0 6px 20px -6px rgba(0, 168, 132, .4);
  --glow-2: 0 6px 20px -8px rgba(11, 143, 214, .4);
  --ok: #16a34a;
  --warn: #c98100;
  --err: #dc2f45;
  --info: #2470d6;
  --shadow: 0 10px 30px -14px rgba(20, 30, 50, .25);
  --grid-line: rgba(10, 20, 40, .035);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 60% 0%, #000 0%, transparent 70%);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--accent); color: var(--accent-fg); }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -.01em; margin: 0; font-weight: 600; }
code, .mono { font-family: var(--mono); font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

/* Kaydırma çubuğu */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================ Yerleşim */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  padding: 18px 14px; background: color-mix(in srgb, var(--bg-2) 85%, transparent);
  border-right: 1px solid var(--border); backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; font-family: var(--font-display); font-size: 19px; font-weight: 700; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #061513; box-shadow: var(--glow);
}
.brand-mark svg { width: 18px; height: 18px; }
.brand small { display: block; font: 500 11px var(--font); color: var(--muted); letter-spacing: .02em; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px;
  color: var(--fg-2); font-weight: 500; transition: background .15s, color .15s; position: relative;
}
.nav a svg { width: 18px; height: 18px; opacity: .85; }
.nav a:hover { background: var(--surface-2); color: var(--fg); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav a.active::before {
  content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--accent); box-shadow: 0 0 12px var(--accent);
}
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.quota-card { padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.quota-card b { color: var(--fg); font-size: 15px; font-family: var(--font-display); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 28px;
  background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.content { padding: 28px; max-width: 1400px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head h2 { font-size: 24px; }

/* ============================================================ Bileşenler */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); position: relative;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card-head h3 svg { width: 17px; height: 17px; color: var(--accent); }
.card.glow { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt { margin-top: 18px; }
.mb { margin-bottom: 18px; }
.right { margin-left: auto; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.stat { display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
.stat .label { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 7px; }
.stat .label svg { width: 15px; height: 15px; }
.stat .value { font-family: var(--font-display); font-size: 28px; font-weight: 600; letter-spacing: -.02em; }
.stat .sub { font-size: 12px; color: var(--muted); }
.stat::after {
  content: ''; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, var(--c, var(--accent)) 0%, transparent 70%); opacity: .12; pointer-events: none;
}

/* Düğmeler */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-2); background: var(--surface-2); color: var(--fg);
  font: 500 13.5px var(--font); cursor: pointer; transition: all .15s var(--ease); white-space: nowrap; text-decoration: none !important;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: var(--muted); background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.btn.primary:hover { box-shadow: var(--glow); filter: brightness(1.05); }
.btn.violet { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn.violet:hover { box-shadow: var(--glow-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--fg-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--fg); }
.btn.danger { color: var(--err); }
.btn.danger:hover { border-color: var(--err); background: color-mix(in srgb, var(--err) 10%, transparent); }
.btn.sm { height: 31px; padding: 0 11px; font-size: 12.5px; }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 31px; }
.btn.loading { pointer-events: none; opacity: .7; }
.btn.loading::after { content: ''; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Form */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label-text { font-size: 12.5px; font-weight: 500; color: var(--fg-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-2);
  background: var(--bg-2); color: var(--fg); font: 14px var(--font); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 100px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
textarea.code { font-family: var(--mono); font-size: 12.5px; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--muted); opacity: .7; }
select.input { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237f8899' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input-group { display: flex; }
.input-group .input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; height: 40px; border-left: 0; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 13.5px; }
.switch input { display: none; }
.switch .track { width: 38px; height: 22px; border-radius: 22px; background: var(--surface-3); border: 1px solid var(--border-2); position: relative; transition: .2s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: .2s var(--ease); }
.switch input:checked + .track { background: var(--accent-soft); border-color: var(--accent); }
.switch input:checked + .track::after { left: 18px; background: var(--accent); box-shadow: 0 0 8px var(--accent); }

.check-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; padding: 4px; border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: var(--bg-2); }
.check-list label { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.check-list label:hover { background: var(--surface-2); }
.check-list input { accent-color: var(--accent); width: 16px; height: 16px; }

/* Rozet */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 23px; padding: 0 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; letter-spacing: .01em; background: var(--surface-3); color: var(--fg-2); white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.badge.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 13%, transparent); }
.badge.err { color: var(--err); background: color-mix(in srgb, var(--err) 12%, transparent); }
.badge.info { color: var(--info); background: color-mix(in srgb, var(--info) 12%, transparent); }
.badge.accent { color: var(--accent); background: var(--accent-soft); }
.badge.violet { color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 13%, transparent); }
.badge.pulse::before { animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 currentColor; } 50% { box-shadow: 0 0 0 4px transparent; opacity: .6; } }

/* Tablo */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.clickable { cursor: pointer; }
.table .actions { text-align: right; white-space: nowrap; }

/* İlerleme */
.progress { height: 7px; border-radius: 7px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 7px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 60%, transparent); transition: width .5s var(--ease); }
.progress.warn > i { background: var(--warn); box-shadow: none; }
.progress.err > i { background: var(--err); box-shadow: none; }

/* Boş durum */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .ico { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty h3 { color: var(--fg); font-size: 16px; margin-bottom: 6px; }
.empty p { margin: 0 auto 16px; max-width: 420px; }

/* Sekmeler */
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); flex-wrap: wrap; }
.tabs button { height: 32px; padding: 0 14px; border-radius: 9px; border: 0; background: transparent; color: var(--fg-2); font: 500 13px var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.tabs button svg { width: 15px; height: 15px; }
.tabs button.active { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0, 0, 0, .2), inset 0 0 0 1px var(--border-2); }
.tabs button.active svg { color: var(--accent); }

/* Uyarı kutusu */
.alert { display: flex; gap: 12px; padding: 13px 15px; border-radius: 12px; border: 1px solid; font-size: 13.5px; line-height: 1.5; }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert.info { border-color: color-mix(in srgb, var(--info) 30%, transparent); background: color-mix(in srgb, var(--info) 8%, transparent); }
.alert.info svg { color: var(--info); }
.alert.warn { border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: color-mix(in srgb, var(--warn) 8%, transparent); }
.alert.warn svg { color: var(--warn); }
.alert.err { border-color: color-mix(in srgb, var(--err) 35%, transparent); background: color-mix(in srgb, var(--err) 8%, transparent); }
.alert.err svg { color: var(--err); }
.alert.ok { border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 8%, transparent); }
.alert.ok svg { color: var(--ok); }

/* Modal */
.modal-back { position: fixed; inset: 0; z-index: 100; background: rgba(4, 6, 10, .6); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--border-2); border-radius: 18px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7); animation: pop .2s var(--ease); }
.modal.lg { max-width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--surface); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* Bildirim */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px; padding: 13px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border-2); box-shadow: var(--shadow); animation: pop .25s var(--ease); font-size: 13.5px; }
.toast svg { width: 18px; height: 18px; flex: none; }
.toast.ok svg { color: var(--ok); } .toast.err svg { color: var(--err); } .toast.info svg { color: var(--info); }
.toast.err { border-color: color-mix(in srgb, var(--err) 40%, var(--border-2)); }

/* Kimlik doğrulama ekranı */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; position: relative; z-index: 1; }
.auth-hero { padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; border-right: 1px solid var(--border); }
.auth-hero::before { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; left: -120px; bottom: -180px; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 35%, transparent), transparent 65%); filter: blur(20px); }
.auth-hero::after { content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%; right: -120px; top: -100px; background: radial-gradient(circle, color-mix(in srgb, var(--accent-2) 30%, transparent), transparent 65%); filter: blur(20px); }
.auth-hero h1 { font-size: 46px; line-height: 1.08; max-width: 520px; position: relative; z-index: 1; }
.auth-hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-hero ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; position: relative; z-index: 1; color: var(--fg-2); }
.auth-hero li { display: flex; gap: 10px; align-items: center; }
.auth-hero li svg { width: 18px; height: 18px; color: var(--accent); }
.auth-form { display: grid; place-items: center; padding: 32px 16px; }
.auth-form .card { width: 100%; max-width: 400px; padding: 32px; }

/* Duyarlı */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .g-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 60; width: 270px; transform: translateX(-100%); transition: transform .25s var(--ease); background: var(--bg-2); }
  .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .menu-btn { display: inline-flex; }
  .content { padding: 18px 16px; }
  .topbar { padding: 12px 16px; }
  .g2, .g4 { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .html-split { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .editor-bar .title-input { width: 160px; }
}
