:root {
  --yesil: #2F5233;
  --yesil-koyu: #1B3A1B;
  --kirmizi: #C0392B;
  --sari: #FFFDE7;
  --gri: #777;
  --border: #ccc;
}
* { box-sizing: border-box; }
body {
  font-family: -apple-system, "Segoe UI", Arial, sans-serif;
  margin: 0; padding: 0; background: #f2f2f2; color: #222;
}
header {
  background: var(--yesil-koyu); color: #fff; padding: 16px 24px;
  display: flex; justify-content: space-between; align-items: center;
}
header h1 { font-size: 18px; margin: 0; }
header .kullanici-bilgi { font-size: 12.5px; display: flex; align-items: center; gap: 12px; }
header .kullanici-bilgi button { background: rgba(255,255,255,0.15); border: none; color: #fff; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 12px; }
header .kullanici-bilgi button:hover { background: rgba(255,255,255,0.28); }
nav { display: flex; gap: 4px; background: var(--yesil); padding: 0 20px; }
nav button {
  background: transparent; border: none; color: #eee; padding: 12px 20px;
  cursor: pointer; font-size: 14px; font-weight: 600; border-bottom: 3px solid transparent;
}
nav button.active { color: #fff; border-bottom-color: #fff; background: rgba(255,255,255,0.08); }
main { max-width: 1100px; margin: 20px auto; padding: 0 16px 60px; }
main:has(#tab-liste:not(.hidden)) { max-width: 1500px; }
main:has(#tab-yonetim:not(.hidden)) { max-width: 1300px; }
.panel { background: #fff; border-radius: 8px; padding: 24px; box-shadow: 0 1px 4px rgba(0,0,0,0.1); margin-bottom: 20px; }
.hidden { display: none !important; }
.field-row { display: flex; align-items: center; margin-bottom: 10px; gap: 10px; }
.field-row label { width: 190px; text-align: right; font-weight: 600; font-size: 13px; flex-shrink: 0; }
.field-row label.required { color: var(--kirmizi); }
.field-row input[type=text], .field-row input[type=number], .field-row input[type=password],
.field-row input[type=date], .field-row select, .field-row textarea {
  flex: 1; padding: 7px 9px; border: 1px solid var(--border); border-radius: 4px; background: var(--sari); font-size: 13px;
}
.hint { font-size: 11px; color: var(--gri); font-style: italic; margin-left: 200px; margin-top: -6px; margin-bottom: 12px; }
.belge-turu-grup { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; }
.belge-chk { display: flex; align-items: center; gap: 5px; font-weight: 400; font-size: 13px; width: auto; text-align: left; cursor: pointer; white-space: nowrap; }
.belge-chk input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; margin: 0; }
.belge-turu-grup input[type=text] { flex: 1; min-width: 160px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--sari); font-size: 13px; }
.arazi-donum-grup { flex: 1; display: flex; gap: 10px; }
.arazi-donum-grup select { max-width: 170px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 4px; background: var(--sari); font-size: 13px; }
.arazi-donum-grup input[type=number] { max-width: 140px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 4px; background: var(--sari); font-size: 13px; }
.arazi-donum-grup input[type=number]:disabled { background: #eee; color: #aaa; cursor: not-allowed; }
.tc-sonuc { border-radius: 8px; padding: 14px 16px; margin: 4px 0 18px; font-size: 13px; }
.tc-sonuc.bulunamadi { background: #f2f2f2; border: 1px solid #ddd; color: #444; }
.tc-sonuc.bulundu { background: #eaf7ec; border: 1px solid #c3e6cb; color: #1B3A1B; }
#tcMsg { font-size: 12.5px; margin: -6px 0 12px; min-height: 16px; color: var(--kirmizi); }
.urun-tablo { width: 100%; border-collapse: collapse; margin: 14px 0; }
.urun-tablo th { background: var(--yesil); color: #fff; padding: 8px; font-size: 12px; text-align: center; }
.urun-tablo td { padding: 4px; }
.urun-tablo select, .urun-tablo input { width: 100%; padding: 6px; border: 1px solid var(--border); border-radius: 4px; background: var(--sari); font-size: 13px; }
.urun-tablo td.num { text-align: center; color: #888; font-size: 12px; width: 24px; }
.btn { padding: 10px 22px; border: none; border-radius: 5px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-save { background: var(--kirmizi); color: #fff; width: 100%; padding: 14px; font-size: 16px; margin-top: 10px; }
.btn-save:hover { background: #a5271b; }
.btn-secondary { background: var(--yesil); color: #fff; }
.btn-secondary:hover { background: var(--yesil-koyu); }
.btn-outline { background: #fff; border: 1px solid var(--border); color: #333; }
.btn-tarih-kisayol { padding: 6px 10px; font-size: 12px; font-weight: 600; border: 1px solid var(--border); background: #fff; color: var(--yesil-koyu); border-radius: 4px; cursor: pointer; white-space: nowrap; flex: none; }
.btn-tarih-kisayol:hover { background: var(--sari); }
.tarih-satir { display: flex; flex: 1; gap: 8px; min-width: 0; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
table.liste { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.liste th { background: var(--yesil); color: #fff; padding: 7px 6px; position: sticky; top: 0; text-align: left; }
table.liste td { padding: 6px; border-bottom: 1px solid #eee; }
table.liste tr:nth-child(even) { background: #fafafa; }
.liste-wrap { max-height: 520px; overflow: auto; border: 1px solid #eee; border-radius: 6px; }
.liste-filtre-satir th { position: static; background: #eef3ee; padding: 4px 5px; }
.liste-filtre { width: 100%; box-sizing: border-box; padding: 4px 5px; font-size: 11px; font-weight: 400; border: 1px solid var(--border); border-radius: 3px; background: #fff; color: #333; }
.liste-filtre-satir select.liste-filtre { cursor: pointer; }
.liste-ozet-panel { margin-top: 18px; padding-top: 16px; border-top: 2px solid #eee; }
.liste-ozet-panel h3 { margin: 0 0 12px; font-size: 15px; color: var(--yesil-koyu); }
.liste-ozet-panel h4 { margin: 0 0 8px; font-size: 12.5px; color: #555; text-transform: uppercase; letter-spacing: 0.03em; }
.liste-ozet-panel .ozet-grid { margin-top: 18px; gap: 28px; }
.liste-ozet-panel .stat-card { min-width: 110px; padding: 10px 16px; }
.liste-ozet-panel .stat-card .num { font-size: 20px; }
.sil-link { color: var(--kirmizi); cursor: pointer; font-size: 11px; text-decoration: underline; }
.duzenle-link { color: var(--yesil-koyu); cursor: pointer; font-size: 11px; text-decoration: underline; }
.yazdir-link { color: #2c5aa0; cursor: pointer; font-size: 11px; text-decoration: underline; }
.teslim-badge { color: #1B3A1B; font-weight: 700; font-size: 11.5px; white-space: nowrap; background: #9fdcb2; padding: 3px 9px; border-radius: 10px; display: inline-block; }
.teslim-badge.teslim-badge-kismi { background: #ffd766; }
.teslim-badge .geri-al { color: var(--kirmizi); cursor: pointer; text-decoration: underline; font-weight: 400; margin-left: 8px; }
.teslim-btn { background: #eee; border: 1px solid var(--border); border-radius: 4px; padding: 4px 8px; font-size: 11px; cursor: pointer; white-space: nowrap; }
.teslim-btn:hover { background: #e2e2e2; }
.teslim-onay { background: var(--yesil); color: #fff; border: none; border-radius: 3px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
.teslim-vazgec { color: var(--gri); cursor: pointer; font-size: 12px; text-decoration: underline; }
.bekleyen-rozet { background: #fdecea; color: #C0392B; font-size: 10px; padding: 1px 6px; border-radius: 8px; white-space: nowrap; }
.bekleyen-rozet.kismi { background: #ffd766; color: #6b4c00; }
.tekrar-rozet { background: #cfe3ff; color: #1a4a8a; font-size: 10px; padding: 1px 6px; border-radius: 8px; white-space: nowrap; font-weight: 600; }
.kismi-not { display: block; font-size: 10px; color: #6b4c00; margin-top: 2px; font-style: italic; }
table.liste tr.satir-urun-alinmis { background: #b9e8c7 !important; }
table.liste tr.satir-kismi-bekleyen { background: #ffe19a !important; }
table.liste tr.satir-kismi-teslim { background: #ffe19a !important; }

.teslim-popover {
  position: fixed; z-index: 500; background: #fff; border: 1px solid var(--border);
  border-radius: 8px; padding: 12px; box-shadow: 0 4px 16px rgba(0,0,0,0.2); width: 226px;
}
.teslim-popover-baslik { font-size: 12px; font-weight: 600; margin-bottom: 6px; color: #333; }
.teslim-popover input[type=date] { width: 100%; padding: 6px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; margin-bottom: 8px; }
.teslim-tip-sekme { display: flex; gap: 4px; margin-bottom: 8px; }
.teslim-tip-btn { flex: 1; padding: 6px 4px; border: 1px solid var(--border); background: #f5f5f5; color: #555; font-size: 12px; border-radius: 4px; cursor: pointer; }
.teslim-tip-btn.active { background: var(--yesil); color: #fff; border-color: var(--yesil); font-weight: 600; }
#teslimKismiAlani { margin-bottom: 8px; }
#teslimKismiAlani input[type=number] { width: 100%; padding: 6px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; }
.teslim-kismi-ipucu { font-size: 10.5px; color: #777; margin-top: 3px; }
.teslim-popover-btns { display: flex; justify-content: space-between; align-items: center; }
.popover-backdrop { position: fixed; inset: 0; z-index: 499; }
.duzenle-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 600;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.duzenle-modal {
  background: #fff; border-radius: 10px; padding: 22px; width: 100%; max-width: 640px;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.duzenle-modal-baslik { font-size: 16px; font-weight: 700; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; color: var(--yesil-koyu); }
.duzenle-modal-kapat { cursor: pointer; font-size: 18px; color: #999; }
.duzenle-modal-kapat:hover { color: #333; }
.duzenle-modal-btns { display: flex; gap: 10px; margin-top: 16px; }
.duzenle-modal-btns .btn-save { width: auto; flex: 1; margin-top: 0; }
.mukerrer-not { font-size: 13px; color: #333; margin-bottom: 14px; }
.mukerrer-urun-blok { margin-bottom: 14px; }
.mukerrer-urun-adi { font-weight: 700; font-size: 13.5px; color: var(--kirmizi); margin-bottom: 6px; }
.mukerrer-tablo { width: 100%; border-collapse: collapse; font-size: 12px; border: 1px solid #eee; border-radius: 6px; overflow: hidden; }
.mukerrer-tablo th { background: #fdecea; color: #6b2018; padding: 6px 8px; text-align: left; }
.mukerrer-tablo td { padding: 6px 8px; border-top: 1px solid #eee; }
.ozet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.ozet-grid > div { min-width: 0; }
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; }
.bar-label { width: 130px; text-align: right; flex-shrink: 0; color: #444; }
.bar-track { flex: 1; background: #eee; border-radius: 3px; overflow: hidden; height: 16px; }
.bar-fill { background: var(--yesil); height: 100%; }
.bar-val { width: 34px; font-weight: 600; color: #333; }
.stat-cards { display: flex; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.stat-card { background: var(--yesil-koyu); color: #fff; border-radius: 8px; padding: 14px 20px; min-width: 130px; }
.stat-card .num { font-size: 26px; font-weight: 700; }
.stat-card .lbl { font-size: 11px; opacity: .85; }
.empty-msg { text-align: center; color: #999; padding: 30px; }
footer { text-align: center; font-size: 11px; color: #999; padding: 20px; }
.footer-imza { margin-top: 4px; }

.urun-tablo-wrap, .tablo-wrap { overflow-x: auto; }

@media print {
  header, nav, footer, .no-print { display: none !important; }
  body { background: #fff; }
  main { max-width: 100%; margin: 0; padding: 0; }
  .panel { box-shadow: none; padding: 0; }
  .liste-wrap { max-height: none; overflow: visible; }
  #tab-kayit, #tab-liste, #tab-yonetim { display: none !important; }
  #tab-ozet { display: block !important; }
  .stat-card { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .bar-fill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

#dilekcePrint { display: none; }
body.yazdirma-modu-dilekce #dilekcePrint { display: block; }
@media print {
  body.yazdirma-modu-dilekce header,
  body.yazdirma-modu-dilekce nav,
  body.yazdirma-modu-dilekce footer,
  body.yazdirma-modu-dilekce main { display: none !important; }
  body.yazdirma-modu-dilekce #dilekcePrint { display: block !important; }
}
@page { size: A4; margin: 12mm 12mm 9mm 12mm; }
.dilekce-sayfa { display: flex; flex-direction: column; min-height: 275mm; max-width: 100%; margin: 0 auto; padding: 0; font-size: 11.5px; line-height: 1.3; color: #111; font-family: "Times New Roman", Times, serif; }
.dilekce-header { display: flex; align-items: center; gap: 11px; border-bottom: 1.5px solid #1B3A1B; padding-bottom: 7px; margin-bottom: 9px; }
.dilekce-header img { width: 46px; height: 46px; }
.dilekce-header-metin { line-height: 1.3; }
.dilekce-header-metin .kurum { font-weight: 700; font-size: 13px; }
.dilekce-mudurluk { text-align: center; font-weight: 700; font-size: 12px; margin: 7px 0 1px; }
.dilekce-form-baslik { text-align: center; font-weight: 700; font-size: 13px; margin-bottom: 9px; text-transform: uppercase; }
.dilekce-form-baslik .altcizgili { text-decoration: underline; }
.dilekce-bolum-baslik { font-weight: 700; margin: 7px 0 4px; font-size: 12px; }
.dilekce-italik { font-style: italic; font-weight: 400; }
.dilekce-not { margin-bottom: 4px; }
.dilekce-satir { margin-bottom: 4px; line-height: 1.3; }
.dilekce-satir b, .dilekce-satir span { font-weight: 400; border-bottom: 1px dotted #999; padding-bottom: 0; }
.dilekce-bos-satir { border-bottom: 1px dotted #999; }
.dilekce-imza-alani { margin-top: 12px; text-align: left; line-height: 1.9; }
.dilekce-imza-baslik { font-weight: 700; margin-bottom: 4px; }
.dilekce-alt-blok { margin-top: auto; padding-top: 11px; }
.dilekce-qr-alani { display: flex; justify-content: space-between; align-items: flex-end; }
.dilekce-qr-blok { text-align: center; font-size: 8px; color: #555; width: 95px; }
.dilekce-qr-blok svg { width: 56px; height: 56px; }
.dilekce-qr-etiket { margin-top: 2px; line-height: 1.25; }
.dilekce-footer { margin-top: 7px; border-top: 1px solid #999; padding-top: 5px; font-size: 8.5px; color: #555; text-align: center; }

/* ===== Giriş ekranı ===== */
#girisEkrani {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--yesil-koyu), var(--yesil));
}
.giris-kutu { background: #fff; border-radius: 10px; padding: 36px 32px; width: 100%; max-width: 380px; box-shadow: 0 10px 40px rgba(0,0,0,0.3); }
.giris-kutu h1 { font-size: 17px; text-align: center; margin: 0 0 6px; color: var(--yesil-koyu); }
.giris-kutu .alt-baslik { text-align: center; font-size: 12px; color: #888; margin-bottom: 24px; }
.giris-kutu label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; color: #333; }
.giris-kutu input { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 5px; background: var(--sari); font-size: 14px; margin-bottom: 16px; }
#girisMsg { min-height: 18px; font-size: 12.5px; color: var(--kirmizi); margin-bottom: 10px; text-align: center; }

/* ===== Yönetim sekmesi ===== */
.yonetim-grid { display: grid; grid-template-columns: 1fr 380px; gap: 24px; align-items: start; }
.yonetim-grid > div { min-width: 0; }
.personel-tablo { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.personel-tablo th { background: var(--yesil); color: #fff; padding: 8px 6px; text-align: left; }
.personel-tablo td { padding: 7px 6px; border-bottom: 1px solid #eee; vertical-align: top; }
.personel-tablo tr.pasif-satir { opacity: .5; }
.rozet { display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: 10.5px; font-weight: 600; }
.rozet.yonetici { background: #dbe9ff; color: #1a4a8a; }
.rozet.personel { background: #eee; color: #555; }
.rozet.pasif { background: #fdecea; color: var(--kirmizi); }
.rozet.aktif { background: #e3f5e6; color: var(--yesil-koyu); }
.ilce-checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: 4px; padding: 10px; background: var(--sari); margin-bottom: 14px; }
.ilce-checkbox-grid label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 400; cursor: pointer; }
.personel-form-kutu { background: #fafafa; border: 1px solid #eee; border-radius: 8px; padding: 18px; position: sticky; top: 20px; }
.personel-form-kutu h3 { margin: 0 0 14px; font-size: 14px; color: var(--yesil-koyu); }
.ithal-kutu { background: #fafafa; border: 1px solid #eee; border-radius: 8px; padding: 18px; margin-top: 20px; }
.ithal-onizleme-tablo { width: 100%; border-collapse: collapse; font-size: 11.5px; margin-top: 12px; }
.ithal-onizleme-tablo th { background: #eee; padding: 5px; text-align: left; }
.ithal-onizleme-tablo td { padding: 5px; border-bottom: 1px solid #eee; }
.gecici-sifre-kutusu { background: #fff8e8; border: 1px solid #ffe69c; border-radius: 6px; padding: 12px; margin-top: 10px; font-size: 13px; }
.gecici-sifre-kutusu code { font-size: 15px; font-weight: 700; color: var(--yesil-koyu); }

/* ===== Mobil uyum (dosyanın sonunda — aynı özgüllükteki daha önceki kurallarla çakışmayı önlemek için) ===== */
@media (max-width: 768px) {
  header { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 16px; }
  header h1 { font-size: 15px; }
  header .kullanici-bilgi { width: 100%; justify-content: space-between; }
  nav { overflow-x: auto; padding: 0 8px; -webkit-overflow-scrolling: touch; }
  nav button { padding: 12px 14px; font-size: 13px; white-space: nowrap; }
  main { padding: 0 8px 40px; margin: 12px auto; }
  .panel { padding: 14px; border-radius: 6px; }

  .field-row { flex-direction: column; align-items: stretch; gap: 4px; }
  .field-row label { width: auto; text-align: left; }
  .hint { margin-left: 0; }
  .arazi-donum-grup { flex-wrap: wrap; }
  .arazi-donum-grup select, .arazi-donum-grup input[type=number] { max-width: none; flex: 1; min-width: 120px; }

  .urun-tablo { min-width: 520px; }

  table.liste { font-size: 11.5px; }
  .liste-wrap { max-height: 65vh; }

  .duzenle-modal-backdrop { padding: 8px; }
  .duzenle-modal { padding: 16px; max-height: 94vh; }
  .duzenle-modal-btns { flex-direction: column; }

  .ozet-grid { grid-template-columns: 1fr; gap: 16px; }
  .bar-label { width: 92px; font-size: 11px; }
  .stat-cards { gap: 10px; }
  .stat-card { min-width: 44%; flex: 1; }

  .yonetim-grid { grid-template-columns: 1fr; }
  .personel-form-kutu { position: static; }
  .ilce-checkbox-grid { grid-template-columns: 1fr; }

  .giris-kutu { padding: 28px 22px; }

  .teslim-popover { max-width: calc(100vw - 20px); }
}

@media (max-width: 420px) {
  header h1 { font-size: 13px; }
  nav button { padding: 10px 10px; font-size: 12px; }
  .stat-card { min-width: 100%; }
}
