/* ==========================================================================
   Tasarım token'ları — tüm panel renkleri buradan gelir.
   Soğuk gri yerine hafif sıcak mürekkep: kağıt üstüne basılmış bir araç gibi dursun.
   ========================================================================== */
:root {
  --bg: #14120e;
  --surface: #1c1914;
  --surface-2: #252119;
  --surface-3: #2e2920;
  --border: #3a342a;
  --border-strong: #514838;
  --text: #f4efe6;
  --muted: #c4b7a4;
  --faint: #8f8272;
  --primary: #f3eadc;
  --primary-fg: #1a1612;
  --success: #8fbf7a;
  --danger: #e08a7a;
  --radius: 10px;
  --radius-sm: 6px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sans: "Outfit", "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 600; letter-spacing: -.015em; }
p { margin: 0; }
[hidden] { display: none !important; }
::selection { background: rgba(255, 255, 255, .2); }

.icon { width: 16px; height: 16px; flex: none; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.link { color: var(--text); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; transition: text-decoration-color .15s; }
.link:hover { text-decoration-color: var(--text); }
.mb { margin-bottom: 16px; }
.mt { margin-top: 16px; }
.narrow { max-width: 680px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.split { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- Panel iskeleti (sidebar + içerik) ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 24px;
  padding: 20px 12px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; min-width: 0; }
.brand-text { min-width: 0; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--text); color: var(--bg); flex: none; }
.brand-mark .icon { width: 17px; height: 17px; }
.brand-mark.lg { width: 44px; height: 44px; border-radius: 12px; }
.brand-mark.lg .icon { width: 22px; height: 22px; }
.brand-name { font-weight: 600; font-size: 14px; letter-spacing: -.01em; }
.brand-sub { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--muted);
  font: inherit; font-weight: 500; text-align: left; cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.is-active { background: var(--surface-3); color: var(--text); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 12px; border-top: 1px solid var(--border); }

.main { width: 100%; max-width: 1160px; padding: 36px 40px 72px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 24px; }
.page-head p { margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px; color: var(--faint); font-size: 13px; font-weight: 500; transition: color .15s; }
.back:hover { color: var(--text); }

/* ---------- Kartlar ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .2s var(--ease), transform .25s var(--ease), box-shadow .25s var(--ease); }
.card:hover { border-color: var(--border-strong); }
.card-body { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 14px; }
.card.danger { border-color: rgba(248, 113, 113, .25); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { padding: 18px 20px; }
.stat-label { font-size: 12px; font-weight: 500; color: var(--muted); }
.stat-value { margin-top: 6px; font-size: 30px; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.url { display: block; margin-top: 4px; font-size: 16px; font-weight: 500; }

/* ---------- Tablo ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 10px 20px; border-bottom: 1px solid var(--border); text-align: left; font-size: 12px; font-weight: 500; color: var(--faint); white-space: nowrap; }
.table td { padding: 12px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: rgba(255, 255, 255, .018); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions form { display: inline-block; }
.cell-main { font-weight: 500; }
.cell-sub { font-size: 12px; color: var(--faint); }
.cell-flex { display: flex; align-items: center; gap: 12px; }
.thumb { width: 40px; height: 40px; flex: none; display: grid; place-items: center; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--faint); }

/* ---------- Form elemanları ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 500; }
.hint { font-size: 12px; color: var(--faint); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.input, .select, .textarea {
  width: 100%; padding: 9px 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: #52525b; box-shadow: 0 0 0 3px rgba(255, 255, 255, .06); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:disabled { color: var(--muted); background: var(--surface-2); }
.input-sm { padding: 6px 10px; }
.textarea { min-height: 140px; resize: vertical; }
.textarea.sm { min-height: 80px; }
.select {
  appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2371717a' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.input-group { display: flex; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.addon { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--text); }
.align-center { align-self: center; padding-top: 8px; }
.form-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.form-bar { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.inline-form { display: flex; gap: 8px; }
.sort-input { width: 90px; flex: none; }
.toolbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .select { width: auto; min-width: 200px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }

.search { position: relative; flex: 1; max-width: 340px; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search .input { padding-left: 36px; }

/* Görsel yükleme alanı: gerçek file input görünmez şekilde alanın tamamını kaplar */
.dropzone {
  position: relative; display: grid; place-items: center; aspect-ratio: 1;
  overflow: hidden; cursor: pointer; text-align: center;
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--bg); color: var(--faint); font-size: 13px;
  transition: border-color .15s;
}
.dropzone:hover { border-color: #52525b; }
.dropzone.has-image { border-style: solid; }
.dropzone.has-image .dropzone-hint { display: none; }
.dropzone img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .icon { width: 22px; height: 22px; margin-bottom: 6px; }
.dropzone small { color: var(--faint); font-size: 11px; }
/* Panel ek fotoğraflar: işaretlenen fotoğraf soluklaşır ve kırmızı çöp kutusu belirir (kaydedince silinir) */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.gallery-item, .gallery-add { position: relative; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.gallery-item { cursor: pointer; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: opacity .15s; }
.gallery-item input { position: absolute; opacity: 0; pointer-events: none; }
.gallery-remove { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; background: rgba(9, 9, 11, .75); color: var(--muted); opacity: 0; transition: opacity .15s; }
.gallery-remove .icon { width: 13px; height: 13px; }
.gallery-item:hover .gallery-remove { opacity: 1; }
.gallery-item:has(input:checked) { border-color: rgba(248, 113, 113, .6); }
.gallery-item:has(input:checked) img { opacity: .3; }
.gallery-item:has(input:checked) .gallery-remove { opacity: 1; background: var(--danger); color: #fff; }
.gallery-add { display: grid; place-items: center; border-style: dashed; background: var(--bg); color: var(--faint); cursor: pointer; transition: border-color .15s, color .15s; }
.gallery-add:hover { border-color: #52525b; color: var(--text); }
.gallery-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.gallery-grid.is-new .gallery-item { cursor: default; border-color: rgba(74, 222, 128, .4); }
.dropzone.logo { width: 88px; flex: none; }
.logo-row { display: flex; gap: 16px; align-items: center; }

/* ---------- Butonlar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn:hover { background: var(--surface-3); border-color: #3f3f46; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.btn-primary:hover { background: #e4e4e7; border-color: #e4e4e7; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; color: var(--text); }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(248, 113, 113, .3); }
.btn-danger:hover { background: rgba(248, 113, 113, .08); border-color: rgba(248, 113, 113, .5); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 36px; padding: 0; }
.btn-block { width: 100%; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { color: var(--success); border-color: rgba(74, 222, 128, .25); background: rgba(74, 222, 128, .06); }

.flash { margin-bottom: 16px; padding: 11px 14px; border: 1px solid; border-radius: var(--radius-sm); font-size: 13px; }
.flash-success { color: #86efac; background: rgba(74, 222, 128, .06); border-color: rgba(74, 222, 128, .22); }
.flash-error { color: #fca5a5; background: rgba(248, 113, 113, .07); border-color: rgba(248, 113, 113, .25); }

.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 56px 20px; color: var(--muted); text-align: center; }
.empty > .icon { width: 28px; height: 28px; color: var(--faint); }
.empty.lg { padding: 96px 20px; }

/* ---------- Giriş ---------- */
/* Ortada yüzen kart değil: solda başlık, sağda form. Hata sayfası hâlâ .center-page kullanır. */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 440px);
}
.login-aside {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 14px;
  padding: 48px 56px 64px;
  background:
    linear-gradient(180deg, transparent, rgba(0, 0, 0, .28)),
    #1a1612;
  border-right: 1px solid var(--border);
}
.login-aside h1 { font-size: 52px; line-height: 1.05; max-width: 9ch; }
.login-aside p { max-width: 36ch; color: var(--muted); font-size: 17px; }
.login-kicker { font-family: var(--sans); font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.login-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  padding: 48px 40px;
  background: var(--bg);
}
.login-form .btn { margin-top: 8px; }

.center-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: var(--bg);
}
.auth-card { width: 100%; max-width: 380px; padding: 32px; display: flex; flex-direction: column; gap: 18px; }
.auth-card h1 { font-size: 20px; }
.auth-card p { margin-top: 4px; }
.auth-card .flash { margin: 0; }
.state { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; max-width: 420px; }
.state h1 { font-size: 24px; }
.state-code { font-size: 64px; font-weight: 700; letter-spacing: -.05em; line-height: 1; background: linear-gradient(180deg, #fafafa, #52525b); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ==========================================================================
   CMS editörü (sayfa blokları + tasarım)
   ========================================================================== */
.main.main-wide { max-width: none; padding-right: 24px; }
.page-head.tight { margin-bottom: 16px; }
.mono-sm { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.textarea.mono { font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; min-height: 60px; }
.text-success { color: var(--success); }
.inline-form.wrap { flex-wrap: wrap; }
.inline-form.wrap .input { flex: 1 1 240px; }
.select.auto { width: auto; }
.addon-left { border-left: 1px solid var(--border-strong); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .addon-left + .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-xs { height: 28px; padding: 0 8px; font-size: 12px; }
.btn-xs.btn-icon { width: 28px; padding: 0; }
.btn-dashed { border-style: dashed; background: transparent; color: var(--muted); width: 100%; }
.btn-dashed:hover { color: var(--text); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.danger-hover:hover { color: var(--danger); }

/* İki sütun: solda editör, sağda yapışkan önizleme */
.editor { display: grid; grid-template-columns: minmax(380px, 520px) minmax(0, 1fr); gap: 24px; align-items: start; }
.editor-side { min-width: 0; }
.editor-preview { position: sticky; top: 16px; height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.preview-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.preview-stage { flex: 1; display: flex; justify-content: center; background: repeating-conic-gradient(#0f0f11 0% 25%, #121215 0% 50%) 50% / 20px 20px; }
.preview-stage { position: relative; }
/* İki iframe üst üste: görünen "is-active", diğeri arkada yeni önizlemeyi yükler */
.preview-frame { position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; height: 100%; border: 0; background: var(--bg); visibility: hidden; transition: width .3s var(--ease); }
.preview-frame.is-active { visibility: visible; }
.editor.is-mobile .preview-frame { width: 390px; max-width: 100%; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }

/* Canlı önizleme etiketi: yüklenirken nabız atar */
.live-badge { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-size: 12px; color: var(--muted); }
.live-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.live-badge[data-state=saving]::before { animation: pulse .7s infinite alternate; background: #facc15; }
.live-badge[data-state=error] { color: var(--danger); }
.live-badge[data-state=error]::before { background: var(--danger); }
/* Son kullanıcı ipucu */
.editor-tip { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 14px; padding: 12px 14px; border: 1px solid rgba(59, 130, 246, .3); border-radius: var(--radius-sm); background: rgba(59, 130, 246, .07); color: #bfdbfe; font-size: 13px; line-height: 1.5; }
.editor-tip .icon { margin-top: 2px; color: #60a5fa; }
.editor-tip strong { color: #fff; font-weight: 600; }
.link-field[data-link-field] { grid-template-columns: 1fr; }
@keyframes pulse { to { opacity: .3; } }

/* Editör üst çubuğu: sayfa seçici */
.editor-top { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.page-switch { position: relative; flex: 1; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.page-switch select { flex: 1; min-width: 0; appearance: none; border: 0; background: transparent; color: var(--text); font: 600 16px/1 inherit; font-family: inherit; cursor: pointer; outline: none; }
.page-switch select option { background: var(--surface); }
.page-switch > .icon:last-child { color: var(--faint); pointer-events: none; }

/* "⋯" işlem menüsü */
.menu { position: relative; }
.menu > summary { list-style: none; font-size: 18px; line-height: 1; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 170px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: 0 12px 32px rgba(0, 0, 0, .45); }
.menu-list button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.menu-list button:hover { background: var(--surface-3); }
.menu-list button.danger { color: var(--danger); }

/* Kaydedilmemiş değişiklik göstergesi */
.dirty-dot { display: none; width: 7px; height: 7px; margin-left: 4px; border-radius: 50%; background: #facc15; vertical-align: middle; }
.block-item.is-dirty .dirty-dot { display: inline-block; }
.block-item.is-dirty { border-color: rgba(250, 204, 21, .35); }
.save-hint { display: none; margin-right: auto; align-self: center; font-size: 12px; color: #facc15; }
.block-item.is-dirty .save-hint, .sticky-bar .save-hint { display: inline; }
.sticky-bar .save-hint { color: var(--faint); }
.narrow-dialog { width: min(460px, calc(100% - 32px)); }

/* Segment kontrol: radio veya buton grubu tek parça görünür */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); flex-wrap: wrap; }
.segmented button, .segmented label span { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.segmented label input { position: absolute; opacity: 0; pointer-events: none; }
.segmented button.is-active, .segmented label input:checked + span { background: var(--surface-3); color: var(--text); }

.settings-card { margin-bottom: 16px; }
.settings-card > summary, .style-box > summary { display: flex; align-items: center; gap: 8px; padding: 14px 18px; cursor: pointer; font-weight: 500; list-style: none; }
.settings-card > summary::-webkit-details-marker, .style-box > summary::-webkit-details-marker { display: none; }
.settings-card[open] > summary { border-bottom: 1px solid var(--border); }

/* Blok listesi */
.block-list { display: flex; flex-direction: column; }
.block-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .15s, opacity .15s; }
.block-item.is-open { border-color: #3f3f46; }
.block-item.is-hidden .block-meta, .block-item.is-hidden .block-icon { opacity: .45; }
.block-item.is-dragging { opacity: .4; }
.block-head { display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 6px; }
.block-grip { display: grid; place-items: center; width: 22px; height: 32px; color: var(--faint); cursor: grab; flex: none; }
.block-grip:active { cursor: grabbing; }
.block-toggle { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding: 4px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.block-icon { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--surface-3); color: var(--text); }
.block-meta { display: flex; flex-direction: column; min-width: 0; }
.block-meta strong { font-size: 14px; font-weight: 600; }
.block-meta small { color: var(--faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.block-actions { display: flex; gap: 0; opacity: .6; transition: opacity .15s; }
.block-item:hover .block-actions, .block-item.is-open .block-actions { opacity: 1; }
.block-body { display: none; padding: 16px 18px 18px; border-top: 1px solid var(--border); }
.block-item.is-open .block-body { display: block; }
.block-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.block-insert { align-self: center; display: grid; place-items: center; width: 26px; height: 26px; margin: 4px 0; padding: 0; border: 1px dashed var(--border-strong); border-radius: 50%; background: var(--bg); color: var(--faint); cursor: pointer; opacity: .5; transition: opacity .15s, color .15s; }
.block-insert:hover { opacity: 1; color: var(--text); border-color: var(--text); }
.block-insert .icon { width: 14px; height: 14px; }
.style-box { margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.style-box > summary { padding: 10px 14px; font-size: 13px; color: var(--muted); }
.style-box[open] > summary { border-bottom: 1px solid var(--border); }
.style-box > .stack { padding: 14px; }

/* Tekrarlanan liste (repeater) */
.repeater { display: flex; flex-direction: column; gap: 8px; }
.repeater-head { display: flex; justify-content: space-between; align-items: baseline; }
.repeater-items { display: flex; flex-direction: column; gap: 8px; }
.repeater-item { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.repeater-item-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 6px 12px; border-bottom: 1px solid var(--border); }
.repeater-title { font-size: 12px; font-weight: 600; color: var(--muted); }
.repeater-tools { display: flex; }
.repeater-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px; }
.repeater-fields > .field:has(textarea), .repeater-fields > .field:has(.image-field), .repeater-fields > .field:has(.link-field), .repeater-fields > .check { grid-column: 1 / -1; }

/* Görsel alanı (blok formlarında) */
.image-field { display: flex; align-items: center; gap: 12px; }
.image-drop { position: relative; width: 96px; height: 72px; flex: none; display: grid; place-items: center; overflow: hidden; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--bg); color: var(--faint); cursor: pointer; }
.image-drop:hover { border-color: #52525b; color: var(--text); }
.image-drop.has-image { border-style: solid; }
.image-drop.has-image .image-drop-hint { display: none; }
.image-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.image-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.image-drop-hint { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; }

/* Blok seçici penceresi */
.picker { width: min(760px, calc(100% - 32px)); padding: 0; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: 0 24px 80px rgba(0, 0, 0, .6); }
.picker::backdrop { background: rgba(0, 0, 0, .65); backdrop-filter: blur(3px); }
.picker-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.picker-head h2 { font-size: 16px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; padding: 16px 20px 20px; max-height: 70vh; overflow-y: auto; }
.picker-item { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background .15s; }
.picker-item:hover { border-color: #52525b; background: var(--surface-2); }
.picker-item strong { font-size: 14px; }
.picker-item small { color: var(--faint); font-size: 12px; line-height: 1.4; }

/* "Hazır seç" bağlantı alanı: sol input, sağ menü */
.link-field { display: grid; grid-template-columns: minmax(0, 1fr) 128px; gap: 6px; }
.link-pick { color: var(--muted); }
.repeater-more { grid-column: 1 / -1; }
.repeater-more > summary { font-size: 12px; color: var(--faint); cursor: pointer; }
.repeater-more[open] > summary { margin-bottom: 10px; }
.picker-body { max-height: 72vh; overflow-y: auto; padding-bottom: 8px; }
.picker-group { padding: 16px 20px 0; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.picker-body .picker-grid { max-height: none; overflow: visible; padding-top: 10px; padding-bottom: 8px; }
.picker-grid.is-basic { grid-template-columns: repeat(3, 1fr); }

/* Tasarım sayfası */
.swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.swatch { width: 32px; height: 32px; padding: 0; border: 2px solid transparent; border-radius: 50%; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); }
.swatch.is-active { border-color: var(--text); }
.swatch.is-theme { width: auto; height: 32px; display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: 13px; color: var(--muted); box-shadow: none; }
.swatch.is-theme input { position: absolute; opacity: 0; }
.swatch.is-theme:has(input:checked) { border-color: var(--text); color: var(--text); }
.swatches input[type=color] { width: 40px; height: 32px; padding: 2px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg); cursor: pointer; }
.pair-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pair { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); cursor: pointer; }
.pair input { position: absolute; opacity: 0; }
.pair strong { font-size: 14px; }
.pair small { color: var(--faint); font-size: 12px; }
.pair:has(input:checked) { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.preset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.preset { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); cursor: pointer; }
.preset input { position: absolute; opacity: 0; }
.preset:has(input:checked) { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.preset-swatch { display: flex; align-items: flex-end; gap: 4px; height: 52px; padding: 8px; border: 1px solid; border-radius: 6px; }
.preset-swatch span { flex: 1; height: 14px; border-radius: 3px; }
.preset-swatch span:nth-child(2) { height: 22px; }
.preset-name { font-size: 13px; font-weight: 500; text-align: center; }
.color-row { display: flex; align-items: center; gap: 14px; }
.color-row input[type=color] { width: 48px; height: 36px; padding: 2px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg); cursor: pointer; }
.sticky-bar { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 40%); }

@media (max-width: 1100px) {
  .editor { grid-template-columns: 1fr; }
  .editor-preview { position: relative; top: 0; height: 70vh; order: 2; }
}

/* ---------- Mobil uyum ---------- */
@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; }
  .login-aside { padding: 32px 24px 28px; border-right: 0; border-bottom: 1px solid var(--border); }
  .login-aside h1 { font-size: 40px; }
  .login-form { padding: 28px 24px 48px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; z-index: 20; height: auto; flex-direction: row; align-items: center; gap: 12px; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
  .brand-text { display: none; }
  .nav { flex-direction: row; }
  .sidebar-foot { flex-direction: row; margin: 0 0 0 auto; padding: 0; border: 0; }
  .sidebar-foot span { display: none; }
  .main { padding: 24px 16px 56px; }
  .grid-2, .row { grid-template-columns: 1fr; }
  .main.main-wide { padding-right: 16px; }
  .repeater-fields { grid-template-columns: 1fr; }
  .preset-grid, .pair-grid, .picker-grid.is-basic { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .nav-link span { display: none; }
  .page-head h1 { font-size: 20px; }
  .stat-value { font-size: 24px; }
  .table th, .table td { padding: 10px 14px; }
}

/* Ürün formu: teknik özellik satırları ve checkbox ızgarası */
.spec-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 8px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 16px; margin-top: 6px; }
details.field > summary { cursor: pointer; }
.nav-badge { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 999px; background: #3b82f6; color: #fff; font-size: 12px; font-weight: 700; }
/* Teklif talepleri: durum rozetleri, müşteri bilgisi listesi, ürün seçim listesi */
.status-new { background: rgba(59, 130, 246, .18); color: #93c5fd; }
.status-contacted { background: rgba(245, 158, 11, .18); color: #fcd34d; }
.status-sent { background: rgba(168, 85, 247, .18); color: #d8b4fe; }
.status-done { background: rgba(34, 197, 94, .18); color: #86efac; }
.status-cancelled { background: rgba(161, 161, 170, .16); color: #a1a1aa; }
.dl { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px 16px; margin: 0; }
.dl dt { color: var(--muted, #a1a1aa); }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.pre-line { white-space: pre-line; }
.check-list { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.segmented a { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 6px; color: var(--muted); font-size: 13px; font-weight: 500; text-decoration: none; }
.segmented a.is-active { background: var(--surface-3); color: var(--text); }
.stats-5 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
a.stat { color: inherit; text-decoration: none; transition: border-color .15s; }
a.stat:hover { border-color: var(--border-strong); }
.stat-alert { border-color: #3b82f6; }

/* ---------- Şablonlar (süper admin) ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.tpl-card { display: flex; flex-direction: column; overflow: hidden; }
/* Canlı küçük önizleme: site 4 kat genişlikte (masaüstü görünümü) render edilip %25'e küçültülür */
.tpl-thumb { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.tpl-thumb iframe { position: absolute; inset: 0; width: 400%; height: 400%; border: 0; transform: scale(.25); transform-origin: 0 0; pointer-events: none; background: #fff; }
.tpl-thumb.is-empty { display: grid; place-items: center; color: var(--faint); }
.tpl-meta { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.tpl-actions { display: flex; gap: 8px; padding: 0 16px 16px; flex-wrap: wrap; }
/* Yeni müşteri formunda seçilebilir şablon kartları (radio) */
.tpl-pick { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.tpl-option { position: relative; cursor: pointer; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.tpl-option input { position: absolute; opacity: 0; pointer-events: none; }
.tpl-option:has(input:checked) { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.tpl-option:has(input:focus-visible) { outline: 2px solid var(--text); outline-offset: 2px; }
.tpl-option .tpl-meta { padding: 10px 12px; flex-direction: row; align-items: center; justify-content: space-between; }
.tpl-option .tpl-meta a { color: var(--muted); display: inline-flex; }
.tpl-option .tpl-meta a:hover { color: var(--text); }
.tpl-check { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%; display: none; place-items: center; background: var(--text); color: var(--bg); z-index: 1; }
.tpl-check .icon { width: 14px; height: 14px; }
.tpl-option:has(input:checked) .tpl-check { display: grid; }
.tenant-form-wide { max-width: 980px; }
/* Yeni seçilen (henüz yüklenmemiş) fotoğraflar: "×" her zaman görünür, tıklayınca seçimden çıkar */
.gallery-grid.is-new .gallery-remove { opacity: 1; border: 0; cursor: pointer; font-size: 16px; line-height: 1; color: #fff; }
.gallery-grid.is-new .gallery-remove:hover { background: var(--danger); }
/* Ürün alanları → seçenek listeleri: iki eşit sütun; satır içi ad düzenleme (kenarlıksız, odakta belirginleşir) */
.grid-2.equal { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.input-inline { height: 32px; border-color: transparent; background: transparent; }
.input-inline:hover { border-color: var(--border); }
.input-inline:focus { border-color: var(--border-strong); background: var(--bg); }
.nowrap { white-space: nowrap; }

/* ---------- Hareket / animasyon ---------- */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes soft-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes bar-rise {
  from { transform: scaleY(0); opacity: .3; }
  to { transform: scaleY(1); opacity: .85; }
}
@keyframes heat-pop {
  from { transform: scale(.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes hbar-fill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.main > .page-head { animation: fade-up .45s var(--ease) both; }
.main > .flash { animation: fade-up .4s var(--ease) both; }
.main > .wa-ledger,
.main > .stats,
.main > .grid-2,
.main > .card,
.main > .stack,
.main > .rp-toolbar,
.main > .rp-section {
  animation: fade-up .5s var(--ease) both;
}
.main .card { animation: fade-up .55s var(--ease) both; }
.nav-link { transition: background .2s var(--ease), color .2s var(--ease), transform .2s var(--ease); }
.nav-link:hover { transform: translateX(2px); }
.btn { transition: background .2s var(--ease), color .2s var(--ease), transform .15s var(--ease), box-shadow .2s var(--ease); }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.stat-value { font-family: var(--display); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Tema seçici */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.theme-card {
  display: flex; flex-direction: column; gap: 8px; padding: 12px;
  border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
  background: var(--surface-2);
}
.theme-card.is-active, .theme-card:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.theme-card input { position: absolute; opacity: 0; pointer-events: none; }
.theme-swatch {
  display: flex; gap: 6px; align-items: flex-end; height: 56px; padding: 10px;
  border: 1px solid; border-radius: var(--radius-sm);
}
.theme-swatch span { width: 18px; height: 18px; border-radius: 4px; }
.border-top { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 8px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

