/* A’dam-ToDo - krem/sade tema */
:root {
  --bg: #fff6e3;
  --surface: #fffff2;
  --line: #fae6cb;
  --line-strong: #e8d3b5;
  --ink: #2c251e;
  --muted: #93836d;
  --muted-2: #b1a086;
  --primary: #3f6251;
  --primary-dark: #314d40;
  --field: #ffefd9;
  --danger: #ab402a;
  --danger-line: #f2ceba;
  --future: #fae6cb;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button, input, select { font-family: inherit; }
input, select { font-size: 16px; } /* iOS'ta odaklanınca zoom yapmasın */
::placeholder { color: var(--muted-2); }

.boot { padding: 40px 20px; color: var(--muted); text-align: center; }

.wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px calc(28px + env(safe-area-inset-bottom));
}

/* ---------- Genel bileşenler ---------- */

.btn {
  border: none;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 700;
  background: var(--primary);
  color: #fffff2;
  cursor: pointer;
  width: 100%;
}
.btn:active { background: var(--primary-dark); }
.btn[disabled] { opacity: .6; cursor: default; }

.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  width: auto;
}
.btn-small {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-small.danger { color: var(--danger); border-color: var(--danger-line); }

.input, select.input {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--field);
  color: var(--ink);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

.muted { color: var(--muted); font-size: 13px; }
.tiny { font-size: 11px; color: var(--muted); }
.row { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wrap-gap { display: flex; gap: 6px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.spacer { height: 18px; }

.code-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--field);
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 2px;
  font-size: 13px;
}

/* ---------- Giriş ---------- */

.login-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px 24px;
  text-align: center;
}
.login-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; line-height: 1.25; }
.code-input {
  font-size: 21px;
  letter-spacing: 3px;
  text-align: center;
  text-transform: uppercase;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--field);
  color: var(--ink);
  width: 100%;
}

/* ---------- Başlık ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0 14px;
}
.hello { font-size: 19px; }
.hello strong { font-weight: 700; }

/* ---------- Bildirim banner'ı ---------- */

.banner {
  background: #faf3e2;
  border: 1px solid #d9e0c5;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 13px;
}
.banner button {
  white-space: nowrap;
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  background: var(--primary);
  color: #fffff2;
  cursor: pointer;
}
.banner.info { background: #fff1da; border-color: var(--line-strong); display: block; }

/* ---------- Haftalık ızgara ---------- */

.grid-scroll {
  height: min(58vh, 420px);
  min-height: 260px;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overscroll-behavior: contain;
}
.grid {
  display: grid;
  gap: 2px;
  padding: 6px;
  width: max-content;
  min-width: 100%;
}
.grid-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  font-size: 10px;
  font-weight: 700;
  color: #726652;
  padding-bottom: 4px;
}
.grid-head.week { display: flex; align-items: flex-end; }
.grid-head.activity {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 2px 0 4px;
}
.grid-head.activity span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  font-size: 9px;
}
.wk-btn {
  border: none;
  border-radius: 4px;
  padding: 0;
  height: 32px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  background: transparent;
  color: var(--ink);
}
.wk-btn.current { background: var(--primary); color: #fffff2; }
.wk-btn.future { color: #d2bfa1; }
.cell {
  border-radius: 6px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}
.week-info {
  grid-column: 1 / -1;
  background: var(--field);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  margin: 2px 0 4px;
}
.legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px 2px 4px;
  font-size: 11px;
  color: var(--muted);
}
.swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }

/* ---------- Doldur ekranı ---------- */

.fill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.fill-row .name { font-size: 15px; font-weight: 600; }
.fill-row .hint { color: var(--muted-2); font-weight: 400; font-size: 11px; }
.fill-row input[type="number"] {
  width: 84px;
  text-align: center;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--field);
  color: var(--ink);
}
.fill-row input[type="checkbox"] {
  width: 26px;
  height: 26px;
  accent-color: var(--primary);
}

/* ---------- Admin ---------- */

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tab {
  white-space: nowrap;
  background: none;
  border: none;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--ink); border-bottom-color: var(--primary); }

.person-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
  margin-bottom: 12px;
}
.person-btn {
  flex: 0 0 138px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  color: #fffff2;
  text-align: left;
}
.person-btn.selected { border-color: var(--ink); }
.person-btn .sub { font-size: 11px; font-weight: 600; opacity: .9; }

.pill {
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}
.pill.active { background: var(--primary); border-color: var(--primary); color: #fffff2; }

.target-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  margin-bottom: 9px;
  gap: 8px;
}
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--field);
  color: var(--ink);
  font-size: 17px;
  cursor: pointer;
  line-height: 1;
}
.stepper .val {
  min-width: 74px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
}
.stepper .val small { display: block; color: var(--muted); font-weight: 400; font-size: 10px; }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: #2c251e;
  color: #fffff2;
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 13px;
  z-index: 50;
  max-width: 88vw;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.toast.err { background: #932f20; }

/* ---------- Gece modu (A - Modern & Premium) ----------
   Koyu lacivert-yesil zemin, altin/krem detaylar. Menudeki dugmeyle acilir;
   secim localStorage'da saklanir, <html data-theme="dark"> ile uygulanir. */

html[data-theme="dark"] {
  --bg: #0f1a1b;
  --surface: #152628;
  --line: #203437;
  --line-strong: #2c464a;
  --ink: #f8e3c6;
  --muted: #a2a89c;
  --muted-2: #7a8379;
  --primary: #d3a225;
  --primary-dark: #b0871c;
  --field: #112022;
  --danger: #e4816a;
  --danger-line: #4e2b24;
  --future: #17282a;
  color-scheme: dark;
}

/* Altin dugmenin uzerindeki yazi koyu olmali, beyaz degil */
html[data-theme="dark"] .btn,
html[data-theme="dark"] .banner button { color: #152628; }

html[data-theme="dark"] .wk-btn.current { color: #152628; }
html[data-theme="dark"] .wk-btn.future { color: #4e5b54; }
html[data-theme="dark"] .grid-head { color: #acb3a5; }
html[data-theme="dark"] .cell[style*="var(--future)"] { color: #4a5656 !important; }

html[data-theme="dark"] .banner { background: #17302a; border-color: #294a3f; }
html[data-theme="dark"] .banner.info { background: #192a2c; border-color: var(--line-strong); }

/* ---------- Sag ustteki menu ---------- */

.menu-wrap { position: relative; }
.menu-btn {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  border-radius: 12px;
  width: 42px;
  height: 42px;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,.16);
}
html[data-theme="dark"] .menu-panel { box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.menu-item:active { background: var(--field); }
.menu-item.danger { color: var(--danger); }
.menu-ayrac { height: 1px; background: var(--line); margin: 4px 6px; }

/* ---------- Etiket (grup) basliklari ---------- */

.tag-baslik {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.tag-baslik::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-strong);
}
.tag-rozet {
  display: inline-block;
  background: var(--field);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

/* ---------- Admin: herkesin tablosu yan yana ---------- */

.wrap.genis { max-width: 1280px; }

.kisi-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 4px;
}
@media (min-width: 760px)  { .kisi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .kisi-grid { grid-template-columns: repeat(3, 1fr); } }

.kisi-karti {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  min-width: 0;
}
.kisi-karti .kisi-ad {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
  padding: 0 2px;
}
.kisi-karti .kisi-yuzde { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.kisi-karti .grid-scroll {
  height: 300px;
  min-height: 300px;
  /* Kaydirma cubuguna bastan yer ayir: yoksa cubuk cikinca hucreler tasiyor. */
  scrollbar-gutter: stable;
}

/* ---------- Telefonda kart içi kaydırma kilidi ----------
   Sorun: kart içindeki tablo kendi kendine kayıyordu, parmak karta denk gelince
   sayfa kaymıyordu. Çözüm: telefonda kart içi DİKEY kaydırma kapalı gelir
   (parmak sayfayı kaydırır), karttaki ↕ tuşuna basınca o kart açılır. */

.kart-kilit { display: none; }

@media (max-width: 759px) {
  .kart-kilit {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--field);
    border: 1px solid var(--line-strong);
    color: var(--muted);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
  }
  .kisi-karti.kaydirma-acik .kart-kilit {
    background: var(--primary);
    border-color: var(--primary);
    color: #fffff2;
  }
  html[data-theme="dark"] .kisi-karti.kaydirma-acik .kart-kilit { color: #152628; }

  /* Kilitliyken dikey kaydırma yok - dokunuş sayfaya gider. Yatay kaydırma açık kalır. */
  .kisi-karti .grid-scroll { overflow-y: hidden; overscroll-behavior: auto; }
  .kisi-karti.kaydirma-acik .grid-scroll { overflow-y: auto; overscroll-behavior: contain; }

  /* Açık kart belli olsun */
  .kisi-karti.kaydirma-acik { border-color: var(--primary); }
}

.kisi-ad .kisi-sag { display: flex; align-items: center; gap: 6px; }

/* ---------- Alt gezinme çubuğu ---------- */

.alt-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--line-strong);
  padding-bottom: env(safe-area-inset-bottom);
}
.alt-nav button {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  padding: 9px 4px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.alt-nav button .ikon { font-size: 19px; line-height: 1; }
.alt-nav button.aktif { color: var(--primary); }
html[data-theme="dark"] .alt-nav button.aktif { color: var(--primary); }
body.alt-navli .wrap { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }

/* ---------- Sıralama (leaderboard) ---------- */

.lig-kart {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.lig-kart.benim { border-color: var(--primary); }
.lig-ust { display: flex; align-items: center; gap: 10px; }
.lig-sira {
  width: 30px; height: 30px; flex: none;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
  background: var(--field); color: var(--muted);
}
.lig-sira.altin { background: #eeb33e; color: #3d2e0a; }
.lig-sira.gumus { background: #cdc7c0; color: #313333; }
.lig-sira.bronz { background: #d78c56; color: #3d2311; }
.lig-ad { flex: 1; font-weight: 700; font-size: 15px; min-width: 0; }
.lig-puan { font-weight: 800; font-size: 17px; white-space: nowrap; }
.lig-alt { font-size: 11px; color: var(--muted); margin-top: 2px; }
.lig-uyeler { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.lig-uye {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0; font-size: 13px;
}
.lig-uye .ad { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lig-uye .puan { font-weight: 700; white-space: nowrap; }
.lig-uye.benim-satir { color: var(--primary); font-weight: 700; }
.streak-rozet {
  display: inline-block;
  background: var(--field);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
  white-space: nowrap;
}

/* ---------- Changelog ---------- */

.cl-giris { margin-bottom: 18px; }
.cl-tarih { font-size: 11px; color: var(--muted-2); font-weight: 700; }
.cl-baslik { font-weight: 700; margin: 2px 0 6px; }
.cl-liste { margin: 0; padding-left: 18px; }
.cl-liste li { margin-bottom: 4px; font-size: 13px; }

/* ---------- Geçmiş hafta (salt okunur gün tablosu) ---------- */

.gecmis-sarmal {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.gecmis-tablo { border-collapse: collapse; width: 100%; font-size: 13px; }
.gecmis-tablo th, .gecmis-tablo td {
  border-bottom: 1px solid var(--line);
  padding: 7px 4px;
  text-align: center;
  white-space: nowrap;
}
.gecmis-tablo thead th {
  position: sticky; top: 0;
  background: var(--surface);
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}
.gecmis-tablo th.akt, .gecmis-tablo td.akt {
  text-align: left;
  position: sticky; left: 0;
  background: var(--surface);
  min-width: 88px;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  z-index: 1;
}
.gecmis-tablo thead th.akt { z-index: 2; }
.gecmis-tablo td.bos { color: var(--muted-2); }
.gecmis-tablo td.dolu { font-weight: 700; }
.gecmis-tablo th.bugun { color: var(--primary); }
.gecmis-tablo tr:last-child td { border-bottom: none; }
.gecmis-tablo td.toplam { font-weight: 800; }
.gecmis-tablo .hedef-tam { color: #317a4b; }
.gecmis-tablo .hedef-eksik { color: var(--danger); }
html[data-theme="dark"] .gecmis-tablo .hedef-tam { color: #75bf87; }

/* ---------- Changelog işaretleri ---------- */

.cl-liste { list-style: none; padding-left: 0; }
.cl-liste li { display: flex; gap: 7px; align-items: flex-start; }
.cl-isaret {
  flex: none;
  width: 16px;
  font-weight: 800;
  line-height: 1.45;
}
.cl-isaret.ekle { color: #317a4b; }
.cl-isaret.cikar { color: var(--danger); }
.cl-isaret.degis { color: var(--muted); }
html[data-theme="dark"] .cl-isaret.ekle { color: #75bf87; }
