:root {
  --bg: #120d1a;
  --bg2: #1a1324;
  --panel: rgba(28, 20, 40, 0.86);
  --panel-solid: #1d1529;
  --line: rgba(255, 255, 255, 0.09);
  --line2: rgba(255, 255, 255, 0.16);
  --txt: #f3eef8;
  --mut: #a99bb8;
  --acc: #b44fb8;
  --acc2: #d97ad9;
  --acc-dim: rgba(180, 79, 184, 0.18);
  --ok: #5ac26a;
  --warn: #f5a623;
  --bad: #e5534b;
  --r: 14px;
  --font: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  --top: 60px;
  --rail: 78px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--txt); font-family: var(--font); overflow: hidden; overscroll-behavior: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
input[type=number] { -moz-appearance: textfield; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

#app { position: fixed; inset: 0; display: grid; grid-template-columns: var(--rail) 1fr; grid-template-rows: var(--top) 1fr; }

/* ---------- üst çubuk ---------- */
#topbar { grid-column: 1 / 3; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 8px; background: linear-gradient(180deg, #1b1327, #150f1f); border-bottom: 1px solid var(--line); z-index: 20; min-width: 0; }
.brand { height: 44px; padding: 4px 10px; background: #fff; border-radius: 10px; display: flex; align-items: center; flex: 0 0 auto; }
.brand img { height: 30px; width: auto; display: block; }
#tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; padding: 6px 2px; }
#tabs::-webkit-scrollbar { display: none; }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 76px; padding: 6px 10px; border-radius: 11px; color: var(--mut); font-size: 10.5px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; white-space: nowrap; transition: background .15s, color .15s; }
.tab svg { width: 19px; height: 19px; }
.tab:hover { color: var(--txt); background: rgba(255,255,255,.05); }
.tab.active { color: #fff; background: linear-gradient(135deg, var(--acc), #7d2d86); box-shadow: 0 4px 16px rgba(180,79,184,.35); }
.tab .new { font-size: 8px; background: var(--ok); color: #0b2410; padding: 1px 5px; border-radius: 6px; margin-left: 3px; }
.top-actions { display: flex; gap: 6px; align-items: center; flex: 0 0 auto; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; color: var(--mut); }
.icon-btn:hover { background: rgba(255,255,255,.07); color: var(--txt); }
.chip-btn { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 19px; background: rgba(255,255,255,.06); border: 1px solid var(--line); font-size: 13px; color: var(--mut); max-width: 190px; }
.chip-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-btn.has { color: var(--txt); border-color: var(--acc); }

/* ---------- sol ray ---------- */
#rail { grid-row: 2; display: flex; flex-direction: column; gap: 4px; padding: 10px 8px; background: #150f1f; border-right: 1px solid var(--line); z-index: 15; overflow-y: auto; scrollbar-width: none; }
.rail-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px; border-radius: 12px; color: var(--mut); font-size: 10.5px; font-weight: 600; }
.rail-btn svg { width: 22px; height: 22px; }
.rail-btn:hover { color: var(--txt); background: rgba(255,255,255,.05); }
.rail-btn.active { color: #fff; background: var(--acc-dim); box-shadow: inset 0 0 0 1px rgba(180,79,184,.5); }
.rail-btn.disabled { opacity: .3; pointer-events: none; }
.rail-sep { flex: 1; }

/* ---------- sahne ---------- */
#stage { grid-row: 2; grid-column: 2; position: relative; overflow: hidden; background: #000; }
.view { position: absolute; inset: 0; }
.view canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hud { position: absolute; pointer-events: none; z-index: 5; }
.hud * { pointer-events: auto; }
.hud-top { top: 14px; left: 0; right: 0; display: flex; justify-content: center; gap: 10px; pointer-events: none; }
.hud-bottom { bottom: 14px; left: 0; right: 0; display: flex; justify-content: center; pointer-events: none; padding: 0 12px; }
.lens-chip { display: inline-flex; align-items: center; gap: 10px; padding: 9px 18px; border-radius: 26px; background: rgba(14,10,22,.78); border: 1px solid rgba(255,255,255,.14); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: 15px; box-shadow: 0 6px 24px rgba(0,0,0,.35); }
.lens-chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 10px currentColor; }
.tier { display: inline-flex; gap: 3px; }
.tier i { width: 12px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.18); }
.tier i.on { background: var(--ok); }
.lens-chip button { pointer-events: auto; }
.cmp-chip { cursor: pointer; }
.cmp-chip:hover { border-color: var(--acc2); }
.ctrlbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; padding: 8px; border-radius: 18px; background: rgba(14,10,22,.82); border: 1px solid rgba(255,255,255,.12); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 8px 30px rgba(0,0,0,.4); max-width: 100%; }
.seg { display: inline-flex; background: rgba(255,255,255,.06); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { padding: 7px 12px; border-radius: 9px; font-size: 12.5px; font-weight: 600; color: var(--mut); white-space: nowrap; }
.seg button.on { background: var(--acc); color: #fff; }
.cb-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 11px; font-size: 12.5px; font-weight: 600; color: var(--mut); background: rgba(255,255,255,.05); white-space: nowrap; }
.cb-btn:hover { color: var(--txt); }
.cb-btn.on { color: #fff; background: var(--acc-dim); box-shadow: inset 0 0 0 1px var(--acc); }
.cb-btn svg { width: 17px; height: 17px; }
.slider-wrap { display: inline-flex; align-items: center; gap: 10px; padding: 4px 10px; background: rgba(255,255,255,.05); border-radius: 12px; }
.slider-wrap label { font-size: 11px; color: var(--mut); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.slider-wrap output { font-weight: 700; min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 170px; height: 28px; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 5px; border-radius: 3px; background: linear-gradient(90deg, var(--acc), rgba(255,255,255,.15)); }
input[type=range]::-moz-range-track { height: 5px; border-radius: 3px; background: rgba(255,255,255,.2); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff; margin-top: -8.5px; box-shadow: 0 2px 8px rgba(0,0,0,.4); border: 3px solid var(--acc); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--acc); }

.caption { position: absolute; left: 50%; transform: translateX(-50%); bottom: 118px; padding: 12px 22px; border-radius: 16px; background: rgba(14,10,22,.8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.1); font-weight: 600; font-size: 16px; text-align: center; max-width: min(640px, 90%); z-index: 6; pointer-events: none; transition: opacity .4s; }
.caption b { color: var(--acc2); }

/* bölme tutamağı */
.split-handle { position: absolute; top: 0; bottom: 0; width: 44px; margin-left: -22px; z-index: 7; cursor: ew-resize; touch-action: none; }
.split-handle::before { content: ""; position: absolute; left: 21px; top: 0; bottom: 0; width: 2px; background: rgba(255,255,255,.85); box-shadow: 0 0 12px rgba(0,0,0,.5); }
.split-handle .knob { position: absolute; top: 50%; left: 2px; width: 40px; height: 40px; margin-top: -20px; border-radius: 50%; background: #fff; display: grid; place-items: center; color: var(--acc); box-shadow: 0 4px 16px rgba(0,0,0,.45); border: 3px solid var(--acc); }
.split-label { position: absolute; top: 70px; z-index: 6; }

/* ---------- çekmece ---------- */
#drawer { position: absolute; top: var(--top); left: var(--rail); bottom: 0; width: min(380px, calc(100vw - var(--rail))); background: var(--panel-solid); border-right: 1px solid var(--line2); z-index: 30; transform: translateX(calc(-100% - var(--rail) - 40px)); visibility: hidden; transition: transform .22s ease, visibility 0s .22s; display: flex; flex-direction: column; box-shadow: 12px 0 40px rgba(0,0,0,.45); }
#drawer.open { transform: none; visibility: visible; transition: transform .22s ease; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 18px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; font-size: 16px; letter-spacing: .02em; }
#drawerBody { overflow-y: auto; padding: 14px 16px 30px; flex: 1; }
.sec-title { font-size: 11px; font-weight: 700; color: var(--mut); text-transform: uppercase; letter-spacing: .08em; margin: 18px 0 8px; }
.sec-title:first-child { margin-top: 2px; }
.fam { border-left: 3px solid var(--c, var(--acc)); border-radius: 10px; background: rgba(255,255,255,.03); margin-bottom: 8px; overflow: hidden; }
.fam-head { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 11px 12px; font-weight: 700; font-size: 13px; color: var(--c); letter-spacing: .05em; text-transform: uppercase; }
.fam-list { display: none; padding: 0 8px 8px; }
.fam.open .fam-list { display: block; }
.lens-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 10px; margin-top: 4px; border-radius: 10px; background: rgba(255,255,255,.04); text-align: left; font-size: 14px; font-weight: 500; }
.lens-item:hover { background: rgba(255,255,255,.08); }
.lens-item.on { background: linear-gradient(135deg, rgba(180,79,184,.35), rgba(180,79,184,.12)); box-shadow: inset 0 0 0 1px var(--acc); }
.lens-item .nm { flex: 1; }
.lens-desc { font-size: 12.5px; color: var(--mut); line-height: 1.5; padding: 10px 12px; background: rgba(255,255,255,.04); border-radius: 10px; margin-top: 10px; }

.rx-table { width: 100%; border-collapse: separate; border-spacing: 4px; }
.rx-table th { font-size: 10.5px; color: var(--mut); font-weight: 600; text-transform: uppercase; }
.rx-table td:first-child { font-weight: 700; font-size: 13px; width: 34px; }
.num { width: 100%; height: 40px; border-radius: 9px; border: 1px solid var(--line2); background: rgba(0,0,0,.25); text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; outline: none; }
.num:focus { border-color: var(--acc); }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.field label { font-size: 11.5px; color: var(--mut); font-weight: 600; }
.field input, .field select, .field textarea { height: 40px; border-radius: 9px; border: 1px solid var(--line2); background: rgba(0,0,0,.25); padding: 0 11px; outline: none; }
.field textarea { height: 80px; padding: 9px 11px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--acc); }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 8px 12px; border-radius: 10px; background: rgba(255,255,255,.06); font-size: 13px; font-weight: 600; color: var(--mut); border: 1px solid transparent; }
.chip.on { color: #fff; background: var(--acc-dim); border-color: var(--acc); }
.chip small { display: block; font-weight: 500; font-size: 10.5px; opacity: .75; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 42px; padding: 0 16px; border-radius: 11px; background: rgba(255,255,255,.08); font-weight: 600; font-size: 13.5px; }
.btn:hover { background: rgba(255,255,255,.13); }
.btn.pri { background: linear-gradient(135deg, var(--acc), #7d2d86); color: #fff; }
.btn.pri:hover { filter: brightness(1.1); }
.btn.danger { color: #ffb3ae; }
.btn.block { width: 100%; }
.btn svg { width: 17px; height: 17px; }
.grid-shapes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.shape-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: 10px; background: rgba(255,255,255,.05); font-size: 10.5px; color: var(--mut); border: 1px solid transparent; }
.shape-btn.on { border-color: var(--acc); color: #fff; background: var(--acc-dim); }
.shape-btn canvas { width: 54px; height: 32px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.sw { width: 38px; height: 38px; border-radius: 50%; border: 3px solid transparent; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.sw.on { border-color: #fff; box-shadow: 0 0 0 2px var(--acc); }
.scene-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.scene-btn { position: relative; aspect-ratio: 16/10; border-radius: 11px; overflow: hidden; border: 2px solid transparent; background: #000; }
.scene-btn img, .scene-btn canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.scene-btn span { position: absolute; left: 6px; bottom: 6px; font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 7px; background: rgba(0,0,0,.65); }
.scene-btn.on { border-color: var(--acc2); }
.scene-btn .del { position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,.7); display: grid; place-items: center; }
.scene-btn .del svg { width: 13px; height: 13px; }
.note { font-size: 12px; color: var(--mut); line-height: 1.55; }
.note.warn { color: #f9cf87; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 13.5px; }
.kv b { font-variant-numeric: tabular-nums; }

/* ---------- genel panel/ızgara modülleri ---------- */
.pane { position: absolute; inset: 0; display: flex; overflow: hidden; background: radial-gradient(ellipse at 50% 0%, #2a1d3a, #120d1a 70%); }
.pane-main { flex: 1; position: relative; min-width: 0; }
.pane-side { width: 340px; flex: 0 0 auto; background: rgba(20,14,30,.9); border-left: 1px solid var(--line); overflow-y: auto; padding: 16px; }
.card { background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 12px; }
.big-num { font-size: 40px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.big-num small { font-size: 15px; font-weight: 600; color: var(--mut); margin-left: 4px; }
.stat-label { font-size: 11px; font-weight: 700; color: var(--mut); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 6px; }
.bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), var(--warn), var(--bad)); }

/* PD */
.steps { display: flex; gap: 6px; margin-bottom: 14px; }
.step { flex: 1; text-align: center; font-size: 11px; font-weight: 700; padding: 8px 4px; border-radius: 9px; background: rgba(255,255,255,.05); color: var(--mut); }
.step.on { background: var(--acc-dim); color: #fff; box-shadow: inset 0 0 0 1px var(--acc); }
.step.done { color: var(--ok); }
.marker { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; z-index: 8; touch-action: none; cursor: grab; display: grid; place-items: center; }
.marker::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; border: 2px solid var(--mc, #fff); box-shadow: 0 0 0 1px rgba(0,0,0,.6), inset 0 0 0 1px rgba(0,0,0,.5); }
.marker::after { content: ""; width: 3px; height: 3px; border-radius: 50%; background: var(--mc, #fff); box-shadow: 0 0 0 1px #000; }
.marker span { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--mc, #fff); color: #111; }
.marker.hline { width: 120px; height: 26px; margin: -13px 0 0 -60px; border-radius: 6px; }
.marker.hline::before { inset: 12px 0 auto 0; height: 2px; border: 0; border-radius: 0; background: var(--mc); }
.marker.hline::after { display: none; }
.loupe { position: absolute; width: 150px; height: 150px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 6px 24px rgba(0,0,0,.6); overflow: hidden; pointer-events: none; z-index: 9; display: none; }
.loupe canvas { width: 100%; height: 100%; }

/* CRM */
.crm { position: absolute; inset: 0; display: flex; background: var(--bg); }
.crm-list { width: 340px; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.crm-list .search { padding: 12px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; }
.crm-items { overflow-y: auto; flex: 1; }
.crm-item { display: block; width: 100%; text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.crm-item:hover { background: rgba(255,255,255,.04); }
.crm-item.on { background: var(--acc-dim); }
.crm-item b { display: block; font-size: 14px; }
.crm-item small { color: var(--mut); font-size: 12px; }
.crm-detail { flex: 1; overflow-y: auto; padding: 20px 24px; }
.crm-detail h2 { margin: 0 0 14px; }
.empty { display: grid; place-items: center; height: 100%; color: var(--mut); text-align: center; padding: 30px; }

#toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 30px); padding: 12px 20px; border-radius: 12px; background: #2b1f3b; border: 1px solid var(--acc); font-weight: 600; font-size: 14px; opacity: 0; transition: all .25s; z-index: 100; pointer-events: none; max-width: 90vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#exitPresent { display: none; position: fixed; top: 10px; right: 10px; z-index: 50; padding: 8px 14px; border-radius: 10px; background: rgba(0,0,0,.45); color: rgba(255,255,255,.7); font-size: 12px; }

body.present #topbar, body.present #rail, body.present .ctrlbar, body.present #drawer { display: none !important; }
body.present #app { grid-template-columns: 0 1fr; grid-template-rows: 0 1fr; }
body.present #exitPresent { display: block; }

.overlay-modal { position: fixed; inset: 0; background: rgba(5,3,10,.7); z-index: 80; display: grid; place-items: center; padding: 20px; }
.modal { width: min(520px, 100%); max-height: 90vh; overflow-y: auto; background: var(--panel-solid); border: 1px solid var(--line2); border-radius: 18px; padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.modal h3 { margin: 0 0 12px; }

/* ---------- dar ekran (telefon) ---------- */
@media (max-width: 760px) {
  :root { --top: 54px; --rail: 0px; }
  #app { grid-template-columns: 1fr; grid-template-rows: var(--top) 1fr 62px; }
  #topbar { grid-column: 1; padding: 0 6px; gap: 6px; }
  .brand { height: 38px; padding: 3px 7px; }
  .brand img { height: 24px; }
  .tab { min-width: 64px; padding: 5px 7px; font-size: 9.5px; }
  .chip-btn span, #presentBtn { display: none; }
  #stage { grid-column: 1; grid-row: 2; }
  #rail { grid-row: 3; grid-column: 1; flex-direction: row; justify-content: space-around; border-right: 0; border-top: 1px solid var(--line); padding: 4px; }
  .rail-btn { flex: 1; padding: 5px 0; }
  .rail-sep { display: none; }
  #drawer { left: 0; top: var(--top); bottom: 62px; width: 100%; }
  .pane { flex-direction: column; }
  .pane-side { width: 100%; max-height: 45%; border-left: 0; border-top: 1px solid var(--line); }
  .crm { flex-direction: column; }
  .crm-list { width: 100%; max-height: 40%; border-right: 0; border-bottom: 1px solid var(--line); }
  input[type=range] { width: 120px; }
  .caption { bottom: 120px; font-size: 14px; }
  .lens-chip { font-size: 12px; padding: 7px 12px; }
}
