:root {
  --bg: #f3f4f7; --panel: #fff; --ink: #1c2230; --muted: #6a7385; --line: #dde1e9; --brand: #1d4ed8;
  --ok: #12805c; --warn: #b45309; --err: #b42318;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #12151c; --panel: #1b2029; --ink: #e8ebf2; --muted: #98a2b6; --line: #2c3342; --brand: #6b93ff; --ok: #3ccf9b; --warn: #f0a640; --err: #ff7b6e; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
button, select, input, textarea { font: inherit; color: inherit; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 12px; align-items: center; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--brand); color: #fff; font-weight: 700; font-size: 20px; }
.privacy { color: var(--muted); font-size: 12px; }
.layout { display: grid; grid-template-columns: 320px 1fr; min-height: calc(100vh - 57px); }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 16px; overflow-y: auto; }
.side h2 { margin: 18px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.side section:first-child h2 { margin-top: 0; }
.drop { display: grid; gap: 2px; text-align: center; padding: 22px 12px; border: 2px dashed var(--line); border-radius: 10px; cursor: pointer; margin-bottom: 8px; }
.drop span { color: var(--muted); font-size: 12px; }
.drop:hover, .drop.over, .drop:focus-visible { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); outline: none; }
.row { display: flex; gap: 8px; } .row.end { justify-content: flex-end; margin-top: 12px; }
.row > * { flex: 1; }
.muted { color: var(--muted); font-size: 12px; margin-top: 6px; word-break: break-word; }
select, input[type=text], textarea, input[type=file] { width: 100%; padding: 7px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
textarea { resize: vertical; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.form { display: grid; gap: 10px; }
.form label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.form label.chk { display: flex; gap: 8px; align-items: center; color: var(--ink); font-size: 13px; }
.form input[type=color] { width: 100%; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
.btn { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); cursor: pointer; text-align: center; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--brand); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.small { padding: 5px 9px; font-size: 12px; }
.main { padding: 16px 20px; min-width: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.tabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.tabs button { border: 0; background: none; padding: 7px 14px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.tabs button.on { background: var(--brand); color: #fff; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--panel); padding: 6px 10px; font-size: 12px; cursor: pointer; }
.seg button.on { background: var(--brand); color: #fff; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--err); color: #fff; font-size: 11px; }
.badge.good { background: var(--ok); } .badge.mid { background: var(--warn); }
.banner { padding: 9px 12px; border-radius: 8px; margin-bottom: 12px; background: color-mix(in srgb, var(--warn) 14%, var(--panel)); border: 1px solid var(--warn); }
.banner.err { background: color-mix(in srgb, var(--err) 12%, var(--panel)); border-color: var(--err); }
.pane { min-width: 0; }
.stage { display: flex; justify-content: center; overflow: auto; padding: 8px 0 40px; }
.hint { color: var(--muted); font-size: 11px; margin-top: -4px; }
.empty { max-width: 460px; margin: 60px auto; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink); }
.xslt-frame { width: 210mm; max-width: 100%; border: 0; background: #fff; box-shadow: 0 2px 18px rgba(0,0,0,.18); }
.code { margin: 0; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: auto; font: 12px/1.5 ui-monospace, Menlo, monospace; white-space: pre; max-height: calc(100vh - 170px); }
.code .t { color: var(--brand); } .code .c { color: var(--muted); }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.checks li { padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px; }
.checks .ok { border-left-color: var(--ok); } .checks .warn { border-left-color: var(--warn); } .checks .err { border-left-color: var(--err); }
.checks small { color: var(--muted); display: block; margin-top: 4px; }
.tbl { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tbl th, .tbl td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; word-break: break-word; }
.tbl th { background: color-mix(in srgb, var(--brand) 8%, var(--panel)); }
dialog { width: min(720px, 94vw); border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.45); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media print {
  @page { margin: 0; }
  body { background: #fff; }
  .topbar, .side, .toolbar, .banner, .pane:not(#pane-preview) { display: none !important; }
  .layout { display: block; } .main { padding: 0; }
  .stage { padding: 0; overflow: visible; }
}

/* ---------- Kenar çubuğu: açılır bölümler, tema galerisi, listeler ---------- */
.sec { border-bottom: 1px solid var(--line); padding: 4px 0; }
.sec > summary { cursor: pointer; padding: 8px 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); list-style: none; }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary::before { content: '▸'; display: inline-block; width: 14px; transition: transform .15s; }
.sec[open] > summary::before { transform: rotate(90deg); }
.sec > :not(summary) { margin-bottom: 10px; }
.sec > .drop { margin-top: 2px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.themes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.theme { text-align: left; padding: 8px; border: 2px solid var(--line); border-radius: 10px; background: var(--panel); cursor: pointer; display: grid; gap: 4px; }
.theme:hover { border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); }
.theme.on { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 25%, transparent); }
.theme b { font-size: 12px; } .theme small { color: var(--muted); font-size: 10.5px; line-height: 1.25; }
.theme .sw { height: 34px; border-radius: 6px; border: 1px solid rgba(0,0,0,.12); display: grid; grid-template-rows: 14px 1fr; overflow: hidden; background: #fff; }
.theme .sw i { display: block; } .theme .sw span { display: block; margin: 5px 6px 0; height: 4px; border-radius: 2px; box-shadow: 0 7px 0 -0px rgba(0,0,0,.12); }
.list { display: grid; gap: 8px; }
.item { display: grid; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: color-mix(in srgb, var(--brand) 3%, var(--panel)); }
.item .top { display: flex; gap: 6px; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); }
.item input, .item select { padding: 5px 7px; font-size: 12.5px; }
.item .ibanwrap { position: relative; }
.item .ibanwrap input { padding-right: 24px; font-family: ui-monospace, Menlo, monospace; }
.item .ibanwrap .st { position: absolute; right: 7px; top: 5px; font-size: 13px; }
.st.ok { color: var(--ok); } .st.bad { color: var(--err); }
.item .del { border: 0; background: none; color: var(--err); cursor: pointer; font-size: 12px; }
.imgrow { display: grid; grid-template-columns: 1fr 44px auto; gap: 8px; align-items: end; }
.imgrow img { width: 44px; height: 34px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: #fff; visibility: hidden; }
.imgrow.has img { visibility: visible; }
.imgrow .clr { display: none; } .imgrow.has .clr { display: inline-block; }
input[type=range] { padding: 0; }
.hint code { font-size: 11px; }

/* Dar ekranda (uygulama) kâğıdı sığdır; belgenin kendisi sabit boyutludur ve bu kuralı XSLT'ye taşımayız */
@media (max-width: 700px) { .paper .doc { grid-template-columns: 1fr !important; grid-template-areas: none !important; } .paper .doc > div { grid-area: auto !important; } .paper { padding: 8mm 5mm; min-height: 0; } }

.theme .sw { height: auto; border: 0; display: block; background: none; }
.theme .sw svg { width: 100%; height: auto; display: block; border-radius: 6px; box-shadow: 0 0 0 1px rgba(0,0,0,.12); background: #fff; }
.themes { padding: 2px; }

/* ---------- Yerleşim düzenleme modu (yalnızca uygulamada) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px dashed var(--line); background: var(--panel); border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.chips button:hover { border-color: var(--brand); }
.btn.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.editing .doc { user-select: none; }
.editing .doc img { pointer-events: none; }
.editing .doc > div[data-b] { outline: 1.5px dashed rgba(37,99,235,.6); outline-offset: 1px; cursor: grab; min-height: 18px; }
.editing .doc > div[data-b]::before { content: attr(data-label); position: absolute; top: -9px; left: 2px; background: #2563eb; color: #fff; font: 600 9px/1 system-ui, sans-serif; padding: 2px 6px; border-radius: 3px; z-index: 6; pointer-events: none; }
.editing .doc > div.dragging { opacity: .35; }
.editing .doc > div[data-drop] { background: rgba(22,163,74,.08); }
.editing .doc > div[data-drop=left] { box-shadow: inset 6px 0 0 #16a34a; }
.editing .doc > div[data-drop=right] { box-shadow: inset -6px 0 0 #16a34a; }
.editing .doc > div[data-drop=top] { box-shadow: inset 0 6px 0 #16a34a; }
.editing .doc > div[data-drop=bottom] { box-shadow: inset 0 -6px 0 #16a34a; }
.ed-tools { position: absolute; top: -9px; right: 2px; display: flex; gap: 2px; z-index: 7; }
.ed-tools button { border: 0; background: #1e293b; color: #fff; font: 600 10px/1 system-ui, sans-serif; padding: 3px 6px; border-radius: 3px; cursor: pointer; }
.ed-tools button:hover { background: #2563eb; }
@media print { .editing .doc > div[data-b] { outline: 0 !important; } .editing .doc > div[data-b]::before, .ed-tools { display: none !important; } }

.sub { border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }
.sub > summary { cursor: pointer; font-size: 12px; padding: 4px 0; }
.sub .list { margin-top: 6px; max-height: 360px; overflow-y: auto; }
.lblrow { display: grid; grid-template-columns: 1fr 1.3fr; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.lblrow input { padding: 4px 7px; font-size: 12px; }
.lblgrp { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 6px; }

/* ---------- Sekmeli kenar çubuğu, menü, karşılama pencereleri ---------- */
.sidetabs { position: sticky; top: -16px; z-index: 6; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--panel); padding: 16px 0 10px; margin: -16px 0 4px; }
.sidetabs button { display: grid; justify-items: center; gap: 3px; padding: 7px 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); cursor: pointer; font-size: 12px; font-weight: 600; color: var(--muted); }
.sidetabs button i { font-style: normal; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--line); font-size: 11px; color: var(--ink); }
.sidetabs button.on { border-color: var(--brand); color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--panel)); }
.sidetabs button.on i { background: var(--brand); color: #fff; }
.stab[hidden] { display: none; }
.tabhint { font-size: 12px; color: var(--muted); margin: 4px 0 6px; line-height: 1.4; }
.outbox { display: grid; gap: 8px; padding: 14px 0 6px; }
.more { position: relative; }
.more > summary { list-style: none; cursor: pointer; user-select: none; }
.more > summary::-webkit-details-marker { display: none; }
.more .menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 14px 34px rgba(0,0,0,.3); padding: 6px; display: grid; gap: 2px; z-index: 40; }
.more .menu button, .more .menu label { text-align: left; padding: 9px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--ink); display: block; }
.more .menu button:hover:not(:disabled), .more .menu label:hover { background: color-mix(in srgb, var(--brand) 10%, var(--panel)); }
.more .menu button:disabled { opacity: .4; cursor: not-allowed; }
.modal { width: min(560px, 94vw); padding: 24px 26px; }
.modal h2 { margin: 0 0 6px; font-size: 22px; }
.modal .steps { padding-left: 22px; display: grid; gap: 9px; margin: 14px 0; line-height: 1.5; }
.modal code { background: color-mix(in srgb, var(--brand) 10%, var(--panel)); padding: 1px 6px; border-radius: 4px; }
.btn.primary { font-weight: 600; }

/* ---------- Yapışkan başlık: sekmeler + seçili tema ---------- */
.sidehead { position: sticky; top: -16px; z-index: 8; background: var(--panel); padding: 16px 0 8px; margin: -16px 0 4px; border-bottom: 1px solid var(--line); }
.sidehead .sidetabs { position: static; padding: 0; margin: 0 0 8px; }
.picked { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 6px 8px; border: 1px solid var(--brand); border-radius: 12px; background: color-mix(in srgb, var(--brand) 7%, var(--panel)); }
.pk-thumb { display: block; width: 34px; height: 44px; border-radius: 5px; overflow: hidden; box-shadow: 0 0 0 1px rgba(0,0,0,.15); background: #fff; }
.pk-thumb svg { width: 100%; height: 100%; display: block; }
.pk-txt { display: grid; min-width: 0; line-height: 1.2; }
.pk-txt small { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pk-txt b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-txt em { font-style: normal; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Erişilebilirlik: görünür odak halkası, 44 px dokunma hedefleri, hareket azaltma */
button:focus-visible, summary:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, .theme:focus-visible, .drop:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, transparent); outline-offset: 2px; }
.sidetabs button { min-height: 52px; } .btn { min-height: 36px; } .theme { min-height: 44px; }
.theme { transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.theme:hover { transform: translateY(-1px); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ---------- Uygulama kabuğu: tema listesi ve ayarlar yan yana, her sütun kendi içinde kayar ---------- */
html, body { height: 100%; }
body { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.layout { flex: 1; min-height: 0; grid-template-columns: var(--side-w, 340px) 1fr; transition: grid-template-columns .2s ease; }
body.design-open { --side-w: 680px; }
.side { display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding: 16px 16px 0; }
.side .sidehead { flex: none; position: static; margin: -16px -16px 8px; padding: 16px 16px 8px; }
.stab { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 24px; }
.stab[data-pane=design] { overflow: hidden; padding-bottom: 0; }
.dsplit { height: 100%; display: grid; grid-template-columns: 252px 1fr; gap: 14px; }
.dcol { min-height: 0; overflow-y: auto; padding: 0 2px 24px 0; scrollbar-gutter: stable; }
.dcol-title { position: sticky; top: 0; z-index: 3; margin: 0 0 8px; padding: 2px 0 8px; background: var(--panel); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.dcol-themes .themes { grid-template-columns: 1fr; gap: 8px; padding: 2px; }
.dcol-themes .theme { grid-template-columns: 48px 1fr; grid-template-rows: auto auto; column-gap: 10px; row-gap: 0; align-items: center; padding: 6px; }
.dcol-themes .theme .sw { grid-row: 1 / 3; }
.dcol-themes .theme b { align-self: end; } .dcol-themes .theme small { align-self: start; }
.dset-head { position: sticky; top: 0; z-index: 3; display: grid; gap: 1px; padding: 2px 0 10px; margin-bottom: 4px; background: var(--panel); border-bottom: 1px solid var(--line); }
.dset-head small { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.dset-head b { font-size: 16px; } .dset-head em { font-style: normal; font-size: 12px; color: var(--muted); }
body.design-open .picked { display: none; }
.main { overflow-y: auto; min-height: 0; }
@media (max-width: 1180px) { body.design-open { --side-w: 580px; } .dsplit { grid-template-columns: 210px 1fr; } }
@media (max-width: 900px) {
  body { display: block; height: auto; overflow: auto; }
  .layout { grid-template-columns: 1fr; height: auto; }
  .side, .stab, .stab[data-pane=design], .dcol, .main { overflow: visible; }
  .dsplit { height: auto; grid-template-columns: 1fr; }
  body.design-open { --side-w: auto; }
}
@media print { body { display: block; height: auto; overflow: visible; } .layout { display: block; height: auto; } .main { overflow: visible; } .jv-top { display: none !important; } }

/* ---------- Tema kategorileri, arama ---------- */
.dcol-sticky { position: sticky; top: 0; z-index: 3; background: var(--panel); padding-bottom: 8px; }
.dcol-sticky .dcol-title { position: static; padding-bottom: 6px; margin: 0; }
#themeSearch { width: 100%; padding: 8px 10px; margin-bottom: 8px; }
.cats { display: flex; flex-wrap: wrap; gap: 5px; }
.cats button { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer; min-height: 28px; }
.cats button:hover { border-color: var(--brand); }
.cats button[aria-selected=true] { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.cats button em { font-style: normal; opacity: .65; margin-left: 3px; }
.theme[hidden] { display: none; }
.theme .tag { font-style: normal; font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding: 1px 6px; border-radius: 999px; background: color-mix(in srgb, var(--brand) 14%, var(--panel)); color: var(--brand); margin-right: 4px; }

.palette { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.palette button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #cbd5e1; cursor: pointer; padding: 0; }
.palette button:hover { box-shadow: 0 0 0 2px var(--accent, #2563eb); }
.palette button:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
