:root {
  color-scheme: light;
  font-family: system-ui, "Segoe UI", Arial, sans-serif;
}

body {
  margin: 0;
  background: #f4f5f7;
  color: #1f2328;
}

header.uygulama-basligi {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1f2937;
  color: #fff;
  padding: 0.75rem 1.5rem;
}

header.uygulama-basligi .ust-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

header.uygulama-basligi .ust-nav a {
  color: #d1d5db;
  text-decoration: none;
  font-size: 0.9rem;
}

header.uygulama-basligi .ust-nav a:hover {
  color: #fff;
}

header.uygulama-basligi .kullanici-bilgisi {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
}

header.uygulama-basligi .kullanici-bilgisi a {
  color: #d1d5db;
  text-decoration: none;
  white-space: nowrap;
}

header.uygulama-basligi .kullanici-bilgisi a:hover {
  color: #fff;
}

header.uygulama-basligi button {
  background: transparent;
  border: 1px solid #6b7280;
  color: #fff;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
}

header.uygulama-basligi button:hover {
  background: #374151;
}

main {
  max-width: 480px;
  margin: 3rem auto;
  background: #fff;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

main.genis {
  max-width: 720px;
}

main.tanimlar {
  max-width: 1100px;
}

/* Liste sayfaları (Modeller, Kalıplar, Matris) veri tablosu barındırır;
   okunacak metin değil taranacak sütun taşıdıkları için ekranın genişliğini
   kullanırlar. Kart ve form sayfaları dar kalmaya devam eder. */
main.liste {
  max-width: min(1800px, 96vw);
}

/* Tablo karta sığmadığında kendi içinde yatay kayar — ama yalnızca dar
   ekranlarda. Sebep: overflow-x tanımlamak elemanı dikey kaydırma kabı
   hâline de getiriyor (tarayıcı overflow-y'yi auto'ya çeviriyor) ve
   thead'in sayfaya yapışması bozuluyor. Geniş ekranda tablo zaten sığdığı
   için sarmalayıcı şeffaf bırakılıp yapışkan başlık korunuyor. */
@media (max-width: 1200px) {
  .tablo-sarmal {
    overflow-x: auto;
  }
}

/* Telefonda 2rem dolgu ve 3rem dış boşluk ekranın yarısını yiyor. Üst menü
   de tek satıra sığmayıp sayfayı yatayda kaydırıyordu; sarmasına izin
   veriliyor. */
@media (max-width: 700px) {
  main {
    margin: 1rem 0.5rem;
    padding: 1rem;
  }

  header.uygulama-basligi {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
  }

  header.uygulama-basligi .ust-nav {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
}

h1 {
  font-size: 1.25rem;
  margin: 0 0 1rem;
}

label {
  display: block;
  margin-top: 1rem;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
  font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 1rem;
  box-sizing: border-box;
  background: #fff;
}

/* --- sekmeler --- */

.sekmeler {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.sekmeler a {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: #e5e7eb;
  color: #374151;
  text-decoration: none;
  font-size: 0.85rem;
}

.sekmeler a.aktif-sekme {
  background: #2563eb;
  color: #fff;
}

.sekmeler.alt-sekmeler a {
  background: transparent;
  border: 1px solid #d1d5db;
}

.sekmeler.alt-sekmeler a.aktif-sekme {
  background: #1f2937;
  border-color: #1f2937;
  color: #fff;
}

/* --- form satırı (yan yana alanlar) --- */

.form-satiri {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.form-satiri > div {
  flex: 1 1 160px;
}

.form-kutusu {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 1rem 1.25rem 1.25rem;
  margin-bottom: 1.5rem;
}

.form-kutusu h2 {
  font-size: 1rem;
  margin: 0 0 0.25rem;
}

button.ikincil {
  margin-top: 1.5rem;
  padding: 0.6rem 1rem;
  background: #fff;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

/* --- tablo --- */

table.veri-tablosu {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.veri-tablosu th,
table.veri-tablosu td {
  text-align: center;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid #e5e7eb;
}

table.veri-tablosu th {
  color: #6b7280;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
}

table.veri-tablosu tr.pasif-satir {
  opacity: 0.5;
}

table.veri-tablosu .eylemler {
  display: flex;
  gap: 0.4rem;
  white-space: nowrap;
}

/* --- kaydırınca sabit kalan başlık + başa dön tuşu --- */
/* Genel sayfa kaydırmasına göre çalışır — tabloyu ayrı bir kutuya
   hapsetmez, thead sayfanın üstüne yapışır. */

table.veri-tablosu.sabit-baslikli thead {
  position: sticky;
  top: 0;
  z-index: 5;
}

table.veri-tablosu.sabit-baslikli thead th {
  background: #fff;
}

.yukari-cik {
  display: none;
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid #d1d5db;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  font-size: 1.2rem;
  color: #374151;
  z-index: 10;
}

.yukari-cik:hover {
  background: #f3f4f6;
}

.yukari-cik.gorunur {
  display: flex;
}

table.veri-tablosu .eylemler form {
  display: inline;
}

.mini-buton {
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  border: 1px solid #d1d5db;
  background: #fff;
  cursor: pointer;
  text-decoration: none;
  color: #374151;
}

.mini-buton:hover {
  background: #f3f4f6;
}

.arama-filtre {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: flex-end;
}

.arama-filtre > div {
  flex: 1 1 200px;
}

.arama-filtre button {
  padding: 0.5rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

button.gonder {
  margin-top: 1.5rem;
  width: 100%;
  padding: 0.6rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
}

button.gonder:hover {
  background: #1d4ed8;
}

.hata {
  background: #fee2e2;
  color: #991b1b;
  padding: 0.6rem 0.8rem;
  border-radius: 4px;
  font-size: 0.9rem;
  margin-top: 1rem;
}

.rozet {
  display: inline-block;
  background: #e5e7eb;
  color: #374151;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
}

.sari-etiket {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

/* Kalıp listesinde tek bir modele süzüldüğünü gösteren rozet. */
.model-rozeti {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #eef2ff;
  color: #3730a3;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
}

.model-rozeti a {
  color: #6366f1;
  text-decoration: none;
  font-size: 1rem;
  line-height: 1;
}

/* Kalıp Kartı özet bölümündeki "Kalıp Bilgileri" / "Model Bilgileri". */
.ozet-baslik {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 0.9rem;
}

/* Taraf bazlı alanların A/B sütunlu özet tablosu (Kalıp Kartı). */
.taraf-tablosu {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 1rem;
}

.taraf-tablosu th,
.taraf-tablosu td {
  padding: 0.35rem 0.5rem;
  text-align: center;
}

.taraf-tablosu thead th {
  font-size: 0.75rem;
  color: #6b7280;
  border-bottom: 1px solid #e5e7eb;
}

.taraf-tablosu td:first-child,
.taraf-tablosu th:first-child {
  text-align: left;
  padding-left: 0;
  color: #6b7280;
}

.taraf-tablosu .taraf-grup-basi td {
  border-top: 1px solid #e5e7eb;
}

/* Konum ve Teflon hücrelerinin altındaki küçük açıklama satırı. */
.hucre-alt-satir {
  font-size: 0.8rem;
  color: #6b7280;
}

/* Çiftli kalıplarda taraf bazlı hücrelerin A/B işareti. */
.taraf-etiketi {
  color: #9ca3af;
  font-size: 0.75rem;
}

/* Sarı hücre yalnızca Matris'te kullanılır (bkz. PROJE.md §6.6) — kalıp
   listesi ve kartında ölçü hücreleri boyanmaz. */
.sari-hucre {
  background: #fef3c7 !important;
}

.numara-sutunu {
  border-left: 1px solid #e5e7eb;
}

.numara-son {
  border-right: 1px solid #e5e7eb;
}

table.veri-tablosu tr.aktif-grup th {
  color: #111827;
  font-weight: 700;
}

/* --- kayıtlar akışı --- */

.kayit-akisi {
  list-style: none;
  margin: 0;
  padding: 0;
}

.kayit-satiri {
  padding: 0.6rem 0;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.9rem;
}

.kayit-satiri .kayit-ust {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #6b7280;
  font-size: 0.8rem;
  margin-bottom: 0.2rem;
}

.kayit-kaynak {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
}

.kayit-kaynak.otomatik {
  background: #eef2ff;
  color: #4338ca;
}

.kayit-kaynak.manuel {
  background: #ecfdf5;
  color: #047857;
}

.kayit-detay {
  margin-top: 0.4rem;
  padding: 0.5rem 0.75rem;
  background: #f9fafb;
  border-radius: 4px;
  font-size: 0.8rem;
}

textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-family: inherit;
  font-size: 1rem;
  box-sizing: border-box;
  min-height: 4rem;
}

/* --- görüntüleme / düzenleme penceresi --- */

[x-cloak] {
  display: none !important;
}

.gorunum-baslik {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.gorunum-eylemler {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.bilgi-izgara {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.9rem 1.5rem;
  padding: 1rem 0;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 1.25rem;
}

.bilgi-izgara .etiket {
  font-size: 0.75rem;
  color: #6b7280;
  margin: 0 0 0.15rem;
}

.bilgi-izgara .deger {
  font-size: 0.9rem;
  margin: 0;
}

.model-ozet {
  display: flex;
  gap: 1.5rem;
  padding: 1rem 0;
  margin-bottom: 1.25rem;
}

.model-ozet-sol {
  flex: 2;
}

.model-ozet-sag {
  flex: 1;
  border-left: 1px solid #e5e7eb;
  padding-left: 1.5rem;
}

.model-ozet-kalip {
  flex: 2;
}

.model-ozet-model {
  flex: 3;
  border-left: 1px solid #e5e7eb;
  padding-left: 1.5rem;
}

.model-ozet-satir {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 0.9rem;
}

.model-ozet-satir:last-child {
  margin-bottom: 0;
}

.model-ozet-satir > div {
  flex: 1;
  min-width: 150px;
}

.model-ozet .etiket {
  font-size: 0.75rem;
  color: #6b7280;
  margin: 0 0 0.15rem;
}

.model-ozet .deger {
  font-size: 0.9rem;
  margin: 0;
}

.eklenti-satiri {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e5e7eb;
  gap: 0.5rem;
}

.eklenti-satiri:last-child {
  border-bottom: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1rem;
  overflow-y: auto;
  z-index: 50;
}

.modal-kutu {
  background: #fff;
  border-radius: 8px;
  width: 100%;
  max-width: 640px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.modal-baslik {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.modal-baslik h2 {
  margin: 0;
}

.modal-kapat {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  color: #6b7280;
  padding: 0.25rem;
}

.modal-alt {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.modal-alt .mini-buton,
.modal-alt button.gonder {
  margin: 0;
  width: auto;
  padding: 0.5rem 1.1rem;
  font-size: 0.9rem;
  line-height: 1.2;
  border-radius: 4px;
}

/* --- ince üst şerit (arama + toggle çipler) --- */

.ince-serit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.ince-serit input[type="search"] {
  width: auto;
  min-width: 220px;
  flex: 0 1 260px;
}

.ince-serit label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.85rem;
  font-weight: 400;
  white-space: nowrap;
}

.ince-serit label input[type="checkbox"] {
  width: auto;
}

.ince-serit button.gonder {
  width: auto;
  margin-top: 0;
  padding: 0.5rem 1rem;
}

/* --- sütun başlığı: sıralama + filtre menüsü --- */

table.veri-tablosu th.sutun-basligi {
  padding: 0;
  position: relative;
}

.th-inner {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.6rem;
  min-height: 2.2rem;
}

.th-inner span {
  color: #6b7280;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  white-space: normal;
  line-height: 1.2;
  min-width: 0;
}

.th-inner.aktif-sirali span {
  color: #2563eb;
}

.th-btn {
  border: none;
  background: transparent;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  cursor: pointer;
  color: #9ca3af;
  font-size: 0.75rem;
  line-height: 1;
}

.th-btn:hover {
  background: #e5e7eb;
  color: #374151;
}

.th-btn.filtreli {
  color: #2563eb;
}

.sutun-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 2px;
  width: 230px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  padding: 0.5rem;
  z-index: 30;
  text-transform: none;
  font-weight: 400;
}

.sutun-menu.gorunur {
  display: block;
}

.sutun-menu .menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 0.4rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #1f2328;
}

.sutun-menu .menu-item:hover {
  background: #f3f4f6;
}

.sutun-menu .menu-item.etkin {
  color: #2563eb;
  font-weight: 600;
}

.sutun-menu .menu-sep {
  height: 1px;
  background: #e5e7eb;
  margin: 0.4rem 0.2rem;
}

.sutun-menu .menu-ara,
.sutun-menu .menu-metin {
  width: 100%;
  box-sizing: border-box;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.sutun-menu .menu-linkler {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  padding: 0 0.2rem 0.4rem;
  font-size: 0.75rem;
}

.sutun-menu .link-buton {
  border: none;
  background: transparent;
  color: #2563eb;
  font-size: 0.75rem;
  padding: 0;
  cursor: pointer;
}

.sutun-menu .menu-liste {
  max-height: 150px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0 0.2rem;
}

.sutun-menu .menu-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #1f2328;
  padding: 0.2rem 0.3rem;
  border-radius: 4px;
  cursor: pointer;
  margin: 0;
  font-weight: 400;
  text-transform: none;
}

.sutun-menu .menu-check:hover {
  background: #f3f4f6;
}

.sutun-menu .menu-check input {
  width: auto;
}

.sutun-menu .menu-alt {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  margin-top: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px solid #e5e7eb;
}

.sutun-menu .menu-temizle {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  font-size: 0.78rem;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
}

.sutun-menu .menu-tamam {
  border: 1px solid #2563eb;
  background: #2563eb;
  color: #fff;
  font-size: 0.78rem;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
}
