/* inkGuide tasarım sistemi — kağıt, mürekkep, zeytin
   Kaynak: Claude Design / Tasarım Sistemi.dc.html */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Renk token'ları */
  --bg: #FAF8F3;            /* paper */
  --sidebar-bg: #F2F0E9;    /* panel */
  --panel-bg: #FFFFFF;      /* surface */
  --border: #E4E0D6;
  --border-soft: #EFEBE1;
  --text: #26251F;          /* ink */
  --muted: #6E6859;
  --muted-2: #6B6559;
  --accent: #55663F;
  --accent-deep: #3E4A2E;
  --accent-soft: #EDEFE4;
  --danger: #A8452F;
  --warn: #C98A2E;
  --tip-bg: #FDF9EA;
  --tip-border: #E0D5B8;
  --tip-text: #86682A;
  --hover: #E9E6DE;
  --track: #E3E0D9;
  /* Gölge token'ları — sıcak, düşük */
  --shadow-sm: 0 1px 2px rgba(40, 38, 33, .05);
  --shadow: 0 1px 2px rgba(40, 38, 33, .05), 0 4px 14px rgba(40, 38, 33, .05);
  --shadow-lg: 0 8px 30px rgba(40, 38, 33, .12);
  --radius: 12px;
  --ring: 0 0 0 3px rgba(85, 102, 63, .22);
  /* Not türü renkleri */
  --note-not: #6D9EC9;
  --note-sentez: #7FB069;
  --note-alinti: #C98B6D;
  --note-fikir: #B08CC9;
  --note-gorsel: #4FA3A5;
  /* Yazı aileleri */
  --font-ui: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
}

body {
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: -2px; }

.app { display: grid; grid-template-columns: 288px 1fr 268px 48px; height: 100vh; }

/* ---------- Sol panel ---------- */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  padding: 20px 18px 0; user-select: none;
}
.brand svg { width: 17px; height: 17px; color: var(--accent); }
.brand .wordmark { font-size: 14px; letter-spacing: -.015em; color: var(--text); }
.brand .wordmark b { font-weight: 700; }
.book-head { padding: 12px 18px 16px; border-bottom: 1px solid var(--border-soft); }
.book-title { font-size: 23px; font-weight: 600; font-family: var(--font-serif); letter-spacing: -.01em; line-height: 1.15; }
.book-subtitle { font-size: 12.5px; color: var(--muted); font-style: italic; margin-top: 4px; }
.progress-wrap { margin-top: 16px; }
.progress-bar { height: 5px; background: var(--track); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); width: 0; transition: width .4s ease; border-radius: 3px; }
.progress-text { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }

.tree { flex: 1; overflow-y: auto; padding: 10px 8px; }
.tree::-webkit-scrollbar { width: 8px; }
.tree::-webkit-scrollbar-thumb { background: #DCD8CD; border-radius: 4px; }
.tree-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; cursor: pointer; font-size: 13px;
  border-radius: 8px; margin: 1px 0;
  user-select: none; transition: background .12s;
}
.tree-item:hover { background: var(--hover); }
.tree-item.selected { background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }
.tree-item.part-title { font-weight: 700; font-size: 11.5px; margin-top: 12px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .05em; cursor: default; gap: 6px; }
.tree-item.part-title:hover { background: none; }
.tree-item.part-title .caret svg { width: 12px; height: 12px; stroke-width: 2; }
.tree-item.chapter { padding-left: 22px; }
.tree-item.special { font-weight: 500; color: #4F4B42; }
.tree-item.special svg { color: var(--accent); opacity: .85; }
.tree-sep { border-top: 1px solid var(--border); margin: 12px 10px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status-taslak { background: #CFCABF; }
.status-yazılıyor { background: var(--warn); }
.status-bitti { background: #7FB069; }
.chapter-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter-words { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row-arrows { display: none; gap: 2px; flex-shrink: 0; }
.tree-item:hover .row-arrows { display: inline-flex; }
.row-arrows button {
  border: 1px solid var(--border); background: var(--panel-bg); border-radius: 6px;
  width: 18px; height: 18px; padding: 0; cursor: pointer; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.row-arrows button:hover { color: var(--accent); border-color: var(--accent); }
.row-arrows svg { width: 10px; height: 10px; }
.tree-item.part-title .row-arrows button { background: transparent; }

.sidebar-actions { padding: 6px 14px; display: flex; gap: 8px; }
.sidebar-actions:first-of-type { padding-top: 12px; border-top: 1px solid var(--border-soft); }
.sidebar-actions button {
  flex: 1; padding: 9px 8px; font-size: 12.5px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 9px; background: var(--panel-bg);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--text); transition: background .12s, border-color .12s, box-shadow .12s; font-family: inherit;
}
.sidebar-actions button svg { width: 14px; height: 14px; }
.sidebar-actions button:hover { background: var(--hover); }
.sidebar-actions button.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; padding: 12px 8px; font-size: 13.5px; border-radius: 10px; gap: 8px; }
.sidebar-actions button.primary svg { width: 16px; height: 16px; }
.sidebar-actions button.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.sidebar-actions button:focus-visible { outline: none; box-shadow: var(--ring); }
.export-result { padding: 4px 16px 6px; font-size: 12px; }
.export-result a { display: block; color: var(--accent); margin-top: 3px; text-decoration: none; }
.export-result a:hover { color: var(--accent-deep); text-decoration: underline; }

.versions-box { padding: 0 16px 14px; font-size: 11.5px; color: var(--muted); max-height: 130px; overflow-y: auto; }
.versions-box .v-title { font-weight: 700; margin: 8px 0 5px; text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; }
.versions-box .v-row { display: flex; justify-content: space-between; align-items: center; padding: 2px 0; font-variant-numeric: tabular-nums; }
.versions-box .v-restore { color: var(--accent); cursor: pointer; }
.versions-box .v-restore:hover { color: var(--accent-deep); text-decoration: underline; }

/* ---------- Orta panel ---------- */
.editor { overflow-y: auto; padding: 36px 44px 80px; background: var(--bg); }
.editor::-webkit-scrollbar { width: 10px; }
.editor::-webkit-scrollbar-thumb { background: #DCD8CD; border-radius: 5px; }
.editor-inner { max-width: 780px; margin: 0 auto; }

/* Sayfa başlığı (Karalama, Kaynaklar, Ön Sayfalar) — serif + accent ikon */
.page-title {
  margin: 0; font-family: var(--font-serif); font-size: 32px; font-weight: 600;
  letter-spacing: -.02em; display: flex; align-items: center; gap: 11px;
}
.page-title svg { width: 24px; height: 24px; color: var(--accent); stroke-width: 1.7; }
.page-intro { font-size: 14px; line-height: 1.7; color: var(--muted-2); margin: 10px 0 0; max-width: 640px; }

.chapter-header { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.chapter-title-input {
  flex: 1; font-size: 32px; font-weight: 600; font-family: var(--font-serif);
  letter-spacing: -.02em; line-height: 1.2;
  border: none; background: transparent; padding: 2px 0; color: var(--text);
}
.chapter-title-input:focus { outline: none; border-bottom: 2px solid var(--accent); }
select.status-select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-bg); font-size: 12px; font-family: inherit; color: var(--text); }
select.status-select:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--ring); }

.field-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 26px 0 8px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.field-label svg { width: 13px; height: 13px; }
.field-label .hint { text-transform: none; font-weight: 400; letter-spacing: 0; }

textarea.synopsis {
  width: 100%; min-height: 58px; padding: 12px 14px; font-size: 13px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel-bg);
  font-family: inherit; resize: vertical; color: var(--muted-2); line-height: 1.55;
}

.draft-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.draft-toolbar button, .draft-toolbar select {
  padding: 6px 11px; font-size: 12px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--panel-bg); cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px; transition: background .12s, color .12s, border-color .12s;
  color: var(--text);
}
.draft-toolbar button svg { width: 13px; height: 13px; }
.draft-toolbar button:hover { background: var(--hover); }
.draft-toolbar button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.draft-toolbar button:focus-visible { outline: none; box-shadow: var(--ring); }
.word-badge { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tool-sep { width: 1px; height: 18px; background: var(--border); margin: 0 2px; }
.draft-toolbar button.fmt { min-width: 32px; justify-content: center; }
.draft-toolbar button.editor-btn { background: var(--tip-bg); border-color: var(--tip-border); color: var(--tip-text); font-weight: 600; }
.draft-toolbar button.editor-btn:hover { background: #F6EED6; }

/* Atıf satırı — araç çubuğunun altında kendi satırında */
.cite-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.cite-row select {
  padding: 6px 10px; font-size: 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel-bg); color: var(--muted); font-family: inherit;
}
.cite-row .cite-hint { font-size: 11.5px; color: var(--muted); }
button.mic { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
button.mic.recording {
  background: var(--danger) !important; color: #fff !important; border-color: var(--danger) !important;
  animation: micpulse 1.2s ease-in-out infinite;
}
@keyframes micpulse { 50% { opacity: .65; } }
.tray-add button.mic { padding: 5px 8px; font-size: 12px; border: 1px solid var(--border); border-radius: 7px; background: var(--panel-bg); }

textarea.draft {
  width: 100%; min-height: 420px; padding: 28px 32px; font-size: 17px; line-height: 1.78;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel-bg);
  font-family: var(--font-serif); resize: vertical; box-shadow: var(--shadow); color: var(--text);
}
textarea.draft:focus, textarea.synopsis:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.draft-preview {
  min-height: 420px; padding: 30px 38px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--panel-bg); box-shadow: var(--shadow);
  font-family: var(--font-serif); font-size: 17px; line-height: 1.78;
}
.draft-preview h1, .draft-preview h2, .draft-preview h3 { margin: 1em 0 .45em; text-align: left; font-weight: 600; letter-spacing: -.01em; }
.draft-preview h3 { font-size: 1.25em; }
.draft-preview p { margin-bottom: .85em; text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
.draft-preview li { text-align: justify; hyphens: auto; margin-bottom: .3em; }
.draft-preview ul, .draft-preview ol { padding-left: 1.4em; margin-bottom: .85em; }
.draft-preview blockquote { border-left: 3px solid var(--tip-border); padding-left: 1.1em; color: var(--muted-2); font-style: italic; margin: .9em 0; }

/* Notlar */
.notes-section { margin-top: 32px; }
.notes-empty {
  border: 1px dashed var(--border); border-radius: var(--radius); padding: 28px;
  text-align: center; color: var(--muted); font-size: 13px; line-height: 1.6;
}
.note-add { display: flex; gap: 7px; margin-bottom: 14px; flex-wrap: wrap; }
.note-add select, .note-add input, .note-add button {
  padding: 8px 11px; font-size: 12.5px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-bg); font-family: inherit;
}
.note-add input:focus, .note-add select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.note-add input.note-text { flex: 1; min-width: 200px; }
.note-add button { cursor: pointer; }
.note-add button#noteAddBtn { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.note-add button#noteAddBtn:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.note-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.note-card {
  background: var(--panel-bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 13px 15px; font-size: 13px; position: relative;
  box-shadow: var(--shadow); transition: transform .12s;
}
.note-card:hover { transform: translateY(-1px); }
.note-type { font-size: 10px; text-transform: uppercase; font-weight: 700; letter-spacing: .07em; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.note-type::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.note-card.not .note-type::before { background: var(--note-not); }
.note-card.sentez .note-type::before { background: var(--note-sentez); }
.note-card.alinti .note-type::before { background: var(--note-alinti); }
.note-card.fikir .note-type::before { background: var(--note-fikir); }
.note-card.gorsel .note-type::before { background: var(--note-gorsel); }
.note-card.gorsel { background: #F4FAFA; }
.note-body { margin-top: 7px; white-space: pre-wrap; line-height: 1.5; }
.note-src { margin-top: 8px; font-size: 11px; color: var(--muted); font-style: italic; }
.note-del { position: absolute; top: 8px; right: 9px; border: none; background: none; cursor: pointer; color: #C9C4B8; font-size: 13px; line-height: 1; padding: 2px; }
.note-del:hover { color: var(--danger); }
.editable { cursor: text; border-radius: 6px; transition: background .12s; }
.editable:hover { background: #F7F4EC; box-shadow: inset 0 0 0 1px var(--border); }
textarea.note-edit {
  width: 100%; min-height: 70px; margin-top: 4px; padding: 7px 9px;
  font-family: inherit; font-size: 12.5px; line-height: 1.5;
  border: 1px solid var(--accent); border-radius: 7px; resize: vertical;
  background: var(--panel-bg); box-shadow: var(--ring);
}
textarea.note-edit:focus { outline: none; }
.note-move { margin-top: 8px; display: flex; align-items: center; gap: 5px; color: var(--muted); }
.note-move svg { width: 12px; height: 12px; }
.note-move select { font-size: 11px; padding: 3px 5px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel-bg); color: var(--muted); max-width: 170px; font-family: inherit; }

/* Kaynaklar */
.src-toolbar { display: flex; align-items: center; gap: 12px; margin: 26px 0 12px; }
.src-toolbar input {
  flex: 1; padding: 10px 13px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--panel-bg); font-family: inherit; font-size: 13.5px;
}
.src-toolbar input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.src-count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.src-table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--panel-bg); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); }
.src-table th, .src-table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border-soft); }
.src-table tr:last-child td { border-bottom: none; }
.src-table th { background: #F6F5F1; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.src-table td code { font-family: var(--font-serif); font-size: 13px; color: var(--accent); }
.src-table tr.sel td { background: #F7F8F2; }
.src-table .src-usage { font-size: 12px; color: var(--muted); }
.src-layout { display: grid; grid-template-columns: 1.25fr .75fr; gap: 20px; margin-top: 26px; align-items: start; }
@media (max-width: 1280px) { .src-layout { grid-template-columns: 1fr; } }
.src-card {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel-bg);
  padding: 20px 22px; box-shadow: var(--shadow);
}
.src-card-title { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.src-side { display: flex; flex-direction: column; gap: 16px; }
.src-mini-label { font-size: 12px; color: var(--muted); }
.src-sample { font-family: var(--font-serif); font-size: 15px; line-height: 1.7; margin-top: 5px; }
.src-apa { font-family: var(--font-serif); font-size: 14px; line-height: 1.65; margin-top: 5px; padding-left: 18px; text-indent: -18px; }
.src-ethics { border: 1px solid var(--tip-border); border-radius: var(--radius); background: var(--tip-bg); padding: 16px 18px; }
.src-ethics .t { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--tip-text); }
.src-ethics .b { font-size: 13px; line-height: 1.6; margin-top: 8px; color: #4F4B42; }
.src-form { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.src-form label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; }
.src-form .f-full { grid-column: span 2; }
.src-form input, .src-form select { width: 100%; padding: 9px 12px; font-size: 13px; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; background: var(--panel-bg); }
.src-form input:focus, .src-form select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.src-form button { grid-column: span 2; padding: 11px; background: var(--accent); color: #fff; border: 1px solid var(--accent); border-radius: 9px; cursor: pointer; font-weight: 600; font-family: inherit; font-size: 13.5px; }
.src-form button:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.src-id-hint { grid-column: span 2; font-size: 12px; color: var(--muted); }
.src-id-hint b { font-family: var(--font-serif); color: var(--accent); font-weight: 600; }
.del-link { color: #C9C4B8; cursor: pointer; font-size: 13px; line-height: 1; }
.del-link:hover { color: var(--danger); }

/* Rehber */
.guide { max-width: 720px; margin: 0 auto; padding-top: 20px; }
.guide .guide-kicker { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.guide h1 { font-family: var(--font-serif); font-size: 42px; font-weight: 600; letter-spacing: -.025em; line-height: 1.1; margin: 14px 0 0; }
.guide .guide-lead { font-size: 16.5px; line-height: 1.75; color: #4F4B42; margin: 18px 0 0; }
.guide h2 { font-family: var(--font-serif); margin: 44px 0 14px; font-size: 25px; font-weight: 600; letter-spacing: -.01em; }
.guide p, .guide li { font-size: 15px; line-height: 1.7; margin-bottom: 6px; }
.guide ul { padding-left: 22px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 9px; }
.guide ul li { margin-bottom: 0; }
.guide .guide-steps { display: flex; flex-direction: column; gap: 14px; }
.guide .guide-step { display: flex; gap: 16px; }
.guide .guide-num { font-family: var(--font-serif); font-size: 22px; color: var(--accent); min-width: 30px; flex-shrink: 0; }
.guide .guide-step p { font-size: 15px; line-height: 1.7; margin: 0; }
.guide .guide-tipbox {
  border: 1px solid var(--tip-border); border-radius: var(--radius); background: var(--tip-bg);
  padding: 16px 18px; margin-top: 18px; font-size: 14.5px; line-height: 1.7;
}
.guide .guide-tipbox a { color: var(--accent); text-decoration: none; }
.guide .guide-tipbox a:hover { color: var(--accent-deep); text-decoration: underline; }
.guide .kural { background: var(--panel-bg); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 10px; padding: 13px 16px; margin: 10px 0 0; font-size: 14.5px; line-height: 1.65; }
.guide .guide-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.guide .guide-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel-bg); padding: 16px 18px; }
.guide .guide-card .t { font-size: 14.5px; font-weight: 600; }
.guide .guide-card .d { font-size: 13.5px; line-height: 1.65; color: var(--muted-2); margin-top: 5px; }
.guide .guide-cta { display: flex; gap: 12px; margin-top: 44px; }
.guide .guide-cta button { font-family: inherit; cursor: pointer; }
.guide .guide-cta .cta-primary { padding: 12px 22px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent); color: #fff; font-size: 14.5px; font-weight: 600; }
.guide .guide-cta .cta-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.guide .guide-cta .cta-secondary { padding: 12px 22px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-bg); color: var(--text); font-size: 14.5px; }
.guide .guide-cta .cta-secondary:hover { background: var(--hover); }
@media (max-width: 900px) { .guide .guide-cards { grid-template-columns: 1fr; } }

.small-actions { display: flex; gap: 8px; margin-top: 14px; }
.small-actions button { padding: 7px 12px; font-size: 12px; border: 1px solid transparent; border-radius: 8px; background: transparent; cursor: pointer; color: var(--muted-2); font-family: inherit; display: inline-flex; align-items: center; gap: 5px; transition: background .12s, color .12s; }
.small-actions button svg { width: 12px; height: 12px; }
.small-actions button:hover { color: var(--text); background: var(--sidebar-bg); }
.small-actions button.danger { color: var(--danger); }
.small-actions button.danger:hover { color: var(--danger); background: #FBEFEC; }

/* Karalamalar */
.back-link { border: none; background: none; color: var(--accent); cursor: pointer; font-size: 13px; padding: 0; margin-bottom: 14px; font-family: inherit; }
.back-link:hover { color: var(--accent-deep); text-decoration: underline; }
.pad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 14px; }
.pad-card {
  background: var(--panel-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 17px; cursor: pointer; position: relative;
  box-shadow: var(--shadow); transition: border-color .12s, box-shadow .12s;
  min-height: 132px; display: flex; flex-direction: column;
}
.pad-card:hover { border-color: var(--accent); }
.pad-title { font-weight: 600; font-size: 15px; font-family: var(--font-serif); margin-bottom: 7px; padding-right: 18px; letter-spacing: -.01em; }
.pad-preview { font-size: 12.5px; color: var(--muted-2); line-height: 1.55; flex: 1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.pad-meta { font-size: 11px; color: var(--muted); margin-top: 10px; font-variant-numeric: tabular-nums; }
.pad-card.pad-new {
  border-style: dashed; border-color: #DCD8CD; align-items: center; justify-content: center;
  color: var(--accent); font-weight: 600; font-size: 13.5px; gap: 8px; flex-direction: row;
  background: transparent; box-shadow: none;
}
.pad-card.pad-new:hover { background: var(--accent-soft); border-color: var(--accent); }

/* ---------- Sağ panel ---------- */
.companion {
  background: var(--sidebar-bg); border-left: 1px solid var(--border);
  padding: 20px 18px; overflow-y: auto;
}
.companion h3 { font-size: 14px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; gap: 7px; }
.companion h3 svg { color: var(--accent); width: 16px; height: 16px; }
.tip-card { background: var(--tip-bg); border: 1px solid var(--tip-border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.tip-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--tip-text); display: flex; align-items: center; gap: 5px; }
.tip-label svg { width: 12px; height: 12px; }
.tip-text { font-size: 13px; line-height: 1.6; margin-top: 8px; }
.tip-next { margin-top: 10px; border: none; background: none; color: var(--accent); cursor: pointer; font-size: 12px; padding: 0; font-family: inherit; }
.tip-next:hover { color: var(--accent-deep); text-decoration: underline; }

/* Kararsız notlar tepsisi */
.tray { margin-top: 18px; }
.tray-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: #4F4B42; display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.tray-head svg { width: 13px; height: 13px; color: var(--accent); }
.tray-count { background: var(--accent-soft); color: var(--accent-deep); border-radius: 999px; padding: 1px 8px; font-size: 10px; }
.tray-add { display: flex; gap: 5px; margin-bottom: 8px; }
.tray-add select { padding: 5px 4px; font-size: 12px; border: 1px solid var(--border); border-radius: 7px; background: var(--panel-bg); font-family: inherit; }
.tray-add input { flex: 1; min-width: 0; padding: 6px 9px; font-size: 12px; border: 1px solid var(--border); border-radius: 7px; font-family: inherit; }
.tray-add input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.tray-list { display: flex; flex-direction: column; gap: 7px; max-height: 40vh; overflow-y: auto; }
.tray-card { background: var(--panel-bg); border: 1px solid var(--border); border-left: 3px solid var(--muted); border-radius: 8px; padding: 8px 22px 8px 10px; position: relative; box-shadow: var(--shadow-sm); }
.tray-card.not { border-left-color: var(--note-not); }
.tray-card.sentez { border-left-color: var(--note-sentez); }
.tray-card.alinti { border-left-color: var(--note-alinti); }
.tray-card.fikir { border-left-color: var(--note-fikir); }
.tray-card.gorsel { border-left-color: var(--note-gorsel); }
.tray-card-text { font-size: 12px; line-height: 1.45; white-space: pre-wrap; }
.tray-card .note-del { top: 5px; right: 5px; font-size: 11px; }
.tray-move { margin-top: 6px; width: 100%; font-size: 11px; padding: 3px 5px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel-bg); color: var(--muted); font-family: inherit; }
.tray-empty { font-size: 11.5px; color: var(--muted); font-style: italic; padding: 4px 2px; }

.lang-row { margin-top: 16px; display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.lang-row svg { width: 13px; height: 13px; color: var(--accent); }
.lang-row select { flex: 1; padding: 5px 7px; font-size: 12px; border: 1px solid var(--border); border-radius: 7px; background: var(--panel-bg); font-family: inherit; }

.stats { margin-top: 20px; font-size: 12.5px; background: var(--panel-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; box-shadow: var(--shadow-sm); }
.stats .stat-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--border-soft); }
.stats .stat-row:last-child { border-bottom: none; }
.stats .stat-row b { font-variant-numeric: tabular-nums; }

.save-indicator { margin-top: 16px; font-size: 11.5px; color: var(--muted); transition: opacity .8s; display: flex; align-items: center; gap: 7px; }
.save-indicator.dim { opacity: .45; }
.save-indicator .save-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.save-indicator.saving .save-dot { animation: save-pulse 1.2s ease-in-out infinite; }
.save-indicator:empty { display: none; }
@keyframes save-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

@media (max-width: 1100px) {
  .app { grid-template-columns: 250px 1fr 48px; }
  .companion { display: none; }
  .editor { padding: 28px 24px; }
}

/* ---------- Kitaplığım (çoklu kitap) ---------- */
.library-link {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 18px 0; font-size: 12.5px; color: var(--muted-2);
  cursor: pointer; text-decoration: none; user-select: none;
}
.library-link:hover { color: var(--accent-deep); }
.library-link svg { width: 13px; height: 13px; color: var(--accent); }

#libraryView { position: fixed; inset: 0; z-index: 50; background: var(--bg); overflow-y: auto; }
#libraryView::-webkit-scrollbar { width: 10px; }
#libraryView::-webkit-scrollbar-thumb { background: #DCD8CD; border-radius: 5px; }
.lib-loading { padding: 80px 20px; text-align: center; color: var(--muted); font-size: 14px; }

.lib-header { border-bottom: 1px solid var(--border); background: rgba(250, 248, 243, .92); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(4px); }
.lib-header-inner { max-width: 1180px; margin: 0 auto; padding: 15px 40px; display: flex; align-items: center; gap: 26px; }
.lib-brand { display: flex; align-items: center; gap: 9px; font-size: 15px; letter-spacing: -.015em; color: var(--text); }
.lib-brand svg { width: 20px; height: 20px; color: var(--accent); }
.lib-nav-active { color: var(--text); font-weight: 600; font-size: 14px; padding-bottom: 2px; border-bottom: 2px solid var(--accent); }
.lib-back { font-size: 13.5px; color: var(--muted-2); cursor: pointer; background: none; border: none; font-family: inherit; padding: 0; }
.lib-back:hover { color: var(--accent-deep); text-decoration: underline; }
.lib-new-btn {
  margin-left: auto; padding: 9px 16px; border: 1px solid var(--accent); border-radius: 9px;
  background: var(--accent); color: #fff; font-family: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
}
.lib-new-btn:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.lib-new-btn svg { width: 14px; height: 14px; }

.lib-main { max-width: 1180px; margin: 0 auto; padding: 44px 40px 90px; }
.lib-main h1 { font-family: var(--font-serif); font-size: 36px; font-weight: 600; letter-spacing: -.02em; margin: 0; }
.lib-sub { margin: 8px 0 0; font-size: 14.5px; color: var(--muted-2); }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 20px; margin-top: 32px; }

.lib-card {
  border: 1px solid var(--border); border-radius: 14px; background: var(--panel-bg);
  overflow: hidden; cursor: pointer; position: relative; box-shadow: var(--shadow);
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
.lib-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.lib-cover { height: 132px; padding: 20px 22px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.lib-cover-initial {
  position: absolute; right: 4px; bottom: -30px; font-family: var(--font-serif);
  font-size: 118px; font-weight: 700; color: rgba(251, 248, 241, .13); line-height: 1; user-select: none; pointer-events: none;
}
.lib-cover-title { font-family: var(--font-serif); font-size: 21px; font-weight: 600; color: #FBF8F1; line-height: 1.2; position: relative; }
.lib-cover-sub { font-size: 12px; color: rgba(251, 248, 241, .75); font-style: italic; position: relative; min-height: 14px; }
.lib-card-body { padding: 16px 20px 18px; }
.lib-bar { height: 5px; border-radius: 3px; background: #E3E0D9; overflow: hidden; }
.lib-bar > div { height: 100%; background: var(--accent); border-radius: 3px; }
.lib-nums { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 7px; font-variant-numeric: tabular-nums; }
.lib-meta { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.lib-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.lib-pill .dot { width: 6px; height: 6px; border-radius: 50%; }
.lib-pill.yaziliyor { background: #FBF2DE; color: #86682A; }
.lib-pill.yaziliyor .dot { background: #C98A2E; }
.lib-pill.taslak { background: #F2F0E9; color: #6B6559; }
.lib-pill.taslak .dot { background: #CFCABF; }
.lib-pill.bitti { background: var(--accent-soft); color: #43522F; }
.lib-pill.bitti .dot { background: #7FB069; }
.lib-time { font-size: 11.5px; color: var(--muted); margin-left: auto; }
.lib-archive {
  position: absolute; top: 10px; right: 10px; z-index: 2; width: 26px; height: 26px;
  border-radius: 7px; border: none; background: rgba(38, 37, 31, .3); color: #FBF8F1;
  cursor: pointer; display: none; align-items: center; justify-content: center;
}
.lib-card:hover .lib-archive { display: inline-flex; }
.lib-archive:hover { background: var(--danger); }
.lib-archive svg { width: 13px; height: 13px; }
.lib-card.lib-new {
  border: 1px dashed #DCD8CD; background: #FDFCF9; box-shadow: none; min-height: 246px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--accent);
}
.lib-card.lib-new:hover { background: var(--accent-soft); border-color: var(--accent); transform: none; box-shadow: none; }
.lib-card.lib-new svg { width: 26px; height: 26px; }
.lib-new-title { font-size: 14px; font-weight: 600; }
.lib-new-hint { font-size: 12.5px; color: var(--muted); }

/* Yeni kitap modalı */
.lib-modal-backdrop {
  position: fixed; inset: 0; background: rgba(38, 37, 31, .38);
  display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 60;
}
.lib-modal {
  width: 100%; max-width: 520px; border: 1px solid var(--border); border-radius: 16px;
  background: var(--panel-bg); box-shadow: 0 24px 70px rgba(40, 38, 33, .25); overflow: hidden;
  animation: lib-in .2s ease;
}
@keyframes lib-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.lib-modal-head { padding: 22px 26px 0; display: flex; align-items: center; }
.lib-modal-head .t { font-family: var(--font-serif); font-size: 21px; font-weight: 600; }
.lib-modal-close { margin-left: auto; border: none; background: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 0 2px; }
.lib-modal-close:hover { color: var(--text); }
.lib-modal-body { padding: 18px 26px 8px; display: flex; flex-direction: column; gap: 14px; }
.lib-modal-body label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.lib-modal-body label .opt { color: var(--muted); font-weight: 400; }
.lib-modal-body input[type=text], .lib-modal-body input[type=number] {
  width: 100%; padding: 10px 13px; border: 1px solid var(--border); border-radius: 9px;
  font-family: inherit; font-size: 14px;
}
.lib-modal-body input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.lib-colors { display: flex; gap: 9px; }
.lib-color { width: 34px; height: 34px; border-radius: 8px; cursor: pointer; border: none; padding: 0; }
.lib-color.sel { box-shadow: 0 0 0 2px var(--panel-bg), 0 0 0 4px var(--accent); }
.lib-targets { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lib-target-chip {
  padding: 8px 14px; border: 1px solid var(--border); border-radius: 9px; font-size: 13.5px;
  cursor: pointer; background: var(--panel-bg); font-family: inherit;
}
.lib-target-chip.sel { border-color: var(--accent); background: var(--accent-soft); color: #43522F; font-weight: 600; }
.lib-targets input[type=number] { width: 92px; }
.lib-modal-foot {
  display: flex; gap: 10px; padding: 16px 26px 22px; margin-top: 14px;
  border-top: 1px solid var(--border-soft); background: #FDFCF9;
}
.lib-modal-foot .cancel {
  padding: 10px 16px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel-bg);
  font-family: inherit; font-size: 13.5px; cursor: pointer; color: var(--text);
}
.lib-modal-foot .cancel:hover { background: var(--sidebar-bg); }
.lib-modal-foot .create {
  margin-left: auto; padding: 10px 20px; border: none; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 13.5px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.lib-modal-foot .create:hover { background: var(--accent-deep); }

/* ---------- Ayarlar ---------- */
.set-h1 { font-family: var(--font-serif); font-size: 34px; font-weight: 600; letter-spacing: -.02em; margin: 0; }
.set-intro { margin: 10px 0 0; font-size: 14.5px; color: #4F4B42; max-width: 620px; line-height: 1.6; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; margin-top: 26px; align-items: start; }
.set-card {
  border: 1px solid var(--border); border-radius: 14px; background: var(--panel-bg);
  padding: 24px 26px; box-shadow: var(--shadow);
}
.set-title { font-size: 15.5px; font-weight: 600; }
.set-desc { font-size: 13.5px; line-height: 1.65; color: #4F4B42; margin: 8px 0 14px; }
.set-field { margin-top: 12px; }
.set-field:first-of-type { margin-top: 14px; }
.set-field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.set-field label .opt { color: var(--muted); font-weight: 400; }
.set-field input, .set-field select {
  width: 100%; padding: 10px 13px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--panel-bg); font-family: inherit; font-size: 14px;
}
.set-field input:focus, .set-field select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.set-hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.set-path {
  display: flex; align-items: center; gap: 10px; padding: 11px 13px; margin-top: 8px;
  border: 1px solid var(--border); border-radius: 9px; background: #FDFCF9; font-size: 13px; color: #4F4B42;
}
.set-path svg { width: 16px; height: 16px; color: var(--accent); }
.set-path .p { font-weight: 600; font-variant-numeric: tabular-nums; }
.set-path .h { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; }
.set-btn {
  padding: 10px 16px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel-bg);
  font-family: inherit; font-size: 13.5px; cursor: pointer; color: var(--text);
  transition: background .12s, border-color .12s;
}
.set-btn:hover { background: var(--sidebar-bg); }
.set-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.set-version { font-size: 12.5px; color: var(--muted); margin-top: 14px; }

/* ---------- Veri evi: mutlak yollar, taşıma uyarısı, kayıp kitap kurtarma ----------
   Yollar artık kısa klasör adları değil tam disk yolları; satır sarılabilir
   olmalı ki uzun Windows yolları kartı taşırmasın. */
.set-card-wide { grid-column: 1 / -1; }
/* Yol uzunsa kendi satırını alır, açıklama ve düğme altına sarar; kısaysa tek satır kalır */
.set-path, .onb-path { flex-wrap: wrap; row-gap: 8px; }
.set-path .p, .onb-path .p {
  flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; word-break: break-word;
  font-variant-numeric: tabular-nums;
}
.set-path .h, .onb-path .h { flex: none; }
.veri-ac {
  flex: none; margin-inline-start: auto;  /* RTL'de de satır sonuna otursun */ padding: 5px 11px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--bg); font-family: inherit; font-size: 12px; color: var(--text); cursor: pointer;
  transition: background .12s, border-color .12s;
}
.veri-ac:hover { background: var(--accent-soft); border-color: var(--accent); }
.veri-ac:focus-visible { outline: none; box-shadow: var(--ring); }

.veri-uyari {
  margin-top: 14px; padding: 13px 15px; border: 1px solid var(--warn); border-radius: 10px;
  background: var(--tip-bg); font-size: 13px; line-height: 1.6; color: var(--text);
  display: flex; flex-direction: column; gap: 11px; align-items: flex-start;
}
.veri-uyari-metin b { font-weight: 600; overflow-wrap: anywhere; }
.set-btn.primary { background: var(--accent); border-color: var(--accent); color: #FFF; font-weight: 600; }
.set-btn.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.set-btn:disabled { opacity: .55; cursor: default; }

.onb-kurtar {
  margin-top: 18px; padding: 15px 17px; border: 1px solid var(--border); border-radius: 11px;
  background: var(--panel-bg);
}
.onb-kurtar-yol { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--muted); }
.onb-kurtar-yol svg { width: 15px; height: 15px; color: var(--accent); flex: none; }
.onb-kurtar-yol span { min-width: 0; overflow-wrap: anywhere; }
.onb-kurtar-liste { list-style: none; padding: 0; margin: 12px 0 15px; display: flex; flex-direction: column; gap: 9px; }
.onb-kurtar-liste li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.onb-kurtar-liste svg { width: 16px; height: 16px; color: var(--accent); flex: none; }
.onb-kurtar-liste .k { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.onb-kurtar-liste .w { margin-left: auto; flex: none; font-size: 12.5px; color: var(--muted); }
[dir="rtl"] .onb-kurtar-liste .w { margin-left: 0; margin-right: auto; }
[data-theme="dark"] .veri-ac:hover { background: #31362A; }
[data-theme="dark"] .set-btn.primary { color: #1C1A16; }

/* ---------- Kurulum sihirbazı (ilk açılış) ---------- */
.onb-backdrop {
  position: fixed; inset: 0; z-index: 90; background: #EFEDE6;
  display: flex; align-items: center; justify-content: center; padding: 48px 24px; overflow-y: auto;
}
.onb-window {
  width: 100%; max-width: 760px; border: 1px solid #DCD8CD; border-radius: 14px;
  background: var(--bg); box-shadow: 0 28px 70px rgba(40, 38, 33, .2); overflow: hidden;
}
.onb-titlebar {
  display: flex; align-items: center; gap: 9px; padding: 11px 16px;
  border-bottom: 1px solid var(--border); background: var(--sidebar-bg);
}
.onb-tb-dot { width: 11px; height: 11px; border-radius: 50%; background: #DDD8CD; }
.onb-tb-label { margin-left: 10px; font-size: 12px; color: var(--muted); }
.onb-body { display: grid; grid-template-columns: 236px 1fr; }
.onb-side { background: var(--accent); padding: 32px 26px; display: flex; flex-direction: column; gap: 26px; }
.onb-logo { display: flex; align-items: center; gap: 11px; }
.onb-logo-badge {
  width: 44px; height: 44px; border-radius: 11px; background: rgba(251, 248, 241, .12);
  display: flex; align-items: center; justify-content: center;
}
.onb-logo-badge svg { width: 26px; height: 26px; stroke: #FBF8F1; stroke-width: 1.6; }
.onb-wordmark { font-size: 19px; color: #FBF8F1; letter-spacing: -.015em; }
.onb-wordmark span { font-weight: 400; }
.onb-wordmark b { font-weight: 700; }
.onb-steps { display: flex; flex-direction: column; gap: 14px; }
.onb-step { display: flex; align-items: center; gap: 10px; font-size: 13px; color: rgba(251, 248, 241, .55); }
.onb-step.now { color: #FBF8F1; font-weight: 600; }
.onb-step-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: rgba(251, 248, 241, .3); }
.onb-step.now .onb-step-dot { background: #FBF8F1; }
.onb-step.done .onb-step-dot { background: #A9BA8B; }
.onb-side-note { margin-top: auto; font-size: 11.5px; line-height: 1.6; color: rgba(251, 248, 241, .6); }
.onb-content { padding: 34px 36px 28px; display: flex; flex-direction: column; min-height: 430px; }
.onb-content-main { flex: 1; }
.onb-h1 { margin: 0; font-family: var(--font-serif); font-size: 27px; font-weight: 600; letter-spacing: -.02em; }
.onb-p { margin: 8px 0 0; font-size: 14px; line-height: 1.65; color: #4F4B42; }
.onb-path {
  display: flex; align-items: center; gap: 10px; margin-top: 22px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel-bg); font-size: 13.5px;
}
.onb-path svg { width: 17px; height: 17px; color: var(--accent); }
.onb-path .p { font-weight: 600; }
.onb-path .h { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; }
.onb-list { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-direction: column; gap: 13px; }
.onb-list li { display: flex; align-items: flex-start; gap: 11px; font-size: 14px; line-height: 1.5; color: #4F4B42; }
.onb-list svg { width: 16px; height: 16px; color: var(--accent); margin-top: 2px; }
.onb-field { margin-top: 16px; }
.onb-field:first-of-type { margin-top: 22px; }
.onb-field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.onb-field input[type=text], .onb-field input[type=number], .onb-field select {
  width: 100%; padding: 10px 13px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--panel-bg); font-family: inherit; font-size: 14px;
}
.onb-field .lib-targets input[type=number] { width: 92px; }
.onb-field input:focus, .onb-field select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.onb-hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.onb-foot { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 24px; }
.onb-back {
  padding: 11px 18px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel-bg);
  color: #4F4B42; font-family: inherit; font-size: 13.5px; cursor: pointer;
}
.onb-back:disabled { opacity: .45; cursor: default; }
.onb-back:not(:disabled):hover { background: var(--sidebar-bg); }
.onb-skip { border: none; background: none; color: var(--muted); font-family: inherit; font-size: 13px; cursor: pointer; padding: 11px 6px; }
.onb-skip:hover { color: var(--accent-deep); text-decoration: underline; }
.onb-next {
  margin-left: auto; padding: 11px 22px; border: none; border-radius: 9px; background: var(--accent);
  color: #fff; font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.onb-next:hover { background: var(--accent-deep); }
.onb-next:focus-visible, .onb-back:focus-visible, .onb-skip:focus-visible { outline: none; box-shadow: var(--ring); }
@media (max-width: 720px) {
  .onb-body { grid-template-columns: 1fr; }
  .onb-side { flex-direction: row; align-items: center; padding: 18px 20px; gap: 16px; }
  .onb-steps { flex-direction: row; gap: 12px; flex-wrap: wrap; }
  .onb-side-note { display: none; }
  .onb-content { min-height: 0; }
}

/* ==================== RTL duzeltmeleri (uiLang = ar) ====================
   i18n.js Arapca secildiginde <html dir="rtl"> ayarlar; asagidaki asgari
   duzeltmeler panel kenarliklarini, hizalamalari ve vurgu cizgilerini cevirir. */

[dir="rtl"] .sidebar { border-right: none; border-left: 1px solid var(--border); }
[dir="rtl"] .companion { border-left: none; border-right: 1px solid var(--border); }
[dir="rtl"] .tree-item.chapter { padding-left: 0; padding-right: 22px; }

[dir="rtl"] .note-del { right: auto; left: 9px; }
[dir="rtl"] .tray-card .note-del { right: auto; left: 5px; }
[dir="rtl"] .lib-archive { right: auto; left: 10px; }
[dir="rtl"] .pad-title { padding-right: 0; padding-left: 16px; }

[dir="rtl"] .tray-card {
  border-left: 1px solid var(--border);
  border-right: 3px solid var(--muted);
  padding: 8px 10px 8px 22px;
}
[dir="rtl"] .tray-card.not { border-right-color: var(--note-not); }
[dir="rtl"] .tray-card.sentez { border-right-color: var(--note-sentez); }
[dir="rtl"] .tray-card.alinti { border-right-color: var(--note-alinti); }
[dir="rtl"] .tray-card.fikir { border-right-color: var(--note-fikir); }
[dir="rtl"] .tray-card.gorsel { border-right-color: var(--note-gorsel); }

[dir="rtl"] .src-table th, [dir="rtl"] .src-table td { text-align: right; }
[dir="rtl"] .src-apa { padding-left: 0; text-indent: 0; padding-right: 18px; }

[dir="rtl"] .guide ul, [dir="rtl"] .draft-preview ul, [dir="rtl"] .draft-preview ol { padding-left: 0; padding-right: 1.4em; }
[dir="rtl"] .guide .kural { border-left: 1px solid var(--border); border-right: 3px solid var(--accent); }
[dir="rtl"] .draft-preview h1, [dir="rtl"] .draft-preview h2, [dir="rtl"] .draft-preview h3 { text-align: right; }
[dir="rtl"] .draft-preview blockquote { border-left: none; padding-left: 0; border-right: 3px solid var(--tip-border); padding-right: 1.1em; }

[dir="rtl"] .set-path .h, [dir="rtl"] .onb-path .h { text-align: left; }

/* ==================== Kitaba Dönüştür ekranı ==================== */

.conv-grid { display: grid; grid-template-columns: 1fr 300px; gap: 26px; margin-top: 30px; align-items: start; }
@media (max-width: 1100px) { .conv-grid { grid-template-columns: 1fr; } }
.conv-label { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.conv-label + .conv-label { margin-top: 26px; }
.conv-formats { display: flex; flex-direction: column; gap: 10px; }
.conv-fmt {
  display: flex; align-items: center; gap: 13px; padding: 15px 17px;
  border-radius: 12px; cursor: pointer; background: var(--panel-bg);
  border: 1px solid var(--border); transition: border-color .12s, background .12s;
}
.conv-fmt.sel { background: var(--accent-soft); border-color: var(--accent); }
.conv-fmt .conv-box {
  width: 20px; height: 20px; border-radius: 6px; display: inline-flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  background: transparent; border: 1px solid #DCD8CD;
}
.conv-fmt.sel .conv-box { background: var(--accent); border-color: var(--accent); }
.conv-fmt .conv-box svg { width: 12px; height: 12px; stroke: #fff; stroke-width: 3; visibility: hidden; }
.conv-fmt.sel .conv-box svg { visibility: visible; }
.conv-fmt .conv-fmt-name { display: block; font-size: 14.5px; font-weight: 600; }
.conv-fmt .conv-fmt-desc { display: block; font-size: 12.5px; color: var(--muted-2); margin-top: 2px; }
.conv-build {
  margin-top: 22px; width: 100%; padding: 14px; border: 1px solid var(--accent); border-radius: 11px;
  background: var(--accent); color: #fff; font-family: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
}
.conv-build:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.conv-build:disabled { opacity: .82; cursor: default; }
.conv-build .conv-spin {
  width: 14px; height: 14px; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff;
  border-radius: 50%; animation: conv-spin .7s linear infinite; display: inline-block;
}
@keyframes conv-spin { to { transform: rotate(360deg); } }
.conv-hint { font-size: 12px; color: var(--muted); margin-top: 10px; }
.conv-result { margin-top: 12px; font-size: 13px; }
.conv-result a { display: inline-block; color: var(--accent); margin-right: 14px; margin-top: 4px; text-decoration: none; }
.conv-result a:hover { color: var(--accent-deep); text-decoration: underline; }
.conv-history {
  border: 1px solid var(--border); border-radius: 12px; background: var(--panel-bg);
  overflow: hidden; box-shadow: var(--shadow);
}
.conv-hrow {
  display: grid; grid-template-columns: 140px 1fr auto; gap: 14px; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border-soft);
}
.conv-hrow:last-child { border-bottom: none; }
.conv-hdate { font-size: 13px; font-variant-numeric: tabular-nums; }
.conv-htags { display: flex; gap: 6px; flex-wrap: wrap; }
.conv-htag { padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px; font-size: 10.5px; color: var(--muted-2); }
.conv-hlinks { display: flex; gap: 12px; font-size: 12.5px; flex-wrap: wrap; }
.conv-hlinks a { color: var(--accent); text-decoration: none; }
.conv-hlinks a:hover { color: var(--accent-deep); text-decoration: underline; }
.conv-hsize { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.conv-hempty { padding: 22px 18px; font-size: 13px; color: var(--muted); }
.conv-cover {
  border-radius: 4px 12px 12px 4px; background: #55663F;
  box-shadow: 0 18px 40px rgba(40, 38, 33, .22); overflow: hidden; position: relative;
}
.conv-cover .conv-spine { position: absolute; top: 0; bottom: 0; left: 0; width: 9px; background: rgba(0, 0, 0, .18); }
.conv-cover-inner { padding: 46px 32px 34px 40px; min-height: 380px; display: flex; flex-direction: column; }
.conv-cover-author { font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: rgba(251, 248, 241, .6); }
.conv-cover-title { font-family: var(--font-serif); font-size: 32px; font-weight: 600; line-height: 1.14; color: #FBF8F1; margin-top: 22px; }
.conv-cover-rule { width: 42px; height: 2px; background: rgba(251, 248, 241, .5); margin: 22px 0; }
.conv-cover-sub { font-family: var(--font-serif); font-style: italic; font-size: 14.5px; color: rgba(251, 248, 241, .82); line-height: 1.5; }
.conv-cover-made { margin-top: auto; font-size: 11px; color: rgba(251, 248, 241, .55); }
.conv-summary { font-size: 12.5px; color: var(--muted-2); margin-top: 12px; font-variant-numeric: tabular-nums; }
.conv-tip {
  border: 1px solid var(--border); border-radius: 12px; background: var(--panel-bg);
  padding: 16px 18px; margin-top: 18px; font-size: 12.5px; line-height: 1.7; color: var(--muted-2);
  box-shadow: var(--shadow);
}
.conv-tip .t { font-weight: 600; color: var(--text); margin-bottom: 6px; }
[dir="rtl"] .conv-cover { border-radius: 12px 4px 4px 12px; }
[dir="rtl"] .conv-cover .conv-spine { left: auto; right: 0; }
[dir="rtl"] .conv-cover-inner { padding: 46px 40px 34px 32px; }

/* ==================== Odak modu ====================
   Sol + sağ paneller gizlenir, yazı alanı ortalanır (220ms geçiş, oturumluk). */

.app { transition: grid-template-columns .22s ease; }
.sidebar, .companion, .rail { min-width: 0; transition: opacity .22s ease; }
body.focus-mode .app { grid-template-columns: 0px 1fr 0px 0px; }
body.focus-mode .rail, body.focus-mode .sidebar, body.focus-mode .companion {
  opacity: 0; pointer-events: none; overflow: hidden;
  border-left: none; border-right: none; padding: 0;
}
body.focus-mode .editor { padding: 64px 48px 120px; }
@media (max-width: 1100px) { body.focus-mode .app { grid-template-columns: 0px 1fr 0px; } }

/* ==================== Karanlık mod ====================
   Sıcak koyu palet — kaynak: Tasarım Sistemi (paper-dark #1C1A16, panel-dark #262319,
   surface-dark #2E2B24, border-dark #3A362F, accent-dark #A9BA8B). */

:root { color-scheme: light; }

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1C1A16;            /* paper-dark */
  --sidebar-bg: #262319;    /* panel-dark */
  --panel-bg: #2E2B24;      /* surface-dark */
  --border: #3A362F;
  --border-soft: #343029;
  --text: #EAE6DC;
  --muted: #9A9384;
  --muted-2: #9A9384;
  --accent: #A9BA8B;        /* accent-dark */
  --accent-deep: #C2CFA8;
  --accent-soft: #31362A;
  --danger: #C86A52;
  --warn: #D9A34E;
  --tip-bg: #2B2718;
  --tip-border: #4A4128;
  --tip-text: #D9BE7E;
  --hover: #34302A;
  --track: #3A362F;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .25);
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 4px 14px rgba(0, 0, 0, .22);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, .4);
  --ring: 0 0 0 3px rgba(169, 186, 139, .28);
}

/* Açık zemin varsayan vurgulu düğmeler: koyu temada accent açık renktir,
   üzerindeki metin mürekkep koyusuna döner */
[data-theme="dark"] .sidebar-actions button.primary,
[data-theme="dark"] .note-add button#noteAddBtn,
[data-theme="dark"] .src-form button,
[data-theme="dark"] .lib-new-btn,
[data-theme="dark"] .lib-modal-foot .create,
[data-theme="dark"] .onb-next,
[data-theme="dark"] .guide .guide-cta .cta-primary,
[data-theme="dark"] .draft-toolbar button.active,
[data-theme="dark"] .conv-build { color: #1C1A16; }
[data-theme="dark"] .conv-build .conv-spin { border-color: rgba(28, 26, 22, .35); border-top-color: #1C1A16; }
[data-theme="dark"] .conv-fmt.sel .conv-box svg { stroke: #1C1A16; }
[data-theme="dark"] .conv-fmt .conv-box { border-color: var(--border); }
[data-theme="dark"] .conv-cover { box-shadow: 0 18px 40px rgba(0, 0, 0, .5); }

/* Sabit açık renkler (hex) için koyu karşılıklar */
[data-theme="dark"] .tree::-webkit-scrollbar-thumb,
[data-theme="dark"] .editor::-webkit-scrollbar-thumb,
[data-theme="dark"] #libraryView::-webkit-scrollbar-thumb { background: #3A362F; }
[data-theme="dark"] .tree-item.special,
[data-theme="dark"] .tray-head,
[data-theme="dark"] .guide .guide-lead,
[data-theme="dark"] .src-ethics .b,
[data-theme="dark"] .set-intro,
[data-theme="dark"] .set-desc,
[data-theme="dark"] .set-path,
[data-theme="dark"] .onb-p,
[data-theme="dark"] .onb-list li,
[data-theme="dark"] .onb-back { color: #C9C3B6; }
[data-theme="dark"] .src-table th { background: #262319; }
[data-theme="dark"] .src-table tr.sel td { background: #31362A; }
[data-theme="dark"] .note-card.gorsel { background: #263030; }
[data-theme="dark"] .editable:hover { background: #34302A; }
[data-theme="dark"] .lib-modal-foot,
[data-theme="dark"] .set-path,
[data-theme="dark"] .lib-card.lib-new { background: #262319; }
[data-theme="dark"] .lib-card.lib-new,
[data-theme="dark"] .pad-card.pad-new,
[data-theme="dark"] .conv-fmt .conv-box { border-color: #4A453C; }
[data-theme="dark"] .lib-header { background: rgba(28, 26, 22, .92); }
[data-theme="dark"] .lib-bar { background: #3A362F; }
[data-theme="dark"] .lib-modal-backdrop { background: rgba(0, 0, 0, .55); }
[data-theme="dark"] .small-actions button.danger:hover { background: #3A2620; }
[data-theme="dark"] .draft-toolbar button.editor-btn:hover { background: #332E1D; }
[data-theme="dark"] .status-taslak { background: #57534A; }
[data-theme="dark"] .lib-pill.yaziliyor { background: #3A3222; color: #D9BE7E; }
[data-theme="dark"] .lib-pill.yaziliyor .dot { background: #D9A34E; }
[data-theme="dark"] .lib-pill.taslak { background: #34302A; color: #9A9384; }
[data-theme="dark"] .lib-pill.taslak .dot { background: #57534A; }
[data-theme="dark"] .lib-pill.bitti { background: #2C3322; color: #A9BA8B; }
[data-theme="dark"] .note-del, [data-theme="dark"] .del-link { color: #6E695E; }
[data-theme="dark"] .lib-modal-body input[type=text],
[data-theme="dark"] .lib-modal-body input[type=number],
[data-theme="dark"] .tray-add input,
[data-theme="dark"] .lib-targets input[type=number] { background: var(--panel-bg); color: var(--text); }
[data-theme="dark"] .lib-target-chip.sel { color: var(--accent); }
[data-theme="dark"] .lib-pill.bitti .dot { background: #A9BA8B; }
[data-theme="dark"] .lib-color.sel { box-shadow: 0 0 0 2px var(--sidebar-bg), 0 0 0 4px var(--accent); }
[data-theme="dark"] .note-del:hover, [data-theme="dark"] .del-link:hover { color: var(--danger); }

/* Kurulum: yan şerit koyu temada da koyu zeytin kalır (üzerinde açık metin var) */
[data-theme="dark"] .onb-backdrop { background: #14120F; }
[data-theme="dark"] .onb-window { border-color: #3A362F; }
[data-theme="dark"] .onb-tb-dot { background: #3A362F; }
[data-theme="dark"] .onb-side { background: #3E4A2E; }

/* Sade (zen) mod — gerçek tam ekran, yalnız metin */
#zenOverlay {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg); display: flex; justify-content: center;
}
#zenOverlay textarea {
  width: min(880px, 94vw); height: 100%;
  border: none; background: transparent; resize: none; outline: none;
  padding: 10vh 0 35vh;
  font-family: var(--font-serif); font-size: 20px; line-height: 1.85;
  color: var(--text); text-align: justify; hyphens: auto; -webkit-hyphens: auto;
  /* Kaydırma çubuğu sade modda görünmez — kaydırma tekerlek/dokunmayla sürer */
  scrollbar-width: none;
}
#zenOverlay textarea::-webkit-scrollbar { display: none; }
.zen-hint {
  position: fixed; bottom: 14px; right: 18px;
  font-size: 11px; color: var(--muted); opacity: .45; user-select: none;
}

/* Türetilmiş bölüm durumları: boş soluk, yazılıyor kehribar, bitti yeşil tonlu */
.status-bos { background: transparent; border: 1.5px solid #CFCABF; }
[data-theme="dark"] .status-bos { border-color: #4A463D; }
.tree-item.chapter.st-bos .chapter-label { color: var(--muted); opacity: .8; }
.tree-item.chapter.st-bitti .chapter-label { color: var(--accent-deep); font-weight: 500; }
[data-theme="dark"] .tree-item.chapter.st-bitti .chapter-label { color: var(--accent); }

/* ---------------- Telefon eşleştirme modalı + uygulama bildirimi ---------------- */

.phone-modal { max-width: 640px; width: min(640px, 92vw); }
.phone-body { padding: 18px 26px 22px; }
.phone-loading, .phone-warn { color: var(--muted); font-size: 13.5px; padding: 20px 0; }
.phone-cols { display: flex; gap: 22px; align-items: flex-start; }
/* QR zemini her temada beyaz kalır — kamera kontrastı için */
.phone-qr { flex-shrink: 0; width: 200px; border: 1px solid var(--border); border-radius: 12px; padding: 10px; background: #FFFFFF; }
.phone-qr svg { display: block; width: 100%; height: auto; }
/* Global ikon kuralı (svg { stroke-width:1.7; round }) QR modüllerini bozar — QR için sıfırla */
.phone-qr svg path { stroke-width: 1; stroke-linecap: butt; stroke-linejoin: miter; }
.phone-steps { flex: 1; min-width: 0; font-size: 13.5px; }
.phone-intro { margin: 0 0 10px; line-height: 1.6; color: var(--text); }
.phone-steps ol { margin: 0; padding-left: 20px; line-height: 1.9; }
.phone-url { margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.phone-url code { background: var(--sidebar-bg); border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px; font-size: 12px; }
.phone-ip-row { margin-top: 10px; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.phone-ip-row select { border: 1px solid var(--border); border-radius: 7px; padding: 5px 8px; font-family: inherit; font-size: 12.5px; background: var(--panel-bg); color: var(--text); }
.phone-foot { display: flex; align-items: center; gap: 14px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.phone-devices { flex: 1; font-size: 12.5px; line-height: 1.6; }
.phone-devices .dim { color: var(--muted); }
.phone-renew { border: 1px solid var(--border); background: var(--panel-bg); color: var(--muted); border-radius: 8px; padding: 8px 13px; font-family: inherit; font-size: 12.5px; cursor: pointer; }
.phone-renew:hover { color: var(--text); border-color: var(--muted); }
.phone-privacy { margin: 14px 0 0; font-size: 12px; color: var(--muted); line-height: 1.6; }

[dir="rtl"] .phone-steps ol { padding-left: 0; padding-right: 20px; }

.app-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px); z-index: 60;
  max-width: 70vw; padding: 11px 20px; border-radius: 10px;
  background: var(--text); color: var(--bg); font-size: 13.5px;
  box-shadow: 0 8px 22px rgba(40, 38, 33, .3);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.app-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Araç rayı (Varyant A): en sağda ince dikey şerit ---------- */
.rail {
  background: var(--sidebar-bg); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 0 12px; gap: 4px;
}
.rail .ric {
  width: 34px; height: 34px; border: none; background: transparent;
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  color: var(--muted); cursor: pointer; transition: background .12s, color .12s;
}
.rail .ric svg { width: 17px; height: 17px; }
.rail .ric:hover { background: var(--border-soft); color: var(--text); }
.rail .ric.on { background: var(--accent-soft); color: var(--accent-deep); }
.rail .ric:focus-visible { outline: none; box-shadow: var(--ring); }
.rail-sep { width: 22px; border-top: 1px solid var(--border); margin: 6px 0; }
.rail-grow { flex: 1; }
.rail .rail-cta { background: var(--accent); color: #fff; width: 36px; height: 36px; border-radius: 10px; }
.rail .rail-cta:hover { background: var(--accent-deep); color: #fff; }
.rail .rail-cta.on { background: var(--accent-deep); color: #fff; }
[data-theme="dark"] .rail .rail-cta { color: #1C1A16; }

/* Ağacın sonundaki sessiz "+ Kısım" satırı */
.tree-item.add-part { color: var(--muted); font-size: 12px; margin-top: 10px; border: 1px dashed var(--border); border-radius: 8px; justify-content: center; padding: 6px; }
.tree-item.add-part:hover { color: var(--accent-deep); border-color: var(--accent); background: var(--accent-soft); }
.tree-item.add-part svg { width: 12px; height: 12px; }

/* Versiyonlar penceresi (mini modal) */
.mini-overlay { position: fixed; inset: 0; z-index: 900; background: rgba(38, 37, 31, .35); display: flex; align-items: center; justify-content: center; }
.mini-modal {
  background: var(--panel-bg); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); width: min(400px, 92vw); padding: 18px 20px 20px;
}
.mini-head { display: flex; align-items: center; justify-content: space-between; font-family: var(--font-serif); font-size: 18px; font-weight: 600; margin-bottom: 14px; }
.mini-close { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 14px; padding: 4px; }
.mini-close:hover { color: var(--danger); }
.btn-take-version {
  width: 100%; padding: 10px; border: 1px solid var(--accent); border-radius: 9px;
  background: var(--accent); color: #fff; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  margin-bottom: 12px;
}
.btn-take-version:hover { background: var(--accent-deep); }
.mini-modal .versions-box { max-height: 240px; padding: 0; }
