/* ============================================================
   Serhendi Gençlik CMS — Design System
   Dark-first, teal accent, geometric sans
   ============================================================ */

/* Yazı tipleri yerel sistem font yığınına devredildi (harici Google Fonts isteği yok).
   Plus Jakarta Sans / JetBrains Mono yüklüyse kullanılır; değilse system-ui / ui-monospace devreye girer. */

/* ---------- Tokens: shared ---------- */
:root {
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 999px;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  --sidebar-w: 256px;
  --topbar-h: 56px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Dark theme (default) ---------- */
[data-theme="dark"] {
  /* color-scheme: native <select> açılır listesi, date/color/datetime seçicileri ve scrollbar'lar
     temayla aynı (koyu) render edilir. Eksikken bunlar BEYAZ zeminde açılıp açık renk option
     metnini okunamaz yapıyordu. */
  color-scheme: dark;

  --bg: #0e0f12;
  --bg-grad: radial-gradient(1100px 560px at 84% -14%, rgba(25,194,172,0.10), transparent 60%);
  --surface: #1a1c21;
  --surface-2: #22252b;
  --surface-3: #2b2f36;
  --raised: #1d2026;
  --sidebar-bg: #121317;
  --border: #2c3037;
  --border-strong: #3a3f48;
  --border-faint: #202329;

  --text: #edeef1;
  --text-2: #b6bcc5;
  --muted: #8a929c;
  --faint: #646b76;

  --accent: #1ec9b2;
  --accent-hover: #34dcc6;
  --accent-soft: rgba(30,201,178,0.16);
  --accent-border: rgba(30,201,178,0.34);
  --accent-text: #5eead4;
  --on-accent: #04201c;

  --success: #34d399;
  --success-soft: rgba(52,211,153,0.14);
  --warning: #fbbf24;
  --warning-soft: rgba(251,191,36,0.14);
  --danger: #f87171;
  --danger-soft: rgba(248,113,113,0.14);
  --info: #60a5fa;
  --info-soft: rgba(96,165,250,0.14);
  --purple: #a78bfa;
  --purple-soft: rgba(167,139,250,0.14);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.45);
  --shadow-md: 0 6px 22px rgba(0,0,0,0.5);
  --shadow-lg: 0 22px 56px rgba(0,0,0,0.62);
  --overlay: rgba(6,9,12,0.7);
  --scrim: rgba(0,0,0,0.3);
}

/* ---------- Light theme ---------- */
[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f8;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, rgba(13,148,136,0.05), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f7f9fa;
  --surface-3: #eef1f4;
  --raised: #ffffff;
  --sidebar-bg: #ffffff;
  --border: #e5e9ed;
  --border-strong: #d4dae0;
  --border-faint: #eef1f4;

  --text: #131a21;
  --text-2: #3f4a55;
  --muted: #6a7681;
  --faint: #9aa5b1;

  --accent: #0d9488;
  --accent-hover: #0b827a;
  --accent-soft: rgba(13,148,136,0.10);
  --accent-border: rgba(13,148,136,0.28);
  --accent-text: #0b766c;
  --on-accent: #ffffff;

  --success: #059669;
  --success-soft: rgba(5,150,105,0.10);
  --warning: #d97706;
  --warning-soft: rgba(217,119,6,0.12);
  --danger: #dc2626;
  --danger-soft: rgba(220,38,38,0.09);
  --info: #2563eb;
  --info-soft: rgba(37,99,235,0.09);
  --purple: #7c3aed;
  --purple-soft: rgba(124,58,237,0.09);

  --shadow-sm: 0 1px 2px rgba(16,24,40,0.06);
  --shadow-md: 0 6px 20px rgba(16,24,40,0.08);
  --shadow-lg: 0 20px 50px rgba(16,24,40,0.16);
  --overlay: rgba(20,28,38,0.42);
  --scrim: rgba(20,28,38,0.06);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 14px;
  line-height: 1.5;
}
#root { height: 100%; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
::selection { background: var(--accent-soft); color: var(--text); }

/* Global [hidden] — UA varsayılanı `[hidden]{display:none}` çok düşük özgüllükte olduğu için
   .row/.col/.btn gibi display:flex|inline-flex|grid taşıyan utility sınıfları onu ezer ve
   öğe gizlenemez. Tek kural + !important bunu kökten çözer; eski tekil yamaların
   (.btn[hidden], .cmd-wrap[hidden], [data-ctb-step][hidden]) yerine geçer. JS hiçbir yerde
   `hidden` taşıyan öğeyi inline `style.display` ile göstermez, bu yüzden regresyon yok. */
[hidden] { display: none !important; }

/* Görünür, temaya uyumlu odak halkası — yalnız klavye gezgini için (fare tıklamasında çıkmaz).
   Inputlar kendi box-shadow halkasını kullandığı için bu listede yok. */
a:focus-visible, button:focus-visible, .btn:focus-visible, .nav-item:focus-visible,
.cmd-item:focus-visible, .dropdown-item:focus-visible, .tab:focus-visible,
.seg button:focus-visible, .chk:focus-visible, .toggle:focus-visible, .mini-btn:focus-visible,
.chip-x:focus-visible, .matrix-cell:focus-visible, .icon-btn:focus-visible, [data-seg-val]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100%; }
.app.collapsed { grid-template-columns: 68px 1fr; }
.main { display: flex; flex-direction: column; min-width: 0; height: 100%; overflow: hidden; }
.content { flex: 1; overflow-y: auto; padding: var(--sp-6) var(--sp-8); }
.content-narrow { max-width: 1320px; margin: 0 auto; }

/* ---------- Sidebar ---------- */
.sidebar { background: var(--sidebar-bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; height: 100%; }
.sidebar-head { height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border-faint); flex-shrink: 0; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--accent-hover)); display: grid; place-items: center; flex-shrink: 0; box-shadow: 0 2px 8px var(--accent-soft); }
.brand-mark span { font-weight: 800; color: var(--on-accent); font-size: 15px; }
.brand-name { font-weight: 700; font-size: 14px; letter-spacing: -0.01em; white-space: nowrap; }
.brand-sub { font-size: 11px; color: var(--muted); white-space: nowrap; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-group-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--faint); padding: 14px 10px 5px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--text-2); font-size: 13.5px; font-weight: 500; border: none; background: none; width: 100%; text-align: left; transition: background .12s, color .12s; position: relative; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-item.active .ico { color: var(--accent-text); }
.nav-item .ico { color: var(--muted); flex-shrink: 0; }
.nav-item.active::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-badge { margin-left: auto; font-size: 10.5px; font-weight: 700; background: var(--surface-3); color: var(--text-2); border-radius: 99px; padding: 1px 7px; }
.collapsed .nav-label, .collapsed .nav-group-label, .collapsed .nav-badge, .collapsed .brand-text { display: none; }
.collapsed .nav-item { justify-content: center; padding: 9px; }
.collapsed .sidebar-head { justify-content: center; padding: 0; }
.sidebar-foot { padding: 10px; border-top: 1px solid var(--border-faint); flex-shrink: 0; }
.collapsed .sidebar-foot { padding: 10px 8px; }
.collapsed .sidebar-foot > div { justify-content: center; padding: 8px !important; }
.collapsed .sidebar-foot > div > div:not(:first-child),
.collapsed .sidebar-foot > div > svg { display: none !important; }

/* ---------- Topbar ---------- */
.topbar { position: relative; z-index: 60; height: var(--topbar-h); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; padding: 0 20px; flex-shrink: 0; background: color-mix(in srgb, var(--surface) 60%, transparent); backdrop-filter: blur(8px); }
.topbar .dropdown { z-index: 75; }
.breadcrumb { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); min-width: 0; white-space: nowrap; flex-shrink: 0; }
.breadcrumb b { color: var(--text); font-weight: 600; white-space: nowrap; }
.breadcrumb span { white-space: nowrap; }
.breadcrumb .sep { color: var(--faint); flex-shrink: 0; }
.topbar-search { display: flex; align-items: center; gap: 9px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 7px 12px; color: var(--muted); font-size: 13px; min-width: 230px; transition: border-color .12s; }
.topbar-search:hover { border-color: var(--border-strong); }
.topbar-search kbd { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; color: var(--faint); }
.topbar-spacer { flex: 1; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: var(--r-sm); font-weight: 600; font-size: 13px; padding: 8px 14px; border: 1px solid transparent; transition: background .12s, border-color .12s, color .12s, transform .04s; white-space: nowrap; line-height: 1; }
.btn:active { transform: translateY(0.5px); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.btn-soft { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-soft:hover { background: var(--surface-3); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-subtle { background: transparent; color: var(--text-2); }
.btn-subtle:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn-xs { padding: 4px 8px; font-size: 12px; gap: 5px; }
.btn-lg { padding: 11px 18px; font-size: 14px; }
.btn-icon { padding: 8px; width: 34px; height: 34px; }
.btn-icon.btn-sm { padding: 6px; width: 30px; height: 30px; }
.btn:disabled, .btn.disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.btn[data-locked] { position: relative; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: var(--r-full); line-height: 1.5; border: 1px solid transparent; white-space: nowrap; }
.badge .dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.badge-draft { background: var(--surface-3); color: var(--muted); }
.badge-modified { background: var(--warning-soft); color: var(--warning); }
.badge-published { background: var(--success-soft); color: var(--success); }
.badge-archived { background: var(--surface-3); color: var(--faint); }
.badge-scheduled { background: var(--info-soft); color: var(--info); }
.badge-review { background: var(--accent-soft); color: var(--accent-text); }
.badge-changes { background: var(--warning-soft); color: var(--warning); }
.badge-approved { background: var(--success-soft); color: var(--success); }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-neutral { background: var(--surface-3); color: var(--text-2); }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.card-pad { padding: var(--sp-5); }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border-faint); }
.card-title { font-weight: 700; font-size: 14px; letter-spacing: -0.01em; }
.card-sub { font-size: 12.5px; color: var(--muted); }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: var(--sp-6); }
.page-title { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.page-desc { color: var(--muted); font-size: 13.5px; margin: 4px 0 0; }
.page-head-actions { margin-left: auto; display: flex; gap: 9px; align-items: center; }

/* ---------- Stat cards ---------- */
.stat { padding: 18px; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); position: relative; overflow: hidden; }
.stat-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; margin-bottom: 14px; }
.stat-val { font-size: 27px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.stat-label { font-size: 12.5px; color: var(--muted); margin-top: 6px; font-weight: 500; }
.stat-delta { font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 3px; margin-top: 8px; }
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--danger); }
.stat-delta.flat { color: var(--muted); }

/* ---------- Table ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th { text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.tbl tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border-faint); vertical-align: middle; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr.selected { background: var(--accent-soft); }
.tbl .cell-title { font-weight: 600; color: var(--text); }
.tbl .cell-sub { font-size: 12px; color: var(--muted); }
.tbl .row-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .1s; justify-content: flex-end; }
.tbl tbody tr:hover .row-actions { opacity: 1; }

/* ---------- Checkbox / inputs ---------- */
.chk { width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--border-strong); background: var(--surface); display: inline-grid; place-items: center; cursor: pointer; flex-shrink: 0; transition: background .1s, border-color .1s; }
.chk.checked { background: var(--accent); border-color: var(--accent); }
.chk.indet { background: var(--accent); border-color: var(--accent); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.field-label .req { color: var(--danger); }
.field-hint { font-size: 11.5px; color: var(--muted); }
.field-err { font-size: 11.5px; color: var(--danger); font-weight: 500; }
.input, .textarea, .select { width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 9px 12px; color: var(--text); font-size: 13.5px; transition: border-color .12s, box-shadow .12s; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input.error, .textarea.error { border-color: var(--danger); }
.textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a929c' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px; }
/* Native açılır liste öğeleri — color-scheme ile birlikte koyu/aydınlık temada okunur kalır
   (color-scheme'i onurlandırmayan tarayıcılar için açık güvence). */
select option, select optgroup { background: var(--surface); color: var(--text); }
select optgroup { font-weight: 700; }

/* toggle */
.toggle { width: 38px; height: 22px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border-strong); position: relative; transition: background .15s; flex-shrink: 0; cursor: pointer; }
.toggle.on { background: var(--accent); border-color: var(--accent); }
.toggle::after { content: ''; position: absolute; top: 1.5px; left: 1.5px; width: 17px; height: 17px; border-radius: 99px; background: #fff; transition: transform .15s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.toggle.on::after { transform: translateX(16px); }

/* segmented */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 2px; gap: 2px; }
.seg button { border: none; background: none; padding: 5px 11px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); transition: background .1s, color .1s; display: inline-flex; align-items: center; gap: 6px; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); }
.tab { padding: 10px 14px; font-size: 13px; font-weight: 600; color: var(--muted); border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .12s, border-color .12s; display: inline-flex; align-items: center; gap: 7px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.tab .tab-count { font-size: 11px; background: var(--surface-3); color: var(--muted); border-radius: 99px; padding: 0 6px; font-weight: 700; }

/* ---------- Drawer / Modal ---------- */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 80; opacity: 0; animation: fadeIn .15s var(--ease) forwards; backdrop-filter: blur(2px); }
@keyframes fadeIn { to { opacity: 1; } }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 480px; max-width: 94vw; background: var(--surface); border-left: 1px solid var(--border); z-index: 81; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); transform: translateX(100%); animation: slideIn .26s var(--ease-out) forwards; }
.drawer.wide { width: 640px; }
.drawer.xwide { width: 860px; }
@keyframes slideIn { to { transform: translateX(0); } }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: center; flex-shrink: 0; background: var(--surface-2); }

.modal-wrap { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); width: 460px; max-width: 100%; z-index: 91; transform: scale(0.96); opacity: 0; animation: pop .2s var(--ease-out) forwards; max-height: 88vh; display: flex; flex-direction: column; }
.modal.lg { width: 720px; }
.modal.xl { width: 980px; }
@keyframes pop { to { transform: scale(1); opacity: 1; } }
.modal-head { padding: 18px 22px 0; }
.modal-body { padding: 16px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px 18px; display: flex; gap: 10px; }

/* ---------- Toast ---------- */
.toast-stack { position: fixed; bottom: 22px; right: 22px; z-index: 120; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: flex-start; gap: 11px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; box-shadow: var(--shadow-lg); min-width: 290px; max-width: 380px; transform: translateX(120%); animation: toastIn .3s var(--ease-out) forwards; }
@keyframes toastIn { to { transform: translateX(0); } }
.toast.out { animation: toastOut .25s var(--ease) forwards; }
@keyframes toastOut { to { transform: translateX(120%); opacity: 0; } }
.toast-ico { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; flex-shrink: 0; margin-top: 1px; }
.toast-body { min-width: 0; flex: 1; }
.toast-title { font-weight: 600; font-size: 13px; }
.toast-msg { font-size: 12px; color: var(--muted); margin-top: 2px; word-wrap: break-word; }
.toast-close { flex-shrink: 0; width: 22px; height: 22px; border-radius: var(--r-xs); border: none; background: transparent; color: var(--faint); display: grid; place-items: center; cursor: pointer; margin: -2px -4px 0 0; transition: background .12s, color .12s; }
.toast-close:hover { background: var(--surface-2); color: var(--text); }
@media (prefers-reduced-motion: reduce) {
  .toast, .overlay, .drawer, .modal, .cmd, .fade-up { animation-duration: .01ms !important; }
}

/* ---------- Sticky action bar ---------- */
.action-bar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 11px 20px; margin: calc(var(--sp-6) * -1) calc(var(--sp-8) * -1) var(--sp-6); }
.dirty-dot { width: 7px; height: 7px; border-radius: 99px; background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }

/* ---------- Empty / Loading / Error states ---------- */
.state-box { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 56px 24px; gap: 14px; }
.state-box.compact { padding: 32px 20px; gap: 10px; }
.state-ico { width: 56px; height: 56px; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; color: var(--muted); }
.state-ico.accent { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-text); }
.state-ico.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.state-title { font-weight: 700; font-size: 15px; }
.state-msg { color: var(--muted); font-size: 13px; max-width: 360px; line-height: 1.55; }
.state-actions { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 4px; flex-wrap: wrap; }

/* satır içi yükleniyor (liste/drawer/picker içeriği beklerken) */
.inline-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 28px 20px; color: var(--muted); font-size: 13px; }

.skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 6px; }
.skel-line { height: 12px; border-radius: 6px; }
.skel-line + .skel-line { margin-top: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .skel, .spin { animation: none; } }

/* ---------- Command palette ---------- */
.cmd-wrap { position: fixed; inset: 0; z-index: 100; display: flex; justify-content: center; padding-top: 12vh; }
.cmd { width: 600px; max-width: 92vw; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden; z-index: 101; transform: translateY(-8px); opacity: 0; animation: pop .18s var(--ease-out) forwards; max-height: 70vh; display: flex; flex-direction: column; }
.cmd-input { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.cmd-input input { flex: 1; border: none; background: none; color: var(--text); font-size: 15px; outline: none; }
.cmd-list { overflow-y: auto; padding: 8px; }
.cmd-group { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); padding: 10px 10px 5px; }
.cmd-item { display: flex; align-items: center; gap: 12px; padding: 9px 11px; border-radius: var(--r-sm); cursor: pointer; font-size: 13.5px; color: var(--text-2); }
.cmd-item.active { background: var(--accent-soft); color: var(--accent-text); }
.cmd-item.active .ico { color: var(--accent-text); }
.cmd-item .ico { color: var(--muted); }
.cmd-item kbd { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }

/* ---------- Misc utilities ---------- */
.row { display: flex; align-items: center; gap: var(--sp-3); }
.col { display: flex; flex-direction: column; gap: var(--sp-3); }
.grow { flex: 1; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }
.divider { height: 1px; background: var(--border); margin: var(--sp-4) 0; }
.vdivider { width: 1px; align-self: stretch; background: var(--border); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-full); padding: 4px 10px; color: var(--text-2); }
.chip-x { color: var(--faint); display: inline-flex; }
.chip-x:hover { color: var(--danger); }
.kbd { font-family: var(--font-mono); font-size: 11px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; color: var(--muted); }
.avatar { border-radius: 99px; display: grid; place-items: center; font-weight: 700; color: #fff; flex-shrink: 0; font-size: 12px; }
.tooltip-anchor { position: relative; }
.tooltip { position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); font-size: 11.5px; font-weight: 500; padding: 5px 9px; border-radius: 6px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s; z-index: 50; box-shadow: var(--shadow-md); }
.tooltip-anchor:hover .tooltip { opacity: 1; }

.code-block { background: #0a0d11; border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7; overflow-x: auto; color: #c9d4e0; }
[data-theme="light"] .code-block { background: #0f1318; }
.code-block .tok-key { color: #5eead4; }
.code-block .tok-str { color: #fbbf24; }
.code-block .tok-num { color: #a78bfa; }
.code-block .tok-bool { color: #60a5fa; }
.code-block .tok-punc { color: #7d8896; }

.dropdown { position: absolute; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: 5px; z-index: 70; min-width: 180px; animation: pop .14s var(--ease-out); }
.topbar [title="Aktif rol"] + .dropdown { min-width: 220px; }
.dropdown-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-xs); font-size: 13px; color: var(--text-2); cursor: pointer; width: 100%; border: none; background: none; text-align: left; }
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-soft); }
.dropdown-sep { height: 1px; background: var(--border-faint); margin: 5px 0; }

/* ---------- Permission matrix ---------- */
.matrix-tbl tbody td { padding: 9px 14px; }
.matrix-tbl thead th { padding-top: 12px; padding-bottom: 12px; }
.matrix-cell { width: 30px; height: 30px; border-radius: 8px; border: 1.5px solid var(--border-strong); background: var(--surface); display: inline-grid; place-items: center; cursor: pointer; color: var(--on-accent); transition: background .12s, border-color .12s, transform .08s; }
.matrix-cell:hover:not(.locked) { border-color: var(--cc); }
.matrix-cell:active:not(.locked) { transform: scale(0.9); }
.matrix-cell.on { background: var(--cc); border-color: var(--cc); }
.matrix-cell.locked { cursor: not-allowed; opacity: 0.85; }
.matrix-dash { width: 9px; height: 1.5px; border-radius: 2px; background: var(--faint); }
.matrix-tbl tbody tr:hover:not(.matrix-group) td { background: var(--surface-2); }
.seo-mini-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 7px; }
.route-row:hover { background: var(--surface-2) !important; }
.diff-cell { font-size: 12px; line-height: 1.55; padding: 8px 10px; border-radius: var(--r-sm); word-break: break-word; }
.diff-old { background: color-mix(in srgb, var(--danger) 8%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 20%, transparent); }
.diff-new { background: color-mix(in srgb, var(--success) 8%, transparent); border: 1px solid color-mix(in srgb, var(--success) 20%, transparent); }

/* grid helpers */
.grid { display: grid; gap: var(--sp-4); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-5 { grid-template-columns: repeat(5, 1fr); }

/* fade up entrance */
.fade-up { animation: fadeUp .3s var(--ease-out) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 1100px) {
  .g-4 { grid-template-columns: repeat(2, 1fr); }
  .g-5 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  .app,
  .app.collapsed {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .app.sidebar-open::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 79;
    background: var(--overlay);
    backdrop-filter: blur(2px);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 80;
    width: min(var(--sidebar-w), 82vw);
    max-width: 320px;
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    transition: transform .22s var(--ease-out);
  }

  .app.sidebar-open .sidebar { transform: translateX(0); }

  .main {
    grid-column: 1;
    width: 100vw;
    min-width: 0;
  }

  .topbar {
    gap: 8px;
    padding: 0 12px;
  }

  .breadcrumb,
  .topbar-spacer,
  .topbar > div[style*="width:1px"] {
    display: none !important;
  }

  .topbar-search {
    min-width: 0;
    flex: 1;
    padding: 7px 10px;
  }

  .topbar-search span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-search kbd { display: none; }

  .topbar [title="Aktif rol"] {
    width: 34px;
    padding: 8px;
    gap: 0;
    font-size: 0;
  }

  .topbar [title="Aktif rol"] .dot { margin: 0; }
  .topbar [title="Aktif rol"] .ico { display: none; }

  .content { padding: var(--sp-4); }
  .content.flush { overflow: auto; }

  .content-narrow,
  .fade-up {
    min-width: 0;
  }

  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .page-head-actions {
    margin-left: 0;
    flex-wrap: wrap;
  }

  .grid,
  .g-2,
  .g-3,
  .g-4,
  .g-5,
  .content.flush > .fade-up[style*="grid-template-columns"],
  .content.flush .fade-up > div[style*="grid-template-columns"],
  .content.flush [style*="grid-template-columns:1fr 300px"],
  .content.flush [style*="grid-template-columns:1fr 320px"],
  .content.flush [style*="grid-template-columns:230px 1fr 312px"],
  .content.flush [style*="grid-template-columns:380px 1fr"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .content.flush .fade-up > div[style*="display:flex"][style*="padding:11px 24px"],
  .content.flush .fade-up > div[style*="display:flex"][style*="padding:11px 24px"] > div:last-child {
    flex-wrap: wrap;
  }

  .content.flush .fade-up > div[style*="display:flex"][style*="padding:11px 24px"] {
    padding: 11px 16px !important;
  }

  .tbl-wrap {
    max-width: calc(100vw - 32px);
  }

  .drawer,
  .drawer.wide,
  .drawer.xwide {
    width: 100vw;
    max-width: 100vw;
  }

  .modal-wrap { padding: 16px; }
}

/* ============================================================
   Builder DnD — shared by Navigation & Form builders
   ============================================================ */
/* draggable rows */
.dnd-row { transition: box-shadow .12s, opacity .12s, transform .12s; }
.dnd-row.dragging { opacity: 0.45; }
.dnd-row.drop-target { box-shadow: 0 0 0 2px var(--accent) inset; }
.dnd-grip { cursor: grab; color: var(--faint); display: inline-flex; flex-shrink: 0; }
.dnd-grip:active { cursor: grabbing; }

/* insertion line between rows */
.dnd-insert { height: 0; position: relative; }
.dnd-insert::before { content: ''; position: absolute; left: 0; right: 0; top: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.dnd-insert::after { content: ''; position: absolute; left: -3px; top: -4px; width: 8px; height: 8px; border-radius: 99px; background: var(--accent); }

/* palette item being dragged onto a canvas */
.palette-item { user-select: none; }
.palette-item:active { cursor: grabbing; }
.palette-item.dragging { opacity: 0.55; box-shadow: var(--shadow-sm); }
.canvas-dropzone { border: 1.5px dashed var(--border-strong); border-radius: var(--r-md); transition: border-color .12s, background .12s; }
.canvas-dropzone.over { border-color: var(--accent); background: var(--accent-soft); }

/* nav tree node */
.tree-node { display: flex; align-items: center; gap: 9px; padding: 9px 11px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); }
.tree-node.sel { border-color: var(--accent); background: var(--accent-soft); }
.tree-node.hidden-item { opacity: 0.55; }

/* theme studio live preview scope */
.tp-scope { font-family: var(--tp-font, inherit); }
.tp-scope * { box-sizing: border-box; }

/* options editor rows */
.opt-row { display: flex; align-items: center; gap: 8px; }

/* small icon button used inside builders */
.mini-btn { width: 26px; height: 26px; border-radius: var(--r-xs); border: none; background: transparent; color: var(--muted); display: inline-grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.mini-btn:hover { background: var(--surface-3); color: var(--text); }
.mini-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }


/* ---------- Loading spinner ---------- */
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }


/* ---------- Anchor resets (button→<a> dönüşümleri için) ---------- */
.nav-item, .cmd-item, .dropdown-item, a.card, .tab, .seg a { text-decoration: none; color: inherit; }
.nav-item:hover, .cmd-item:hover, a.card:hover { text-decoration: none; }


/* ---------- Flush content (kenara yaslı 2-kolon ekranlar) ---------- */
.content.flush { padding: 0; overflow: hidden; }

/* ---------- Lucide ikon boyut/stil köprüsü ---------- */
.ico, svg.lucide { flex-shrink: 0; }
i[data-lucide] { display: inline-flex; }
svg.lucide { vertical-align: middle; }

/* ---------- Checkbox işareti (JS .checked sınıfı için) ---------- */
.chk.checked::after { content: ''; width: 5px; height: 9px; border: solid var(--on-accent, #fff); border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-1px); }
.chk.indet:not(.checked)::after { content: ''; width: 8px; height: 2px; border-radius: 2px; background: var(--on-accent, #fff); }
.drag-ghost { opacity: 0.4; }

/* ---------- Etkileşim eklemeleri (ekran JS'leri ile sürülür) ---------- */
/* Medya kart seçimi (kütüphane + seçici grid) */
.media-card.sel, .picker-item.sel { outline: 2px solid var(--accent); outline-offset: -2px; }
.picker-item { border: 2px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer; }
.picker-item.sel { border-color: var(--accent); }
/* Odak noktası imleci (medya detay) */
.focal-stage { cursor: crosshair; }
.focal-dot { position: absolute; width: 22px; height: 22px; border-radius: 99px; border: 2.5px solid #fff; box-shadow: 0 0 0 2px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.4); background: rgba(255,255,255,0.15); transform: translate(-50%, -50%); pointer-events: none; transition: left .08s, top .08s; }
.focal-h { position: absolute; left: 0; right: 0; height: 1px; background: rgba(255,255,255,0.5); pointer-events: none; }
.focal-v { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,0.5); pointer-events: none; }
/* İlişki satırı (content editor) */
.rel-row { display: flex; align-items: center; gap: 10px; padding: 9px 11px; background: var(--surface-2); border-radius: var(--r-sm); }
/* Sihirbaz adım göstergesi tamamlanmış hali */
.wiz-step.done { background: var(--accent) !important; color: var(--on-accent) !important; border-color: var(--accent) !important; }
.wiz-step.active { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent); }
/* ---------- İçerik dili anahtarı (Content Manager editör başlığı) ---------- */
.lang-switch { display: inline-flex; align-items: center; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-full); padding: 3px 5px 3px 10px; }
.lang-switch-ico { color: var(--muted); margin-right: 5px; }
.lang-pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 11px; border-radius: var(--r-full); font-size: 12px; font-weight: 700; letter-spacing: .03em; color: var(--text-2); text-decoration: none; transition: background .12s, color .12s; }
.lang-pill:hover { background: var(--surface-3); color: var(--text); }
.lang-pill.active { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-sm); }
.lang-pill.missing:not(.active) { color: var(--faint); }
.lang-pill-dot { width: 5px; height: 5px; border-radius: 99px; background: var(--warning); flex-shrink: 0; }
.lang-pill.active .lang-pill-dot { background: var(--on-accent); opacity: .7; }

/* ============================================================
   Onay diyaloğu (window.confirmDialog) — native confirm() yerine
   focus-trap'li, klavye destekli, erişilebilir modal.
   .modal-wrap / .modal görsel dilini paylaşır.
   ============================================================ */
.confirm { width: 420px; }
.confirm-head { display: flex; gap: 14px; align-items: flex-start; padding: 22px 22px 4px; }
.confirm-ico { width: 40px; height: 40px; border-radius: var(--r-md); display: grid; place-items: center; flex-shrink: 0; background: var(--accent-soft); color: var(--accent-text); }
.confirm-ico.danger { background: var(--danger-soft); color: var(--danger); }
.confirm-ico.warning { background: var(--warning-soft); color: var(--warning); }
.confirm-title { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.confirm-msg { color: var(--muted); font-size: 13px; line-height: 1.55; margin-top: 4px; }
.confirm-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 18px 22px 20px; }

/* ============================================================
   Zengin metin editörü (richtext.js) — vanilla contenteditable WYSIWYG.
   İçerik Editörü ve Page Builder'da ortak kullanılır; gizli textarea ile
   form/model binding'i korur, sanitize edilmiş HTML üretir.
   ============================================================ */
.rte { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--surface); transition: border-color .12s, box-shadow .12s; }
.rte.focused { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rte.error { border-color: var(--danger); }
.rte-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.rte-sep { width: 1px; align-self: stretch; background: var(--border); margin: 3px 4px; }
.rte-btn { width: 30px; height: 30px; border-radius: var(--r-xs); border: none; background: transparent; color: var(--text-2); display: inline-grid; place-items: center; cursor: pointer; transition: background .1s, color .1s; }
.rte-btn:hover { background: var(--surface-3); color: var(--text); }
.rte-btn.active { background: var(--accent-soft); color: var(--accent-text); }
.rte-btn:disabled { opacity: .4; cursor: not-allowed; }
.rte-linkbar { display: flex; gap: 8px; align-items: center; padding: 8px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.rte-linkbar .input { flex: 1; height: 30px; font-size: 12.5px; padding: 4px 10px; }
.rte-surface { min-height: 180px; max-height: 520px; overflow-y: auto; padding: 14px 16px; color: var(--text); font-size: 14px; line-height: 1.7; outline: none; background: var(--surface); }
.rte-surface:empty::before, .rte-surface[data-empty="true"]::before { content: attr(data-placeholder); color: var(--faint); pointer-events: none; }
.rte-surface > :first-child { margin-top: 0; }
.rte-surface > :last-child { margin-bottom: 0; }
.rte-surface p { margin: 0 0 10px; }
.rte-surface h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; margin: 18px 0 8px; }
.rte-surface h3 { font-size: 16px; font-weight: 700; margin: 16px 0 6px; }
.rte-surface ul, .rte-surface ol { margin: 0 0 10px; padding-left: 22px; }
.rte-surface li { margin: 2px 0; }
.rte-surface a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
.rte-surface blockquote { margin: 10px 0; padding: 4px 0 4px 14px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.rte-surface code { font-family: var(--font-mono); font-size: .9em; background: var(--surface-3); padding: 1px 5px; border-radius: 5px; }
.rte-surface pre { background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px 14px; overflow-x: auto; margin: 0 0 10px; }
.rte-surface pre code { background: none; padding: 0; }
.rte-surface img { max-width: 100%; border-radius: var(--r-sm); }

/* ============================================================
   Sıcaklık & derinlik (yalnız koyu tema) — yapı/teal kimlik korunur.
   Kartlara hafif elevation + iç parlama + yumuşak üst gradyan; düz yüzeyler
   yerine katmanlı, premium his. Aydınlık tema talep edilmediği için dokunulmadı.
   ============================================================ */
[data-theme="dark"] .card {
  background-image: linear-gradient(180deg, rgba(255,255,255,0.020), rgba(255,255,255,0) 64%);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.035);
}
[data-theme="dark"] .stat {
  background-image: linear-gradient(180deg, rgba(255,255,255,0.026), rgba(255,255,255,0) 72%);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.05);
  transition: transform .14s var(--ease), border-color .14s, box-shadow .14s;
}
[data-theme="dark"] .stat:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.06);
}
/* tıklanabilir kartlar (a.card) hafifçe yükselip teal kenar kazanır */
[data-theme="dark"] a.card { transition: transform .14s var(--ease), border-color .14s, box-shadow .14s; }
[data-theme="dark"] a.card:hover {
  border-color: var(--accent-border);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.04);
  transform: translateY(-1px);
}
/* birincil aksiyon butonu: hafif teal derinlik (CTA öne çıksın) */
[data-theme="dark"] .btn-primary { box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 6px 16px rgba(30,201,178,0.20); }
[data-theme="dark"] .btn-primary:hover { box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 8px 22px rgba(30,201,178,0.28); }
/* overlay yüzeyleri biraz daha derin */
[data-theme="dark"] .drawer, [data-theme="dark"] .modal, [data-theme="dark"] .cmd, [data-theme="dark"] .dropdown {
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.04);
}
@media (prefers-reduced-motion: reduce) {
  [data-theme="dark"] .stat, [data-theme="dark"] a.card { transition: none; }
  [data-theme="dark"] .stat:hover, [data-theme="dark"] a.card:hover { transform: none; }
}
