:root {
  --bg: #eef0f4;
  --dot: #cdd2db;
  --ink: #1d2330;
  --muted: #6a7282;
  --line: #e3e6ec;
  --surface: #ffffff;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --amber: #f59e0b;
  --amber-soft: #fef3c7;
  --ok: #16a34a;
  --danger: #dc2626;
  --shadow: 0 8px 28px rgba(20, 25, 40, 0.13), 0 1px 3px rgba(20, 25, 40, 0.08);
  /* Temaya göre değişen nötr tonlar */
  --card: #ffffff; /* görev kutusu zemini */
  --field: #ffffff; /* yazı alanı ve düğme zemini */
  --hover: #f3f4f8; /* üzerine gelince */
  --hover-strong: #e9ebf0;
  --soft: #fafbfc;
  --track: #e2e5eb; /* boş ilerleme çubuğu */
  --line-strong: #c3c8d2;
  --box-border: #98a1b0; /* kutucuk kenarlığı */
  --accent-soft-hover: #e0e3ff;
  color-scheme: light;
}

/* ================= Koyu tema =================
   Nötr tonlar değişkenlerden gelir; renkli kutular (alt başlık rengine göre) aşağıda ayrıca koyulaştırılır. */
:root[data-theme="dark"] {
  --bg: #12151c;
  --dot: #2a3040;
  --ink: #e6e9f0;
  --muted: #9aa3b5;
  --line: #2c3344;
  --surface: #1b202b;
  --accent: #8b93f8;
  --accent-soft: #272c52;
  --amber-soft: #3a2e12;
  --ok: #22c55e;
  --danger: #f87171;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
  --card: #202634;
  --field: #252c3b;
  --hover: #2a3243;
  --hover-strong: #343d51;
  --soft: #20252f;
  --track: #333c4f;
  --line-strong: #3d465a;
  --box-border: #66708a;
  --accent-soft-hover: #323871;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  font: 14px/1.4 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }

/* ================= Çalışma alanı ================= */

#viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1.2px, transparent 1.4px);
}
#viewport.panning, #viewport.panning .cell { cursor: grabbing; }

#world {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  display: grid;
  grid-template-columns: repeat(3, max-content);
  gap: 26px;
}
#world.anim { transition: transform 0.32s cubic-bezier(0.2, 0.7, 0.2, 1); }

/* ---- Çoklu görünüm: her hedef kendi çerçevesinde, tuvalde serbestçe yerleşir ---- */
#world.wall { display: block; }
.bframe {
  position: absolute;
  padding: 36px;
  border-radius: 44px;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  border: 2px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset, 0 30px 80px -30px rgba(25, 30, 55, 0.22);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.bframe.active { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: 0 0 0 6px var(--accent-soft), 0 30px 80px -30px rgba(25, 30, 55, 0.28); }
.bframe.due:not(.active) { border-color: color-mix(in srgb, var(--amber) 60%, var(--line)); }
.bframe.lifted { z-index: 2; box-shadow: 0 0 0 6px var(--accent-soft), 0 60px 120px -30px rgba(25, 30, 55, 0.4); transition: none; }
.bgrid { display: grid; grid-template-columns: repeat(3, max-content); gap: 26px; }
.bframe.lifted .bhead { cursor: grabbing; }
.bhead {
  /* Başlık şeridi yakınlıktan bağımsız okunur boyda: uzaktayken büyür, yakında 20 px'e iner.
     Çerçevenin hemen üstünde, satır aralığında durur (yükseklik app.js WALL_HEAD ile aynı);
     çerçevenin boyunu değiştirmez, düzen yakınlıkla kaymaz. */
  --fs: clamp(20px, calc(15px / var(--zs, 1)), 70px);
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(100% + 6px);
  display: flex;
  align-items: flex-end;
  gap: calc(var(--fs) * 0.6);
  box-sizing: border-box;
  height: 170px;
  padding: 0 0 calc(var(--fs) * 0.25);
  font-size: var(--fs);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.bgrip { display: grid; place-items: center; color: var(--muted); opacity: 0.5; }
.bgrip svg { width: 1em; height: 1em; }
.bhead:hover .bgrip { opacity: 1; }
.bname { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; letter-spacing: -0.015em; color: var(--ink); }
.bprog { display: inline-flex; align-items: center; gap: 0.4em; flex: none; font-size: 0.62em; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }
.bprog .bar { width: 5em; height: 0.42em; border-radius: 1em; background: var(--hover); overflow: hidden; }
.bprog .bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.bstats { display: inline-flex; gap: 0.35em; margin-left: auto; flex: none; }
.bst { padding: 0.22em 0.7em; border-radius: 1em; font-size: 0.6em; font-weight: 700; white-space: nowrap; }
.bst.now { background: var(--amber-soft); color: color-mix(in srgb, var(--amber) 70%, var(--ink)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--amber) 50%, transparent) inset; }
.bst.soon { background: var(--accent-soft); color: var(--accent); }
.bst.free { background: var(--hover); color: var(--muted); }
.bsolo { display: grid; place-items: center; flex: none; width: 1.8em; height: 1.8em; padding: 0; border: 1px solid var(--line); border-radius: 0.5em; background: var(--surface); color: var(--muted); font-size: inherit; }
.bsolo:hover { border-color: var(--accent); color: var(--accent); }
.bsolo svg { width: 0.95em; height: 0.95em; }
.bframe.due .bst.now { animation: bpulse 2.4s ease-in-out infinite; }
@keyframes bpulse { 50% { box-shadow: 0 0 0 1px var(--amber) inset, 0 0 0 0.35em color-mix(in srgb, var(--amber) 25%, transparent); } }
@media (prefers-reduced-motion: reduce) { .bframe.due .bst.now { animation: none; } }

.block {
  --h: 230;
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 230px);
  grid-auto-rows: 180px;
  gap: 6px;
  padding: 10px;
  border-radius: 22px;
  background: hsl(var(--h) 60% 96.5%);
  border: 2px solid hsl(var(--h) 45% 82%);
}
.block.center {
  background: var(--surface);
  border-color: var(--line-strong);
  box-shadow: 0 10px 40px rgba(30, 35, 60, 0.14);
}

.cell {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 13px;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.cell .title {
  flex: 0 1 auto;
  min-height: 0;
  font-weight: 600;
  line-height: 1.22;
  overflow: hidden;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}
.cell .title.ph { opacity: 0.36; font-weight: 500; }

/* Görev hücresi */
.leaf {
  background: var(--card);
  border: 1.5px solid hsl(var(--h) 38% 84%);
  color: var(--ink);
}
.leaf:hover { border-color: hsl(var(--h) 45% 62%); }
.leaf.empty { background: hsl(var(--h) 55% 98.6%); border-style: dashed; }
.leaf.empty::after {
  content: "+";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 34px;
  font-weight: 300;
  color: hsl(var(--h) 35% 62%);
  opacity: 0;
  transition: opacity 0.12s;
}
.leaf.empty:hover::after { opacity: 0.8; }
.leaf.complete { background: hsl(var(--h) 45% 95.5%); }
.leaf.complete .title { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1.5px; }

.leaf .todos { list-style: none; margin: 0; padding: 0; min-height: 0; overflow: hidden; }
.leaf .todos li {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 2px 0;
  font-size: 13px;
  line-height: 1.25;
}
.leaf .todos li span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leaf .todos li.on span { color: var(--muted); text-decoration: line-through; }
.leaf .todos li.more { color: var(--muted); font-size: 12px; padding-left: 20px; }
.cb {
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 1px;
  border: 1.5px solid var(--box-border);
  border-radius: 4px;
  background: var(--field) center / 10px no-repeat;
}
li.on .cb, .cbbtn.on {
  border-color: var(--ok);
  background-color: var(--ok);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.3l2.4 2.4 4.6-5' fill='none' stroke='%23fff' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.leaf .note {
  min-height: 0;
  font-size: 13px;
  line-height: 1.3;
  color: var(--muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  white-space: pre-line;
}
.leaf .foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: hsl(var(--h) 55% 93%);
  color: hsl(var(--h) 45% 28%);
}
.chip svg { flex: none; }
.chip.ok { background: #dcfce7; color: #166534; }
.chip.late { background: #fee2e2; color: #991b1b; }
.chip.today { background: var(--amber-soft); color: #92400e; }
.leaf.late { border-color: #f87171; }
.cbbtn {
  flex: none;
  margin-left: auto;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1.5px solid var(--box-border);
  border-radius: 7px;
  background: var(--field) center / 14px no-repeat;
}
.cbbtn:hover { border-color: var(--ok); }
.donebtn {
  flex: none;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 0;
  border-radius: 8px;
  background: #b45309;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.donebtn:hover { background: #92400e; }

/* Zamanı gelen tekrarlı iş: flash */
@keyframes flash {
  0%, 100% { background-color: var(--card); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
  50% { background-color: #fde68a; box-shadow: 0 0 0 9px rgba(245, 158, 11, 0.42); }
}
.leaf.due {
  border: 2px solid var(--amber);
  animation: flash 1.15s ease-in-out infinite;
  z-index: 2;
}
@keyframes dotpulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.22); }
}
@media (prefers-reduced-motion: reduce) {
  .leaf.due { animation: none; background: var(--amber-soft); }
  .duedot { animation: none !important; }
  #world.anim { transition: none; }
}

/* Alt başlık hücresi */
.sub {
  align-items: center;
  justify-content: center;
  text-align: center;
  background: hsl(var(--h) 62% 88%);
  border: 2px solid hsl(var(--h) 45% 60%);
  color: hsl(var(--h) 50% 18%);
}
.sub:hover { background: hsl(var(--h) 62% 85%); }
.sub.mirror { background: hsl(var(--h) 60% 84%); }
.sub .num {
  position: absolute;
  top: 8px;
  left: 9px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: hsl(var(--h) 45% 42%);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.duedot {
  position: absolute;
  top: 8px;
  right: 9px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #b45309;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  animation: dotpulse 1.15s ease-in-out infinite;
}
.prog {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}
.prog .bar { flex: 1; height: 6px; border-radius: 999px; background: hsl(var(--h) 40% 74%); overflow: hidden; }
.prog .bar i { display: block; height: 100%; border-radius: inherit; background: hsl(var(--h) 50% 34%); }

/* Ana hedef hücresi */
.goal {
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #1d2330;
  border: 2px solid #1d2330;
  color: #fff;
}
.goal .tag {
  position: absolute;
  top: 9px;
  left: 0;
  right: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #a5b4fc;
}
.goal .prog .bar { background: #3a4257; }
.goal .prog .bar i { background: #a5b4fc; }

/* Hücre içi düğmeler yalnızca seçili hücrede tıklanabilir; diğerlerinde tık hücreyi seçer. */
.cell:not(.selected) [data-action] { pointer-events: none; }

/* Seçim */
.cell.selected { outline: 4px solid var(--accent); outline-offset: 1px; z-index: 3; }
.cell.linked { outline: 3px dashed var(--accent); outline-offset: 1px; }

/* Hücre içinde yazma */
.cell textarea.inline {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: inherit;
  outline: none;
  resize: none;
  background: var(--field);
  color: var(--ink);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.22;
  text-align: inherit;
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
}

/* ---- Yakınlığa göre ayrıntı (LOD) ---- */
#viewport[data-lod="far"] .leaf .title { font-size: 28px; -webkit-line-clamp: 4; line-clamp: 4; }
#viewport[data-lod="far"] .sub .title { font-size: 31px; }
#viewport[data-lod="far"] .goal .title { font-size: 33px; }
#viewport[data-lod="far"] .leaf .todos,
#viewport[data-lod="far"] .leaf .note,
#viewport[data-lod="far"] .chip { display: none; }
#viewport[data-lod="far"] .chip.late,
#viewport[data-lod="far"] .chip.today { display: inline-flex; font-size: 20px; padding: 4px 10px; }
#viewport[data-lod="far"] .chip.late svg,
#viewport[data-lod="far"] .chip.today svg { display: none; }
#viewport[data-lod="far"] .leaf.due .title { -webkit-line-clamp: 2; line-clamp: 2; }
#viewport[data-lod="far"] .donebtn { flex: 1; justify-content: center; padding: 8px 10px; font-size: 24px; border-radius: 10px; }
#viewport[data-lod="far"] .cbbtn { width: 34px; height: 34px; border-width: 2.5px; border-radius: 10px; background-size: 22px; }
#viewport[data-lod="far"] .num, #viewport[data-lod="far"] .duedot { min-width: 34px; height: 34px; font-size: 20px; }
#viewport[data-lod="far"] .prog { font-size: 18px; }
#viewport[data-lod="far"] .prog .bar { height: 9px; }
#viewport[data-lod="far"] .goal .tag { font-size: 16px; }

#viewport[data-lod="mid"] .leaf .title { font-size: 21px; }
#viewport[data-lod="mid"] .sub .title { font-size: 25px; }
#viewport[data-lod="mid"] .goal .title { font-size: 27px; }
#viewport[data-lod="mid"] .leaf .todos, #viewport[data-lod="mid"] .leaf .note { display: none; }
#viewport[data-lod="mid"] .chip { font-size: 14px; }
#viewport[data-lod="mid"] .donebtn { font-size: 16px; }

#viewport[data-lod="near"] .leaf .title { font-size: 17px; -webkit-line-clamp: 2; line-clamp: 2; }
#viewport[data-lod="near"] .sub .title { font-size: 23px; }
#viewport[data-lod="near"] .goal .title { font-size: 25px; }

/* ---- Öncelik ve etiket ---- */
.pr.p1, .p1 > .pr { --pc: #dc2626; }
.pr.p2, .p2 > .pr { --pc: #c2610c; }
.pr.p3, .p3 > .pr { --pc: #2563eb; }
.leaf.p1 { border-left: 5px solid #dc2626; }
.leaf.p2 { border-left: 5px solid #d97706; }
.leaf.p3 { border-left: 5px solid #2563eb; }
.chip.pr { background: color-mix(in srgb, var(--pc) 13%, var(--surface)); color: var(--pc); }
.pf { display: inline-flex; margin-right: 4px; vertical-align: -2px; color: var(--pc); }
.chip.tag { background: hsl(var(--th) 70% 92%); color: hsl(var(--th) 60% 26%); }
.tags { flex-shrink: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.leaf.dim { opacity: 0.22; }
.leaf.dim.selected { opacity: 0.6; }
.trow.p1 { border-left: 4px solid #dc2626; padding-left: 7px; }
.trow.p2 { border-left: 4px solid #d97706; padding-left: 7px; }
.trow.p3 { border-left: 4px solid #2563eb; padding-left: 7px; }

/* ---- Sayısal hedef: hücredeki sayaç satırı ---- */
.count {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: hsl(var(--h) 45% 26%);
}
.count .bar { flex: 1; min-width: 20px; height: 6px; border-radius: 999px; background: hsl(var(--h) 40% 88%); overflow: hidden; }
.count .bar i { display: block; height: 100%; border-radius: inherit; background: hsl(var(--h) 50% 40%); }
/* Üst satır: ad başta (uzunsa kısalır), sayı ve +1 sonda. Alt satır: tam genişlikte çubuk. */
.count { flex-wrap: wrap; row-gap: 4px; }
.count .cl { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count .cl::first-letter { text-transform: uppercase; }
.count .cn { flex: none; margin-left: auto; white-space: nowrap; }
.count .bar { order: 3; flex: 0 0 100%; }
.incbtn {
  flex: none;
  padding: 1px 7px;
  border: 1.5px solid hsl(var(--h) 40% 72%);
  border-radius: 7px;
  background: var(--field);
  color: hsl(var(--h) 50% 28%);
  font-size: 12px;
  font-weight: 700;
}
.incbtn:hover { background: hsl(var(--h) 55% 92%); }
#viewport[data-lod="far"] .count span, #viewport[data-lod="far"] .incbtn { display: none; }
#viewport[data-lod="far"] .count .bar { height: 10px; }
#viewport[data-lod="mid"] .count { font-size: 15px; }
#viewport[data-lod="mid"] .incbtn { font-size: 14px; }

/* ---- Seri, süre, günlük (hücre içi) ---- */
.chip.streak { background: #ffedd5; color: #9a3412; }
.chip.tmr svg { flex: none; }
.chip.tmr.run { background: #dcfce7; color: #166534; }
.tclock { font-variant-numeric: tabular-nums; }
.leaf .logline {
  flex-shrink: 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.leaf .logline b { color: hsl(var(--h) 45% 30%); font-weight: 700; }
/* Ana hedef ve alt başlıktaki bağlantılar (odak modunda) */
.sub .links, .goal .links { justify-content: center; max-width: 92%; }
.sub.top .links { justify-content: flex-start; max-width: none; }
.goal .lnk { background: #343c52; color: #dbe2ff; }
.goal .lnk:hover { background: #454e69; }

/* ---- Yer değiştirme modu ---- */
#viewport.swapping, #viewport.swapping .cell { cursor: crosshair; }
.cell.swap-src { outline: 4px dashed #d97706; outline-offset: 1px; z-index: 3; }

/* ---- 3×3 odak modu: tek kutu ekranı doldurur, hücreler ayrıntılı ---- */
#world.focus { grid-template-columns: max-content; }
#world.focus .block {
  grid-template-columns: repeat(3, var(--cw, 230px));
  grid-auto-rows: var(--ch, 180px);
  gap: 10px;
  padding: 14px;
}
@keyframes pop {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: none; }
}
#world.pop .block { animation: pop 0.22s ease-out; }
#world.focus .cell { padding: 14px 16px; gap: 8px; border-radius: 15px; }
#world.focus .leaf .title { font-size: 19px; -webkit-line-clamp: 2; line-clamp: 2; flex-shrink: 0; }
#world.focus .leaf .todos, #world.focus .leaf .foot, #world.focus .leaf .meta { flex-shrink: 0; }
#world.focus .sub .title { font-size: 30px; }
#world.focus .goal .title { font-size: 32px; }
#world.focus .leaf .todos { display: block; }
#world.focus .leaf .todos li { font-size: 14.5px; padding: 3px 0; gap: 8px; }
#world.focus .cb { width: 16px; height: 16px; margin-top: 1px; }
#world.focus .leaf .note { font-size: 14px; line-height: 1.4; }
#world.focus .chip { display: inline-flex; font-size: 13px; }
#world.focus .count { font-size: 13.5px; }
#world.focus .count span { display: inline; }
#world.focus .count .bar { height: 7px; }
#world.focus .incbtn { display: inline-block; font-size: 13px; padding: 2px 9px; }
#world.focus .donebtn { flex: none; padding: 5px 12px; font-size: 14px; border-radius: 8px; }
#world.focus .cbbtn { width: 24px; height: 24px; border-width: 1.5px; border-radius: 7px; background-size: 15px; }
#world.focus .num, #world.focus .duedot { min-width: 28px; height: 28px; font-size: 15px; }
#world.focus .prog { font-size: 14px; left: 18px; right: 18px; bottom: 14px; }
#world.focus .prog .bar { height: 7px; }
#world.focus .goal .tag { font-size: 13px; top: 14px; }
/* Ortalanmış ana hedef ve alt başlık: içerik (başlık, not, bağlantılar, bugün özeti) alttaki ilerleme çubuğunun
   ve üstteki etiketin üstüne binmesin. "safe center": içerik sığmazsa üstten kırpılmak yerine üstten başlar. */
#world.focus .goal { justify-content: safe center; padding-top: 34px; padding-bottom: 38px; }
#world.focus .sub:not(.top) { justify-content: safe center; padding-bottom: 38px; }
/* Yer daralınca: öğeler yarım kesilmez, kutunun yüksekliğine göre bütün olarak gizlenir. Sıra: önce bağlantılar
   (not tek satıra iner), sonra not, en son bugün özeti. Başlık her zaman görünür. */
#world.focus .goal, #world.focus .sub:not(.top) { container-type: size; }
#world.focus .goal > *, #world.focus .sub:not(.top) > * { flex-shrink: 0; }
/* Küçük ekranda (kutu yüksekliği --ch az) ana hedef başlığı üç satırıyla kutuya sığsın */
#world.focus .goal .title { font-size: clamp(20px, calc(var(--ch, 180px) * 0.15), 32px); }
/* Eşikler kutunun iç (padding düşülmüş) yüksekliğidir. Ana hedef: başlık en çok 3 satır (~117px) + özet (~28px). */
@container (max-height: 230px) {
  .goal > .links { display: none; }
  .goal > .hnote { -webkit-line-clamp: 1; line-clamp: 1; }
}
@container (max-height: 170px) { .goal > .hnote { display: none; } }
@container (max-height: 135px) { .goal > .gsum { display: none; } }
/* Alt başlık: başlık en çok 2 satır (~73px) + not (1 satır ~20px) + bağlantılar (~24px) */
@container (max-height: 160px) { .sub > .hnote { -webkit-line-clamp: 1; line-clamp: 1; } }
@container (max-height: 130px) { .sub > .links { display: none; } }
@container (max-height: 100px) { .sub > .hnote { display: none; } }
/* Odak modunda görev hücresi: başlık ve alt satır sabit, aradaki içerik (tüm liste + not) kaydırılır */
.scroll { scrollbar-width: thin; scrollbar-color: rgba(100, 110, 130, 0.45) transparent; overscroll-behavior: contain; }
#world.focus .leaf .body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  margin-right: -8px;
  padding-right: 8px;
}
#world.focus .leaf .body .todos { overflow: visible; }
#world.focus .leaf .body .todos li span { white-space: normal; overflow-wrap: anywhere; }
#world.focus .leaf .body .note { display: block; overflow: visible; flex-shrink: 0; }

/* Ana hedef 3×3 sayfası: alt başlık kutusunda bugünün işleri */
/* .top: başlık üstte tek satır, altında liste ya da not (listesi olan kutu; "Sola" ayarında hepsi).
   .top.ctr: aynı düzen, başlık ortalı ("Ortala" ayarında listesi olan kutu). */
#world.focus .sub.top {
  justify-content: flex-start;
  align-items: stretch;
  text-align: left;
  padding: 12px 14px 40px;
  gap: 8px;
}
#world.focus .sub.top .title {
  flex-shrink: 0;
  padding: 1px 34px 0 30px;
  font-size: 22px;
  -webkit-line-clamp: 1;
  line-clamp: 1;
}
#world.focus .sub.top .hnote { max-width: none; padding: 0 6px 0 30px; }
#world.focus .sub.top:not(.has-today) .links { padding-left: 30px; }
#world.focus .sub.top:not(.has-today) .title { -webkit-line-clamp: 2; line-clamp: 2; } /* liste yok: uzun başlığa iki satır */
#world.focus .sub.top.ctr .title { padding: 1px 34px 0; text-align: center; }
#world.focus .sub.top.ctr .links { justify-content: center; }
.tlist { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.trow {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 3px 5px 3px 10px;
  border-radius: 9px;
  background: hsl(var(--h) 70% 96% / 0.9);
  color: hsl(var(--h) 50% 16%);
  font-size: 14.5px;
  font-weight: 600;
}
.trow .tt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .tw {
  flex: none;
  padding: 1px 8px;
  border-radius: 999px;
  background: hsl(var(--h) 45% 85%);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.trow.k-due { background: var(--amber-soft); box-shadow: inset 0 0 0 1.5px var(--amber); color: #78350f; }
.trow.k-due .tw { background: #b45309; color: #fff; }
.trow.k-late { background: #fee2e2; box-shadow: inset 0 0 0 1.5px #f87171; color: #7f1d1d; }
.trow.k-late .tw { background: var(--danger); color: #fff; }
.trow.k-today .tw { background: #fde68a; color: #78350f; }
.tcheck {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: var(--field);
  color: var(--ok);
  box-shadow: inset 0 0 0 1.5px var(--box-border);
}
.tcheck:hover { background: var(--ok); color: #fff; box-shadow: none; }
.tprog { flex: none; padding-right: 5px; font-size: 12px; opacity: 0.75; font-variant-numeric: tabular-nums; }
.gsum { font-size: 14px; font-weight: 600; color: #c7d2fe; }

/* Görev hücresindeki bağlantı etiketleri (odak modunda) */
.links { flex-shrink: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.lnk {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 3px 10px 3px 7px;
  border-radius: 999px;
  background: hsl(var(--h) 55% 93%);
  color: hsl(var(--h) 50% 24%);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  -webkit-user-drag: none;
}
.lnk:hover { background: hsl(var(--h) 55% 86%); text-decoration: underline; }
.lnk svg { flex: none; }
.lnk span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lnk.k-video svg, .lk.k-video { color: #dc2626; }

.leaf .meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hnote {
  max-width: 90%;
  font-size: 15px;
  line-height: 1.35;
  opacity: 0.78;
  white-space: pre-line;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}
@media (prefers-reduced-motion: reduce) {
  #world.pop .block { animation: none; }
}

/* ================= Yüzen arayüz ================= */

.float {
  position: fixed;
  z-index: 10;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

#topbar {
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  max-width: calc(100vw - 24px);
}
.brand { display: grid; place-items: center; padding: 0 4px 0 2px; }
.tb-sep { width: 1px; align-self: stretch; margin: 4px 3px; background: var(--line); }
.tb-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
}
.tb-btn:hover, .tb-btn.open { background: var(--hover); }
.tb-btn.icon { width: 34px; padding: 0; justify-content: center; }
.tb-btn.board { font-weight: 600; max-width: 340px; }
#boardName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-btn:disabled { opacity: 0.32; cursor: default; background: transparent; }
.tb-btn.alert { color: #b45309; }
.tb-btn.back { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.tb-btn.back:hover { background: var(--accent-soft-hover); }
.badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #b45309;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 340px;
  max-height: min(70vh, 560px);
  overflow: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.pop-title { padding: 6px 8px 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.pop-empty { padding: 10px 8px 12px; color: var(--muted); }
.pop-note { padding: 8px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); margin-top: 4px; }

.row { display: flex; align-items: center; gap: 2px; border-radius: 9px; }
.row:hover { background: var(--hover); }
.row.active { background: var(--accent-soft); }
.row .pick {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 0;
  background: none;
  text-align: left;
  border-radius: 9px;
}
.row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.row .sub2 { display: block; font-weight: 400; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .pc { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row input.rename { flex: 1; min-width: 0; margin: 4px; padding: 5px 8px; border: 1.5px solid var(--accent); border-radius: 7px; outline: none; }
.iconbtn {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
}
.iconbtn:hover { background: var(--hover-strong); color: var(--ink); }
.iconbtn.danger:hover { background: #fee2e2; color: var(--danger); }
.iconbtn.go { color: #fff; background: #b45309; }
.iconbtn.go:hover { background: #92400e; color: #fff; }
.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 8px;
  border: 0;
  border-radius: 9px;
  background: none;
  text-align: left;
}
.menu-item:hover { background: var(--hover); }
.menu-item.add { color: var(--accent); font-weight: 600; }
.menu-item .state { margin-left: auto; font-size: 12px; color: var(--muted); }

/* ---- Bugün çekmecesi ---- */
#topbar { z-index: 12; }
#today {
  top: 64px;
  left: 12px;
  bottom: 56px;
  width: 340px;
  max-width: calc(100vw - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#today .crumb { color: var(--ink); font-size: 14px; }
#today .crumb small { font-weight: 500; color: var(--muted); font-size: 13px; }
.t-sum { display: flex; flex-direction: column; gap: 6px; padding: 12px 16px 10px; border-bottom: 1px solid var(--line); }
.t-sum .bigbar i { background: var(--ok); }
.t-scope { padding: 10px 12px 0; }
.t-scope select {
  width: 100%;
  padding: 7px 8px;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  background: var(--field);
  font-weight: 600;
  outline: none;
  cursor: pointer;
}
.t-scope select:focus { border-color: var(--accent); }
.t-filter { display: flex; align-items: center; gap: 8px; margin: 10px 12px 0; padding: 6px 8px 6px 10px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600; }
.t-filter span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-filter svg { flex: none; width: 15px; height: 15px; }
.t-body { flex: 1; overflow: auto; padding: 6px; }
.t-empty { padding: 14px 10px; color: var(--muted); line-height: 1.5; }
.row .pick .dot { flex: none; align-self: flex-start; width: 10px; height: 10px; margin-top: 5px; border-radius: 3px; background: hsl(var(--h, 235) 50% 50%); }
.row .tx { display: block; overflow: hidden; text-overflow: ellipsis; }
.row.done .tx { color: var(--muted); text-decoration: line-through; }
.row .tm { flex: none; font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; padding-right: 8px; }

/* ---- Ayrıntı paneli ---- */
#panel {
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: 360px;
  max-width: calc(100vw - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.p-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 10px 10px 16px;
  border-bottom: 1px solid var(--line);
}
.crumb { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.crumb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb .dot { flex: none; width: 12px; height: 12px; border-radius: 4px; background: hsl(var(--h, 235) 50% 50%); }
.crumb .dot.goal { background: #1d2330; }
.p-body { flex: 1; overflow: auto; padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld > label, .lbl { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.fld textarea, .fld input[type="text"], .fld input[type="number"], .fld input[type="time"], .fld input[type="date"] {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  background: var(--field);
  outline: none;
}
.fld textarea { resize: vertical; min-height: 40px; line-height: 1.35; }
.fld textarea.title-in { font-size: 16px; font-weight: 600; }
.fld textarea:focus, .fld input:focus { border-color: var(--accent); }
.check-row { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.check-row input, .todo-list input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--ok); cursor: pointer; }

.todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.todo-list li { display: flex; align-items: center; gap: 6px; }
.todo-list input[type="text"] { flex: 1; min-width: 0; padding: 5px 7px; border-color: transparent; background: transparent; }
.todo-list input[type="text"]:hover { border-color: var(--line); }
.todo-list li.on input[type="text"] { color: var(--muted); text-decoration: line-through; }

/* Paneldeki seri istatistiği: sayılar ve son 14 dönemin noktaları */
.stats { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.stats b { font-size: 17px; color: var(--ink); margin-right: 3px; }
.status.due .stats, .status.due .stats b { color: #78350f; }
.dots { display: flex; gap: 4px; }
.dots i { width: 12px; height: 12px; border-radius: 4px; background: var(--track); }
.dots i.on { background: var(--ok); }
.status.due .dots i { background: #fcd9a0; }
.status.due .dots i.on { background: var(--ok); }

/* Süre / zamanlayıcı */
#pTimer { display: flex; flex-direction: column; gap: 8px; }
#pTimer input[type="number"] { width: 72px; }
#pTimer .clock { min-width: 96px; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
#pTimer .clock.run { color: var(--ok); }

/* Liste maddelerini sürükleyerek sıralama */
.todo-list .grip { flex: none; display: grid; place-items: center; width: 18px; height: 28px; color: var(--box-border); cursor: grab; }
.todo-list .grip:hover { color: var(--ink); }
.todo-list li.dragging { opacity: 0.4; }
.todo-list li.drop-before { box-shadow: 0 -2px 0 var(--accent); }
.todo-list li.drop-after { box-shadow: 0 2px 0 var(--accent); }

.counter-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.counter-list li[data-id] { display: flex; flex-direction: column; gap: 6px; padding: 9px; border: 1.5px solid var(--line); border-radius: 11px; background: var(--soft); }
.counter-list .numgoal { gap: 5px; }
.counter-list .iconbtn { margin-left: -2px; }
.counter-list .cstat { display: flex; flex-direction: column; gap: 6px; }
.counter-list .per { font-size: 12.5px; color: var(--muted); }
.counter-list .per input { width: 62px; }
.add-counter { align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; color: var(--accent); }
.count.more { font-size: 12px; font-weight: 600; color: var(--muted); }
.opts.numgoal { flex-wrap: nowrap; }
.opts.numgoal input[type="number"] { width: 66px; flex: none; }
.opts.numgoal input[type="text"] { flex: 1; min-width: 0; }
.opts .tip { margin-left: 4px; }
.seg button.pr.on { color: var(--pc); }
.tag-edit { display: flex; flex-wrap: wrap; gap: 5px; }
.tag-edit:empty { display: none; }
.tag-edit .chip { padding: 0; font-size: 13px; overflow: visible; }
.tag-edit .chip button { border: 0; background: none; color: inherit; font: inherit; font-weight: 600; padding: 3px 3px 3px 9px; }
.tag-edit .chip button:last-child { padding: 3px 8px 3px 2px; opacity: 0.6; }
.tag-edit .chip button:hover { opacity: 1; text-decoration: underline; }
.btn.sm.on { border-color: var(--accent); background: var(--accent-soft); }
.btn.sm.pr { color: var(--pc); }
.menu-item.on { background: var(--accent-soft); }
.lang-select { padding: 5px 8px; border: 1.5px solid var(--line); border-radius: 9px; background: var(--field); font-size: 13px; font-weight: 600; }
.tb-btn.active { background: var(--accent-soft); color: var(--accent); }

.link-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.link-list li { display: flex; align-items: center; gap: 4px; }
.link-list a.lk { color: var(--accent); text-decoration: none; }
.link-list a.lk svg { width: 17px; height: 17px; }
.link-list input[type="text"] { flex: 1; min-width: 0; padding: 5px 7px; border-color: transparent; background: transparent; }
.link-list input[type="text"]:hover { border-color: var(--line); }

.seg { display: flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--hover); }
.seg button { flex: 1; padding: 6px 2px; border: 0; border-radius: 8px; background: none; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--field); color: var(--ink); box-shadow: 0 1px 3px rgba(20, 25, 40, 0.15); }
.opts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.opts input[type="number"] { width: 68px; }
.opts input[type="time"] { width: 112px; }
.opts input[type="date"] { width: 100%; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.tip.late { color: var(--danger); font-weight: 600; }
.tip.pace { margin-top: 4px; color: var(--ink); font-weight: 600; }
.iconbtn.go.late, .iconbtn.go.late:hover { background: var(--danger); }
.days { display: flex; gap: 4px; width: 100%; }
.days button { flex: 1; padding: 6px 0; border: 1.5px solid var(--line); border-radius: 8px; background: var(--field); font-size: 12px; font-weight: 600; color: var(--muted); }
.days button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.days button.gap { margin-left: 6px; } /* hafta sonu, hafta içinden biraz ayrık */

/* Tekrar planı: günler, gün içi kontrol saatleri, haftalık şerit */
.rplan { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--soft); }
.rrow { display: flex; flex-direction: column; gap: 6px; }
.rlbl { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.rbody { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.rbody.opts { flex-direction: row; margin-top: 0; }
.rchips { display: flex; flex-wrap: wrap; gap: 4px; }
.rchip { padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: none; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.rchip:hover { border-color: var(--line-strong); color: var(--ink); }
.rchip.on { border-color: transparent; background: var(--accent-soft); color: var(--accent); }
.times { display: flex; flex-wrap: wrap; gap: 5px; }
.tchip { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 9px; background: var(--field); overflow: hidden; }
.tchip:focus-within { border-color: var(--accent); }
.tchip input[type="time"] { width: 92px; padding: 4px 4px 4px 8px; border: 0; background: none; font-variant-numeric: tabular-nums; font-weight: 600; }
.tchip input[type="time"]:focus { outline: none; box-shadow: none; }
.tchip button { display: grid; place-items: center; width: 24px; height: 28px; padding: 0; border: 0; background: none; color: var(--muted); }
.tchip button:hover { color: var(--danger); }
.tchip button svg { width: 12px; height: 12px; }
.tadd { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border: 1.5px dashed var(--line-strong); border-radius: 9px; background: none; font-size: 12.5px; font-weight: 600; color: var(--accent); }
.tadd:hover { border-style: solid; background: var(--accent-soft); }
.tadd svg { width: 13px; height: 13px; }
.wstrip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding-top: 2px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 6px 0 7px; border-radius: 9px; }
.wd span { font-size: 10.5px; font-weight: 700; letter-spacing: 0.03em; color: var(--muted); }
.wd.now { background: var(--hover); }
.wd.now span { color: var(--ink); }
.wdots { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 10px; }
.wdots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.wdots b { width: 10px; height: 2px; margin-top: 4px; border-radius: 2px; background: var(--line-strong); }
.wd:not(.on) span { opacity: 0.55; }
.rplan > .tip { margin-top: -4px; }
/* Geçici (dönemlik) plan: paneldeki not ve hücredeki rozet */
.wnote { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; padding: 10px 10px 10px 12px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: 12px; background: var(--accent-soft); font-size: 12.5px; line-height: 1.45; color: var(--ink); }
.wnote > svg { flex: none; margin-top: 2px; color: var(--accent); }
.wnote span { flex: 1; }
.wnote .btn { flex: none; }
.chip.wplan { color: var(--accent); }
/* Hücrede bugünkü kontrol sayısı ("1/3") */
.chip.checks { font-variant-numeric: tabular-nums; }
.chip.checks.ok { color: var(--ok); }

.status { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; background: var(--hover); }
.status.due { background: var(--amber-soft); border: 1.5px solid var(--amber); }
.status b { font-size: 15px; }
.status small { color: var(--muted); font-size: 12px; }
.status.due small { color: #78350f; }

.hues { display: flex; flex-wrap: wrap; gap: 8px; }
.hues button { width: 28px; height: 28px; padding: 0; border: 2px solid var(--surface); border-radius: 9px; background: hsl(var(--h) 60% 62%); box-shadow: 0 0 0 1px var(--line); }
.hues button.on { box-shadow: 0 0 0 2.5px var(--ink); }

.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.task-list button { width: 100%; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 0; border-radius: 8px; background: none; text-align: left; }
.task-list button:hover { background: var(--hover); }
.task-list .n { flex: none; width: 18px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.task-list .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-list .t.ph { color: var(--muted); font-style: italic; }
.task-list .m { flex: none; font-size: 12px; color: var(--muted); }

.bigbar { height: 8px; border-radius: 999px; background: var(--track); overflow: hidden; }
.bigbar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.tip { font-size: 12.5px; line-height: 1.45; color: var(--muted); }

.btn {
  padding: 8px 14px;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  background: var(--field);
  font-weight: 600;
}
.btn:hover { background: var(--hover); }
.btn.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.btn.primary:hover { background: #4338ca; }
.btn.danger { border-color: var(--danger); background: var(--danger); color: #fff; }
.btn.amber { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-color: #b45309; background: #b45309; color: #fff; }
.btn.amber:hover { background: #92400e; }
.btn.link { align-self: flex-start; padding: 4px 0; border: 0; background: none; color: var(--danger); font-weight: 600; }
.btn.link:hover { background: none; text-decoration: underline; }

/* ---- Zoom çubuğu, ipucu, toast, diyalog ---- */
#zoombar { left: 12px; bottom: 12px; display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 12px; }
#zoombar button {
  min-width: 32px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  border: 0;
  border-radius: 8px;
  background: none;
  font-size: 16px;
  font-weight: 600;
}
#zoombar button:hover { background: var(--hover); }
#zoomLabel { min-width: 52px !important; font-size: 13px !important; font-variant-numeric: tabular-nums; }

#hint {
  position: fixed;
  left: 200px;
  bottom: 19px;
  z-index: 5;
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
  white-space: nowrap;
}
@media (max-width: 1100px) { #hint { display: none; } }

/* Yedek hatırlatması */
#backupBar {
  position: fixed;
  left: 50%;
  bottom: 64px;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 9px 10px 9px 16px;
  border: 1.5px solid var(--amber);
  border-radius: 12px;
  background: var(--amber-soft);
  color: #78350f;
  font-weight: 600;
  box-shadow: var(--shadow);
}
#backupBar .btn { flex: none; }

/* ---- Pasif hedef: tuval soluk, üstte durum şeridi, menüde rozet ---- */
#pausedBar {
  position: fixed;
  left: 50%;
  top: 70px;
  transform: translateX(-50%);
  z-index: 19;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 7px 8px 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  color: var(--muted);
  box-shadow: var(--shadow);
}
#pausedBar b { color: var(--ink); }
#pausedBar .btn { flex: none; border-radius: 999px; }
#pausedBar .pdot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 3px var(--hover); }
#world.paused .block { filter: saturate(0.25); opacity: 0.72; transition: filter 0.3s, opacity 0.3s; }
#world.paused .cell.selected { opacity: 1; }
#boardBtn.paused #boardName::after { content: var(--t-paused, 'Paused'); /* metin dile göre: app.js applyI18n */ margin-left: 8px; padding: 1px 7px; border-radius: 999px; background: var(--hover-strong); font-size: 11px; font-weight: 700; letter-spacing: 0.02em; color: var(--muted); vertical-align: 1px; }
.pbadge { flex: none; padding: 1px 7px; border-radius: 999px; background: var(--hover-strong); font-size: 11px; font-weight: 700; color: var(--muted); }
#boardMenu .row.paused .nm { color: var(--muted); }
@media print { #pausedBar { display: none !important; } }

#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 30;
  padding: 10px 16px;
  border-radius: 10px;
  background: #1d2330;
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow);
}

/* ---- Sağ tık menüsü ---- */
.ctxmenu {
  position: fixed;
  z-index: 40;
  width: 262px;
  max-height: calc(100vh - 16px);
  overflow: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.ctxmenu .pop-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctxmenu .menu-item { padding: 7px 8px; }
.ctxmenu .menu-item svg { flex: none; width: 16px; height: 16px; color: var(--muted); }
.ctxmenu .menu-item > span:first-of-type { flex: 1; min-width: 0; }
.menu-item:disabled { opacity: 0.4; cursor: default; background: none; }
.menu-item.danger, .menu-item.danger svg { color: var(--danger); }
.ctx-sep { height: 1px; margin: 4px 6px; background: var(--line); }
.ctx-row { display: flex; flex-direction: column; gap: 6px; padding: 6px 8px 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.ctx-btns { display: flex; flex-wrap: wrap; gap: 4px; }
.ctx-btns .btn { color: var(--ink); }
.ctx-row .hues { gap: 6px; }
.ctx-row .hues button { width: 23px; height: 23px; border-radius: 7px; }

dialog#linkDlg {
  width: min(440px, calc(100vw - 32px));
  padding: 20px;
  border: 0;
  border-radius: 16px;
  box-shadow: var(--shadow);
  color: var(--ink);
}
dialog#linkDlg::backdrop { background: rgba(20, 25, 40, 0.35); }
#linkDlg h3 { margin: 0 0 14px; font-size: 16px; }
.dlg-fld { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; font-size: 12px; font-weight: 700; color: var(--muted); }
.dlg-fld input {
  padding: 9px 10px;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  outline: none;
  font-size: 14px;
  font-weight: 400;
  color: var(--ink);
}
.dlg-fld input:focus { border-color: var(--accent); }
.err { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--danger); }

dialog#dlg {
  width: min(420px, calc(100vw - 32px));
  padding: 20px;
  border: 0;
  border-radius: 16px;
  box-shadow: var(--shadow);
  color: var(--ink);
}
dialog#dlg::backdrop { background: rgba(20, 25, 40, 0.35); }
#dlgMsg { margin: 0 0 18px; font-size: 15px; line-height: 1.45; white-space: pre-line; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---- Hesap / abonelik penceresi ve ⋯ menüsündeki hesap bölümü (yalnızca bulut açıkken) ---- */
dialog#cloudDlg {
  width: min(440px, calc(100vw - 32px));
  padding: 22px;
  border: 0;
  border-radius: 16px;
  box-shadow: var(--shadow);
  color: var(--ink);
}
dialog#cloudDlg::backdrop { background: rgba(20, 25, 40, 0.35); }
#cloudBox h3 { margin: 0 0 10px; font-size: 17px; }
#cloudBox p { margin: 0 0 14px; font-size: 14px; line-height: 1.5; }
#cloudBox .cloud-credits { padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); font-weight: 600; }
#cloudBox .cloud-who { font-size: 12px; color: var(--muted); }
#cloudBox a.btn { text-decoration: none; display: inline-flex; align-items: center; }
#cloudBox .dlg-actions { flex-wrap: wrap; }
.cloud-acct { display: flex; align-items: center; gap: 8px; padding: 8px; }
.cloud-acct > svg { flex: none; color: var(--muted); }
.cloud-acct b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.cloud-line { padding: 0 8px 6px 32px; font-size: 12px; color: var(--muted); }

/* ================= Koyu tema: renkli kutular ================= */
:root[data-theme="dark"] .block { background: hsl(var(--h) 28% 13%); border-color: hsl(var(--h) 28% 26%); }
:root[data-theme="dark"] .block.center { background: var(--surface); border-color: var(--line-strong); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45); }
:root[data-theme="dark"] .leaf { border-color: hsl(var(--h) 22% 30%); }
:root[data-theme="dark"] .leaf:hover { border-color: hsl(var(--h) 40% 52%); }
:root[data-theme="dark"] .leaf.empty { background: hsl(var(--h) 24% 11%); }
:root[data-theme="dark"] .leaf.empty::after { color: hsl(var(--h) 35% 55%); }
:root[data-theme="dark"] .leaf.complete { background: hsl(var(--h) 22% 17%); }
:root[data-theme="dark"] .leaf.late { border-color: #b94a4a; }
:root[data-theme="dark"] .leaf.due { border-color: var(--amber); }
:root[data-theme="dark"] .leaf.p1 { border-left-color: #ef4444; }
:root[data-theme="dark"] .leaf.p2 { border-left-color: #f59e0b; }
:root[data-theme="dark"] .leaf.p3 { border-left-color: #60a5fa; }
@keyframes flash-dark {
  0%, 100% { background-color: #202634; box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
  50% { background-color: #6b4e0a; box-shadow: 0 0 0 9px rgba(245, 158, 11, 0.4); }
}
:root[data-theme="dark"] .leaf.due { animation-name: flash-dark; }

:root[data-theme="dark"] .chip { background: hsl(var(--h) 32% 24%); color: hsl(var(--h) 65% 84%); }
:root[data-theme="dark"] .chip.ok, :root[data-theme="dark"] .chip.tmr.run { background: #14532d; color: #bbf7d0; }
:root[data-theme="dark"] .chip.late { background: #5a1e1e; color: #fecaca; }
:root[data-theme="dark"] .chip.today { background: #4a3a10; color: #fde68a; }
:root[data-theme="dark"] .chip.streak { background: #4a2a12; color: #fdba74; }
:root[data-theme="dark"] .chip.tag { background: hsl(var(--th) 38% 24%); color: hsl(var(--th) 75% 84%); }
:root[data-theme="dark"] .pr.p1, :root[data-theme="dark"] .p1 > .pr { --pc: #f87171; }
:root[data-theme="dark"] .pr.p2, :root[data-theme="dark"] .p2 > .pr { --pc: #fb923c; }
:root[data-theme="dark"] .pr.p3, :root[data-theme="dark"] .p3 > .pr { --pc: #60a5fa; }
:root[data-theme="dark"] .chip.pr { background: color-mix(in srgb, var(--pc) 22%, var(--surface)); }

:root[data-theme="dark"] .sub { background: hsl(var(--h) 34% 25%); border-color: hsl(var(--h) 40% 44%); color: hsl(var(--h) 70% 92%); }
:root[data-theme="dark"] .sub:hover { background: hsl(var(--h) 34% 29%); }
:root[data-theme="dark"] .sub.mirror { background: hsl(var(--h) 36% 29%); }
:root[data-theme="dark"] .sub .num { background: hsl(var(--h) 50% 62%); color: #10131a; }
:root[data-theme="dark"] .prog .bar { background: hsl(var(--h) 28% 38%); }
:root[data-theme="dark"] .prog .bar i { background: hsl(var(--h) 70% 76%); }
/* Ana hedef: koyu zeminde öne çıksın diye vurgu renginde */
:root[data-theme="dark"] .goal { background: #4338ca; border-color: #6366f1; color: #fff; }
:root[data-theme="dark"] .goal .tag { color: #c7d2fe; }
:root[data-theme="dark"] .goal .prog .bar { background: rgba(255, 255, 255, 0.25); }
:root[data-theme="dark"] .goal .prog .bar i { background: #fff; }
:root[data-theme="dark"] .goal .lnk { background: rgba(255, 255, 255, 0.16); color: #fff; }
:root[data-theme="dark"] .goal .lnk:hover { background: rgba(255, 255, 255, 0.26); }
:root[data-theme="dark"] .gsum { color: #e0e7ff; }

:root[data-theme="dark"] .count { color: hsl(var(--h) 65% 84%); }
:root[data-theme="dark"] .count .bar { background: hsl(var(--h) 26% 30%); }
:root[data-theme="dark"] .count .bar i { background: hsl(var(--h) 65% 66%); }
:root[data-theme="dark"] .incbtn { border-color: hsl(var(--h) 30% 44%); color: hsl(var(--h) 65% 84%); }
:root[data-theme="dark"] .incbtn:hover { background: hsl(var(--h) 30% 28%); }
:root[data-theme="dark"] .lnk { background: hsl(var(--h) 32% 24%); color: hsl(var(--h) 65% 86%); }
:root[data-theme="dark"] .lnk:hover { background: hsl(var(--h) 32% 31%); }
:root[data-theme="dark"] .lnk.k-video svg, :root[data-theme="dark"] .lk.k-video { color: #f87171; }
:root[data-theme="dark"] .leaf .logline b { color: hsl(var(--h) 65% 80%); }

:root[data-theme="dark"] .trow { background: hsl(var(--h) 28% 18% / 0.92); color: hsl(var(--h) 65% 90%); }
:root[data-theme="dark"] .trow .tw { background: hsl(var(--h) 34% 34%); }
:root[data-theme="dark"] .trow.k-due { background: #3a2e12; color: #fde68a; }
:root[data-theme="dark"] .trow.k-late { background: #4a1c1c; color: #fecaca; }
:root[data-theme="dark"] .trow.k-today .tw { background: #6b4e0a; color: #fde68a; }

/* Koyu zeminde koyu yazı kalan uyarı kutuları */
:root[data-theme="dark"] .status.due,
:root[data-theme="dark"] .status.due small,
:root[data-theme="dark"] .status.due .stats,
:root[data-theme="dark"] .status.due .stats b,
:root[data-theme="dark"] #backupBar { color: #fde68a; }
:root[data-theme="dark"] .status.due .dots i { background: #6b5a2a; }
:root[data-theme="dark"] .status.due .dots i.on { background: var(--ok); }
:root[data-theme="dark"] .iconbtn.danger:hover { background: #4a1c1c; }
:root[data-theme="dark"] .cell.swap-src { outline-color: #f59e0b; }
:root[data-theme="dark"] #toast { background: #343c52; }
:root[data-theme="dark"] .btn.primary { color: #10131a; }
:root[data-theme="dark"] .btn.primary:hover { background: #a5acfb; }
:root[data-theme="dark"] .brand svg rect:first-child { fill: #6366f1; }

/* Diyaloglar tema zeminini kullansın (tarayıcı varsayılanı beyazdır) */
dialog#dlg, dialog#linkDlg, dialog#cloudDlg { background: var(--surface); }
.dlg-fld input { background: var(--field); }

/* ================= Arama ================= */
#searchPop { width: 420px; padding: 8px; }
#searchInput {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--field);
  outline: none;
  font-size: 15px;
}
#searchInput:focus { border-color: var(--accent); }
#searchResults { margin-top: 6px; }
#searchResults .row.cur { background: var(--accent-soft); }
#searchResults .row .pick .dot.goal { background: var(--ink); }
#searchResults mark { background: #fde68a; color: #1d2330; border-radius: 3px; padding: 0 1px; }
:root[data-theme="dark"] #searchResults mark { background: #a16207; color: #fff; }
.search-count { padding: 4px 8px 2px; font-size: 12px; color: var(--muted); }

/* ================= Yazdırma / PDF =================
   Sayfa: A4 yatay. Ölçek ve boyutlar JS'te (beforeprint) hesaplanır. */
#printHead { display: none; }
@page { size: A4 landscape; margin: 8mm; }
@media print {
  html, body { height: auto; overflow: visible; background: #fff; }
  .float, #hint, #toast, #backupBar, .ctxmenu, dialog { display: none !important; }
  #printHead { display: block; height: 30px; margin: 0 0 10px; font: 600 16px/30px "Segoe UI", system-ui, sans-serif; color: #1d2330; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* !important: kutu stillerinin zemin kuralları (doku, ışık lekeleri) daha özgül; kâğıda basılmasın */
  #viewport { position: static; overflow: hidden; background: none !important; cursor: auto; }
  #world { position: static; }
  .cell.selected, .cell.linked, .cell.swap-src { outline: none; }
  .leaf.due { animation: none; background: #fef3c7; }
  .duedot { animation: none; }
  .leaf.dim { opacity: 1; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ================= Bugün bekleyen iş: yanıp sönme =================
   .due  — zamanı geldi (güçlü, hızlı)
   .soon — bugün yapılacak ama saati henüz gelmedi / günü geçmiş (yumuşak, yavaş)
   Görev kutularında ve (8 görevinden biri bekliyorsa) alt başlık kutularında kullanılır. */
@keyframes soon {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
  50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.34); }
}
@keyframes subflash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); filter: none; }
  50% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0.6); filter: brightness(1.08) saturate(1.25); }
}
.leaf.soon { border-color: var(--amber); animation: soon 2.2s ease-in-out infinite; z-index: 1; }
.sub.soon { border-color: var(--amber); animation: soon 2.2s ease-in-out infinite; z-index: 1; }
.sub.due { border-color: #d97706; animation: subflash 1.15s ease-in-out infinite; z-index: 2; }
@media (prefers-reduced-motion: reduce) {
  .leaf.soon, .sub.soon, .sub.due { animation: none; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.45); }
}
@media print {
  .leaf.soon, .sub.soon, .sub.due { animation: none; box-shadow: none; }
}

/* ================= Yanıp sönme: kutunun iç rengi =================
   Kenar yerine zemin rengi nabız gibi atar; böylece uzaktan da belli olur.
   --pulse-from / --pulse-to her kutu ve tema için ayrı verilir. */
@keyframes pulse-fill {
  0%, 100% { background-color: var(--pulse-from); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
  50% { background-color: var(--pulse-to); box-shadow: 0 0 0 var(--pulse-ring, 6px) rgba(245, 158, 11, var(--pulse-alpha, 0.3)); }
}
/* Görev kutusu — zamanı geldi (güçlü, hızlı) */
.leaf.due { --pulse-from: var(--card); --pulse-to: #fcd34d; --pulse-ring: 9px; --pulse-alpha: 0.45; animation: pulse-fill 1.15s ease-in-out infinite; }
/* Görev kutusu — bugün yapılacak (yumuşak, yavaş) */
.leaf.soon { --pulse-from: var(--card); --pulse-to: #fde9a6; animation: pulse-fill 2.2s ease-in-out infinite; }
/* Alt başlık kutusu: kendi renginden sarıya */
.sub.soon { --pulse-from: hsl(var(--h) 62% 88%); --pulse-to: #fde68a; animation: pulse-fill 2.2s ease-in-out infinite; }
.sub.due { --pulse-from: hsl(var(--h) 62% 88%); --pulse-to: #fbbf24; --pulse-ring: 10px; --pulse-alpha: 0.55; animation: pulse-fill 1.15s ease-in-out infinite; filter: none; }

:root[data-theme="dark"] .leaf.due { --pulse-to: #8a640c; animation-name: pulse-fill; }
:root[data-theme="dark"] .leaf.soon { --pulse-to: #4f3d10; }
:root[data-theme="dark"] .sub.soon { --pulse-from: hsl(var(--h) 34% 25%); --pulse-to: #7a5a0c; }
:root[data-theme="dark"] .sub.due { --pulse-from: hsl(var(--h) 34% 25%); --pulse-to: #b7791f; }

@media (prefers-reduced-motion: reduce) {
  .leaf.due, .leaf.soon, .sub.soon, .sub.due { animation: none; background-color: var(--pulse-to); }
}
@media print {
  .leaf.due, .leaf.soon, .sub.soon, .sub.due { animation: none; box-shadow: none; }
}

/* ---- Tekrarlı işte "Yapıldı" ve geri alma düğmeleri ---- */
/* Saati gelmeden yapıldı işaretleme: dolu yerine çerçeveli düğme */
.donebtn.early { background: var(--field); color: #b45309; box-shadow: inset 0 0 0 1.5px #d97706; }
.donebtn.early:hover { background: #b45309; color: #fff; }
:root[data-theme="dark"] .donebtn.early { color: #fbbf24; box-shadow: inset 0 0 0 1.5px #b7791f; }
/* Bugün yapıldı: tıklayınca geri alınır */
button.chip.undone { border: 0; cursor: pointer; margin-left: auto; flex: none; }
button.chip.undone svg { width: 12px; height: 12px; }
button.chip.undone:hover { background: #bbf7d0; text-decoration: underline; }
:root[data-theme="dark"] button.chip.undone:hover { background: #166534; }
#viewport[data-lod="far"] button.chip.undone { display: inline-flex; font-size: 20px; padding: 6px 12px; }
#viewport[data-lod="far"] button.chip.undone svg { width: 18px; height: 18px; }
.status .acts { display: flex; flex-wrap: wrap; gap: 6px; }

/* Geri al düğmeli bildirim */
#toast { display: flex; align-items: center; gap: 12px; }
#toast button { flex: none; padding: 4px 10px; border: 0; border-radius: 7px; background: rgba(255, 255, 255, 0.18); color: #fff; font-weight: 700; }
#toast button:hover { background: rgba(255, 255, 255, 0.32); }
/* Bugün listesinde saati gelmemiş işi şimdiden yapıldı sayma düğmesi */
.iconbtn.early { color: #b45309; box-shadow: inset 0 0 0 1.5px #d97706; }
.iconbtn.early:hover { background: #b45309; color: #fff; }
:root[data-theme="dark"] .iconbtn.early { color: #fbbf24; box-shadow: inset 0 0 0 1.5px #b7791f; }

/* ---- Boş kutucuk: "henüz yapılmadı, işaretlemek için tıkla" ----
   Yapılmamış işin düğmesinde onay işareti yerine boş kutu durur; işaretlenince yeşil "✓ Yapıldı" olur. */
.cbx { flex: none; display: inline-block; width: 1em; height: 1em; border: 0.14em solid currentColor; border-radius: 0.26em; vertical-align: -0.14em; }
.donebtn .cbx { margin-right: 1px; }
.status.today { background: var(--amber-soft); }
.status.today b { color: #92400e; }
:root[data-theme="dark"] .status.today b { color: #fde68a; }
/* Listelerdeki "şimdiden işaretle" düğmeleri de boş kutu gibi görünür; onay işareti üzerine gelince belirir */
.iconbtn.early svg, .tcheck svg { opacity: 0; transition: opacity 0.1s; }
.iconbtn.early:hover svg, .tcheck:hover svg { opacity: 1; }

/* ================= Sürükleyerek taşıma ================= */
#viewport.carrying, #viewport.carrying .cell { cursor: grabbing; }
.cell.carry-src { opacity: 0.38; outline: 3px dashed var(--muted); outline-offset: 1px; animation: none; }
/* Hedef: boşsa yeşil (doğrudan taşınır), doluysa turuncu (yer değiştir / üzerine taşı sorulur) */
.cell.drop-ok { outline: 5px solid var(--ok); outline-offset: 2px; z-index: 5; }
.cell.drop-full { outline: 5px solid var(--amber); outline-offset: 2px; z-index: 5; }
#carryGhost {
  --h: 235;
  position: fixed;
  z-index: 50;
  pointer-events: none;
  max-width: 260px;
  padding: 8px 13px;
  border: 2px solid hsl(var(--h) 50% 55%);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translate(14px, 14px) rotate(-2deg);
}

/* ================= Günlük ================= */
/* Görev kutusunun sağ üstündeki günlük düğmesi */
.jbtn {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 24px;
  padding: 0 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--box-border);
  font-size: 12px;
  font-weight: 700;
}
.jbtn:hover { background: var(--hover); color: var(--accent); }
.jbtn.has { color: var(--accent); background: var(--accent-soft); }
.jbtn svg { width: 15px; height: 15px; }
/* 9×9'da uzaktan bakarken kalabalık etmesin; yakında ve 3×3'te görünür */
#viewport[data-lod="far"] .jbtn, #viewport[data-lod="mid"] .jbtn { display: none; }
#world.focus .jbtn { display: inline-flex; }
#viewport[data-lod="near"] .leaf .title, #world.focus .leaf .title { padding-right: 34px; }

/* Paneldeki sekmeler */
.p-tabs { display: flex; gap: 2px; padding: 6px 12px 0; border-bottom: 1px solid var(--line); }
.p-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font-weight: 600;
}
.p-tabs button:hover { color: var(--ink); }
.p-tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.p-tabs b { padding: 0 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11px; }
.p-tabs svg { width: 15px; height: 15px; }

/* Günlük sekmesi */
.j-add { align-self: flex-end; }
.j-filters select {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  background: var(--field);
  outline: none;
}
.j-dates { flex-wrap: nowrap; }
.j-dates input[type="date"] { flex: 1; min-width: 0; width: auto; }
.j-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.j-tags:empty { display: none; }
.j-tags .chip { border: 0; cursor: pointer; font-size: 12.5px; }
.j-tags .chip b { opacity: 0.6; font-weight: 600; }
.j-tags .chip.on { box-shadow: 0 0 0 2px var(--accent); }
.j-count { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); }
.j-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.j-list li[data-id] { padding: 9px 6px 10px 12px; border: 1.5px solid var(--line); border-radius: 11px; background: var(--soft); }
.j-head { display: flex; align-items: center; gap: 8px; min-height: 26px; }
.j-when { flex: none; font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.j-src { flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: var(--accent); font-size: 12px; font-weight: 600; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.j-src:hover { text-decoration: underline; }
.j-head .iconbtn { margin-left: auto; width: 24px; height: 24px; }
.j-text { padding-right: 6px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.jtag { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; }
.jtag:hover { text-decoration: underline; }

/* =====================================================================================
   KUTU STİLLERİ  (⋯ menüsü → Kutu stili)
   Tema (açık / koyu) ile birlikte çalışır: html öğesinde data-style + data-theme bulunur.
   minimal (varsayılan) · glass · porcelain · washi · paper · velvet · obsidian · classic
   Ortak dil: ana hedef en güçlü vurgu, alt başlıklar orta, görevler sakin. Kategori rengi (--h) düşük
   doygunlukta ve ölçülü kullanılır (şerit, ince çizgi, hafif ton); gökkuşağı dolgusu yok. İnce (1px) çizgi,
   katmanlı yumuşak gölge. Eski kimlikler (neu, vivid, neon) app.js'te yeni karşılıklarına çevrilir.
   Seçici notu: alt başlık kuralları ".sub:is(*, .mirror, :hover)" ile yazılır; koyu temanın .sub.mirror ve
   .sub:hover kurallarıyla aynı özgüllüğe çıkıp onları ezer (stil kuralları dosyada daha sonra gelir).
   ===================================================================================== */

/* Temaya göre değişen iki ton: stiller renkli yazı ve yumuşak zeminlerde bunları kullanır */
:root { --tone-ink: 26%; --tone-soft: 90%; }
:root[data-theme="dark"] { --tone-ink: 86%; --tone-soft: 26%; }

/* Yanıp sönme artık zemin rengini değil, zeminin ÜSTÜNE binen bir renk katmanını (iç gölge) oynatır;
   böylece saydam ya da geçişli zemini olan stillerde de aynı şekilde görünür. */
@keyframes pulse-fill {
  0%, 100% { box-shadow: inset 0 0 0 999px transparent, 0 0 0 0 rgba(245, 158, 11, 0); }
  50% { box-shadow: inset 0 0 0 999px var(--pulse-to), 0 0 0 var(--pulse-ring, 6px) rgba(245, 158, 11, var(--pulse-alpha, 0.3)); }
}
@media (prefers-reduced-motion: reduce) {
  .leaf.due, .leaf.soon, .sub.soon, .sub.due { animation: none; box-shadow: inset 0 0 0 999px var(--pulse-to); }
}

:root { --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif; }
/* İnce tipografi: bütün stillerde */
:root[data-style] .cell .title { letter-spacing: -0.006em; }
:root[data-style] .sub .title { letter-spacing: -0.012em; }
:root[data-style] .goal .title { letter-spacing: -0.016em; }
/* Hiyerarşi: ana hedef > alt başlık > görev. Görev başlıkları bir kademe ince (klasik stil hariç). */
:root[data-style]:not([data-style="classic"]) .leaf .title { font-weight: 500; }

/* ---------- Klasik: özgün pastel görünüm, ölçülü "suluboya" tonlarıyla ----------
   Dış kutular çok hafif tonlu, alt başlıklar yumuşak pastel, çizgiler ince ve aynı renkte. */
:root[data-style="classic"] .block { border-width: 1px; border-color: hsl(var(--h) 30% 86%); background: hsl(var(--h) 40% 97.5%); }
:root[data-style="classic"] .leaf { border-width: 1px; border-color: hsl(var(--h) 26% 88%); }
:root[data-style="classic"] .sub:is(*, .mirror, :hover) { background: hsl(var(--h) 46% 91%); border: 1px solid hsl(var(--h) 32% 80%); color: hsl(var(--h) 40% 20%); }
:root[data-style="classic"] .sub:hover { filter: brightness(1.015); }
:root[data-style="classic"] .sub .num { background: hsl(var(--h) 30% 40%); }
:root[data-style="classic"] .sub .prog .bar { background: hsl(var(--h) 26% 82%); }
:root[data-style="classic"] .sub .prog .bar i { background: hsl(var(--h) 34% 38%); }
:root[data-style="classic"][data-theme="dark"] .block { border-color: hsl(var(--h) 20% 22%); background: hsl(var(--h) 18% 12%); }
:root[data-style="classic"][data-theme="dark"] .leaf { border-color: hsl(var(--h) 16% 24%); }
:root[data-style="classic"][data-theme="dark"] .sub:is(*, .mirror, :hover) { background: hsl(var(--h) 24% 22%); border-color: hsl(var(--h) 24% 34%); color: hsl(var(--h) 40% 90%); }
:root[data-style="classic"][data-theme="dark"] .sub .num { background: hsl(var(--h) 36% 66%); color: #10131a; }
:root[data-style="classic"][data-theme="dark"] .sub .prog .bar { background: hsl(var(--h) 18% 32%); }
:root[data-style="classic"][data-theme="dark"] .sub .prog .bar i { background: hsl(var(--h) 45% 74%); }

/* ---------- 1. Liquid Glass: yumuşak ışıklı zemin, buzlu kartlar, koyu cam ana hedef ---------- */
:root[data-style="glass"] {
  --gl-edge: rgba(255, 255, 255, 0.74);
  --gl-card: rgba(255, 255, 255, 0.64);
  --gl-card-2: rgba(255, 255, 255, 0.42);
  --gl-ui: rgba(255, 255, 255, 0.72);
}
:root[data-style="glass"][data-theme="dark"] {
  --gl-edge: rgba(255, 255, 255, 0.1);
  --gl-card: rgba(255, 255, 255, 0.06);
  --gl-card-2: rgba(255, 255, 255, 0.028);
  --gl-ui: rgba(22, 26, 38, 0.68);
}
:root[data-style="glass"] #viewport {
  background-color: #e7ebf3;
  background-image:
    radial-gradient(60% 55% at 12% 8%, hsl(222 70% 90% / 0.95), transparent 70%),
    radial-gradient(55% 50% at 88% 12%, hsl(266 50% 92% / 0.9), transparent 70%),
    radial-gradient(60% 55% at 72% 96%, hsl(28 65% 92% / 0.85), transparent 70%),
    radial-gradient(50% 50% at 6% 94%, hsl(176 40% 90% / 0.75), transparent 70%);
  background-size: 100% 100% !important;
  background-position: 0 0 !important;
  background-repeat: no-repeat;
}
:root[data-style="glass"][data-theme="dark"] #viewport {
  background-color: #0b0e16;
  background-image:
    radial-gradient(60% 55% at 12% 8%, hsl(228 45% 18% / 0.8), transparent 70%),
    radial-gradient(55% 50% at 88% 12%, hsl(272 32% 16% / 0.7), transparent 70%),
    radial-gradient(60% 55% at 72% 96%, hsl(200 40% 13% / 0.6), transparent 70%);
}
:root[data-style="glass"] .block {
  background: linear-gradient(155deg, hsl(var(--h) 45% 80% / 0.22), hsl(var(--h) 40% 75% / 0.08));
  border: 1px solid var(--gl-edge);
  box-shadow: inset 0 1px 0 var(--gl-edge), 0 1px 2px rgba(25, 35, 70, 0.05), 0 22px 48px -22px rgba(25, 35, 70, 0.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  backdrop-filter: blur(24px) saturate(1.4);
}
:root[data-style="glass"] .block.center { background: linear-gradient(155deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.3)); border-color: var(--gl-edge); }
:root[data-style="glass"][data-theme="dark"] .block {
  background: linear-gradient(155deg, hsl(var(--h) 35% 55% / 0.1), hsl(var(--h) 30% 50% / 0.035));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 24px 50px -24px rgba(0, 0, 0, 0.75);
}
:root[data-style="glass"][data-theme="dark"] .block.center { background: rgba(255, 255, 255, 0.05); }
:root[data-style="glass"] .leaf {
  background: linear-gradient(170deg, var(--gl-card), var(--gl-card-2));
  border: 1px solid var(--gl-edge);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65), 0 1px 2px rgba(25, 35, 70, 0.06);
}
:root[data-style="glass"][data-theme="dark"] .leaf { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05); }
:root[data-style="glass"] .leaf:hover { border-color: hsl(var(--h) 40% 62% / 0.75); }
:root[data-style="glass"] .leaf.empty { background: rgba(255, 255, 255, 0.16); border: 1px dashed var(--gl-edge); box-shadow: none; }
:root[data-style="glass"][data-theme="dark"] .leaf.empty { background: rgba(255, 255, 255, 0.015); }
:root[data-style="glass"] .leaf.complete { background: linear-gradient(170deg, hsl(var(--h) 40% 93% / 0.6), hsl(var(--h) 40% 88% / 0.32)); }
:root[data-style="glass"][data-theme="dark"] .leaf.complete { background: hsl(var(--h) 30% 50% / 0.1); }
:root[data-style="glass"] .sub:is(*, .mirror, :hover) {
  background: linear-gradient(160deg, hsl(var(--h) 50% 85% / 0.8), hsl(var(--h) 44% 77% / 0.55));
  border: 1px solid rgba(255, 255, 255, 0.72);
  color: hsl(var(--h) 40% 19%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), 0 12px 26px -14px hsl(var(--h) 40% 30% / 0.42);
}
:root[data-style="glass"][data-theme="dark"] .sub:is(*, .mirror, :hover) {
  background: linear-gradient(160deg, hsl(var(--h) 34% 42% / 0.42), hsl(var(--h) 30% 34% / 0.26));
  border-color: hsl(var(--h) 40% 75% / 0.16);
  color: hsl(var(--h) 40% 93%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 14px 28px -16px rgba(0, 0, 0, 0.7);
}
:root[data-style="glass"] .sub:hover { filter: brightness(1.025); }
:root[data-style="glass"] .sub .num { background: hsl(var(--h) 30% 28% / 0.82); }
:root[data-style="glass"][data-theme="dark"] .sub .num { background: hsl(var(--h) 40% 74%); color: #0d1018; }
:root[data-style="glass"] .sub .prog .bar { background: hsl(var(--h) 30% 40% / 0.16); }
:root[data-style="glass"] .sub .prog .bar i { background: hsl(var(--h) 38% 30% / 0.78); }
:root[data-style="glass"][data-theme="dark"] .sub .prog .bar { background: rgba(255, 255, 255, 0.12); }
:root[data-style="glass"][data-theme="dark"] .sub .prog .bar i { background: hsl(var(--h) 50% 80%); }
:root[data-style="glass"] .goal {
  background: linear-gradient(160deg, #2c3453, #151a2c);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f4f6ff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 26px 50px -20px rgba(15, 20, 45, 0.6);
}
:root[data-style="glass"][data-theme="dark"] .goal { background: linear-gradient(160deg, #39417a, #1f2448); border-color: rgba(255, 255, 255, 0.14); }
:root[data-style="glass"] .goal .tag { color: #aab6f2; }
:root[data-style="glass"] .float,
:root[data-style="glass"] .popover,
:root[data-style="glass"] .ctxmenu {
  background: var(--gl-ui);
  border-color: var(--gl-edge);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  backdrop-filter: blur(22px) saturate(1.5);
}

/* ---------- 2. Porselen: sıcak porselen beyazı, sır şeridi, kömür ve şampanya ---------- */
:root[data-style="porcelain"] {
  --pc-bg: #f1efea;
  --pc-block: #f8f6f1;
  --pc-card: #fffdf9;
  --pc-line: rgba(70, 55, 30, 0.09);
  --pc-ink: #2a2622;
  --pc-gold: #b59a62;
  --pc-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 1px 2px rgba(70, 55, 30, 0.05), 0 20px 44px -26px rgba(70, 55, 30, 0.32);
}
:root[data-style="porcelain"][data-theme="dark"] {
  --pc-bg: #121110;
  --pc-block: #191816;
  --pc-card: #1f1e1b;
  --pc-line: rgba(255, 240, 215, 0.07);
  --pc-ink: #ece6da;
  --pc-gold: #cdb27a;
  --pc-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 22px 46px -26px rgba(0, 0, 0, 0.75);
}
:root[data-style="porcelain"] #viewport { background-color: var(--pc-bg); background-image: none; }
:root[data-style="porcelain"] .block { background: var(--pc-block); border: 1px solid var(--pc-line); border-radius: 26px; box-shadow: var(--pc-shadow); }
:root[data-style="porcelain"] .block.center { background: var(--pc-card); border-color: var(--pc-line); }
:root[data-style="porcelain"] .leaf { background: var(--pc-card); border: 1px solid var(--pc-line); box-shadow: 0 1px 2px rgba(70, 55, 30, 0.05), 0 8px 18px -12px rgba(70, 55, 30, 0.18); }
:root[data-style="porcelain"][data-theme="dark"] .leaf { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
:root[data-style="porcelain"] .leaf:hover { border-color: hsl(var(--h) 30% 60% / 0.6); }
:root[data-style="porcelain"] .leaf.empty { background: transparent; border: 1px dashed var(--pc-line); box-shadow: none; }
:root[data-style="porcelain"] .leaf.complete { background: color-mix(in srgb, var(--pc-card) 88%, hsl(var(--h) 30% 70%)); }
:root[data-style="porcelain"] .sub:is(*, .mirror, :hover) {
  background: linear-gradient(hsl(var(--h) 34% 56%), hsl(var(--h) 34% 56%)) top / 100% 3px no-repeat, linear-gradient(180deg, hsl(var(--h) 40% 95%), var(--pc-card) 78%);
  border: 1px solid var(--pc-line);
  color: var(--pc-ink);
  box-shadow: 0 1px 2px rgba(70, 55, 30, 0.05), 0 12px 26px -16px rgba(70, 55, 30, 0.3);
}
:root[data-style="porcelain"][data-theme="dark"] .sub:is(*, .mirror, :hover) {
  background: linear-gradient(hsl(var(--h) 38% 62%), hsl(var(--h) 38% 62%)) top / 100% 3px no-repeat, linear-gradient(180deg, hsl(var(--h) 18% 19%), var(--pc-card) 80%);
  box-shadow: 0 12px 26px -16px rgba(0, 0, 0, 0.7);
}
:root[data-style="porcelain"] .sub:hover { filter: brightness(1.015); }
:root[data-style="porcelain"] .sub .num { background: transparent; color: hsl(var(--h) 32% 40%); box-shadow: inset 0 0 0 1px hsl(var(--h) 28% 70%); }
:root[data-style="porcelain"][data-theme="dark"] .sub .num { color: hsl(var(--h) 40% 74%); box-shadow: inset 0 0 0 1px hsl(var(--h) 22% 40%); }
:root[data-style="porcelain"] .sub .prog .bar { background: hsl(var(--h) 18% 88%); }
:root[data-style="porcelain"] .sub .prog .bar i { background: hsl(var(--h) 32% 50%); }
:root[data-style="porcelain"][data-theme="dark"] .sub .prog .bar { background: hsl(var(--h) 10% 26%); }
:root[data-style="porcelain"][data-theme="dark"] .sub .prog .bar i { background: hsl(var(--h) 38% 64%); }
:root[data-style="porcelain"] .goal {
  background: linear-gradient(165deg, #2f2b26, #1f1c18);
  border: 1px solid rgba(181, 154, 98, 0.35);
  color: #f5efe4;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 24px 46px -22px rgba(40, 30, 15, 0.6);
}
:root[data-style="porcelain"][data-theme="dark"] .goal { background: linear-gradient(165deg, #2a2621, #1b1916); }
:root[data-style="porcelain"] .goal .tag { color: var(--pc-gold); letter-spacing: 0.22em; }
:root[data-style="porcelain"] .goal .prog .bar { background: rgba(255, 255, 255, 0.12); }
:root[data-style="porcelain"] .goal .prog .bar i { background: var(--pc-gold); }
:root[data-style="porcelain"] .goal .lnk { background: rgba(255, 255, 255, 0.08); color: #efe6d2; }
:root[data-style="porcelain"] .gsum { color: #e2d6bb; }

/* ---------- 3. Washi: Japon kâğıdı dokusu, sumi mürekkebi, vermilyon mühür ---------- */
:root[data-style="washi"] {
  --wa-bg: #efe9de;
  --wa-block: #f6f1e7;
  --wa-card: #fbf8f1;
  --wa-line: rgba(45, 35, 25, 0.12);
  --wa-line-2: rgba(45, 35, 25, 0.28);
  --wa-ink: #26221d;
  --wa-shu: #b23a2a;
}
:root[data-style="washi"][data-theme="dark"] {
  --wa-bg: #14120e;
  --wa-block: #1b1814;
  --wa-card: #211e19;
  --wa-line: rgba(240, 225, 200, 0.09);
  --wa-line-2: rgba(240, 225, 200, 0.24);
  --wa-ink: #ece4d4;
  --wa-shu: #c4513b;
}
:root[data-style="washi"] #viewport {
  background-color: var(--wa-bg);
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20width%3D'260'%20height%3D'260'%3E%20%3Cfilter%20id%3D'g'%20x%3D'0'%20y%3D'0'%20width%3D'100%25'%20height%3D'100%25'%3E%3CfeTurbulence%20type%3D'fractalNoise'%20baseFrequency%3D'.9'%20numOctaves%3D'2'%20seed%3D'5'%20stitchTiles%3D'stitch'%2F%3E%3CfeColorMatrix%20type%3D'saturate'%20values%3D'0'%2F%3E%3C%2Ffilter%3E%20%3Cfilter%20id%3D'f'%20x%3D'0'%20y%3D'0'%20width%3D'100%25'%20height%3D'100%25'%3E%3CfeTurbulence%20type%3D'fractalNoise'%20baseFrequency%3D'.008%20.11'%20numOctaves%3D'3'%20seed%3D'9'%20stitchTiles%3D'stitch'%2F%3E%3CfeColorMatrix%20type%3D'saturate'%20values%3D'0'%2F%3E%3C%2Ffilter%3E%20%3Crect%20width%3D'100%25'%20height%3D'100%25'%20filter%3D'url(%23g)'%20opacity%3D'.055'%2F%3E%3Crect%20width%3D'100%25'%20height%3D'100%25'%20filter%3D'url(%23f)'%20opacity%3D'.05'%2F%3E%3C%2Fsvg%3E");
  background-size: 260px 260px !important;
  background-position: 0 0 !important;
}
:root[data-style="washi"] .block { background: var(--wa-block); border: 1px solid var(--wa-line); border-radius: 10px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 14px 30px -24px rgba(45, 35, 25, 0.38); }
:root[data-style="washi"][data-theme="dark"] .block { box-shadow: 0 16px 32px -24px rgba(0, 0, 0, 0.8); }
:root[data-style="washi"] .block.center { background: var(--wa-card); border-color: var(--wa-line); }
:root[data-style="washi"] .cell { border-radius: 6px; }
:root[data-style="washi"] .leaf { background: var(--wa-card); border: 1px solid var(--wa-line); color: var(--wa-ink); box-shadow: none; }
:root[data-style="washi"] .leaf:hover { border-color: var(--wa-line-2); }
:root[data-style="washi"] .leaf.empty { background: transparent; border: 1px dashed var(--wa-line); }
:root[data-style="washi"] .leaf.complete { background: color-mix(in srgb, var(--wa-card) 90%, hsl(var(--h) 25% 60%)); }
:root[data-style="washi"] .sub:is(*, .mirror, :hover) {
  background: linear-gradient(hsl(var(--h) 26% 46%), hsl(var(--h) 26% 46%)) left / 4px 100% no-repeat, var(--wa-card);
  border: 1px solid var(--wa-line);
  color: var(--wa-ink);
  box-shadow: none;
}
:root[data-style="washi"][data-theme="dark"] .sub:is(*, .mirror, :hover) {
  background: linear-gradient(hsl(var(--h) 30% 60%), hsl(var(--h) 30% 60%)) left / 4px 100% no-repeat, var(--wa-card);
}
:root[data-style="washi"] .sub:hover { border-color: var(--wa-line-2); }
:root[data-style="washi"] .sub .title,
:root[data-style="washi"] .goal .title { font-family: var(--serif); font-weight: 600; }
/* Serif harfler daha geniş: 3×3 sayfasında ana hedef başlığı üç satıra sığsın (Kâğıt stilinde de aynı) */
:root[data-style="washi"] #world.focus .goal .title,
:root[data-style="paper"] #world.focus .goal .title { font-size: clamp(18px, calc(var(--ch, 180px) * 0.135), 29px); }
:root[data-style="washi"] .sub .num { background: transparent; color: var(--wa-ink); box-shadow: inset 0 0 0 1px var(--wa-line-2); font-family: var(--serif); }
:root[data-style="washi"] .sub .prog .bar { background: var(--wa-line); }
:root[data-style="washi"] .sub .prog .bar i { background: hsl(var(--h) 26% 42%); }
:root[data-style="washi"][data-theme="dark"] .sub .prog .bar i { background: hsl(var(--h) 30% 62%); }
:root[data-style="washi"] .goal { background: #24201b; border: 1px solid #24201b; color: #f3ede1; box-shadow: 0 18px 36px -24px rgba(30, 20, 10, 0.6); }
:root[data-style="washi"] .goal .tag {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  padding: 2px 7px 1px;
  border-radius: 3px;
  background: var(--wa-shu);
  color: #fbf1e6;
  letter-spacing: 0.24em;
}
:root[data-style="washi"] .goal .prog .bar { background: rgba(255, 255, 255, 0.12); }
:root[data-style="washi"] .goal .prog .bar i { background: #d0644d; }
:root[data-style="washi"] .goal .lnk { background: rgba(255, 255, 255, 0.08); color: #efe6d6; }
:root[data-style="washi"] .gsum { color: #d9cdb8; }
/* Koyu temada ana hedef ters çevrilir: koyu zeminde kâğıt rengi, mürekkep yazı */
:root[data-style="washi"][data-theme="dark"] .goal { background: #eee6d6; border-color: #eee6d6; color: #221e19; box-shadow: 0 18px 36px -24px rgba(0, 0, 0, 0.8); }
:root[data-style="washi"][data-theme="dark"] .goal .prog .bar { background: rgba(0, 0, 0, 0.1); }
:root[data-style="washi"][data-theme="dark"] .goal .prog .bar i { background: var(--wa-shu); }
:root[data-style="washi"][data-theme="dark"] .goal .lnk { background: rgba(0, 0, 0, 0.06); color: #3a332a; }
:root[data-style="washi"][data-theme="dark"] .gsum { color: #5a4f40; }

/* ---------- 4. Kâğıt: noktalı defter sayfası, renkli karton, mürekkep lacivert ---------- */
:root[data-style="paper"] {
  --pa-bg: #f3efe6;
  --pa-dot: #d8d0bf;
  --pa-block: #f9f6ee;
  --pa-card: #fffdf8;
  --pa-line: #e5ddcb;
  --pa-ink: #1f2a44;
}
:root[data-style="paper"][data-theme="dark"] {
  --pa-bg: #171512;
  --pa-dot: #2c2822;
  --pa-block: #1d1b17;
  --pa-card: #23201b;
  --pa-line: #322d25;
  --pa-ink: #e8e0cf;
}
/* Noktalı sayfa: nokta ızgarası tuvalle birlikte kayar (boyutu ve konumu app.js ayarlar) */
:root[data-style="paper"] #viewport { background-color: var(--pa-bg); background-image: radial-gradient(var(--pa-dot) 1.1px, transparent 1.3px); }
:root[data-style="paper"] .block { background: var(--pa-block); border: 1px solid var(--pa-line); border-radius: 16px; box-shadow: 0 1px 1px rgba(80, 60, 30, 0.05), 0 16px 32px -22px rgba(80, 60, 30, 0.3); }
:root[data-style="paper"][data-theme="dark"] .block { box-shadow: 0 18px 36px -22px rgba(0, 0, 0, 0.7); }
:root[data-style="paper"] .block.center { background: var(--pa-card); border-color: var(--pa-line); }
:root[data-style="paper"] .cell { border-radius: 9px; }
:root[data-style="paper"] .leaf { background: var(--pa-card); border: 1px solid var(--pa-line); box-shadow: 0 1px 0 rgba(80, 60, 30, 0.05); }
:root[data-style="paper"] .leaf:hover { border-color: hsl(var(--h) 25% 62%); }
:root[data-style="paper"] .leaf.empty { background: transparent; border: 1px dashed var(--pa-line); box-shadow: none; }
:root[data-style="paper"] .leaf.complete { background: color-mix(in srgb, var(--pa-card) 90%, hsl(var(--h) 30% 65%)); }
:root[data-style="paper"] .sub:is(*, .mirror, :hover) {
  background: hsl(var(--h) 30% 91%);
  border: 1px solid hsl(var(--h) 22% 80%);
  color: var(--pa-ink);
  box-shadow: 0 1px 0 rgba(80, 60, 30, 0.06), 0 10px 22px -16px rgba(80, 60, 30, 0.35);
}
:root[data-style="paper"][data-theme="dark"] .sub:is(*, .mirror, :hover) {
  background: hsl(var(--h) 16% 19%);
  border-color: hsl(var(--h) 14% 29%);
  box-shadow: 0 10px 22px -16px rgba(0, 0, 0, 0.7);
}
:root[data-style="paper"] .sub:hover { filter: brightness(1.02); }
:root[data-style="paper"] .sub .title,
:root[data-style="paper"] .goal .title { font-family: var(--serif); font-weight: 600; }
:root[data-style="paper"] .sub .num { background: var(--pa-ink); color: var(--pa-card); font-family: var(--serif); }
:root[data-style="paper"] .sub .prog .bar { background: hsl(var(--h) 18% 82%); }
:root[data-style="paper"] .sub .prog .bar i { background: var(--pa-ink); }
:root[data-style="paper"][data-theme="dark"] .sub .prog .bar { background: hsl(var(--h) 10% 28%); }
:root[data-style="paper"] .goal { background: #1f2a44; border: 1px solid #1f2a44; color: #f8f4ea; box-shadow: 0 2px 0 rgba(20, 25, 40, 0.25), 0 22px 40px -22px rgba(20, 25, 40, 0.55); }
:root[data-style="paper"] .goal .tag { color: #cdb98d; letter-spacing: 0.22em; }
:root[data-style="paper"] .goal .prog .bar { background: rgba(255, 255, 255, 0.14); }
:root[data-style="paper"] .goal .prog .bar i { background: #cdb98d; }
:root[data-style="paper"] .goal .lnk { background: rgba(255, 255, 255, 0.1); color: #efe8d8; }
:root[data-style="paper"] .gsum { color: #e6dcc4; }
:root[data-style="paper"][data-theme="dark"] .goal { background: #ece4d2; border-color: #ece4d2; color: #1f2a44; box-shadow: 0 22px 40px -22px rgba(0, 0, 0, 0.75); }
:root[data-style="paper"][data-theme="dark"] .goal .tag { color: #8a6f3c; }
:root[data-style="paper"][data-theme="dark"] .goal .prog .bar { background: rgba(31, 42, 68, 0.12); }
:root[data-style="paper"][data-theme="dark"] .goal .prog .bar i { background: #1f2a44; }
:root[data-style="paper"][data-theme="dark"] .goal .lnk { background: rgba(31, 42, 68, 0.08); color: #1f2a44; }
:root[data-style="paper"][data-theme="dark"] .gsum { color: #3b4660; }

/* ---------- 5. Kadife: soluk ve derin mücevher tonları, şampanya ayrıntılar ---------- */
:root[data-style="velvet"] #viewport { background-color: #ecebf0; background-image: none; }
:root[data-style="velvet"][data-theme="dark"] #viewport { background-color: #0f0f14; }
:root[data-style="velvet"] .block { background: hsl(var(--h) 18% 95%); border: 1px solid hsl(var(--h) 16% 88%); box-shadow: 0 18px 40px -26px hsl(var(--h) 30% 25% / 0.45); }
:root[data-style="velvet"][data-theme="dark"] .block { background: hsl(var(--h) 14% 11%); border-color: hsl(var(--h) 14% 18%); box-shadow: 0 20px 44px -26px rgba(0, 0, 0, 0.75); }
:root[data-style="velvet"] .block.center { background: #f7f6f9; border-color: #e2e0e8; }
:root[data-style="velvet"][data-theme="dark"] .block.center { background: #16161c; border-color: #24242c; }
:root[data-style="velvet"] .leaf { background: #fff; border: 1px solid hsl(var(--h) 14% 88%); box-shadow: 0 1px 2px rgba(30, 25, 45, 0.05); }
:root[data-style="velvet"][data-theme="dark"] .leaf { background: #1b1b22; border-color: hsl(var(--h) 12% 22%); box-shadow: none; }
:root[data-style="velvet"] .leaf:hover { border-color: hsl(var(--h) 22% 62%); }
:root[data-style="velvet"] .leaf.empty { background: transparent; border: 1px dashed hsl(var(--h) 14% 82%); box-shadow: none; }
:root[data-style="velvet"][data-theme="dark"] .leaf.empty { border-color: hsl(var(--h) 12% 24%); }
:root[data-style="velvet"] .leaf.complete { background: hsl(var(--h) 20% 96%); }
:root[data-style="velvet"][data-theme="dark"] .leaf.complete { background: hsl(var(--h) 14% 15%); }
:root[data-style="velvet"] .sub:is(*, .mirror, :hover) {
  background: linear-gradient(165deg, hsl(var(--h) 30% 38%), hsl(var(--h) 34% 27%));
  border: 1px solid hsl(var(--h) 30% 25%);
  color: #f6f3ee;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 14px 28px -16px hsl(var(--h) 35% 18% / 0.6);
}
:root[data-style="velvet"][data-theme="dark"] .sub:is(*, .mirror, :hover) { border-color: hsl(var(--h) 25% 40% / 0.5); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 14px 28px -16px rgba(0, 0, 0, 0.7); }
:root[data-style="velvet"] .sub:hover { filter: brightness(1.06); }
:root[data-style="velvet"] .sub .num { background: rgba(255, 255, 255, 0.14); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22); }
:root[data-style="velvet"] .sub .prog .bar { background: rgba(255, 255, 255, 0.18); }
:root[data-style="velvet"] .sub .prog .bar i { background: #f1e3c2; }
:root[data-style="velvet"] .goal {
  background: linear-gradient(165deg, #23212f, #14131c);
  border: 1px solid rgba(212, 191, 142, 0.45);
  color: #f7f2e8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 26px 50px -22px rgba(20, 18, 30, 0.7);
}
:root[data-style="velvet"] .goal .tag { color: #d4bf8e; letter-spacing: 0.22em; }
:root[data-style="velvet"] .goal .prog .bar { background: rgba(255, 255, 255, 0.12); }
:root[data-style="velvet"] .goal .prog .bar i { background: #d4bf8e; }
:root[data-style="velvet"] .goal .lnk { background: rgba(255, 255, 255, 0.08); color: #efe6d0; }
:root[data-style="velvet"] .gsum { color: #e3d5b4; }

/* ---------- 6. Obsidyen: siyah alt başlıklar, ince kategori çizgisi, gece siyahı ana hedef ---------- */
:root[data-style="obsidian"] #viewport { background-color: #e7e7ea; background-image: none; }
:root[data-style="obsidian"][data-theme="dark"] #viewport {
  background-color: #0c0c0e; /* saf siyah değil: koyu zeminde yüzeyler kademeli açılır */
  background-image: radial-gradient(70% 50% at 50% 0%, rgba(255, 255, 255, 0.045), transparent 70%);
  background-size: 100% 100% !important;
  background-position: 0 0 !important;
  background-repeat: no-repeat;
}
:root[data-style="obsidian"] .block { background: #f6f6f7; border: 1px solid #dcdce0; border-radius: 20px; box-shadow: inset 0 1px 0 #fff, 0 20px 44px -28px rgba(10, 10, 15, 0.45); }
:root[data-style="obsidian"][data-theme="dark"] .block { background: #141417; border-color: #222226; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 22px 46px -26px rgba(0, 0, 0, 0.85); }
:root[data-style="obsidian"] .block.center { background: #fff; border-color: #d2d2d7; }
:root[data-style="obsidian"][data-theme="dark"] .block.center { background: #111114; border-color: #26262b; }
:root[data-style="obsidian"] .leaf { background: #fff; border: 1px solid #e3e3e7; box-shadow: 0 1px 2px rgba(10, 10, 15, 0.05); }
:root[data-style="obsidian"][data-theme="dark"] .leaf { background: #1b1b1f; border-color: #26262b; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04); }
:root[data-style="obsidian"] .leaf:hover { border-color: #9a9aa3; }
:root[data-style="obsidian"][data-theme="dark"] .leaf:hover { border-color: #4a4a52; }
:root[data-style="obsidian"] .leaf.empty { background: transparent; border: 1px dashed #d4d4d9; box-shadow: none; }
:root[data-style="obsidian"][data-theme="dark"] .leaf.empty { border-color: #26262b; }
:root[data-style="obsidian"] .leaf.complete { background: #f4f4f6; }
:root[data-style="obsidian"][data-theme="dark"] .leaf.complete { background: #121214; }
:root[data-style="obsidian"] .sub:is(*, .mirror, :hover) {
  background: linear-gradient(170deg, #26262b, #18181c);
  border: 1px solid #0f0f12;
  color: #f2f2f4;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 -2px 0 hsl(var(--h) 45% 62%), 0 16px 32px -18px rgba(0, 0, 0, 0.55);
}
:root[data-style="obsidian"][data-theme="dark"] .sub:is(*, .mirror, :hover) { border-color: #2a2a30; }
:root[data-style="obsidian"] .sub:hover { filter: brightness(1.12); }
:root[data-style="obsidian"] .sub .num { background: transparent; color: hsl(var(--h) 55% 74%); box-shadow: inset 0 0 0 1px hsl(var(--h) 40% 50% / 0.6); }
:root[data-style="obsidian"] .sub .prog .bar { background: rgba(255, 255, 255, 0.12); }
:root[data-style="obsidian"] .sub .prog .bar i { background: hsl(var(--h) 50% 70%); }
:root[data-style="obsidian"] .goal {
  background: radial-gradient(120% 90% at 50% 0%, #2b2b31, #0b0b0d 70%);
  border: 1px solid rgba(220, 220, 230, 0.18);
  color: #fafafa;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 30px 60px -24px rgba(0, 0, 0, 0.7);
}
:root[data-style="obsidian"] .goal .tag { color: #c9c9d1; letter-spacing: 0.26em; }
:root[data-style="obsidian"] .goal .prog .bar { background: rgba(255, 255, 255, 0.12); }
:root[data-style="obsidian"] .goal .prog .bar i { background: #e9e9ee; }
:root[data-style="obsidian"] .goal .lnk { background: rgba(255, 255, 255, 0.08); color: #e6e6ea; }
:root[data-style="obsidian"] .gsum { color: #cfcfd6; }

/* ---------- 7. Minimal: beyaz kâğıt, ince çizgi, kategori yalnızca alt çizgide ---------- */
:root[data-style="minimal"] #viewport { background-color: #f6f6f4; background-image: none; }
:root[data-style="minimal"][data-theme="dark"] #viewport { background-color: #0f1012; }
:root[data-style="minimal"] .block { background: transparent; border: 1px solid #e2e2de; border-radius: 16px; box-shadow: none; }
:root[data-style="minimal"][data-theme="dark"] .block { border-color: #24262a; }
:root[data-style="minimal"] .block.center { background: #fff; border-color: #d6d6d1; box-shadow: none; }
:root[data-style="minimal"][data-theme="dark"] .block.center { background: #141518; border-color: #2c2e33; }
:root[data-style="minimal"] .leaf { background: #fff; border: 1px solid #ececea; box-shadow: none; }
:root[data-style="minimal"][data-theme="dark"] .leaf { background: #141518; border-color: #222428; }
:root[data-style="minimal"] .leaf:hover { border-color: #b9b9b4; }
:root[data-style="minimal"][data-theme="dark"] .leaf:hover { border-color: #3a3d43; }
:root[data-style="minimal"] .leaf.empty { background: transparent; border: 1px dashed #e0e0dc; }
:root[data-style="minimal"][data-theme="dark"] .leaf.empty { border-color: #25272b; }
:root[data-style="minimal"] .leaf.complete { background: #fafaf9; }
:root[data-style="minimal"][data-theme="dark"] .leaf.complete { background: #121316; }
:root[data-style="minimal"] .sub:is(*, .mirror, :hover) { background: #fff; border: 1px solid #e6e6e2; color: #18181b; box-shadow: inset 0 -2px 0 hsl(var(--h) 38% 56%); }
:root[data-style="minimal"][data-theme="dark"] .sub:is(*, .mirror, :hover) { background: #141518; border-color: #26282c; color: #ededee; box-shadow: inset 0 -2px 0 hsl(var(--h) 40% 62%); }
:root[data-style="minimal"] .sub:hover { border-color: #cfcfca; }
:root[data-style="minimal"] .sub .num { background: transparent; color: hsl(var(--h) 38% 46%); font-weight: 700; }
:root[data-style="minimal"][data-theme="dark"] .sub .num { color: hsl(var(--h) 45% 66%); }
:root[data-style="minimal"] .prog .bar { height: 3px; }
:root[data-style="minimal"] .sub .prog .bar { background: #ececea; }
:root[data-style="minimal"] .sub .prog .bar i { background: #18181b; }
:root[data-style="minimal"][data-theme="dark"] .sub .prog .bar { background: #26282c; }
:root[data-style="minimal"][data-theme="dark"] .sub .prog .bar i { background: #ededee; }
:root[data-style="minimal"] .goal { background: #fff; border: 1.5px solid #18181b; color: #18181b; box-shadow: none; }
:root[data-style="minimal"][data-theme="dark"] .goal { background: #141518; border-color: #ededee; color: #ededee; }
:root[data-style="minimal"] .goal .tag { color: #8a8a86; }
:root[data-style="minimal"] .goal .prog .bar { background: #ececea; }
:root[data-style="minimal"] .goal .prog .bar i { background: #18181b; }
:root[data-style="minimal"][data-theme="dark"] .goal .prog .bar { background: #26282c; }
:root[data-style="minimal"][data-theme="dark"] .goal .prog .bar i { background: #ededee; }
:root[data-style="minimal"] .goal .lnk { background: #f2f2f0; color: #18181b; }
:root[data-style="minimal"][data-theme="dark"] .goal .lnk { background: #1d1f23; color: #ededee; }
:root[data-style="minimal"] .gsum { color: #6b6b67; }
:root[data-style="minimal"][data-theme="dark"] .gsum { color: #9b9b97; }

/* ---------- Tüm stillerde korunması gereken durum işaretleri ----------
   Stiller kenarlık rengini değiştirdiği için öncelik şeridi, gecikme ve bekleyen iş
   kenarlıkları burada yeniden uygulanır (en sonda, daha özgül seçiciyle). */
:root[data-style] .leaf.late { border-color: #f87171; }
:root[data-style] .leaf.due, :root[data-style] .leaf.soon, :root[data-style] .sub.soon { border-color: var(--amber); }
:root[data-style] .sub.due { border-color: #d97706; }
:root[data-style] .leaf.p1 { border-left: 5px solid #dc2626; }
:root[data-style] .leaf.p2 { border-left: 5px solid #d97706; }
:root[data-style] .leaf.p3 { border-left: 5px solid #2563eb; }
:root[data-style] .leaf.dim { opacity: 0.22; }

/* Stil seçici (⋯ menüsü) */
.style-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.style-grid .btn { display: flex; align-items: center; gap: 7px; padding: 6px 8px; text-align: left; color: var(--ink); }
.style-grid .sw { flex: none; width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--line-strong); }
.sw.s-glass { background: linear-gradient(135deg, hsl(222 60% 86%), hsl(266 42% 89%) 55%, hsl(28 60% 89%)); border-color: rgba(255, 255, 255, 0.9); box-shadow: 0 0 0 1px var(--line); }
.sw.s-porcelain { background: linear-gradient(#b59a62, #b59a62) top / 100% 3px no-repeat, #fbf9f4; border-color: #e3ddd0; }
.sw.s-washi { background: linear-gradient(#b23a2a, #b23a2a) center / 7px 7px no-repeat, #f4eee3; border-color: #d8cdb9; }
.sw.s-paper { background: radial-gradient(#cfc5b0 0.9px, transparent 1.1px) 0 0 / 5px 5px, #fbf8f1; border-color: #ddd4c2; }
.sw.s-velvet { background: linear-gradient(135deg, #4a3d6b, #2b2540); border-color: #d4bf8e; }
.sw.s-obsidian { background: radial-gradient(120% 90% at 50% 0%, #34343b, #0b0b0d 70%); border-color: #3a3a42; }
.sw.s-minimal { background: #fff; border: 1.5px solid #18181b; }
.sw.s-classic { background: #fff; border-color: #c3c8d2; }

/* ================= AI penceresi =================
   Ayarlar, yeni hedef sihirbazı, kart geliştirme, geçmiş ve bağlam aynı pencerede çizilir (js/ai-ui.js). */
dialog#aiDlg {
  width: min(940px, calc(100vw - 32px));
  height: min(820px, calc(100vh - 32px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  overflow: hidden;
}
dialog#aiDlg::backdrop { background: rgba(20, 25, 40, 0.42); }
#aiBox { display: flex; flex-direction: column; height: 100%; }
#aiBox button { cursor: pointer; }
#aiBox button:disabled { cursor: default; opacity: 0.5; }

.ai-head { flex: none; display: flex; align-items: center; gap: 14px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line); }
.ai-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.ai-title > div { min-width: 0; }
.ai-ico { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.ai-ico svg { width: 18px; height: 18px; }
.ai-head h2 { margin: 0; font-size: 16px; line-height: 1.25; }
.ai-crumbs { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-body { flex: 1; min-height: 0; overflow: auto; padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.ai-body > * { flex: none; }
.ai-foot { flex: none; display: flex; align-items: center; gap: 12px; padding: 12px 16px 12px 20px; border-top: 1px solid var(--line); background: var(--soft); }
.ai-foot > :first-child { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); }
.ai-btns { flex: none; display: flex; gap: 8px; }
.ai-err { color: var(--danger); font-weight: 600; font-size: 13px; }
.ai-foot .ai-err { color: var(--danger); }
.ai-ok { color: var(--ok); font-weight: 600; font-size: 13px; }
.ai-note { font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.ai-note a, .ai-lnk { color: var(--accent); font: inherit; font-weight: 600; text-decoration: none; padding: 0; border: 0; background: none; }
.ai-note a:hover, .ai-lnk:hover { text-decoration: underline; }
.ai-lead { margin: 0; font-size: 14.5px; line-height: 1.5; }
.ai-busy { display: flex; align-items: center; gap: 9px; color: var(--ink) !important; font-weight: 600; font-variant-numeric: tabular-nums; }
.ai-spin { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--track); border-top-color: var(--accent); animation: ai-spin 0.8s linear infinite; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
#aiBox.busy .ai-body { opacity: 0.6; pointer-events: none; }
#aiBox.busy .ai-body:has(.ai-stages) { opacity: 1; }

.ai-in {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--field);
  outline: none;
  line-height: 1.45;
}
textarea.ai-in { resize: vertical; min-height: 44px; }
.ai-in:focus { border-color: var(--accent); }
.ai-big { font-size: 15px; min-height: 150px; }
.ai-empty { margin: auto; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px; text-align: center; color: var(--muted); }
.ai-empty svg { width: 30px; height: 30px; color: var(--accent); }
.ai-empty b { font-size: 16px; color: var(--ink); }
.ai-empty p { margin: 0 0 8px; }

/* ---- Sekmeler ve adımlar ---- */
.ai-tabs { flex: none; display: flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--hover); }
.ai-tabs button { padding: 6px 14px; border: 0; border-radius: 8px; background: none; font-size: 13px; font-weight: 600; color: var(--muted); }
.ai-tabs button.on { background: var(--field); color: var(--ink); box-shadow: 0 1px 3px rgba(20, 25, 40, 0.15); }
.ai-tabs small { margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11px; }
.ai-steps { flex: none; display: flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.ai-steps span { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 5px; border-radius: 999px; }
.ai-steps i { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--hover-strong); font-style: normal; font-size: 11px; }
.ai-steps .on { background: var(--accent-soft); color: var(--accent); }
.ai-steps .on i { background: var(--accent); color: #fff; }
.ai-steps .done i { background: var(--ok); color: #fff; }

/* ---- Sorular ---- */
.ai-under { padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); line-height: 1.5; }
.ai-under b { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.ai-under p { margin: 4px 0 0; }
.ai-round { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.ai-q { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1.5px solid var(--line); border-radius: 14px; }
.ai-q-t { font-size: 14.5px; font-weight: 600; line-height: 1.4; }
.ai-q-t small { margin-left: 6px; font-size: 12px; font-weight: 400; color: var(--muted); }
.ai-q-why { margin-top: -4px; font-size: 12.5px; color: var(--muted); }
.ai-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-opt { position: relative; cursor: pointer; }
.ai-opt input { position: absolute; opacity: 0; pointer-events: none; }
.ai-opt span { display: block; padding: 7px 13px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--field); font-size: 13.5px; }
.ai-opt:hover span { border-color: var(--line-strong); background: var(--hover); }
.ai-opt input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.ai-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.ai-opt input[type="checkbox"] + span::before { content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 7px; border: 1.5px solid currentColor; border-radius: 3px; vertical-align: -1px; opacity: 0.55; }
.ai-opt input[type="checkbox"]:checked + span::before { background: currentColor; opacity: 1; }
.ai-other { font-size: 13.5px; padding: 7px 11px; }

/* ---- Plan oluşturma aşamaları ---- */
.ai-stages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ai-stages li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: var(--hover); font-weight: 600; }
.ai-stages li > span { flex: 1; min-width: 0; }
.ai-stages small { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.ai-stages i { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--track); }
.ai-stages .wait { color: var(--muted); }
.ai-stages .run i { border-top-color: var(--accent); animation: ai-spin 0.8s linear infinite; }
.ai-stages .done i { border-color: var(--ok); background: var(--ok); box-shadow: inset 0 0 0 3px var(--hover); }
.ai-stages .err i { border-color: var(--danger); background: var(--danger); }
.ai-stages .err small { color: var(--danger); }

/* ---- Plan önizleme ---- */
.ai-planhead { padding: 16px; border-radius: 14px; background: var(--accent-soft); text-align: center; }
.ai-goal { font-size: 19px; font-weight: 700; line-height: 1.3; }
.ai-goalnote { margin-top: 6px; color: var(--muted); white-space: pre-line; }
.ai-fold { border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.ai-fold summary { cursor: pointer; font-weight: 600; }
.ai-fold summary small { margin-left: 6px; font-weight: 400; color: var(--muted); }
.ai-fold p { margin: 8px 0 2px; line-height: 1.5; white-space: pre-line; }
.ai-fold dl { margin: 8px 0 0; }
.ai-fold dt { margin-top: 8px; font-weight: 600; }
.ai-fold dd { margin: 2px 0 0; color: var(--muted); }
.ai-subs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ai-sub { padding: 12px 14px; border: 1.5px solid hsl(var(--h) 55% 78%); border-radius: 14px; background: hsl(var(--h) 70% 97%); }
:root[data-theme="dark"] .ai-sub { border-color: hsl(var(--h) 28% 30%); background: hsl(var(--h) 28% 14%); }
.ai-sub header { display: flex; align-items: center; gap: 8px; }
.ai-sub header b { flex: 1; min-width: 0; font-size: 15px; color: hsl(var(--h) 60% var(--tone-ink, 26%)); }
.ai-sub p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.ai-sub p.ai-rhythm { display: inline-block; margin-top: 6px; padding: 1px 8px; border-radius: 999px; background: hsl(var(--h) 55% 90%); color: hsl(var(--h) 55% var(--tone-ink, 26%)); font-size: 12px; font-weight: 600; }
:root[data-theme="dark"] .ai-sub p.ai-rhythm { background: hsl(var(--h) 28% 22%); }
.ai-sub ol { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 5px; }
.ai-sub li span { font-weight: 600; margin-right: 6px; }
.ai-sub li em, .ai-prop-v em { display: block; font-style: normal; font-size: 12.5px; color: var(--muted); }
/* ---- Programı yeniden düzenle ---- */
.sch-opt { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; }
.sch-opt:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); background: var(--accent-soft); }
.sch-opt input { margin-top: 3px; accent-color: var(--accent); }
.sch-opt span { display: flex; flex-direction: column; gap: 2px; }
.sch-opt small { font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.sch-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sch-seg { min-width: 230px; }
.sch-sub { margin-top: 6px; }
.sch-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.sch-day { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 0 8px; border: 1.5px solid var(--line); border-radius: 11px; background: var(--field); color: var(--ink); }
.sch-day small { font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); }
.sch-day b { font-size: 16px; font-variant-numeric: tabular-nums; }
.sch-day.we small { color: color-mix(in srgb, var(--muted) 70%, var(--accent)); }
.sch-day.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.sch-day.on small { color: var(--accent); }
.sch-day:disabled { opacity: 0.35; cursor: not-allowed; }
[data-ai="sch-off"].sch-day.on { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--field)); color: var(--danger); }
[data-ai="sch-off"].sch-day.on small { color: var(--danger); }
[data-ai="sch-off"].sch-day.on b { text-decoration: line-through; text-decoration-thickness: 2px; }
.sch-hint { font-size: 12.5px; color: var(--muted); }
.sch-budget { margin-top: 6px; }
.sch-budget-box { display: flex; flex-direction: column; gap: 8px; padding: 0 2px; }
.sch-min { width: 84px; }
.sch-warn { padding: 10px 12px; border-radius: 10px; background: var(--amber-soft); color: var(--ink); }
.sch-msg { margin: 0; line-height: 1.55; }
.sch-list { display: flex; flex-direction: column; gap: 8px; }
.sch-change { display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; }
.sch-change.on { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.sch-change:not(.on) { opacity: 0.6; }
.sch-change input { margin-top: 3px; accent-color: var(--accent); }
.sch-change > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.sch-title { display: flex; align-items: center; gap: 7px; font-weight: 650; }
.sch-ref { flex: none; padding: 0 6px; border-radius: 6px; background: var(--hover-strong); font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }
.sch-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: 13px; }
.sch-l { min-width: 92px; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.sch-line s { color: var(--muted); text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.sch-arrow { color: var(--muted); }
.sch-line b { color: var(--accent); font-weight: 650; }
.sch-why { font-size: 12.5px; color: var(--muted); }
.ai-badge { display: inline-block; margin: 1px 4px 1px 0; padding: 1px 7px; border-radius: 999px; background: var(--hover-strong); font-size: 11.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }

/* ---- Kart geliştirme ---- */
.ai-target { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-left: 5px solid hsl(var(--h) 60% 55%); border-radius: 10px; background: var(--hover); }
.ai-target small { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.ai-target b { font-size: 16px; }
.ai-target span { font-size: 12.5px; color: var(--muted); }
.ai-target span:empty { display: none; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-chip { padding: 5px 11px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--field); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.ai-chip:hover { border-color: var(--accent); color: var(--accent); }
.ai-result { display: flex; flex-direction: column; gap: 12px; padding-top: 14px; border-top: 1px dashed var(--line-strong); }
.ai-msg { padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); line-height: 1.5; white-space: pre-line; }
.ai-props { display: flex; flex-direction: column; gap: 6px; }
.ai-prop { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; }
.ai-prop:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.ai-prop.learn:has(input:checked) { border-color: var(--amber); background: color-mix(in srgb, var(--amber-soft) 60%, transparent); }
.ai-prop > input { flex: none; width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--accent); cursor: pointer; }
.ai-prop > div { flex: 1; min-width: 0; }
.ai-prop-k { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.ai-prop-v { margin-top: 2px; line-height: 1.45; overflow-wrap: anywhere; }
.ai-prop-v s { color: var(--muted); }
.ai-prop-v ul { margin: 4px 0 0; padding-left: 18px; }
.ai-prop-v small { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); }
.ai-prop-v small.warn { color: #b45309; font-weight: 600; }
.ai-prop-v select { margin-top: 6px; padding: 5px 8px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--field); }
.ai-badges:empty { display: none; }

/* ---- Geçmiş ---- */
.ai-filter select, .ai-job select { padding: 7px 9px; border: 1.5px solid var(--line); border-radius: 9px; background: var(--field); max-width: 100%; }
.ai-log { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 14px; }
.ai-log header { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.ai-log header small { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ai-tag { padding: 1px 8px; border-radius: 999px; background: var(--hover-strong); font-size: 11.5px; font-weight: 600; color: var(--muted); }
.ai-tag.ok { background: #dcfce7; color: #166534; }
.ai-tag.err { background: #fee2e2; color: #991b1b; }
.ai-log-q, .ai-log-a, .ai-log-ap { line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.ai-log-q small, .ai-log-a small, .ai-log-ap small { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.ai-log details summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--accent); }
.ai-log pre { margin: 6px 0 0; max-height: 320px; overflow: auto; padding: 10px 12px; border-radius: 10px; background: var(--hover); font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- Bağlam ---- */
.ai-notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ai-notes:empty { display: none; }
.ai-notes li { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border-radius: 10px; background: var(--hover); }
.ai-notes li span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ai-notes li small { flex: none; font-size: 12px; color: var(--muted); }

/* ---- Ayarlar ---- */
.ai-sec { display: flex; flex-direction: column; gap: 8px; }
.ai-lbl { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.ai-provs { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-keyrow { display: flex; gap: 8px; }
.ai-keyrow .ai-in { flex: 1; min-width: 0; }
.ai-keyrow .btn { flex: none; white-space: nowrap; }
#aiKey { font-family: ui-monospace, Consolas, monospace; }
.ai-models { width: 100%; border-collapse: collapse; font-size: 13px; }
.ai-models th { padding: 6px 10px; text-align: left; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); border-bottom: 1.5px solid var(--line); }
.ai-models td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ai-models td small { display: block; color: var(--muted); }
.ai-jobs { display: flex; flex-direction: column; gap: 6px; }
.ai-job { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, 220px) 150px; align-items: center; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; }
.ai-job small { display: block; font-size: 12.5px; color: var(--muted); }

@media (max-width: 720px) {
  .ai-subs { grid-template-columns: 1fr; }
  .ai-job { grid-template-columns: 1fr 1fr; }
  .ai-job > div { grid-column: 1 / -1; }
  .ai-head { flex-wrap: wrap; }
  .ai-steps span:not(.on) { padding-right: 5px; font-size: 0; }
  .ai-foot { flex-wrap: wrap; }
}

/* ================= Kaynaklar sekmesi (alt başlığın öğrenme kaynakları) ================= */
.res-ai { width: 100%; justify-content: center; gap: 7px; }
.res-ai svg { width: 16px; height: 16px; }
.res-bar { margin-top: 10px; }
.res-bar i { background: var(--ok); }
.res-scope { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.res-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.res-list li[data-id] { display: flex; align-items: flex-start; gap: 8px; padding: 9px 4px 9px 10px; border: 1.5px solid var(--line); border-radius: 11px; background: var(--soft); }
.res-list li.mine { border-left: 4px solid var(--accent); }
.res-list li > input[type="checkbox"] { flex: none; width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--ok); cursor: pointer; }
.res-list .iconbtn { flex: none; width: 24px; height: 24px; opacity: 0.55; }
.res-list li:hover .iconbtn, .res-list .iconbtn:focus-visible { opacity: 1; }
.res-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.res-t { display: flex; align-items: flex-start; gap: 6px; color: var(--ink); font-weight: 600; line-height: 1.35; text-decoration: none; overflow-wrap: anywhere; }
.res-t svg { flex: none; width: 15px; height: 15px; margin-top: 2px; color: var(--accent); }
.res-t:hover span { color: var(--accent); text-decoration: underline; }
.res-list li.on .res-t span { color: var(--muted); text-decoration: line-through; }
.res-meta { font-size: 12px; color: var(--muted); line-height: 1.5; }
.res-flag { padding: 0 6px; border-radius: 999px; background: var(--hover-strong); font-size: 11px; font-weight: 600; white-space: nowrap; }
.res-flag.ok { background: #dcfce7; color: #166534; }
.res-flag.search { background: #fef3c7; color: #92400e; }
.res-task { align-self: flex-start; max-width: 100%; padding: 0; border: 0; background: none; color: var(--accent); font-size: 12px; font-weight: 600; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-task:hover { text-decoration: underline; }
.res-note { font-size: 12.5px; line-height: 1.45; color: var(--muted); overflow-wrap: anywhere; }
.res-list li.edit { flex-direction: column; align-items: stretch; gap: 6px; padding: 10px; border-color: var(--accent); }
.res-list li.edit input[type="text"], .res-list li.edit textarea, .res-list li.edit select { width: 100%; min-width: 0; padding: 7px 9px; border: 1.5px solid var(--line); border-radius: 9px; background: var(--field); color: var(--ink); font: inherit; outline: none; }
.res-list li.edit input:focus, .res-list li.edit textarea:focus, .res-list li.edit select:focus { border-color: var(--accent); }
.res-list li.edit input.bad { border-color: #dc2626; }
.res-row { display: flex; gap: 6px; }
.res-row select { flex: 0 0 44%; }
.res-row.end { justify-content: flex-end; }
.res-empty { padding: 14px 12px; border: 1.5px dashed var(--line); border-radius: 11px; font-size: 13px; line-height: 1.5; color: var(--muted); }
[data-theme="dark"] .res-flag.ok { background: #14532d; color: #bbf7d0; }
[data-theme="dark"] .res-flag.search { background: #78350f; color: #fde68a; }

/* AI penceresi: kaynak arama */
.ai-check { display: flex; align-items: flex-start; gap: 9px; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 11px; cursor: pointer; }
.ai-check input { flex: none; width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--accent); cursor: pointer; }
.ai-check span { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.ai-check small { font-size: 12px; line-height: 1.45; color: var(--muted); }
.ai-chip.res { border-style: dashed; border-color: var(--accent); color: var(--accent); }
/* Sihirbaz: eklenen belgeler (anlatım adımı) ve kaynak taraması seçimi (önizleme adımı) */
.ai-files { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ai-file { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 4px 4px 4px 11px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--field); font-size: 13px; }
.ai-file b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ai-file small { flex: none; font-size: 12px; color: var(--muted); }
.ai-file button { flex: none; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 7px; background: none; color: var(--muted); }
.ai-file button:hover { background: var(--hover); color: var(--danger); }
.ai-extras { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: start; }
.ai-extra { display: flex; flex-direction: column; gap: 4px; padding: 9px 10px; border: 1.5px solid hsl(var(--h) 55% 78%); border-radius: 12px; background: hsl(var(--h) 70% 97%); }
:root[data-theme="dark"] .ai-extra { border-color: hsl(var(--h) 28% 30%); background: hsl(var(--h) 28% 14%); }
.ai-extra > b { font-size: 13.5px; color: hsl(var(--h) 60% var(--tone-ink, 26%)); }
.ai-extra label { display: flex; align-items: flex-start; gap: 8px; padding: 5px 6px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.ai-extra label:hover { background: var(--hover); }
.ai-extra label span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ai-extra label em { display: block; font-style: normal; font-weight: 400; font-size: 12px; color: var(--muted); }
.ai-extra label i.ai-tag { font-style: normal; margin-right: 2px; }
.ai-extra label > small { flex: none; margin-top: 1px; }
.ai-extra input { flex: none; width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--accent); cursor: pointer; }
.ai-scan-acts { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 720px) { .ai-extras { grid-template-columns: 1fr; } }
.ai-tag.warn { background: #fef3c7; color: #92400e; }
.ai-prop-k .ai-tag { margin-left: 4px; letter-spacing: 0; text-transform: none; }
.ai-prop.res a { color: var(--ink); font-weight: 600; text-decoration: none; }
.ai-prop.res a:hover { color: var(--accent); text-decoration: underline; }
.ai-prop-v small.ai-url { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; opacity: 0.8; }
[data-theme="dark"] .ai-tag.warn { background: #78350f; color: #fde68a; }
.fld .res-scope { letter-spacing: 0; text-transform: none; font-size: 12.5px; font-weight: 500; color: var(--muted); }
@media (max-width: 720px) {
  .ai-btns { flex-wrap: wrap; justify-content: flex-end; }
}

/* ================= Belgeler: Kaynaklar'daki dosyalar ve belge penceresi (js/docview.js) ================= */
button.res-t { padding: 0; border: 0; background: none; font: inherit; font-weight: 600; line-height: 1.35; color: var(--ink); text-align: left; cursor: pointer; }
button.res-t:hover span { color: var(--accent); text-decoration: underline; }
.res-flag.doc { background: var(--accent-soft); color: var(--accent); }
.res-doc { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.res-list li.edit .tip { margin: 0; }

.ai-prop.doc { cursor: default; }
.ai-prop.doc em { display: block; margin-top: 2px; color: var(--muted); font-style: normal; font-size: 13px; }
.ai-doc-acts { margin-top: 7px; }

dialog#docDlg {
  width: min(900px, calc(100vw - 32px));
  height: min(860px, calc(100vh - 32px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  overflow: hidden;
}
dialog#docDlg[open] { display: flex; flex-direction: column; }
dialog#docDlg::backdrop { background: rgba(20, 25, 40, 0.42); }
dialog#docDlg button { cursor: pointer; }
.doc-head { flex: none; display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 20px; border-bottom: 1px solid var(--line); }
.doc-ttl { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.doc-ttl b { font-size: 15.5px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-ttl small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-fmt { padding: 0 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; }
.doc-acts { flex: none; display: flex; align-items: center; gap: 6px; }
.doc-acts .btn { padding: 6px 11px; font-size: 13px; white-space: nowrap; }
.doc-hint { flex: none; padding: 8px 20px; border-bottom: 1px solid var(--line); background: var(--accent-soft); font-size: 12.5px; line-height: 1.45; }
.doc-hint code { padding: 1px 5px; border-radius: 5px; background: var(--surface); font: 0.92em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.doc-body { flex: 1; min-height: 0; overflow: auto; padding: 22px 28px 32px; }
.doc-edit { display: block; width: 100%; height: 100%; min-height: 300px; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--field); color: var(--ink); font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; resize: none; outline: none; }
.doc-edit:focus { border-color: var(--accent); }
.doc-body:has(.doc-edit) { padding: 14px; overflow: hidden; }

/* Markdown içeriği */
.md { max-width: 760px; margin: 0 auto; font-size: 14.5px; line-height: 1.62; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md h1 { margin: 0 0 14px; font-size: 24px; line-height: 1.25; }
.md h2 { margin: 26px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); font-size: 18.5px; line-height: 1.3; }
.md h3 { margin: 20px 0 8px; font-size: 15.5px; }
.md h4, .md h5, .md h6 { margin: 16px 0 6px; font-size: 14.5px; }
.md p { margin: 0 0 11px; }
.md ul, .md ol { margin: 0 0 11px; padding-left: 24px; }
.md li { margin: 3px 0; }
.md li > p { margin: 6px 0; }
.md li > ul, .md li > ol { margin: 3px 0; }
.md ul.tasks { list-style: none; padding-left: 4px; }
.md li.task input { width: 15px; height: 15px; margin: 0 6px 0 0; vertical-align: -2px; accent-color: var(--accent); }
.md a { color: var(--accent); text-decoration: none; }
.md a:hover { text-decoration: underline; }
.md code { padding: 1px 5px; border-radius: 5px; background: var(--hover-strong); font: 0.88em/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.md pre { position: relative; margin: 0 0 13px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 11px; background: var(--soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.md pre code { padding: 0; background: none; font-size: 12.8px; line-height: 1.55; }
.md pre[data-lang]::before { content: attr(data-lang); display: block; margin-bottom: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.md-copy { position: absolute; top: 7px; right: 7px; padding: 3px 9px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); font-size: 11.5px; font-weight: 600; opacity: 0; transition: opacity 0.12s; }
.md pre:hover .md-copy, .md-copy:focus-visible { opacity: 1; }
.md-copy:hover { color: var(--accent); border-color: var(--accent); }
.md blockquote { margin: 0 0 13px; padding: 9px 14px; border-left: 4px solid var(--accent); border-radius: 0 10px 10px 0; background: var(--accent-soft); }
.md blockquote > :last-child { margin-bottom: 0; }
.md hr { margin: 20px 0; border: 0; border-top: 1px solid var(--line); }
.md-table { margin: 0 0 13px; overflow-x: auto; }
.md table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.md th, .md td { padding: 6px 9px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.md th { background: var(--soft); font-weight: 700; }
@media (hover: none) { .md-copy { opacity: 1; } }
@media (max-width: 720px) {
  .doc-head { flex-wrap: wrap; }
  .doc-ttl { flex-basis: 100%; }
  .doc-acts { flex: 1 1 100%; flex-wrap: wrap; }
  .doc-acts .iconbtn { margin-left: auto; }
  .doc-body { padding: 16px 16px 24px; }
}
