/* ==========================================================================
   Corn DSS — tasarım değişkenleri
   Ana renk: petrol yeşili (teal). Nötrler: slate. Durum renkleri yumuşak zeminli.
   ========================================================================== */
:root {
  --brand-900: #134e4a;
  --brand-700: #0f766e;
  --brand-600: #0d9488;
  --brand-100: #ccfbf1;
  --brand-50:  #f0fdfa;

  --ink:     #0f172a;
  --ink-2:   #334155;
  --muted:   #64748b;
  --line:    #e2e8f0;
  --line-2:  #f1f5f9;
  --bg:      #f6f8fa;
  --surface: #ffffff;

  --ok:      #15803d; --ok-bg:     #dcfce7;
  --warn:    #b45309; --warn-bg:   #fef3c7;
  --danger:  #b91c1c; --danger-bg: #fee2e2;
  --info:    #1d4ed8; --info-bg:   #dbeafe;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --sidebar-w: 264px;

  /* Bootstrap'i aynı palete bağla */
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--bg);
  --bs-border-color: var(--line);
  --bs-link-color: var(--brand-700);
  --bs-link-color-rgb: 15, 118, 110;
  --bs-link-hover-color: var(--brand-900);
  --bs-link-hover-color-rgb: 19, 78, 74;
  --bs-secondary-color: var(--muted);
  --bs-focus-ring-color: rgba(13, 148, 136, .25);
}

body { background: var(--bg); color: var(--ink); font-size: .9375rem; -webkit-font-smoothing: antialiased; }
h1, h2, h3, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--ink); font-weight: 650; letter-spacing: -.01em; }
.text-muted { color: var(--muted) !important; }

/* --------------------------------------------------------------------------
   Kenar menüsü
   Bootstrap .offcanvas-lg geniş ekranda arka planı şeffaf yapar; bu yüzden !important.
   -------------------------------------------------------------------------- */
.sidebar {
  --bs-offcanvas-width: var(--sidebar-w);
  --bs-offcanvas-bg: var(--surface);
  background: var(--surface) !important;
  border-right: 1px solid var(--line);
  color: var(--ink-2);
}
@media (min-width: 992px) {
  .sidebar { width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); position: sticky; top: 0; height: 100vh; }
  .sidebar .offcanvas-body { flex-direction: column; flex-grow: 1; overflow-y: auto !important; }
}
.sidebar .offcanvas-body { display: flex; flex-direction: column; padding: 0; }

.brand {
  display: flex; align-items: center; gap: .75rem;
  padding: 1.25rem 1.25rem 1rem; text-decoration: none; color: var(--ink);
}
.brand:hover { color: var(--ink); }
.brand-logo { height: 42px; width: auto; flex: none; }
.topbar .brand-logo { height: 34px; }
.login-logo { height: 96px; width: auto; }
.brand-name { font-weight: 700; font-size: 1.05rem; line-height: 1.1; }
.brand-sub { font-size: .75rem; color: var(--muted); }

.side-nav { padding: .25rem .75rem 1rem; }
.side-nav .nav-section {
  font-size: .6875rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding: 1.1rem .75rem .4rem; display: flex; align-items: center; gap: .4rem;
}
.side-nav .nav-link {
  display: flex; align-items: center; gap: .65rem;
  color: var(--ink-2); font-weight: 500; padding: .5rem .75rem; border-radius: 8px;
  transition: background-color .12s, color .12s;
}
.side-nav .nav-link i { font-size: 1.05rem; color: var(--muted); width: 1.25rem; text-align: center; transition: color .12s; }
.side-nav .nav-link:hover { background: var(--line-2); color: var(--ink); }
.side-nav .nav-link:hover i { color: var(--ink-2); }
.side-nav .nav-link.active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand-600); }
.side-nav .nav-link.active i { color: var(--brand-600); }
.side-nav .nav-link.dev { color: var(--muted); }
/* Açılır menü grupları */
.side-nav .nav-group { width: 100%; border: 0; background: transparent; text-align: left; margin-top: .15rem; }
.side-nav .nav-group .chevron { margin-left: auto; font-size: .75rem; width: auto; transition: transform .15s; }
.side-nav .nav-group .nav-badge + .chevron { margin-left: .5rem; }
.side-nav .nav-group:not(.collapsed) .chevron { transform: rotate(180deg); }
.side-nav .nav-group:not(.collapsed) { color: var(--ink); }
.nav-sub { margin: .1rem 0 .35rem 1.1rem; padding-left: .5rem; border-left: 1px solid var(--line); }
.nav-sub .nav-link { padding: .4rem .65rem; font-size: .875rem; }
.nav-sub-label {
  font-size: .65rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding: .6rem .65rem .25rem;
}
.nav-badge {
  margin-left: auto; min-width: 1.4rem; padding: .05rem .45rem; border-radius: 999px; text-align: center;
  background: #f59e0b; color: #fff; font-size: .72rem; font-weight: 700; line-height: 1.5;
}

.user-box {
  margin: auto .75rem .75rem; padding: .75rem; border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; align-items: center; gap: .65rem; background: var(--bg);
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--brand-100); color: var(--brand-900); font-weight: 700; font-size: .9rem;
}
.user-box .name { font-weight: 600; font-size: .875rem; line-height: 1.2; }
.user-box .role { font-size: .75rem; color: var(--muted); }
.icon-btn { border: 0; background: transparent; color: var(--muted); padding: .35rem .45rem; border-radius: 8px; }
.icon-btn:hover { background: var(--line); color: var(--danger); }

/* Mobil üst çubuk */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); padding: .6rem 1rem; }
.topbar .brand { padding: 0; }

/* --------------------------------------------------------------------------
   İçerik
   -------------------------------------------------------------------------- */
.main { min-width: 0; padding: 1.25rem 1rem 2rem; }
@media (min-width: 992px) { .main { padding: 2rem 2.25rem 3rem; } }

.page-header { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.5rem; margin: 0; }
.page-header .sub { color: var(--muted); font-size: .875rem; margin-top: .2rem; }
/* Sayfa içindeki ana bölümler (ör. Genel bakış: Bugünkü satışlar, Depoların güncel durumu) */
.section-title { display: flex; align-items: center; gap: .5rem; margin: .25rem 0 .9rem; padding-bottom: .5rem; border-bottom: 1px solid var(--line, #e5e7eb); }
.section-title h2 { font-size: 1.0625rem; margin: 0; }
.section-title > i { color: var(--brand-700, #0f766e); font-size: 1.05rem; }
* + .section-title { margin-top: 1.75rem; }
.back-link { font-size: .8125rem; color: var(--muted); text-decoration: none; display: inline-flex; gap: .3rem; margin-bottom: .35rem; }
.back-link:hover { color: var(--brand-700); }

.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface); }
.card-footer { background: var(--surface); border-top: 1px solid var(--line-2); border-radius: 0 0 var(--radius) var(--radius) !important; }
.card-title-sm { font-size: .9375rem; font-weight: 600; margin-bottom: .75rem; display: flex; align-items: center; gap: .5rem; }

/* Depo kartları */
.wh-card .card-body { padding: 1.25rem; }
.wh-icon {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 1.1rem; flex: none;
  background: var(--brand-50); color: var(--brand-700);
}
.wh-icon.branch { background: var(--info-bg); color: var(--info); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: 1rem 0 .75rem; }
.stat { background: var(--bg); border-radius: 10px; padding: .65rem .75rem; }
.stat .v { font-size: 1.35rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { font-size: .75rem; color: var(--muted); }
.stat.ok .v { color: var(--ok); }
.stat.bad .v { color: var(--danger); }
.empty-state { color: var(--muted); font-size: .875rem; padding: 1rem 0 .5rem; display: flex; gap: .5rem; align-items: flex-start; }

/* Sekmeler (alt çizgili) */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap;
  padding: .65rem .9rem; color: var(--muted); font-weight: 500; text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--brand-700); border-bottom-color: var(--brand-600); font-weight: 600; }

/* Tablolar */
.table { --bs-table-bg: transparent; --bs-table-hover-bg: var(--line-2); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .6rem .75rem; border-bottom-color: var(--line-2); }
.table thead th {
  font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); background: var(--surface); border-bottom: 1px solid var(--line);
}
.table-sticky thead th { position: sticky; top: 0; z-index: 1; }
@media (max-width: 991.98px) { .table-sticky thead th { top: 57px; } }
.table td .brand-tag { display: block; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Satır durumları: tam boyalı satır yerine sol şerit + hafif zemin */
.table tr.row-danger > * { background: #fef6f6; }
.table tr.row-danger > td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.table tr.row-warn > * { background: #fffbeb; }
.table tr.row-warn > td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
.table tr.entered > * { background: var(--brand-50); }
.table tr.entered > td:first-child { box-shadow: inset 3px 0 0 var(--brand-600); }

/* Rozetler */
.chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 600; padding: .2rem .55rem; border-radius: 999px; line-height: 1.4; white-space: nowrap; }
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-danger { background: var(--danger-bg); color: var(--danger); }
.chip-info { background: var(--info-bg); color: var(--info); }
.chip-brand { background: var(--brand-50); color: var(--brand-700); }
.chip-neutral { background: var(--line-2); color: var(--ink-2); border: 1px solid var(--line); }
.unit { font-size: .72rem; font-weight: 600; color: var(--ink-2); background: var(--line-2); border: 1px solid var(--line); border-radius: 6px; padding: .1rem .4rem; }

/* Fark renkleri */
.diff-pos { color: var(--ok); font-weight: 600; }
.diff-neg { color: var(--danger); font-weight: 600; }

/* Butonlar ve formlar (Bootstrap success sınıflarını ana renge bağla) */
.btn { font-weight: 500; border-radius: 8px; }
.btn-success, .btn-primary {
  --bs-btn-bg: var(--brand-700); --bs-btn-border-color: var(--brand-700);
  --bs-btn-hover-bg: var(--brand-900); --bs-btn-hover-border-color: var(--brand-900);
  --bs-btn-active-bg: var(--brand-900); --bs-btn-active-border-color: var(--brand-900);
  --bs-btn-disabled-bg: var(--brand-600); --bs-btn-disabled-border-color: var(--brand-600);
}
.btn-outline-success {
  --bs-btn-color: var(--brand-700); --bs-btn-border-color: var(--line); --bs-btn-bg: var(--surface);
  --bs-btn-hover-color: var(--brand-900); --bs-btn-hover-bg: var(--brand-50); --bs-btn-hover-border-color: var(--brand-100);
  --bs-btn-active-color: var(--brand-900); --bs-btn-active-bg: var(--brand-100); --bs-btn-active-border-color: var(--brand-100);
}
.btn-outline-secondary {
  --bs-btn-color: var(--ink-2); --bs-btn-border-color: var(--line); --bs-btn-bg: var(--surface);
  --bs-btn-hover-color: var(--ink); --bs-btn-hover-bg: var(--line-2); --bs-btn-hover-border-color: var(--line);
}
.btn-warning { --bs-btn-bg: #f59e0b; --bs-btn-border-color: #f59e0b; --bs-btn-color: #fff; --bs-btn-hover-bg: #d97706; --bs-btn-hover-border-color: #d97706; --bs-btn-hover-color: #fff; }
.form-control, .form-select { border-color: var(--line); border-radius: 8px; }
.form-control:focus, .form-select:focus { border-color: var(--brand-600); box-shadow: 0 0 0 3px rgba(13, 148, 136, .15); }
.form-check-input:checked { background-color: var(--brand-700); border-color: var(--brand-700); }
.form-label { font-weight: 500; font-size: .875rem; color: var(--ink-2); }
.search-input { position: relative; }
.search-input i { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-input input { padding-left: 2.25rem; }
.filter-sum { background: var(--line-2, #f1f5f9); border-radius: .5rem; padding: .4rem .75rem; }
.qty-input { max-width: 120px; text-align: right; font-size: 1rem; font-variant-numeric: tabular-nums; }

/* Uyarılar */
.alert { border: 0; border-radius: var(--radius); font-size: .9rem; }
.alert-success { background: var(--ok-bg); color: #14532d; }
.alert-warning { background: var(--warn-bg); color: #78350f; }
.alert-danger  { background: var(--danger-bg); color: #7f1d1d; }
.alert-info    { background: var(--info-bg); color: #1e3a8a; }
.alert-secondary, .alert-light { background: var(--line-2); color: var(--ink-2); border: 1px solid var(--line); }

/* Sayım kaydet çubuğu */
.save-bar {
  position: sticky; bottom: 0; z-index: 5; margin-top: 1rem; padding: .75rem 1rem;
  background: rgba(255, 255, 255, .95); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 -4px 16px rgba(15, 23, 42, .06);
}
.progress-slim { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; min-width: 140px; }
.progress-slim > div { height: 100%; background: var(--brand-600); transition: width .2s; }

/* Yapım aşamasında modülleri */
.module-hero { display: flex; gap: 1rem; align-items: flex-start; }
.module-hero .wh-icon { width: 48px; height: 48px; font-size: 1.35rem; }
.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: .75rem; padding: .65rem 0; border-bottom: 1px solid var(--line-2); }
.steps li:last-child { border-bottom: 0; }
.steps li::before {
  content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: .8rem; font-weight: 600; background: var(--brand-50); color: var(--brand-700);
}

/* Giriş ekranı */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 1rem;
  background: radial-gradient(1200px 600px at 10% -10%, var(--brand-100), transparent 60%),
              radial-gradient(900px 500px at 110% 110%, #e0f2fe, transparent 60%), var(--bg);
}
.login-card { width: 100%; max-width: 400px; padding: 2rem; }

/* Transfer akışı: kaynak → hedef */
.route { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.route .arrow { color: var(--muted); }
.qty-changed { text-decoration: line-through; color: var(--muted); font-weight: 400; margin-right: .35rem; }

/* --------------------------------------------------------------------------
   Satış raporları
   -------------------------------------------------------------------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .75rem; }
@media (max-width: 1199.98px) { .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi .card-body { padding: .9rem 1rem; }
.kpi .label { font-size: .75rem; color: var(--muted); font-weight: 500; display: flex; gap: .35rem; align-items: center; }
.kpi .v { font-size: 1.35rem; font-weight: 700; line-height: 1.2; margin: .2rem 0 .15rem; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.quick-range { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: .2rem .7rem; }
.quick-range:hover { background: var(--line-2); }
.quick-range.active { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-700); font-weight: 600; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--line-2); }
.seg label { padding: .3rem .85rem; border-radius: 6px; font-size: .875rem; font-weight: 500; color: var(--muted); cursor: pointer; }
.seg .btn-check:checked + label { background: var(--surface); color: var(--brand-700); box-shadow: var(--shadow); font-weight: 600; }
.seg .btn-check:focus-visible + label { outline: 2px solid var(--brand-600); }

.check-chip { display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .75rem .3rem .55rem; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface); font-size: .875rem; cursor: pointer; user-select: none; }
.check-chip input { accent-color: var(--brand-700); margin: 0; }
.check-chip .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.check-chip:has(input:not(:checked)) { color: var(--muted); background: var(--line-2); }
.check-chip:has(input:not(:checked)) .dot { opacity: .35; }

.toolbar { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.report-section h2 { font-size: 1rem; }
.chart-box { padding: 0 .75rem .5rem; min-height: 120px; }
.report-table { max-height: 540px; overflow: auto; border-top: 1px solid var(--line-2); }
.report-table .table-sticky thead th { top: 0; }
.table tr.table-total > * { font-weight: 700; background: var(--line-2); border-top: 2px solid var(--brand-600); position: sticky; bottom: 0; }
.table-details { border-top: 1px solid var(--line-2); }
.table-details summary { padding: .65rem 1rem; cursor: pointer; font-size: .875rem; font-weight: 500; color: var(--brand-700); }
.table-details summary:hover { background: var(--line-2); }

.loading-overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(246, 248, 250, .75); backdrop-filter: blur(2px);
  display: grid; place-content: center; justify-items: center; gap: .75rem; font-weight: 500; color: var(--ink-2); }
.loading-overlay[hidden] { display: none; }

/* Trend tabloları ve ürün seçici */
.spark { display: block; overflow: visible; }
.add-btn { color: var(--muted); }
.add-btn:hover { background: var(--brand-50); color: var(--brand-700); }
.sel-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .25rem .2rem .6rem; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface); font-size: .8125rem; font-weight: 500; }
.sel-chip .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.chip-x { border: 0; background: transparent; color: var(--muted); border-radius: 50%; width: 22px; height: 22px;
  display: grid; place-items: center; padding: 0; }
.chip-x:hover { background: var(--danger-bg); color: var(--danger); }
.urun-ekle { min-width: 260px; max-width: 360px; flex: 1; }
.sel-chip .sel-trend { font-size: .75rem; font-weight: 600; }
.input-group .time-input { flex: 0 0 7.25rem; }
