/* Rakip analizi paneli – style.css üzerine ek stiller */
:root { --client: var(--accent); --branch: color-mix(in srgb, var(--accent) 55%, var(--surface)); --rival: #94a3b8; }
@media (prefers-color-scheme: dark) { :root { --rival: #64748b; } }

.mainnav { display: flex; gap: 4px; margin-right: auto; margin-left: 28px; }
.mainnav a, .mainnav .soon { padding: 7px 12px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--text-2); }
.mainnav a:hover { background: var(--surface-2); text-decoration: none; }
.mainnav a.on { background: var(--accent-soft); color: var(--accent); }
.mainnav .soon { color: var(--muted); cursor: default; }
.mainnav .soon small { font-size: 10.5px; background: var(--surface-2); padding: 1px 6px; border-radius: 99px; margin-left: 4px; }

.panel-main { padding-top: 28px; padding-bottom: 60px; min-height: 70vh; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: clamp(22px, 3vw, 30px); font-weight: 800; letter-spacing: -.01em; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.danger:hover { border-color: var(--fail); color: var(--fail); }
.link-btn { border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* rol bazlı görünürlük */
body:not([data-role="yonetici"]) .admin-only { display: none !important; }
body[data-role="musteri"] .agency-only, body:not([data-role]) .agency-only { display: none !important; }
.user-chip { max-width: 200px; }
.user-chip .lbl-t { overflow: hidden; text-overflow: ellipsis; }
.client-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; max-height: 200px; overflow: auto;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-weight: 500; color: var(--text); }
.client-checks label { display: flex; gap: 8px; align-items: center; font-size: 13.5px; }
.client-checks input { accent-color: var(--accent); width: 16px !important; height: 16px; padding: 0 !important; flex: none; }
.readonly-note { background: var(--surface-2); border-radius: 10px; padding: 10px 14px; font-size: 13px; color: var(--text-2); margin-bottom: 16px; }

/* müşteri kartları */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.client-card { display: block; color: var(--text); padding: 18px; transition: border-color .15s, transform .1s; }
.client-card:hover { border-color: var(--accent); text-decoration: none; }
.client-card h3 { font-size: 17px; margin-bottom: 4px; }
.client-card .meta { color: var(--muted); font-size: 13px; }
.client-card .row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.onboard { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 16px; }
.onboard .card { padding: 18px; }
.onboard .num { width: 30px; height: 30px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; margin-bottom: 10px; }
.onboard h3 { font-size: 15px; margin-bottom: 4px; }
.onboard p { margin: 0; font-size: 13.5px; color: var(--text-2); }

/* sekmeler */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; padding: 10px 14px; font-weight: 600; font-size: 14px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.subtabs button { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 99px; cursor: pointer; }
.subtabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.subtabs button small { opacity: .75; margin-left: 4px; }

/* tarama ilerleme */
.scan-card { margin-bottom: 20px; }
.scan-card .bar { margin: 12px 0; }
.task-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px; font-size: 13px; max-height: 260px; overflow: auto; }
.task { display: grid; grid-template-columns: 18px 1fr; gap: 8px; align-items: start; }
.task .d { width: 14px; height: 14px; border-radius: 50%; margin-top: 3px; border: 2px solid var(--border); }
.task.running .d { border-color: var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
.task.done .d { background: var(--pass); border-color: var(--pass); }
.task.error .d { background: var(--warn); border-color: var(--warn); }
.task .n { color: var(--muted); font-size: 12px; display: block; word-break: break-word; }

/* konum kutucukları */
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.pos { padding: 14px 16px; }
.pos .ch { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pos .lb { font-weight: 600; font-size: 14px; margin: 2px 0 8px; }
.pos .val { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pos .rk { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; margin-left: 8px; }
.pos .ld { font-size: 12.5px; color: var(--text-2); margin-top: 6px; }
.rk.good { color: var(--pass); } .rk.mid { color: var(--text-2); } .rk.bad { color: var(--fail); }

/* karşılaştırma tablosu */
.cmp td, .cmp th { white-space: nowrap; }
.cmp td.nm { white-space: normal; min-width: 160px; font-weight: 600; }
.cmp tr.is-client td { background: var(--accent-soft); }
.cmp td.lead { font-weight: 800; }
.cmp td.lead::after { content: " ★"; color: var(--warn); font-size: 11px; }
.cmp td.err { color: var(--muted); font-style: italic; }
.role { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 99px; margin-left: 6px; vertical-align: 1px; text-transform: uppercase; letter-spacing: .04em; }
.role.ana { background: var(--accent); color: #fff; }
.role.sube { background: var(--accent-soft); color: var(--accent); }
.role.rakip { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.src { font-size: 10.5px; font-weight: 700; color: var(--warn); margin-left: 4px; }
.th-sort { font-size: 10px; color: var(--muted); font-weight: 500; display: block; text-transform: none; }

/* yatay çubuk grafik */
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; margin-top: 16px; }
.chart-card h4 { font-size: 14px; margin-bottom: 2px; }
.chart-card .cap { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; gap: 8px; align-items: center; padding: 4px 0; font-size: 12.5px; cursor: default; }
.hbar .hl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.hbar.client .hl { color: var(--text); font-weight: 700; }
.hbar .tr { height: 14px; position: relative; }
.hbar .fl { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; background: var(--rival); min-width: 2px; }
.hbar.client .fl { background: var(--client); }
.hbar.sube .fl { background: var(--branch); }
.hbar .hv { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); min-width: 46px; text-align: right; }
.hbar:hover .fl { filter: brightness(1.12); }
.hbar.empty .hv { color: var(--muted); font-weight: 400; }

/* çizgi grafik */
.line-wrap { position: relative; }
.line-wrap svg { width: 100%; height: 150px; display: block; overflow: visible; }
.line-wrap .grid { stroke: var(--border); stroke-width: 1; }
.line-wrap .ln { fill: none; stroke: var(--client); stroke-width: 2; }
.line-wrap .pt { fill: var(--client); stroke: var(--surface); stroke-width: 2; }
.line-wrap .ax { fill: var(--muted); font-size: 10.5px; font-family: inherit; }
.line-wrap .xh { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }

.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--text); color: var(--bg); padding: 7px 10px; border-radius: 8px; font-size: 12.5px; max-width: 280px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.tip b { display: block; }

/* önce / sonra */
.ba-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 16px; }
.ba-card.wide { grid-column: 1 / -1; }
.ba-card .lines { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 6px 18px; }
.ba-card td:first-child { min-width: 150px; }
.ba-card td.num { white-space: nowrap; }
.ba-card h4 { font-size: 15px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.ba-card h4 small { font-weight: 500; color: var(--muted); font-size: 12px; }
.delta { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta.good { color: var(--pass); } .delta.bad { color: var(--fail); } .delta.flat { color: var(--muted); }
.ba-issues { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; font-size: 13px; }
.ba-issues h5 { font-size: 12px; margin: 0 0 6px; text-transform: uppercase; letter-spacing: .05em; }
.ba-issues ul { margin: 0; padding-left: 16px; color: var(--text-2); display: grid; gap: 2px; }
.notice { background: var(--accent-soft); border-radius: 12px; padding: 14px 16px; font-size: 14px; margin-bottom: 16px; }
.notice.warn { background: var(--warn-soft); }

/* çözüm haritası */
.rm-group { margin-bottom: 22px; }
.rm-group > h3 { font-size: 16px; display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.rm-item { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 14px 18px; margin-bottom: 10px; }
.rm-item h4 { font-size: 15px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rm-item .why { color: var(--text-2); font-size: 13.5px; }
.rm-item .act { background: var(--surface-2); border-left: 3px solid var(--accent); border-radius: 8px; padding: 8px 12px; font-size: 14px; white-space: pre-wrap; }
.rm-item .tgt { font-size: 13px; font-weight: 700; color: var(--pass); }

/* notlar / markdown */
.note-card { margin-bottom: 14px; }
.note-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.md { font-size: 14px; line-height: 1.6; }
.md h1, .md h2, .md h3, .md h4 { margin: 16px 0 6px; }
.md h1 { font-size: 20px; } .md h2 { font-size: 18px; } .md h3 { font-size: 16px; } .md h4 { font-size: 15px; }
.md p { margin: 6px 0; }
.md ul, .md ol { margin: 6px 0; padding-left: 22px; }
.md code { font-family: var(--mono); background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.md table { margin: 8px 0; }
.md.collapsed { max-height: 320px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }

/* formlar / diyaloglar */
.dlg.wide { width: min(940px, 96vw); }
.dlg-form { display: flex; flex-direction: column; max-height: 90vh; }
.dlg-body { padding: 16px 20px; overflow: auto; display: grid; gap: 12px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 .full { grid-column: 1 / -1; }
.fld { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.fld input, .fld select, .fld textarea, .row-end select { font: inherit; font-size: 14px; font-weight: 400; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; width: 100%; }
.fld input:focus, .fld select:focus, .fld textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
.fld em { font-style: normal; font-weight: 700; font-size: 11.5px; margin-left: 6px; }
.hint { margin: 0; font-size: 12.5px; color: var(--muted); }
.keybox { border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: grid; gap: 6px; }
.sub-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 4px; }
.code-area { width: 100%; font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 10px; resize: vertical; }
.row-end { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.row-end select { width: auto; }
.steps-mini { margin: 0; padding-left: 20px; font-size: 13.5px; color: var(--text-2); display: grid; gap: 3px; }
.ent-links { display: flex; gap: 4px; flex-wrap: wrap; }
.ent-links .tag { font-size: 11px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: 14px; z-index: 200; box-shadow: 0 10px 30px rgba(0,0,0,.25); }

@media (max-width: 860px) {
  .mainnav { margin-left: 8px; gap: 2px; }
  .mainnav a { padding: 6px 8px; font-size: 13px; white-space: nowrap; }
  .mainnav .soon, .brand-text, #btnSettings .lbl-t { display: none; }
  .grid2, .ba-issues { grid-template-columns: 1fr; }
  .charts, .ba-grid { grid-template-columns: 1fr; }
}
@media print {
  .tabs, .actions, .subtabs, .mainnav, #btnSettings, .no-print { display: none !important; }
  .md.collapsed { max-height: none; -webkit-mask-image: none; mask-image: none; }
}
