/* LeadOS — profesyonel "defter" arayüzü
   Palet: Lacivert Mürekkep #0a1c33 · Kağıt #f3f5f9 · Defter Altını #b08a3e/#c9a961 · CRM Moru #7c5cbf
   Tip: Sora (rakam/başlık) + Inter (metin) · İmza: çift altın defter çizgisi (KPI, başlık, marka) */

:root {
  --ink: #0a1c33;
  --ink-2: #0e2242;
  --ink-3: #1b3a63;
  --bg: #f3f5f9;
  --card: #ffffff;
  --line: #e2e8f1;
  --line-soft: #edf1f7;
  --text: #1b2a3f;
  --muted: #64748b;
  --gold: #b08a3e;
  --gold-2: #c9a961;
  --gold-soft: #f7f1e3;
  --ok: #157f4a;
  --ok-soft: #e2f3ea;
  --warn: #a15c07;
  --warn-soft: #fdf0dc;
  --err: #b3352e;
  --err-soft: #fbe9e7;
  --crm: #7c5cbf;
  --radius: 13px;
  --shadow: 0 1px 2px rgba(10,28,51,.05), 0 10px 28px -22px rgba(10,28,51,.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 400 14px/1.55 Inter, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: Sora, Inter, sans-serif; color: var(--ink); margin: 0; }
a { color: var(--ink-3); }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); }
code { background: var(--line-soft); border-radius: 5px; padding: 1px 5px; font-size: 12px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

/* İmza: çift altın defter çizgisi */
.rule { display: inline-block; border-bottom: 3px double var(--gold-2); padding-bottom: 5px; }

/* ---------- Yerleşim ---------- */

.layout { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }

.sidebar {
  background: linear-gradient(178deg, var(--ink) 0%, var(--ink-2) 100%);
  color: #c6d2e4;
  padding: 22px 14px 16px;
  display: flex; flex-direction: column; gap: 3px;
  position: sticky; top: 0; height: 100vh;
}
.brand { padding: 0 10px 20px; }
.brand .name {
  font-family: Sora, sans-serif; font-weight: 700; font-size: 21px; color: #fff;
  letter-spacing: .02em; display: inline-block;
  border-bottom: 3px double var(--gold-2); padding-bottom: 6px;
}
.brand .sub { font-size: 10.5px; color: #7e92ae; margin-top: 8px; letter-spacing: .1em; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 9px; border: 0; background: none;
  color: #bfcbde; text-align: left; width: 100%; font-size: 13.5px; font-weight: 500;
  transition: background .12s ease, color .12s ease;
}
.nav-item svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; flex: none; opacity: .9; }
.nav-item .pmark { width: 11px; height: 11px; border-radius: 3.5px; flex: none; margin: 0 2.5px; }
.nav-item .lbl { flex: 1; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(201,169,97,.15); color: #fff; box-shadow: inset 3px 0 0 var(--gold-2); }
.nav-item .dot { width: 7px; height: 7px; border-radius: 50%; background: #3d4b64; flex: none; }
.nav-item .dot.on { background: #3ecf8e; box-shadow: 0 0 7px rgba(62,207,142,.85); }
.nav-sep { border: 0; border-top: 1px solid rgba(255,255,255,.09); margin: 9px 6px; width: auto; }
.sidebar .foot { margin-top: auto; padding: 10px; font-size: 11px; color: #7e92ae; display: grid; gap: 8px; }
.sidebar .foot button { background: none; border: 1px solid rgba(255,255,255,.22); color: #c6d2e4; border-radius: 7px; padding: 5px 10px; width: fit-content; }
.sidebar .foot button:hover { border-color: var(--gold-2); color: #fff; }

.main { padding: 0 30px 56px; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 18px 0 14px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.topbar h1 { font-size: 19px; font-weight: 600; margin-right: auto; }
.range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range input[type="date"], .range select {
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; background: var(--card); font-size: 13px;
}
.range-sep { color: var(--muted); }

#view { padding-top: 20px; display: grid; gap: 18px; }

/* ---------- Kart / bölüm ---------- */

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px;
}
.card.accent { border-left: 5px double var(--gold-2); }
.card > h2 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.card .hint, .hint { font-size: 12px; color: var(--muted); }

.deck-head { display: flex; align-items: baseline; gap: 12px; margin: 4px 2px 10px; }
.deck-head .overline {
  font-family: Sora, sans-serif; font-weight: 600; font-size: 12px; letter-spacing: .14em;
  color: var(--ink); text-transform: uppercase;
  border-bottom: 3px double var(--gold-2); padding-bottom: 5px;
}
.deck-head .cmp { margin-left: auto; font-size: 11.5px; color: var(--muted); }

/* ---------- KPI ---------- */

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 11px; }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px 11px; box-shadow: var(--shadow); position: relative;
}
.kpi .label { font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.kpi .value {
  font-family: Sora, sans-serif; font-weight: 600; font-size: 21px; color: var(--ink);
  font-variant-numeric: tabular-nums; line-height: 1.3; margin-top: 5px;
  display: inline-block; border-bottom: 3px double var(--gold-2); padding-bottom: 4px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kpi.crm .value { border-bottom-color: var(--crm); }
.kpi .foot { font-size: 11px; color: var(--muted); margin-top: 6px; }
.delta {
  position: absolute; top: 10px; right: 10px;
  font-size: 10.5px; font-weight: 600; border-radius: 99px; padding: 2px 7px;
  font-variant-numeric: tabular-nums;
}
.delta.good { background: var(--ok-soft); color: var(--ok); }
.delta.bad { background: var(--err-soft); color: var(--err); }
.delta.neu { background: var(--line-soft); color: var(--muted); }

/* ---------- Grafik bölgesi ---------- */

.grid2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; }
.chart-box { position: relative; height: 296px; }
.chart-box.sm { height: 250px; }

/* ---------- Huni ---------- */

.funnel { display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap; }
.fstage { flex: 1; min-width: 130px; background: var(--line-soft); border-radius: 10px; padding: 12px 14px; }
.fstage .fnum { font-family: Sora, sans-serif; font-weight: 600; font-size: 22px; color: var(--ink); font-variant-numeric: tabular-nums; }
.fstage .flab { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin-top: 2px; }
.fstage.won { background: var(--gold-soft); }
.fconv { align-self: center; text-align: center; min-width: 64px; }
.fconv .pct { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.fconv .arr { color: var(--gold); font-size: 15px; line-height: 1; }
.fconv .cl { font-size: 10px; color: var(--muted); }

/* ---------- Tablolar ---------- */

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; max-height: 520px; background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: 13px; background: var(--card); }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
thead th {
  position: sticky; top: 0; background: #f7f9fc; z-index: 1;
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600;
}
tbody tr:hover { background: #fafbfe; }
tfoot td { font-weight: 600; background: var(--gold-soft); border-top: 2px solid var(--gold-2); position: sticky; bottom: 0; }
.cell-sub { color: var(--muted); font-size: 11.5px; }
.srcmark { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 8px; vertical-align: baseline; }

/* ---------- Form / düğme ---------- */

.btn {
  border: 1px solid var(--ink); background: var(--ink); color: #fff;
  border-radius: 9px; padding: 8px 15px; font-weight: 500; font-size: 13.5px;
  transition: background .12s ease, border-color .12s ease; text-decoration: none; display: inline-block;
}
.btn:hover { background: var(--ink-3); }
.btn.ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink-3); }
.btn.gold { background: var(--gold); border-color: var(--gold); }
.btn.gold:hover { background: #9a7834; border-color: #9a7834; }
.btn.danger { background: var(--card); color: var(--err); border-color: #e6b6b3; }
.btn.danger:hover { border-color: var(--err); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: default; }

.field { display: grid; gap: 5px; min-width: 0; }
.field label { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; width: 100%; font-size: 13.5px;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; border-radius: 99px; padding: 3px 10px; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.off { background: var(--line-soft); color: var(--muted); }

.note { font-size: 12.5px; color: var(--muted); background: #f7f9fc; border: 1px dashed var(--line); border-radius: 9px; padding: 9px 12px; }
.error-chip { font-size: 12.5px; color: var(--err); background: var(--err-soft); border-radius: 9px; padding: 8px 12px; }

/* ---------- Kurulum adımları / bağlantılar ---------- */

.conn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.conn-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.conn-head .pmark { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.conn-head h2 { font-size: 15px; margin-right: auto; }
.steps { margin: 4px 0 12px; padding: 0 0 0 4px; list-style: none; counter-reset: st; display: grid; gap: 6px; }
.steps li { counter-increment: st; display: flex; align-items: baseline; gap: 9px; font-size: 12.5px; color: var(--muted); }
.steps li::before {
  content: counter(st); flex: none;
  width: 18px; height: 18px; border-radius: 50%; background: var(--ink); color: #fff;
  font-size: 10.5px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
  transform: translateY(2px);
}
.steps li.done::before { content: "✓"; background: var(--ok); }
.callback-box {
  display: flex; gap: 8px; align-items: center; background: var(--ink); color: #dbe5f2;
  border-radius: 9px; padding: 9px 12px; font-family: ui-monospace, monospace; font-size: 12px;
  overflow: auto; white-space: nowrap;
}
.callback-box .btn { background: #fff; }

/* ---------- Zoho alan seçici ---------- */

.field-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px 14px; max-height: 300px; overflow: auto;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fbfcfe;
}
.field-check { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 2px; }
.field-check .type { color: var(--muted); font-size: 11px; margin-left: auto; }
.field-check.hide { display: none; }

/* ---------- Giriş kapısı ---------- */

#gate {
  position: fixed; inset: 0; background: linear-gradient(160deg, var(--ink) 0%, var(--ink-2) 70%);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
#gate.show { display: flex; }
.gate-card { background: var(--card); border-radius: 16px; padding: 36px; width: 384px; max-width: 100%; box-shadow: 0 26px 64px -22px rgba(0,0,0,.55); }
.gate-card .name { font-family: Sora, sans-serif; font-weight: 700; font-size: 24px; color: var(--ink); display: inline-block; border-bottom: 3px double var(--gold-2); padding-bottom: 6px; }
.gate-card h2 { margin-top: 18px; font-size: 16.5px; }
.gate-card p { color: var(--muted); font-size: 13px; }
.gate-card form { display: grid; gap: 12px; margin-top: 14px; }

/* ---------- Toast ---------- */

#toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 60; }
.toast {
  background: var(--ink); color: #fff; border-radius: 10px; padding: 11px 16px;
  font-size: 13px; box-shadow: var(--shadow); max-width: 400px;
}
.toast.err { background: var(--err); }
.toast.ok { background: var(--ok); }

.skeleton { color: var(--muted); font-size: 13px; padding: 14px 4px; }

/* ---------- Duyarlılık / hareket ---------- */

@media (max-width: 1080px) {
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; }
  .brand { padding: 0 8px; }
  .brand .sub { display: none; }
  .nav-item { width: auto; }
  .nav-item .lbl { flex: none; }
  .nav-sep, .sidebar .foot span { display: none; }
  .sidebar .foot { margin: 0 0 0 auto; padding: 0; }
  .main { padding: 0 14px 44px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
