:root {
  --bg: #f6f6f9; --panel: #ffffff; --panel-2: #fafafc; --line: #e7e7ef; --line-2: #d9d9e5;
  --text: #1c1c26; --muted: #6b6b7e; --faint: #9a9aab;
  --accent: #6d4aff; --accent-2: #5a38ee; --accent-soft: #efeaff;
  --ok: #138a54; --ok-soft: #e3f6ec; --warn: #b26a00; --warn-soft: #fff3dc;
  --bad: #c62f3b; --bad-soft: #fde8ea; --info: #1d6fd6; --info-soft: #e5f0fd;
  --radius: 10px; --shadow: 0 1px 2px rgba(20,20,40,.05), 0 4px 16px rgba(20,20,40,.05);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111117; --panel: #18181f; --panel-2: #1d1d26; --line: #2a2a35; --line-2: #363644;
    --text: #ececf3; --muted: #9d9db0; --faint: #6e6e80;
    --accent: #8b70ff; --accent-2: #9d86ff; --accent-soft: #2a2347;
    --ok: #3ccf8e; --ok-soft: #173327; --warn: #f0b04c; --warn-soft: #3a2d15;
    --bad: #ff6b76; --bad-soft: #3d1d22; --info: #6aa8ff; --info-soft: #1a2940;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; letter-spacing: -.2px; }
h2 { font-size: 15px; margin: 0 0 10px; }
h3 { font-size: 13px; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; } .row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; } .right { margin-left: auto; }
.hidden { display: none !important; }

/* Yerleşim */
.app { display: grid; grid-template-columns: 216px 1fr; height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 10px; gap: 2px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; padding: 4px 10px 16px; }
.brand img { width: 22px; height: 22px; }
.brand small { font-weight: 500; color: var(--muted); font-size: 12px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); font-weight: 500; }
.nav a:hover { background: var(--panel-2); text-decoration: none; }
.nav a.on { background: var(--accent-soft); color: var(--accent); }
.nav .ico { width: 18px; text-align: center; opacity: .85; }
.nav .badge { margin-left: auto; }
.side .foot { margin-top: auto; padding: 10px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.main { overflow: auto; }
.page { padding: 22px 26px 60px; max-width: 1400px; }
.page.full { max-width: none; height: 100vh; display: flex; flex-direction: column; padding-bottom: 16px; }
.head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }

/* Bileşenler */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .v { font-size: 24px; font-weight: 700; letter-spacing: -.5px; margin-top: 2px; }
.kpi .l { font-size: 12px; color: var(--muted); }
.kpi .s { font-size: 12px; color: var(--faint); }
button, .btn { font: inherit; border: 1px solid var(--line-2); background: var(--panel); color: var(--text); border-radius: 8px; padding: 7px 12px; cursor: pointer; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
button:hover { border-color: var(--faint); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-2); }
button.danger { color: var(--bad); }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover { background: var(--panel-2); }
button.sm { padding: 4px 9px; font-size: 12px; }
button.ai { background: linear-gradient(135deg, #7b5cff, #b04cff); border: 0; color: #fff; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 10px; outline: none; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; width: 100%; }
textarea.code { font-family: var(--mono); font-size: 12.5px; line-height: 1.55; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
label.f > input, label.f > select, label.f > textarea { color: var(--text); font-size: 14px; }
.check { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 1px 8px; font-size: 11.5px; font-weight: 600; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.pill.acc { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tag { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 0 7px; font-size: 12px; }
.tag button { border: 0; background: none; padding: 0; color: inherit; font-size: 13px; line-height: 1; }
.badge { background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 0 7px; line-height: 18px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--faint); }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }
.empty { padding: 36px; text-align: center; color: var(--muted); }
.sep { height: 1px; background: var(--line); margin: 12px 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 12px; color: var(--muted); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }

/* Tablo */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--panel-2); position: sticky; top: 0; z-index: 1; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--panel-2); }
.tbl .nm { font-weight: 600; } .tbl .em { color: var(--muted); font-size: 12px; }
.tblwrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.score { display: inline-block; min-width: 30px; text-align: center; font-weight: 700; font-size: 12px; border-radius: 6px; padding: 1px 6px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 10px; color: var(--muted); font-size: 12px; }

/* Filtre çubuğu */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 10px; }
.filters input, .filters select { padding: 6px 8px; font-size: 13px; }
.aibar { display: flex; gap: 8px; align-items: center; background: linear-gradient(135deg, var(--accent-soft), transparent); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 10px; }
.aibar input { flex: 1; }
.aiout { font-size: 13px; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--panel); border-radius: 0 8px 8px 0; margin-bottom: 10px; }

/* Çekmece + modal */
.scrim { position: fixed; inset: 0; background: rgba(10,10,20,.35); z-index: 40; display: flex; justify-content: flex-end; }
.drawer { width: min(720px, 100vw); height: 100%; background: var(--bg); overflow: auto; box-shadow: -8px 0 30px rgba(0,0,0,.15); animation: slide .16s ease-out; }
.drawer .dh { position: sticky; top: 0; background: var(--panel); border-bottom: 1px solid var(--line); padding: 14px 18px; display: flex; gap: 10px; align-items: center; z-index: 2; }
.drawer .db { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
@keyframes slide { from { transform: translateX(30px); opacity: .5; } }
.scrim.center { justify-content: center; align-items: center; padding: 16px; }
.modal { background: var(--panel); border-radius: 14px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: var(--shadow); }
.modal.wide { width: min(900px, 100%); }
.modal .mh { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; font-weight: 700; }
.modal .mb { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.modal .mf { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.x { margin-left: auto; border: 0; background: none; font-size: 20px; color: var(--muted); padding: 0 4px; }

/* Zaman çizelgesi */
.tl { display: flex; flex-direction: column; gap: 0; }
.tl .it { display: grid; grid-template-columns: 26px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.tl .it:last-child { border-bottom: 0; }
.tl .ic { width: 26px; height: 26px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line); display: grid; place-items: center; font-size: 12px; }
.tl .body { white-space: pre-wrap; word-break: break-word; }
.tl .meta { font-size: 11.5px; color: var(--faint); }

/* Gelen kutusu */
.inbox { display: grid; grid-template-columns: 360px 1fr; gap: 0; flex: 1; min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ilist { border-right: 1px solid var(--line); overflow: auto; display: flex; flex-direction: column; }
.ilist .tools { padding: 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; position: sticky; top: 0; background: var(--panel); z-index: 1; }
.ilist .tabs { margin: 0; border: 0; }
.ii { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.ii:hover { background: var(--panel-2); }
.ii.on { background: var(--accent-soft); }
.ii .t { display: flex; gap: 6px; align-items: center; }
.ii .who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ii.unread .who::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: 1px; }
.ii .sub { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ii .pre { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ithread { display: flex; flex-direction: column; min-height: 0; }
.ithread .th { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ithread .msgs { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--bg); }
.msg { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; max-width: 86%; }
.msg.out { align-self: flex-end; background: var(--accent-soft); border-color: transparent; }
.msg.camp { align-self: flex-end; background: var(--panel-2); border-style: dashed; }
.msg.auto { opacity: .7; }
.msg .mhd { font-size: 12px; color: var(--muted); display: flex; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.msg .mbd { white-space: pre-wrap; word-break: break-word; }
.msg .quote { color: var(--faint); }
.composer { border-top: 1px solid var(--line); padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; background: var(--panel); }
.composer textarea { min-height: 110px; }

/* Kanban */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; flex: 1; min-height: 0; align-items: flex-start; }
.lane { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); width: 272px; flex: 0 0 272px; display: flex; flex-direction: column; max-height: 100%; }
.lane .lh { padding: 10px 12px; display: flex; gap: 6px; align-items: center; border-bottom: 1px solid var(--line); }
.lane .lh b { font-size: 13px; }
.lane .lv { font-size: 12px; color: var(--muted); }
.lane .cards { padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow: auto; min-height: 60px; }
.lane.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.lane.won .lh { border-top: 3px solid var(--ok); border-radius: var(--radius) var(--radius) 0 0; }
.lane.lost .lh { border-top: 3px solid var(--bad); border-radius: var(--radius) var(--radius) 0 0; }
.deal { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; cursor: grab; box-shadow: var(--shadow); }
.deal:active { cursor: grabbing; }
.deal .dt { font-weight: 600; font-size: 13px; }
.deal .dc { font-size: 12px; color: var(--muted); }
.deal .dv { font-size: 12px; font-weight: 600; }
.deal.dragging { opacity: .4; }

/* Şablon/kampanya editörü */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.preview { width: 100%; height: 640px; border: 1px solid var(--line); border-radius: var(--radius); background: #f4f4f7; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips button { font-family: var(--mono); font-size: 11.5px; padding: 2px 7px; }
.list-side { display: grid; grid-template-columns: 280px 1fr; gap: 14px; align-items: start; }
.li { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.li:hover { background: var(--panel-2); } .li.on { background: var(--accent-soft); }
.funnel { display: flex; flex-direction: column; gap: 8px; }
.fbar { display: grid; grid-template-columns: 110px 1fr 90px; gap: 10px; align-items: center; font-size: 13px; }
.fbar .track { height: 10px; background: var(--panel-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.fbar .fill { height: 100%; background: var(--accent); border-radius: 999px; }
.steps { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.steps .st { padding: 3px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.steps .st.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.steps .st.done { background: var(--ok-soft); color: var(--ok); border-color: transparent; }

/* Toast */
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 99; }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow); max-width: 420px; animation: slide .16s ease-out; }
.toast.err { background: var(--bad); color: #fff; }
.spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side { flex-direction: row; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand small, .side .foot { display: none; }
  .nav { display: flex; gap: 2px; } .nav a span.lbl { display: none; }
  .g2, .g3, .editor, .list-side, .inbox { grid-template-columns: 1fr; }
  .page { padding: 16px; }
}
