:root {
  --navy: #0d3b66;
  --navy-2: #123f6b;
  --navy-light: #1d5288;
  --ink: #1c2733;
  --muted: #56708a;
  --muted-2: #8aa0b5;
  --line: #e4ebf2;
  --bg: #eef2f7;
  --paper: #fff;
  --gold: #f4d35e;
  --green: #1e7a33;
  --green-bg: #d3f3d8;
  --red: #b3261e;
  --red-bg: #fbd5d0;
  --orange: #a34a00;
  --orange-bg: #ffe0c2;
  --purple: #5b2da0;
  --purple-bg: #e7dbfb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(13,59,102,.06), 0 6px 16px -8px rgba(13,59,102,.18);
  --shadow-sm: 0 1px 2px rgba(13,59,102,.08);
  --gap: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: "Segoe UI", system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased; line-height: 1.45; }

/* ---------------------------------------------------------------- Uygulama iskeleti: sol menü + içerik --- */
.shell { display: flex; align-items: flex-start; min-height: 100vh; }

.sidebar { width: 258px; flex: 0 0 258px; min-height: 100vh; position: sticky; top: 0; align-self: flex-start;
  background: linear-gradient(180deg, var(--navy-2), #0a2e50); color: #fff; padding: 18px 0 16px;
  display: flex; flex-direction: column; box-shadow: 2px 0 14px rgba(6,26,46,.18); z-index: 20; }
.sidebar .brand { font-weight: 700; font-size: 15px; letter-spacing: .2px; padding: 4px 20px 16px; display: flex;
  align-items: center; gap: 8px; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 8px; }
.sidebar .brand span { line-height: 1.25; }
.sidebar nav { flex: 1; overflow-y: auto; }
.nav-grup { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: #8fb3d4;
  padding: 14px 20px 6px; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; color: #cfe3f7; text-decoration: none; padding: 8px 20px;
  font-size: 13.5px; transition: background .12s ease, color .12s ease; border-left: 3px solid transparent; }
.sidebar nav a .ikon { font-size: 14px; width: 18px; text-align: center; opacity: .9; }
.sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar nav a.aktif { background: rgba(244,211,94,.14); color: var(--gold); font-weight: 700; border-left-color: var(--gold); }
.sidebar-bot { display: flex; align-items: center; gap: 10px; color: #9fc6ec; text-decoration: none; font-size: 12.5px;
  padding: 12px 20px 4px; margin-top: 8px; border-top: 1px solid rgba(255,255,255,.1); padding-top: 14px; }
.sidebar-bot:hover { color: #fff; }
.sidebar-kullanici { display: flex; align-items: center; gap: 8px; color: #cfe3f7; font-size: 12.5px; padding: 10px 20px 2px; }
.sidebar-kullanici .ikon { font-size: 13px; opacity: .85; }
.sidebar-kullanici a { margin-left: auto; color: #9fc6ec; text-decoration: none; font-weight: 600; font-size: 12px; }
.sidebar-kullanici a:hover { color: #fff; text-decoration: underline; }

.content { flex: 1; min-width: 0; }
main { max-width: 1320px; margin: 0 auto; padding: 26px 28px 60px; }
/* Sayfadaki üst üste dizilmiş panel/kart/tablo bloklarına tutarlı, nefes alan bir ritim verir
   (tek tek her sayfayı değiştirmeye gerek kalmadan — komşu kardeşler arasında boşluk). */
main > * + * { margin-top: var(--gap); }

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex: 0 0 auto; min-height: auto; position: static; flex-direction: row; align-items: center;
    padding: 10px 12px; gap: 4px; overflow-x: auto; }
  .sidebar .brand { border-bottom: 0; margin-bottom: 0; padding: 4px 10px; white-space: nowrap; }
  .sidebar nav { display: flex; flex: none; overflow-x: auto; }
  .nav-grup { display: none; }
  .sidebar nav a { border-left: 0; border-bottom: 3px solid transparent; white-space: nowrap; padding: 8px 12px; }
  .sidebar nav a.aktif { border-left-color: transparent; border-bottom-color: var(--gold); }
  .sidebar-bot { border-top: 0; margin-top: 0; padding: 4px 10px; white-space: nowrap; }
  .sidebar-kullanici { border-top: 0; margin-top: 0; padding: 4px 10px; white-space: nowrap; }
  main { padding: 20px 16px 40px; }
}

/* --- Küçük ekran (telefon) inceltmeleri: genişçe tablolar yatay kaydırılabilir, dar sığmayan
   filtre/işlem satırları alt alta diziliyor. HTML'e dokunmadan, mevcut sınıflara ek kural. --- */
@media (max-width: 640px) {
  h1 { font-size: 19px; }
  main { padding: 16px 12px 34px; }
  .kartlar { grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 10px; }
  .kart { padding: 12px 14px; }
  .kart .sayi { font-size: 21px; }
  table.liste, table.alt { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  .filtre { flex-direction: column; align-items: stretch; }
  .filtre > div { min-width: 0; }
  .sevk-islem { flex-direction: column; align-items: stretch; }
  .sevk-islem .giris { min-width: 0; width: 100%; }
  .btn { width: 100%; text-align: center; }
  form.satir .btn, table .btn, .kartlar .btn { width: auto; }
}

h1 { font-size: 22px; margin: 4px 0 4px; font-weight: 700; letter-spacing: -.2px; color: var(--navy); }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 700; color: var(--navy); display: flex; align-items: center; gap: 8px; }
footer { text-align: center; color: var(--muted-2); font-size: 12px; padding: 26px 0 10px; margin-top: 40px; }

.kartlar { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kart { background: var(--paper); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm);
  border-top: 3px solid #ccc; transition: box-shadow .18s ease, transform .18s ease; }
.kart:hover { box-shadow: var(--shadow); }
.kartlar .kart:has(a):hover { transform: translateY(-1px); }
.kart .sayi { font-size: 26px; font-weight: 700; margin-top: 2px; letter-spacing: -.3px; }
.kart .kg { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.kart > div:first-child { font-size: 12.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.kart a { text-decoration: none; color: inherit; display: block; }

/* Kompakt tek satırlık özet çubuğu — bir dizi büyük .kart yerine (çok fazla ayrı kutu birikmesin diye,
   bkz. "dashboard karışık" geri bildirimi, 2026-10-01). Toolbar panelin üst kısmına konur. */
.stat-cubuk { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; font-size: 13.5px; }
.stat-cubuk b { color: var(--navy); }
.stat-cubuk .ayrac { color: var(--line); margin: 0 12px; }
.stat-cubuk a { color: inherit; text-decoration: none; }
.stat-cubuk a:hover { text-decoration: underline; }
.stat-cubuk .vurgu-kirmizi { color: #b3261e; font-weight: 600; }
.stat-cubuk .vurgu-kirmizi b { color: #b3261e; }
.stat-cubuk details { margin-left: auto; font-size: 12.5px; }
.stat-cubuk details summary { cursor: pointer; color: var(--muted); }

/* Sessiz durum noktası — büyük renkli rozet yerine (satır başına görsel gürültüyü azaltmak için,
   bkz. "dashboard/liste karışık" geri bildirimi, 2026-10-01). */
.durum-nokta { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.durum-nokta::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.durum-nokta.ok { color: var(--green); }
.durum-nokta.yok { color: #b3261e; font-weight: 600; }
.durum-nokta.bilinmiyor { color: var(--muted-2); }

/* Satırın birincil (her zaman görünen) bölümünü sade tutmak için ikincil bilgiler (plaka/şoför/
   lot/not/fabrika/kaynak) küçük, tek satırlık, düşük kontrastlı bir meta çizgisine toplanır. */
.meta-satir { color: var(--muted-2); font-size: 12px; margin-top: 2px; }
.meta-satir span + span::before { content: '·'; margin: 0 6px; color: var(--line); }

table.liste { width: 100%; border-collapse: collapse; background: var(--paper); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); font-size: 13.5px; }
table.liste th { background: var(--navy); color: #fff; text-align: left; padding: 10px 12px; font-weight: 600; white-space: nowrap;
  font-size: 12.5px; letter-spacing: .2px; }
table.liste td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: top; }
table.liste tbody tr:nth-child(even) td { background: #fafcfe; }
table.liste tr:hover td { background: #eef4fb; }
table.liste tr.gecikmis td { background: #fff3f0; }
table.liste tfoot td { font-weight: 700; background: #eef3f8; }
.sag { text-align: right; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap;
  letter-spacing: .2px; }
.d-bekleyen { background: #fde9c8; color: #8a5a00; }
.d-uretimde { background: #cfe3fb; color: #0b4f9e; }
.d-hazir    { background: var(--green-bg); color: var(--green); }
.d-arac     { background: var(--purple-bg); color: var(--purple); }
.d-yukleme  { background: var(--orange-bg); color: var(--orange); }
.d-sevk     { background: #d6dde4; color: #33424f; }
.d-aktif      { background: #cfe3fb; color: #0b4f9e; }
.d-tamamlandi { background: var(--green-bg); color: var(--green); }
.d-iptal      { background: var(--red-bg); color: #9e2516; }
.d-yem1       { background: #cfe3fb; color: #0b4f9e; }
.d-yem2       { background: var(--purple-bg); color: var(--purple); }
.d-bilinmiyor { background: #e9edf2; color: var(--muted); }

/* --- Bağlantılar (tedarikçi kontenjanı) --- */
.ilerleme { background: #e4ebf2; border-radius: 6px; height: 10px; width: 120px; overflow: hidden; }
.ilerleme-dolu { background: var(--navy); height: 100%; border-radius: 6px 0 0 6px; transition: width .3s ease; }
.vade-yakin  { color: var(--orange); font-weight: 700; }
.vade-gecmis { color: var(--red); font-weight: 700; }

.flash { padding: 11px 16px; border-radius: var(--radius-sm); margin: 0; font-size: 13.5px; font-weight: 600;
  border-left: 4px solid transparent; box-shadow: var(--shadow-sm); }
.flash + .flash { margin-top: 8px; }
.flash-ok { background: var(--green-bg); color: var(--green); border-left-color: var(--green); }
.flash-hata { background: var(--red-bg); color: #9e2516; border-left-color: var(--red); }
.flash-bilgi { background: #cfe3fb; color: #0b4f9e; border-left-color: #0b4f9e; }

form.satir { display: inline; }
.btn { display: inline-block; border: 0; border-radius: var(--radius-sm); padding: 9px 16px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; text-decoration: none; background: var(--navy); color: #fff; box-shadow: var(--shadow-sm);
  transition: background .15s ease, transform .1s ease; }
.btn:hover { background: var(--navy-light); }
.btn:active { transform: translateY(1px); }
.btn-kucuk { padding: 5px 10px; font-size: 12px; box-shadow: none; }
.btn-yesil { background: var(--green); } .btn-yesil:hover { background: #2b9445; }
.btn-gri { background: #6c8198; } .btn-gri:hover { background: #87a0b8; }
.btn-kirmizi { background: var(--red); } .btn-kirmizi:hover { background: #d3392f; }

.panel { background: var(--paper); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.izgara2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .izgara2 { grid-template-columns: 1fr; } }

label { display: block; font-size: 12.5px; color: var(--muted); margin: 10px 0 4px; font-weight: 600; }
input[type=text], input[type=password], input[type=date], input[type=number], input[type=file], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #ccd7e2; border-radius: var(--radius-sm); font-size: 14px;
  font-family: inherit; background: var(--paper); color: var(--ink); transition: border-color .15s ease, box-shadow .15s ease; }
input[type=text]:focus, input[type=password]:focus, input[type=date]:focus, input[type=number]:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--navy-light); box-shadow: 0 0 0 3px rgba(29,82,136,.15); }
textarea { min-height: 220px; font-family: Consolas, monospace; font-size: 13px; }
.filtre { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; background: var(--paper);
  border-radius: var(--radius); padding: 14px 16px 16px; box-shadow: var(--shadow-sm); }
.filtre > div { min-width: 150px; }
.filtre label { margin-top: 0; }

details.kalemler summary { cursor: pointer; color: var(--navy-light); font-size: 12.5px; font-weight: 600; }
table.alt { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 12.5px; }
table.alt th { background: #eef3f8; padding: 5px 8px; text-align: left; }
table.alt td { padding: 5px 8px; border-top: 1px solid var(--line); }

.prompt-kutu { background: #0d2233; color: #cde7ff; border-radius: var(--radius-sm); padding: 14px; font-family: Consolas, monospace;
  font-size: 13px; white-space: pre-wrap; position: relative; }
.kopyala { position: absolute; top: 8px; right: 8px; }

.uyari { background: #fff8e1; border: 1px solid var(--gold); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; margin: 10px 0; }
.ok-yesil { color: var(--green); font-weight: 700; }
.ok-kirmizi { color: var(--red); font-weight: 700; }

/* --- Sevk Onay / Gelen Hammadde / Üretim Kaydı kartları --- */
.ipucu { color: var(--muted); font-size: 13px; }
.sevk-kart { border-top: 4px solid var(--gold); }
.sevk-ust { display: flex; flex-wrap: wrap; gap: 16px 28px; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.sevk-ust .etiket, .sevk-orta .etiket { display: block; font-size: 10.5px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
.sevk-ust b { font-size: 14.5px; }
.sevk-orta { padding: 0 0 10px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.eslesme { padding: 9px 11px; border-radius: var(--radius-sm); font-size: 13.5px; }
.eslesme-ok { background: #eef7f0; }
.eslesme-yok { background: #fff3f0; color: #9e2516; }
.eslesme a { color: var(--navy-light); text-decoration: none; font-weight: 600; }
.fark { font-weight: 700; padding: 1px 7px; border-radius: 10px; }
.fark-tam   { background: var(--green-bg); color: var(--green); }
.fark-eksik { background: #fbe2cf; color: var(--orange); }
.fark-fazla { background: var(--red-bg); color: #9e2516; }
table.sevk-kalem { margin: 6px 0 4px; }
.sevk-islem { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sevk-islem .giris { width: auto; min-width: 230px; }

/* --- Üretim Planlama matrisi --- */
.matris-sar { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); max-height: 78vh;
  box-shadow: var(--shadow-sm); }
table.matris { border-collapse: separate; border-spacing: 0; font-size: 12.5px; white-space: nowrap; }
table.matris th, table.matris td { padding: 5px 8px; border-bottom: 1px solid #e9eff5; border-right: 1px solid #eef3f8; vertical-align: middle; }
table.matris thead th { position: sticky; top: 0; z-index: 3; background: var(--navy); color: #fff; }
table.matris .sticky-sol { position: sticky; left: 0; z-index: 2; background: var(--paper); min-width: 210px; max-width: 240px;
  box-shadow: 2px 0 4px rgba(13,59,102,.06); }
table.matris thead .sticky-sol { z-index: 4; background: var(--navy); }
table.matris .urun-ad { overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
table.matris .urun-ad small { color: var(--muted-2); }
table.matris .mm-grup td, table.matris .mm-grup .sticky-sol { background: #163e63; color: #fff; font-weight: 700; }
table.matris .must { min-width: 96px; max-width: 110px; font-weight: 600; white-space: normal; }
table.matris .must-ad { font-size: 11px; line-height: 1.2; }
table.matris .must-kg { font-size: 10px; color: #bcd4ec; font-weight: 400; }
table.matris input.hk { width: 78px; text-align: right; padding: 4px 6px; border: 1px solid #ccd7e2; border-radius: 5px; font-size: 12px; }
table.matris .hucre { width: 70px; background: #fcfdff; }
table.matris select.sel-durum { width: 88px; }
table.matris .amb { font-size: 10px; color: #7a93a8; font-weight: 600; margin-top: 1px; }
.amb { font-size: 10px; color: #7a93a8; font-weight: 600; }

/* Hücre bazlı "hazır" (paketlendi) işareti — Excel'deki tek tek yeşil hücrelerle aynı mantık:
   çift tıkla işaretle/kaldır, tek görünen fark hücrenin rengi (Excel'de de sadece renk vardı,
   ekstra bir buton/kutu yoktu — burada da öyle, tıklanabilir olduğu ipucu title'da). */
table.matris td.hucre-hazir .hucre { background: #d3f3d8; }
table.matris td.hucre-td { cursor: pointer; }

/* Satır silme ikonu: sadece satırın üstüne gelince görünür — Excel'de olmayan, nadir kullanılan
   bir yönetim aksiyonu olduğu için her zaman göze batmasın istendi. */
.satir-sil-ikon { border: 0; background: none; color: var(--muted-2); font-size: 12px; cursor: pointer;
  opacity: 0; padding: 0 2px; margin-left: 4px; float: right; }
tr:hover .satir-sil-ikon { opacity: 1; }
.satir-sil-ikon:hover { color: var(--red); }

/* Stok Detay tablosu */
table.stok-detay { border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.stok-detay th, table.stok-detay td { padding: 6px 9px; border-bottom: 1px solid #e9eff5; }
table.stok-detay thead th { position: sticky; top: 0; z-index: 3; background: var(--navy); color: #fff; }
table.stok-detay .sticky-sol { position: sticky; left: 0; z-index: 2; background: var(--paper); min-width: 230px; box-shadow: 2px 0 4px rgba(13,59,102,.06); }
table.stok-detay thead .sticky-sol { z-index: 4; background: var(--navy); }
table.stok-detay .mm-grup .sticky-sol, table.stok-detay .mm-grup td { background: #163e63; color: #fff; font-weight: 700; }
table.stok-detay tfoot td { position: sticky; bottom: 0; background: #eef3f8; font-weight: 700; }
table.stok-detay .inp-not { width: 180px; padding: 4px 7px; }
table.matris select.hk { padding: 4px 4px; font-size: 12px; }
table.matris tr.satir-eksik .sticky-sol, table.matris tr.satir-eksik .sip-h, table.matris tr.satir-eksik .stok-h { background: #fff3f0; }
table.matris tr.satir-eksik td { background: #fff7f5; }
table.matris tr.satir-hazir .sticky-sol { background: #e3f3e8; }
table.matris tr.satir-hazir td { background: #eef9f1; }
table.matris .footer-dagitim td, table.matris .footer-dagitim .sticky-sol { position: sticky; bottom: 0; background: #eef3f8; font-weight: 700; z-index: 2; }
.fark { font-weight: 700; }
.f-tam { color: var(--green); } .f-eksik { color: var(--red); } .f-fazla { color: #0b4f9e; }
.kayit-not { position: fixed; bottom: 18px; right: 18px; background: var(--paper); padding: 9px 15px;
  border-radius: var(--radius-sm); box-shadow: 0 4px 16px rgba(13,59,102,.28); font-size: 13px; font-weight: 600; z-index: 30; }

/* Kaynak fotoğraf paneli — sayfadan çıkmadan (yeni sekme YOK) sağda açılıp karşılaştırma/büyütme için */
.kucuk-resim { cursor: zoom-in; border-radius: 6px; border: 1px solid var(--line); object-fit: cover; }
.resim-arkaplan { position: fixed; inset: 0; background: rgba(13,20,30,.55); z-index: 998; opacity: 0; pointer-events: none; transition: opacity .18s ease; }
.resim-arkaplan.acik { opacity: 1; pointer-events: auto; }
.resim-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(52vw, 760px); max-width: 96vw;
  background: var(--paper); box-shadow: -10px 0 34px rgba(13,59,102,.35); z-index: 999;
  transform: translateX(100%); transition: transform .2s ease; display: flex; flex-direction: column; }
.resim-panel.acik { transform: translateX(0); }
.resim-panel-ust { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); flex: none; }
.resim-panel-ust b { font-size: 14px; }
.resim-panel-kapat { background: none; border: none; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1; padding: 4px 8px; }
.resim-panel-kapat:hover { color: var(--ink); }
.resim-panel-govde { flex: 1; overflow: auto; padding: 16px; background: var(--bg); text-align: center; }
.resim-panel-govde img { max-width: 100%; border-radius: 8px; box-shadow: var(--shadow); cursor: zoom-in; }
.resim-panel-govde img.buyuk { max-width: none; width: 170%; cursor: zoom-out; }
.resim-panel-ipucu { padding: 8px 18px; font-size: 11.5px; color: var(--muted-2); border-top: 1px solid var(--line); flex: none; }
