:root {
  --bg: #f3f4f6; --bg2: #ffffff; --bg3: #e9ebef; --line: #d3d7de; --line2: #c3c8d0;
  --tx: #1f2328; --tx2: #6b7280; --acc: #e8590c; --sel: #2563eb; --in: #ffffff;
  --hover: #e5e9f0; --on: #dbe7ff; --stage: #dfe2e7;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--tx); font: 13px/1.4 "Segoe UI", system-ui, sans-serif; user-select: none; }
button, input, select { font: inherit; color: inherit; }
#app { display: flex; flex-direction: column; height: 100vh; }

/* menü çubuğu */
#menubar { display: flex; align-items: center; height: 32px; background: var(--bg3); border-bottom: 1px solid var(--line); padding: 0 6px; flex: none; }
#menubar .brand { font-weight: 800; color: var(--acc); padding: 0 12px 0 6px; letter-spacing: .5px; font-size: 14px; }
#menubar .top { padding: 6px 11px; border-radius: 5px; cursor: default; }
#menubar .top:hover, #menubar .top.on { background: var(--hover2); }
.menu { position: fixed; z-index: 1000; min-width: 230px; background: var(--bg2); border: 1px solid var(--line2); box-shadow: 0 10px 28px rgba(15,23,42,.18); padding: 5px 0; border-radius: 8px; }
.menu .mi { display: flex; align-items: center; padding: 6px 14px 6px 4px; white-space: nowrap; cursor: default; }
.menu .mi:hover { background: var(--sel); color: #fff; }
.menu .mi .chk { width: 20px; text-align: center; }
.menu .mi .lbl { flex: 1; padding-right: 24px; }
.menu .mi .key { color: var(--tx2); font-size: 12px; }
.menu .mi:hover .key { color: #dbe7ff; }
.menu .sep { height: 1px; background: var(--line); margin: 5px 0; }

/* kontrol çubuğu */
#controlbar { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 10px; background: var(--bg2); border-bottom: 1px solid var(--line); flex: none; white-space: nowrap; overflow: hidden; }
#controlbar .topts { display: flex; align-items: center; gap: 10px; }
#controlbar .topts b { color: var(--acc); font-weight: 700; }
#controlbar .hint { color: var(--tx2); }
.quick { display: flex; gap: 4px; }
.qb { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border: 1px solid var(--line2); background: var(--bg2); border-radius: 7px; cursor: default; font-weight: 600; }
.qb:hover { background: var(--hover); }
.qb.main { background: var(--sel); border-color: var(--sel); color: #fff; }
.qb.main:hover { background: var(--seld); }
.vsep { width: 1px; height: 24px; background: var(--line2); }
.grow { flex: 1; }
label.chk { display: inline-flex; align-items: center; gap: 5px; }

/* sekmeler */
#tabs { display: flex; height: 30px; background: var(--bg3); border-bottom: 1px solid var(--line); flex: none; overflow: hidden; padding-left: 4px; }
.tab { display: flex; align-items: center; gap: 8px; padding: 0 8px 0 13px; max-width: 240px; border-right: 1px solid var(--line); color: var(--tx2); cursor: default; }
.tab span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab:hover { background: var(--hover2); }
.tab.on { background: var(--bg2); color: var(--tx); font-weight: 600; box-shadow: inset 0 2px 0 var(--acc); }
.tab .x { opacity: .55; padding: 0 4px; border-radius: 4px; }
.tab .x:hover { opacity: 1; background: var(--line2); }
.tab.plus { padding: 0 13px; font-size: 16px; }

#main { flex: 1; display: flex; min-height: 0; }

/* araç çubuğu */
#toolbar { width: 88px; flex: none; background: var(--bg2); border-right: 1px solid var(--line); padding: 8px 6px; overflow-y: auto; scrollbar-width: none; }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.tool { height: 34px; border: 1px solid transparent; background: none; border-radius: 7px; padding: 3px; cursor: default; display: flex; align-items: center; justify-content: center; color: var(--ic); }
.tool svg { width: 22px; height: 22px; }
.tool:hover { background: var(--hover); }
.tool.on { background: var(--on); border-color: var(--onb); color: var(--sel); }
.fs { position: relative; height: 56px; margin: 14px auto 4px; width: 58px; }
.chipbox { border: 1px solid #fff; box-shadow: 0 0 0 1px #6b7280; background: #fff; cursor: default; position: relative; display: inline-block; }
.chipbox.none, .sw.none { background: #fff linear-gradient(to top left, transparent calc(50% - 1px), #e11 calc(50% - 1px), #e11 calc(50% + 1px), transparent calc(50% + 1px)) !important; }
.chipbox.sm { width: 22px; height: 22px; vertical-align: middle; flex: none; border-radius: 3px; }
.chipbox.stroke i, .fsStroke i { position: absolute; inset: 25%; background: var(--bg2); border: 1px solid #6b7280; }
.fsFill, .fsStroke { position: absolute; width: 32px; height: 32px; }
.fsFill { left: 2px; top: 2px; } .fsStroke { left: 22px; top: 22px; }
.fs .front { z-index: 2; }
.fsSwap, .fsDef { position: absolute; background: none; border: 0; padding: 0; font-size: 13px; color: var(--ic); cursor: default; }
.fsSwap { right: -4px; top: -6px; } .fsDef { left: -4px; bottom: -8px; }
.fsBtns { display: flex; justify-content: center; gap: 3px; margin-top: 10px; }
.fsBtns button { width: 22px; height: 22px; padding: 0; background: var(--bg2); border: 1px solid var(--line2); border-radius: 4px; font-size: 11px; cursor: default; }
.fsBtns button:hover { background: var(--hover); }

/* sahne */
#stage { flex: 1; position: relative; min-width: 0; display: grid; grid-template: 20px 1fr / 20px 1fr; background: var(--stage); }
#stage.norulers { grid-template: 0 1fr / 0 1fr; }
#stage.norulers #rulerH, #stage.norulers #rulerV, #stage.norulers #rulerCorner { display: none; }
#rulerCorner { background: var(--ruler); border-right: 1px solid var(--line2); border-bottom: 1px solid var(--line2); }
#rulerH { border-bottom: 1px solid var(--line2); cursor: row-resize; } #rulerV { border-right: 1px solid var(--line2); cursor: col-resize; }
#viewport { position: relative; overflow: hidden; grid-column: 2; grid-row: 2; touch-action: none; }
#stage.norulers #viewport { grid-column: 1 / -1; grid-row: 1 / -1; }
#viewport canvas { position: absolute; left: 0; top: 0; }
#overlay { pointer-events: none; }
#textEditor { display: none; position: absolute; margin: 0; padding: 0; border: 0; outline: 1px dashed #1e90ff; background: transparent; resize: none; overflow: hidden; white-space: pre; z-index: 5; }
#dropHint { display: none; position: absolute; inset: 16px; border: 3px dashed var(--sel); border-radius: 14px; align-items: center; justify-content: center; font-size: 22px; color: var(--sel); background: rgba(255,255,255,.8); pointer-events: none; z-index: 20; }
body.dragging #dropHint { display: flex; }

/* paneller */
#panels { width: 286px; flex: none; background: var(--bg); border-left: 1px solid var(--line); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; padding: 6px; }
.panel { background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; margin-bottom: 6px; overflow: hidden; }
.panel header { padding: 8px 10px; font-weight: 700; cursor: default; display: flex; gap: 7px; }
.panel header:hover { background: var(--bg); }
.panel header .car { display: inline-block; transition: transform .1s; color: var(--tx2); }
.panel.closed .car { transform: rotate(-90deg); }
.panel.closed .body { display: none; }
.panel .body { padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 7px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.rowx { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.fld { display: flex; align-items: center; gap: 6px; min-width: 0; }
.fld.wide { grid-column: 1 / -1; }
.fld > span { color: var(--tx2); flex: none; min-width: 12px; }
.fld em { color: var(--tx2); font-style: normal; flex: none; }
input.num, select, input[type=text] { background: var(--in); border: 1px solid var(--line2); border-radius: 6px; padding: 3px 7px; min-width: 0; width: 100%; height: 28px; outline: none; }
input.num:focus, select:focus, input[type=text]:focus { border-color: var(--sel); box-shadow: 0 0 0 2px var(--focus); }
input.num.sm { width: 46px; flex: none; text-align: right; }
input:disabled { opacity: .5; background: var(--bg); }
#controlbar .fld input.num { width: 62px; }
#controlbar select { width: auto; }
#statusbar input.num { width: 68px; text-align: center; height: 24px; }
.pb { background: var(--bg2); border: 1px solid var(--line2); border-radius: 6px; padding: 3px 9px; min-height: 28px; cursor: default; display: inline-flex; align-items: center; gap: 5px; }
.pb:hover { background: var(--hover); }
.pb.on, .pb.tgl.on { background: var(--on); border-color: var(--onb); color: var(--ontx); }
.pb.ic { padding: 3px; width: 36px; justify-content: center; }
.pb.ic svg { width: 20px; height: 20px; }
.crow { display: grid; grid-template-columns: 14px 1fr 46px; gap: 7px; align-items: center; }
.crow span { color: var(--tx2); font-weight: 600; }
input[type=range] { width: 100%; accent-color: var(--sel); height: 18px; margin: 0; }
input[type=color] { width: 48px; height: 28px; padding: 0; border: 1px solid var(--line2); border-radius: 6px; background: none; flex: none; }
.swatches { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.sw { aspect-ratio: 1; border: 1px solid #9aa1ac; border-radius: 3px; cursor: default; display: flex; align-items: center; justify-content: center; color: var(--ic); }
.sw:hover { outline: 2px solid var(--sel); }
.sw.add { background: var(--bg); }
.gbox { padding: 2px 6px 14px; }
.gbar { position: relative; height: 20px; border: 1px solid #6b7280; border-radius: 3px; cursor: copy; }
.gstop { position: absolute; top: 17px; width: 12px; height: 12px; margin-left: -6px; border: 2px solid #fff; border-radius: 3px; cursor: ew-resize; box-shadow: 0 0 0 1px var(--ic); }
.gstop.on { box-shadow: 0 0 0 2px var(--sel); }
.llist { max-height: 300px; overflow-y: auto; background: var(--in); border: 1px solid var(--line); border-radius: 6px; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; min-height: 60px; }
.llist.short { max-height: 120px; min-height: 28px; }
.lrow { display: flex; align-items: center; gap: 5px; height: 26px; padding-right: 8px; border-bottom: 1px solid var(--hover); cursor: default; white-space: nowrap; }
.lrow:hover { background: var(--bg); }
.lrow.layer { background: var(--bg); font-weight: 700; }
.lrow.layer.active { box-shadow: inset 3px 0 0 var(--acc); }
.lrow.sel { background: var(--on); }
.lrow.drop { box-shadow: inset 0 2px 0 var(--sel); }
.lrow.more { color: var(--tx2); font-style: italic; }
.lrow .eye, .lrow .lock, .lrow .car { width: 16px; text-align: center; flex: none; font-size: 11px; color: var(--ic); }
.lrow .eye.off { color: var(--line2); }
.lrow .th { width: 13px; height: 13px; border: 1px solid #6b7280; border-radius: 2px; flex: none; background: #fff; }
.lrow .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.lrow .cnt { color: var(--tx2); font-weight: 400; font-size: 12px; }

/* durum çubuğu */
#statusbar { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; background: var(--bg3); border-top: 1px solid var(--line); flex: none; white-space: nowrap; }
#statusbar .st { color: var(--tx2); padding: 0 8px; font-variant-numeric: tabular-nums; }
#statusbar .pb { min-height: 24px; padding: 1px 9px; }

/* iletişim kutuları */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 2000; display: flex; align-items: center; justify-content: center; }
.dlg { background: var(--bg2); border: 1px solid var(--line2); border-radius: 12px; padding: 20px 22px; min-width: 350px; max-width: 92vw; max-height: 90vh; overflow: auto; box-shadow: 0 20px 56px rgba(15,23,42,.3); display: flex; flex-direction: column; gap: 10px; user-select: text; }
.dlg.wide { width: 660px; }
.dlg h3 { margin: 0 0 6px; font-size: 16px; }
.dlg .row { display: grid; grid-template-columns: 1fr 160px; gap: 10px; align-items: center; }
.dlg .row.chk { display: flex; gap: 8px; }
.dlg .btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.dlg button { background: var(--bg2); border: 1px solid var(--line2); border-radius: 7px; padding: 7px 18px; cursor: default; font-weight: 600; }
.dlg button:hover { background: var(--hover); }
.dlg button.primary { background: var(--sel); border-color: var(--sel); color: #fff; }
.info { line-height: 1.65; } .info li { margin: 4px 0; }
table.keys { border-collapse: collapse; width: 100%; } table.keys td { padding: 5px 8px; border-bottom: 1px solid var(--line); }
table.keys td:nth-child(odd) { color: var(--sel); white-space: nowrap; font-weight: 700; }
#busy { position: fixed; inset: 0; z-index: 3000; background: color-mix(in srgb, var(--bg) 75%, transparent); display: none; align-items: center; justify-content: center; gap: 12px; font-size: 15px; font-weight: 600; }
#busy.on { display: flex; }
.spin { width: 24px; height: 24px; border: 3px solid #cbd5e1; border-top-color: var(--sel); border-radius: 50%; animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
#toasts { position: fixed; bottom: 46px; left: 50%; transform: translateX(-50%); z-index: 4000; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: #1f2937; color: #fff; padding: 9px 16px; border-radius: 9px; max-width: 70vw; box-shadow: 0 8px 22px rgba(15,23,42,.3); }

/* tema seçici */
#menubar .themebtn { margin-left: auto; padding: 4px 11px; border: 1px solid var(--line2); border-radius: 6px; background: var(--bg2); cursor: default; display: flex; align-items: center; gap: 6px; font-weight: 600; }
#menubar .themebtn:hover { background: var(--hover); }
#menubar .themebtn i { width: 13px; height: 13px; border-radius: 50%; background: var(--sel); border: 1px solid var(--line2); }
.themepop { position: fixed; z-index: 1000; top: 34px; right: 6px; background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px; box-shadow: 0 10px 28px rgba(15,23,42,.2); padding: 10px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; width: 440px; }
.themepop h4 { grid-column: 1 / -1; margin: 0 0 4px; font-size: 13px; }
.themepop button { display: flex; align-items: center; gap: 7px; padding: 6px 8px; background: var(--bg2); border: 1px solid var(--line); border-radius: 7px; cursor: default; white-space: nowrap; }
.themepop button:hover { background: var(--hover); }
.themepop button.on { border-color: var(--sel); box-shadow: 0 0 0 2px var(--focus); font-weight: 700; }
.themepop button i { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0,0,0,.25); flex: none; }

/* Taşı penceresi, Nitelikler ve Bilgi panelleri */
.dlg.tasi { min-width: 320px; }
.dlg.tasi fieldset { border: 1px solid var(--line, #d1d5db); border-radius: 6px; padding: 8px 12px 10px; margin: 0 0 10px; }
.dlg.tasi legend { padding: 0 4px; font-size: 12px; opacity: .8; }
.dlg.tasi hr { border: 0; border-top: 1px solid var(--line, #d1d5db); margin: 8px 0; }
.dlg.tasi .btns { gap: 8px; }
.panel label.attr { display: flex; align-items: center; gap: 6px; margin: 4px 0; font-size: 12px; }
.panel .hint { font-size: 11px; opacity: .7; margin: 6px 0 2px; line-height: 1.35; }
.info-grid { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12px; }
.info-grid b { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
