:root {
  --etsan-red: #c8102e;
  --etsan-dark: #8f0b20;
}
body { background: #f4f5f7; }
.bg-etsan { background: linear-gradient(90deg, var(--etsan-red), var(--etsan-dark)); }
.brand-logo { display: block; height: 30px; width: auto; margin-right: 8px; }
/* "Rapor" yazısının tabanı logodaki ETSAN harflerinin tabanıyla aynı hizada (harfler logo yüksekliğinin ~%90'ında biter) */
.navbar-brand .brand-text { align-self: flex-end; line-height: 1; margin-bottom: calc(30px * .103 - .2em + 1px); }
@media (min-width: 992px) { .navbar-brand .brand-text { margin-bottom: calc(40px * .103 - .2em + 1px); } }
@media (min-width: 992px) { .navbar-brand { padding-top: 0; padding-bottom: 0; font-size: 1.6rem; } .brand-logo { height: 40px; margin-right: 10px; } }
.btn-etsan { background: var(--etsan-red); color: #fff; border-color: var(--etsan-red); }
.btn-etsan:hover { background: var(--etsan-dark); color: #fff; }

.sidebar { width: 250px; flex: 0 0 250px; min-height: calc(100vh - 56px); }
@media (min-width: 992px) { .sidebar { position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; } }
.sidebar .nav-link { color: #333; padding: .45rem 1rem; border-left: 3px solid transparent; font-size: .93rem; }
.sidebar .nav-link i { width: 1.4rem; display: inline-block; color: #777; }
/* kendi çizdiğimiz menü simgeleri (üzüm, inek): Bootstrap Icons ile aynı boyut ve hizada */
.nav-svg { width: 1.15em; height: 1.15em; vertical-align: -.2em; }
.sidebar .nav-link .nav-svg { width: 1.15rem; margin-right: .25rem; color: #777; }
.sidebar .nav-link.active .nav-svg { color: var(--etsan-red); }
.sidebar .nav-link:hover { background: #f1f1f1; }
.sidebar .nav-link.active { background: #fdecef; border-left-color: var(--etsan-red); color: var(--etsan-red); font-weight: 600; }
.sidebar .nav-link.active i { color: var(--etsan-red); }
.sidebar .nav-header { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #999; padding: .9rem 1rem .25rem; }
.main-content { min-width: 0; }

.card { border: 0; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.card-header { background: #fff; font-weight: 600; }
.kpi-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.table-sm td, .table-sm th { vertical-align: middle; }
.table thead th { font-size: .8rem; text-transform: uppercase; color: #666; white-space: nowrap; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-danger td { background: #fff1f1 !important; }
.row-warning td { background: #fff9e6 !important; }
.row-band-green td { background: #c3ecce !important; }
.row-band-yellow td { background: #f8f3e8 !important; }
.row-band-red td { background: #ffc4c4 !important; }
.row-band-green td:first-child { box-shadow: inset 5px 0 0 #1f9d55; }
.row-band-yellow td:first-child { box-shadow: inset 5px 0 0 #e3d3b0; }
.row-band-red td:first-child { box-shadow: inset 5px 0 0 #c8102e; }
.band-pill { display: inline-block; padding: .1rem .45rem; border-radius: .35rem; color: #fff; font-weight: 600; }
.band-pill-green { background: #1f9d55; }
.band-pill-yellow { background: #ece2cc; color: #4a3d24; }
.band-pill-red { background: #c8102e; }
.filter-bar { background: #fff; border-radius: .5rem; padding: .75rem; box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 1rem; }
.risk-badge { min-width: 2.4rem; }
.price-up { color: #c8102e; font-weight: 600; }
.price-down { color: #198754; font-weight: 600; }
.heat-cell { text-align: center; font-size: .8rem; }
.login-card { max-width: 420px; }
.demo-users code { cursor: pointer; }

/* Tablet takas paneli */
body.bare { background: #1b1d21; color: #eee; }
.tablet-head { background: var(--etsan-red); color: #fff; border-radius: .75rem; padding: .75rem 1rem; }
.tablet-card { background: #2a2d33; border-radius: .9rem; padding: 1rem; margin-bottom: .8rem; border-left: 8px solid #555; }
.tablet-card.urgent { border-left-color: #ff3b3b; animation: pulse 1.5s infinite; }
.tablet-card.normal { border-left-color: #f0b400; }
.tablet-card.mine { border-left-color: #3b8cff; }
.tablet-card .big { font-size: 1.6rem; font-weight: 700; }
.tablet-btn { font-size: 1.25rem; padding: .8rem 1.2rem; border-radius: .7rem; }
.quick-req { font-size: 1.1rem; padding: 1rem; border-radius: .8rem; width: 100%; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,59,59,.5); } 50% { box-shadow: 0 0 0 10px rgba(255,59,59,0); } }
.login-logo { display: inline-block; height: 80px; width: auto; max-width: 100%; }
@media (min-width: 992px) { .login-logo { height: 110px; } }

/* Sıralanabilir tablo başlıkları (app.js) */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--bs-link-color); }
th.sortable::after { content: ' ⇅'; opacity: .35; font-size: .85em; }
th.sortable[data-dir="asc"]::after { content: ' ▲'; opacity: 1; }
th.sortable[data-dir="desc"]::after { content: ' ▼'; opacity: 1; }

/* Excel yükleme: dosya türü etiketi (bölüm + veri türü), yanlış alana yüklemeyi önlemek için iri ve renkli */
.utype { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem; border-radius: .45rem; color: #fff; font-weight: 500; line-height: 1.2; white-space: nowrap; }
.utype-lg { font-size: 1.05rem; padding: .5rem .9rem; }
.utype-sm { font-size: .78rem; }
.utype-meat-report { background: #c8102e; }
.utype-og-report { background: #1f9d55; }
.utype-dry-report { background: #6f42c1; }
.utype-meat-count { background: #fff; color: #c8102e; border: 2px dashed #c8102e; }
.utype-og-count { background: #fff; color: #1f7a45; border: 2px dashed #1f9d55; }
.utype-yearly { background: #5a3e9b; }
.utype-skip { background: #f8d7da; color: #842029; border: 2px solid #842029; }
.utype-unknown { background: #6c757d; }
.upload-item.border-danger { background: #fff5f5; }

/* arka planda kaydedilen satır (istatistikten çıkarıldı / geri alındı) */
tr.row-done > td { opacity: .45; }
tr.row-done > td:last-child { opacity: 1; }

/* geniş sayı tabloları: sayılar tek satırda, adlar kırılabilir */
.table-nums-nowrap td.num, .table-nums-nowrap th.num { white-space: nowrap; }

/* Şube müdürü: telefonda uygulama gibi alt menü */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; display: flex; background: #fff; border-top: 1px solid #dee2e6;
  box-shadow: 0 -2px 8px rgba(0,0,0,.06); padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .45rem 0 .4rem; color: #666; text-decoration: none; font-size: .72rem; }
.bottom-nav a i { font-size: 1.35rem; line-height: 1; }
.bottom-nav a.active { color: var(--etsan-red); font-weight: 600; }
@media (max-width: 991.98px) {
  body.has-bottom-nav .main-content { padding-bottom: calc(5rem + env(safe-area-inset-bottom)) !important; }
  /* dokunmatik: giriş alanları ve düğmeler parmakla rahat basılsın; iOS'ta odaklanınca yakınlaştırmasın (16px) */
  body.has-bottom-nav .form-control, body.has-bottom-nav .form-select { font-size: 16px; min-height: 2.6rem; }
  body.has-bottom-nav .btn { min-height: 2.6rem; }
  body.has-bottom-nav .navbar-brand { font-size: 1.1rem; }
}
@media (max-width: 991.98px) { body.has-bottom-nav .main-content > p.text-muted { font-size: .85rem; } }
.nav-pills .nav-link.active { background: var(--etsan-red); border-color: var(--etsan-red) !important; }
.nav-pills .nav-link:not(.active) { color: #333; }

/* hedef renkleri (Yönetim → şube müdürleri): orta bant bej */
.tband-yellow { background: #f8f3e8 !important; color: #5c4b2c; }
/* katlanır açıklama */
.note-details > summary { cursor: pointer; list-style: none; color: var(--bs-secondary-color); user-select: none; }
.note-details > summary::-webkit-details-marker { display: none; }
.note-details > summary::after { content: ' ▸'; }
.note-details[open] > summary::after { content: ' ▾'; }
.note-details[open] > summary { margin-bottom: .35rem; }
/* telefonda grafik açıklaması: alt alta */
.chart-legend-stack { display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; margin-top: .4rem; font-size: .8rem; }
.chart-legend-stack .cls-item { display: flex; align-items: center; gap: .4rem; cursor: pointer; }
.chart-legend-stack .cls-box { width: 28px; height: 11px; border: 1px solid transparent; border-radius: 2px; flex: none; }
.chart-legend-stack .cls-hidden { text-decoration: line-through; opacity: .5; }
/* telefonda çok dönemli grafik: 6 dönem görünür, gerisi yana kaydırılır */
@media (max-width: 767.98px) {
  .chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .chart-scroll > div { min-width: calc(100% * max(var(--n, 6), 6) / 6); }
}

/* Yazdır / PDF (ör. Inspector raporu): yalnız içerik; menü, üst çubuk, süzgeç ve düğmeler basılmaz */
.print-only { display: none; }
@media print {
  .navbar, .sidebar, .filter-bar, .no-print, .alert-dismissible, .btn, .bottom-nav { display: none !important; }
  .print-only { display: block !important; }
  .note-details:not([open]) { display: none !important; }
  body, .main-content { background: #fff !important; }
  main.main-content { padding: 0 !important; }
  .card { break-inside: avoid; box-shadow: none !important; border: 1px solid #dee2e6 !important; }
  .table-responsive { max-height: none !important; overflow: visible !important; }
  .sticky-top { position: static !important; }
  a { color: inherit !important; text-decoration: none !important; }
  @page { size: A4 portrait; margin: 12mm; }
}
/* tablolarda şube: kod sabit genişlikte, adresler aynı noktadan başlar */
.mcode { display: inline-block; min-width: 3.2em; text-align: right; margin-right: .6em; font-weight: 600; }
/* sıralanabilir tablolarda sayı sütunları eşit genişlikte: başlık uzunluğu (KÂR % / Δ ÖNCEKİ) aralıkları bozmasın */
table[data-sortable] th.num { min-width: 7.5em; }
/* Kasap / Meyve Sebze / Kuru Gıda şube tablosu: Δ önceki değerleri (kısa içerik) ~0,8 cm içeride, başlık yerinde */
.col-delta { padding-right: 2rem !important; }
