/* Lobbi Reklam Paneli */
:root {
  --bg: #f5f6fa;
  --panel: #ffffff;
  --panel-2: #f9fafc;
  --line: #e6e8ef;
  --text: #1b1e2b;
  --muted: #6b7185;
  --brand: #5046e5;
  --brand-2: #7c6cf6;
  --brand-soft: #eeedfd;
  --ok: #12a150;  --ok-soft: #e5f6ec;
  --warn: #c77c02; --warn-soft: #fdf3dd;
  --bad: #d93b3b; --bad-soft: #fce8e8;
  --info: #2563eb; --info-soft: #e6effd;
  --shadow: 0 1px 2px rgba(20,23,40,.04), 0 4px 16px rgba(20,23,40,.05);
  --radius: 12px;
  --side: 236px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1117; --panel: #171a23; --panel-2: #1c2029; --line: #2a2f3c;
    --text: #e8eaf2; --muted: #9097ab; --brand: #7c73ff; --brand-2: #9a8cff; --brand-soft: #25234a;
    --ok: #3ccf7e; --ok-soft: #173325; --warn: #f0b340; --warn-soft: #3a2e14;
    --bad: #ff6b6b; --bad-soft: #3d1c1f; --info: #6aa1ff; --info-soft: #182744;
    --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1117; --panel: #171a23; --panel-2: #1c2029; --line: #2a2f3c;
  --text: #e8eaf2; --muted: #9097ab; --brand: #7c73ff; --brand-2: #9a8cff; --brand-soft: #25234a;
  --ok: #3ccf7e; --ok-soft: #173325; --warn: #f0b340; --warn-soft: #3a2e14;
  --bad: #ff6b6b; --bad-soft: #3d1c1f; --info: #6aa1ff; --info-soft: #182744;
  --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
small, .muted { color: var(--muted); }
code { font-size: 12px; background: var(--panel-2); padding: 1px 5px; border-radius: 5px; border: 1px solid var(--line); }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------- iskelet ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: var(--side); flex: 0 0 var(--side); background: var(--panel); border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 12px; overflow-y: auto;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 10px 18px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 800;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}
.brand b { display: block; font-size: 15px; }
.brand small { font-size: 11px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 10px 6px; }
.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(--brand-soft); color: var(--brand); }
.nav a svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: .85; }
.nav .badge { margin-left: auto; }
.side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); font-size: 12px; }
.side-foot b { display: block; font-size: 13px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--line);
  background: var(--panel); position: sticky; top: 0; z-index: 20;
}
.top .grow { flex: 1; }
.top .burger { display: none; }
.content { padding: 24px 28px 60px; max-width: 1500px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 200px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ---------- bileşenler ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-h .grow { flex: 1; }
.card-b { padding: 18px; }
.card-b.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.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-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.mt { margin-top: 16px; } .mt2 { margin-top: 24px; } .mb { margin-bottom: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi .v { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .d { font-size: 12px; margin-top: 2px; font-weight: 600; }
.up { color: var(--ok); } .down { color: var(--bad); } .flat { color: var(--muted); }
.kpi .d.inv.up { color: var(--bad); } .kpi .d.inv.down { color: var(--ok); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); padding: 7px 13px; border-radius: 8px; font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--panel-2); text-decoration: none; }
.btn.pri { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.pri:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { color: var(--bad); }
.btn.danger.fill { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.sm { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
.btn[disabled], .btn.busy { opacity: .55; pointer-events: none; }
.btn svg { width: 16px; height: 16px; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px;
  border-radius: 99px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.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.brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.pill.plain::before { display: none; }
.badge { background: var(--bad); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 700; padding: 0 7px; line-height: 18px; }
.badge.brand { background: var(--brand); }

.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); white-space: nowrap;
  position: sticky; top: 0;
}
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tbody tr:hover { background: var(--panel-2); }
.tbl .name { font-weight: 600; max-width: 360px; }
.tbl .name small { display: block; font-weight: 400; }
.tbl tr.child td { background: var(--panel-2); }
.tbl tr.child td:first-child { padding-left: 34px; }
.tbl tr.child2 td:first-child { padding-left: 58px; }
.tbl .exp { cursor: pointer; }
.tbl .caret { display: inline-block; width: 14px; transition: transform .15s; color: var(--muted); }
.tbl tr.open .caret { transform: rotate(90deg); }
.thumb { width: 38px; height: 38px; border-radius: 6px; object-fit: cover; background: var(--line); vertical-align: middle; margin-right: 8px; }

.form { display: grid; gap: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=date],
input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 11px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--brand); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; padding: 2px; background: var(--panel-2); flex-wrap: wrap; }
.seg a, .seg button { padding: 5px 11px; border-radius: 7px; color: var(--muted); font-weight: 550; font-size: 13px; border: 0; background: none; cursor: pointer; font-family: inherit; }
.seg a:hover { text-decoration: none; color: var(--text); }
.seg .on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }

.alert { display: flex; gap: 12px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); }
.alert + .alert { margin-top: 8px; }
.alert .ic { width: 8px; border-radius: 4px; flex: 0 0 4px; background: var(--muted); }
.alert.critical .ic, .alert.bad .ic { background: var(--bad); }
.alert.warn .ic { background: var(--warn); }
.alert.info .ic, .alert.ok .ic { background: var(--info); }
.alert .t { font-weight: 600; }
.alert .grow { flex: 1; min-width: 0; }
.notice { padding: 12px 14px; border-radius: 10px; background: var(--info-soft); color: var(--text); border: 1px solid transparent; }
.notice.warn { background: var(--warn-soft); }
.notice.bad { background: var(--bad-soft); }
.notice.ok { background: var(--ok-soft); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; opacity: .5; margin-bottom: 8px; }

.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 180px; }

.score { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 20px; flex: 0 0 64px;
  background: conic-gradient(var(--c, var(--brand)) calc(var(--p) * 1%), var(--line) 0); position: relative; }
.score::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--panel); }
.score span { position: relative; z-index: 1; }

.rec { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: var(--panel); }
.rec + .rec { margin-top: 10px; }
.rec .h { display: flex; gap: 8px; align-items: flex-start; }
.rec .h .grow { flex: 1; }
.rec p { margin: 6px 0 0; color: var(--muted); }
.rec .acts { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

.chat { display: flex; flex-direction: column; height: 560px; }
.chat .log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 12px; line-height: 1.55; }
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.assistant p { margin: 0 0 8px; } .msg.assistant p:last-child { margin: 0; }
.msg.assistant ul { margin: 4px 0 8px; padding-left: 18px; }
.chat form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat textarea { min-height: 42px; height: 42px; }
.typing { color: var(--muted); font-style: italic; }

.steps { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.steps button { flex: 1; min-width: 120px; text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 10px 12px; cursor: pointer; font: inherit; color: var(--muted); }
.steps button b { display: block; color: var(--text); font-size: 13px; }
.steps button.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.steps button.done b::after { content: " ✓"; color: var(--ok); }
.step { display: none; } .step.on { display: block; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 6px; background: var(--brand-soft); color: var(--brand); padding: 3px 6px 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; }
.tag button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 3px; }
.ac { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); max-height: 260px; overflow-y: auto; margin-top: 4px; }
.ac-list div { padding: 8px 11px; cursor: pointer; }
.ac-list div:hover { background: var(--panel-2); }
.ac-list small { display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); padding: 6px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; background: var(--panel); }
.chips input { accent-color: var(--brand); }
.chips label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }

.preview { max-width: 380px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); }
.preview .ph { display: flex; gap: 8px; align-items: center; padding: 10px 12px; }
.preview .ph i { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); display: block; }
.preview .ph b { font-size: 13px; display: block; } .preview .ph small { font-size: 11px; }
.preview .txt { padding: 0 12px 10px; white-space: pre-wrap; font-size: 13px; }
.preview .img { aspect-ratio: 1.91/1; background: var(--panel-2) center/cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.preview .foot { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--panel-2); }
.preview .foot .grow { flex: 1; min-width: 0; }
.preview .foot small { display: block; text-transform: uppercase; font-size: 10.5px; }
.preview .foot b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.media-grid .m { border: 2px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer; position: relative; background: var(--panel-2); }
.media-grid .m img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.media-grid .m.on { border-color: var(--brand); }
.media-grid .m small { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 10.5px; padding: 2px 5px; }
.drop { border: 2px dashed var(--line); border-radius: 10px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; }
.drop.over { border-color: var(--brand); background: var(--brand-soft); }

.log-box { background: #0f1220; color: #cfd6ee; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 12px 14px; border-radius: 10px; max-height: 280px; overflow-y: auto; white-space: pre-wrap; }

.modal-bg { position: fixed; inset: 0; background: rgba(12,14,24,.5); display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal-bg.on { display: flex; }
.modal { background: var(--panel); border-radius: 14px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal .card-h { position: sticky; top: 0; background: var(--panel); }

.toast-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--text); color: var(--panel); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: 420px; animation: tin .2s ease-out; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }

.acc-card { display: block; color: inherit; }
.acc-card:hover { text-decoration: none; border-color: var(--brand); }
.acc-card .row { justify-content: space-between; }
.mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.mini div small { display: block; font-size: 11.5px; }
.mini div b { font-variant-numeric: tabular-nums; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background:
  radial-gradient(1200px 500px at 10% -10%, var(--brand-soft), transparent), var(--bg); }
.login .card { width: 100%; max-width: 380px; }

.md h1, .md h2, .md h3 { margin: 10px 0 6px; font-size: 14px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }

/* ---------- mobil ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g-main, .g3 { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 800px) {
  .side { position: fixed; left: 0; top: 0; z-index: 90; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .side.on { transform: none; }
  .top { padding: 12px 16px; }
  .top .burger { display: inline-flex; }
  .content { padding: 16px 16px 60px; }
  .g2, .g4 { grid-template-columns: minmax(0,1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .kpi .v { font-size: 19px; }
  .hide-m { display: none !important; }
  .chat { height: 70vh; }
}

/* yapay zekâ yardımcıları */
.ai-bar { border-color: var(--brand); background: linear-gradient(135deg, var(--brand-soft), var(--panel) 60%); }
.ai-ic { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.ai-ic svg { width: 20px; height: 20px; }
.ai-mini { border: 1px solid var(--line); background: var(--panel); color: var(--brand); border-radius: 6px; line-height: 0; padding: 3px; cursor: pointer; vertical-align: -3px; margin-left: 4px; }
.ai-mini svg { width: 13px; height: 13px; }
.ai-mini:hover { border-color: var(--brand); background: var(--brand-soft); }
.ai-mini.busy { opacity: .5; pointer-events: none; animation: nabiz 1s infinite; }
@keyframes nabiz { 50% { opacity: .2; } }
.field { position: relative; }
.ai-pop { position: absolute; z-index: 40; left: 0; right: 0; top: 100%; margin-top: 4px; background: var(--panel); border: 1px solid var(--brand); border-radius: 10px; box-shadow: var(--shadow); padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.ai-pop button { text-align: left; border: 1px solid var(--line); background: var(--panel-2); border-radius: 8px; padding: 8px 10px; font: inherit; color: var(--text); cursor: pointer; white-space: pre-wrap; }
.ai-pop button:hover { border-color: var(--brand); background: var(--brand-soft); }
.ai-pop button.kapat { background: none; border: 0; color: var(--muted); text-align: right; padding: 2px; }
.ai-flash { animation: parla 1.6s ease-out; }
@keyframes parla { 0% { box-shadow: 0 0 0 3px var(--brand); } 100% { box-shadow: 0 0 0 3px transparent; } }

.harita { height: 340px; border-radius: 10px; border: 1px solid var(--line); margin-top: 8px; z-index: 0; }
.leaflet-container { font: inherit; }
