:root {
  --bg: #f4f3fb;
  --surface: #ffffff;
  --surface-alt: #e6e2f4;
  --text: #1c1917;
  --muted: #6b6a63;
  --muted-soft: #a3a29c;
  --border: #e2e0ef;
  --primary: #0f766e;
  --primary-dark: #0c5c56;
  --primary-light: #14b8a6;
  --primary-soft: #eafaf7;
  --accent: #f59e0b;
  --accent-dark: #d97706;
  --accent-soft: #fff6e0;
  /* Vurgu paleti: --primary (teal) ve --accent (amber) yanında, KPI
     kartları/istatistik kutuları gibi TEKRAR EDEN elemanlarda tutarlı bir
     anlamla kullanılan 2 ek renk (mavi=ciro/nakit girişi, mor=depo değeri/
     brüt kâr). Amaç her yeri boyamak değil, aynı 4 rengi HER YERDE aynı
     anlamda kullanmak -- bkz. .kpi-tile[data-kpi] / .stat-box[data-stat]. */
  --accent-blue: #2563eb;
  --accent-blue-soft: #eaf1fd;
  --accent-purple: #7c3aed;
  --accent-purple-soft: #f3eefd;
  --danger: #e11d48;
  --danger-dark: #be123c;
  --danger-soft: #fdeef1;
  --ok: #16a34a;
  --ok-dark: #15803d;
  --ok-soft: #eefbf1;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --sidebar-bg: linear-gradient(165deg, #201f3d 0%, #2b2360 55%, #34205c 100%);
  --sidebar-bg-2: #201f3d;
  --sidebar-text: #a8a29c;
  --sidebar-text-active: #ffffff;
  --sidebar-active-bg: rgba(20, 184, 166, 0.16);
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 18px;
  --shadow-card: 0 1px 2px rgba(28, 25, 23, 0.04), 0 6px 16px -8px rgba(28, 25, 23, 0.10);
  --shadow-pop: 0 20px 45px -14px rgba(28, 25, 23, 0.28);
  --shadow-btn: 0 4px 12px -4px rgba(15, 118, 110, 0.38);
  --glow-primary: 0 10px 26px -10px rgba(15, 118, 110, 0.45);
  --glow-blue: 0 10px 26px -10px rgba(37, 99, 235, 0.42);
  --glow-purple: 0 10px 26px -10px rgba(124, 58, 237, 0.42);
  --glow-amber: 0 10px 26px -10px rgba(217, 119, 6, 0.4);
  --glow-ok: 0 10px 26px -10px rgba(22, 163, 74, 0.4);
  --glow-danger: 0 10px 26px -10px rgba(225, 29, 72, 0.4);
  --font-display: "Sora", "Inter", -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(150deg, #e9e5f7 0%, #dde3f7 50%, #d3ddf6 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100vh; }

/* ---- Üst bar ------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--sidebar-bg);
  border-bottom: 2px solid var(--primary-light);
  gap: 16px;
  position: relative;
  z-index: 5;
}
.topbar .business-picker { display: flex; align-items: center; gap: 10px; }
.topbar .business-picker label { font-size: 0.7rem; color: var(--sidebar-text); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.business-color-dot {
  width: 14px; height: 14px; border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}
.business-name-big { font-size: 1.08rem; font-weight: 800; line-height: 1.15; letter-spacing: -0.01em; color: #ffffff; font-family: var(--font-display); }
.topbar select {
  border: 1px solid var(--sidebar-border);
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  font-weight: 600;
  padding: 9px 12px;
  min-width: 180px;
  border-radius: var(--radius-sm);
  transition: border-color 0.15s;
}
.topbar select:hover { border-color: var(--primary-light); }
.topbar select option { color: var(--text); background: var(--surface); }
.topbar .user-area { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary-light);
  color: #06201d;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem;
  flex-shrink: 0;
}
.user-email { font-size: 0.85rem; color: var(--sidebar-text); }
.topbar #logout-btn { background: rgba(255, 255, 255, 0.06); border-color: var(--sidebar-border); color: #ffffff; }
.topbar #logout-btn:hover { background: rgba(255, 255, 255, 0.12); }

/* ---- Yerleşim -------------------------------------------------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  padding: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--sidebar-border);
}
.sidebar .brand .mark {
  width: 36px; height: 36px; border-radius: 11px;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  color: #06201d; font-weight: 800; font-size: 1.05rem;
  flex-shrink: 0;
}
.sidebar .brand .name { color: white; font-weight: 700; font-size: 0.98rem; letter-spacing: -0.01em; font-family: var(--font-display); }
.sidebar .brand .sub { color: var(--sidebar-text); font-size: 0.7rem; }

.sidebar nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.sidebar-group-label {
  font-size: 0.64rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
  color: #6f6b64; padding: 12px 10px 5px;
}
.sidebar-group-label:first-child { padding-top: 2px; }
.sidebar button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  margin-bottom: 2px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.sidebar button svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.8; }
.sidebar button.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--primary-light);
}
.sidebar button.active svg { opacity: 1; color: var(--primary-light); }
.sidebar button:hover:not(.active) { background: rgba(255, 255, 255, 0.06); color: var(--sidebar-text-active); }

.main { flex: 1; padding: 28px 32px; max-width: 1080px; animation: view-fade-in 0.2s ease; }
@keyframes view-fade-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .main { animation: none; }
}

/* ---- Kartlar ---------------------------------------------------------- */
.card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 24px 26px;
  margin-bottom: 20px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
/* Çok hafif bir "canlılık" -- kartın üstüne gelince küçük bir yükselme ve
   gölge artışı. Tıklanabilir kart-butonlarda (.simple-home-btn, .stat-box)
   bu daha belirgin bir versiyonla ayrıca tanımlı. */
.card:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px -3px rgba(28, 25, 23, 0.08), 0 14px 28px -16px rgba(28, 25, 23, 0.16);
}
@media (prefers-reduced-motion: reduce) {
  .card:hover { transform: none; }
}
.card h2 { margin-top: 0; margin-bottom: 14px; font-size: 1.02rem; font-weight: 800; letter-spacing: -0.01em; color: var(--primary-dark); font-family: var(--font-display); }

/* ---- Az kullanılan kart bölümleri: <details> ile katlanır -------------- */
/* "İşletme Ayarları" gibi tek sayfada çok fazla kart üst üste dizildiğinde
   ekran kalabalıklaşıyordu -- sık kullanılmayan bölümler (Ekip üyeleri,
   Ekipmanlar, İç üretim, Denetim Günlüğü, Verileri sıfırla) artık varsayılan
   olarak kapalı, tıklayınca açılan bir <details> kartı; sık düzenlenen
   "Sabit aylık giderler" ve "Satış kesintileri" değişmeden hep açık kalıyor. */
details.card { padding: 0; }
details.card > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  list-style: none; cursor: pointer; padding: 24px 26px;
  border-radius: var(--radius);
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before {
  content: ""; display: inline-block; flex-shrink: 0;
  width: 9px; height: 9px; margin-right: 10px;
  background-color: var(--muted-soft);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3'%3E%3Cpath d='M8 4l10 8-10 8'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3'%3E%3Cpath d='M8 4l10 8-10 8'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-size: contain; mask-size: contain;
  transition: transform 0.15s;
}
details.card[open] > summary::before { transform: rotate(90deg); }
details.card > summary h2 { margin: 0; }
details.card > summary:hover { background: var(--surface-alt); }
details.card > *:not(summary) { padding: 0 26px; }
details.card > *:not(summary):last-child { padding-bottom: 24px; }
details.card[open] > summary { padding-bottom: 10px; }
@media (max-width: 880px) {
  details.card > summary, details.card > *:not(summary) { padding-left: 16px; padding-right: 16px; }
}

/* ---- Tablolar --------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 700; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: var(--primary-soft); }
tbody tr:last-child td { border-bottom: none; }

/* ---- Rozetler --------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; }
.badge.critical { background: var(--danger-soft); color: var(--danger-dark); }
.badge.ok { background: var(--ok-soft); color: var(--ok-dark); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
/* Parasal değerler: "1.234,56" ile "₺" arasındaki boşluktan satır
   bölünüp ₺ işareti yalnız kalmasın -- tnum sınıfı HTML'de zaten
   kullanılıyordu, sadece tanımı eksikti. */
.tnum { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---- Formlar ------------------------------------------------------- */
form.inline { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin-top: 12px; }
form.inline .field { display: flex; flex-direction: column; gap: 5px; }
form.inline label { font-size: 0.74rem; font-weight: 700; color: var(--muted); }

input, select, textarea {
  font: inherit;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 700;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.15s ease, box-shadow 0.18s ease;
}
button.primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  box-shadow: var(--shadow-btn);
}
button.primary:hover { background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%); transform: translateY(-1px) scale(1.015); box-shadow: 0 10px 22px -6px rgba(15, 118, 110, 0.48); }
button.secondary { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
button.secondary:hover { background: var(--surface-alt); border-color: var(--primary-light); box-shadow: 0 4px 12px -6px rgba(28, 25, 23, 0.12); transform: translateY(-1px); }
button.danger { color: var(--danger-dark); border-color: #f6c3ce; background: white; }
button.danger:hover { background: var(--danger-soft); border-color: var(--danger); box-shadow: 0 4px 12px -6px rgba(225, 29, 72, 0.18); transform: translateY(-1px); }
button:active { transform: translateY(1px) !important; box-shadow: none !important; }
button:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
@media (prefers-reduced-motion: reduce) {
  button:hover { transform: none !important; }
}
/* Bir buton etiketinin İÇİNDE (rozet olarak değil, metinle aynı satırda)
   küçük bir ICONS SVG'si göstermek için -- bkz. app.js'teki "Mal Aldım"
   butonu gibi kullanımlar. Emoji karakteri metne gömmek yerine buradan. */
.btn-icon { display: inline-flex; width: 14px; height: 14px; vertical-align: -2px; margin-right: 5px; }
.btn-icon svg { width: 100%; height: 100%; }

/* ---- Giriş ekranı ------------------------------------------------------ */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.auth-card {
  width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 34px 32px 28px;
}
.auth-card .brand-row { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-card .brand-row .mark {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 800;
}
.auth-card .brand-row .title { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; }
.auth-card h1 { font-size: 1.2rem; margin: 0 0 18px; font-weight: 800; letter-spacing: -0.01em; }
.auth-card .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.auth-card .field label { font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.auth-card input { width: 100%; padding: 10px 12px; }
.auth-card button[type=submit] { width: 100%; margin-top: 8px; padding: 12px; font-size: 0.92rem; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 0.85rem; color: var(--muted); }
.auth-switch a { color: var(--primary); cursor: pointer; text-decoration: none; font-weight: 700; }
.auth-switch a:hover { text-decoration: underline; }

/* ---- Bildirimler ------------------------------------------------------- */
.error-banner {
  background: var(--danger-soft);
  color: var(--danger-dark);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  margin-bottom: 14px;
  border: 1px solid #f6c3ce;
}
.notice-banner {
  background: var(--warn-soft);
  color: #92400e;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  margin-bottom: 14px;
  border: 1px solid #fde68a;
}
.muted { color: var(--muted); font-size: 0.86rem; }

/* ---- "Bugün ne yapacaksın?" basit ana sayfa ----------------------------- */
.simple-home { margin-bottom: 24px; }
.simple-home-head { margin-bottom: 14px; }
.simple-home-head span { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; color: var(--primary); }
.simple-home-head h2 { margin: 4px 0 2px; font-size: 1.4rem; letter-spacing: -0.02em; font-family: var(--font-display); }
.simple-home-head p { margin: 0; color: var(--muted); font-size: 0.88rem; }
/* Grid yerine flex + justify-content:center: 5 (ya da başka herhangi bir
   sayıda) kart olduğunda son satırdaki eksik kart(lar) SOLA yaslanıp öksüz
   kalmasın -- satırın ORTASINA gelsin, kaç kart olursa olsun düzenli
   görünsün. */
.simple-home-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.simple-home-btn {
  display: flex; align-items: center; gap: 12px;
  text-align: left; padding: 14px 16px;
  flex: 1 1 180px;
  background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.simple-home-btn span { font-size: 1.5rem; flex-shrink: 0; width: 42px; height: 42px; border-radius: 13px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.simple-home-btn span svg { width: 22px; height: 22px; }
.simple-home-btn div { flex: 1; }
.simple-home-btn strong { display: block; font-size: 0.95rem; }
.simple-home-btn small { color: var(--muted); font-size: 0.78rem; }
.simple-home-btn b { color: var(--muted-soft); font-size: 1.1rem; font-weight: 400; }
.simple-home-btn:hover { border-color: var(--primary-light); transform: translateY(-2px); box-shadow: 0 12px 26px -10px rgba(15, 118, 110, 0.25); }
.simple-home-alert {
  display: flex; align-items: center; gap: 14px; width: 100%;
  margin-top: 12px; padding: 14px 18px;
  background: var(--warn-soft); border: 1px solid #fde68a; border-radius: var(--radius);
  text-align: left;
}
.simple-home-alert span { flex-shrink: 0; width: 42px; height: 42px; border-radius: 13px; background: rgba(217, 119, 6, 0.14); color: #92400e; display: flex; align-items: center; justify-content: center; }
.simple-home-alert span svg { width: 22px; height: 22px; }
.simple-home-alert div { flex: 1; }
.simple-home-alert strong { display: block; color: #92400e; }
.simple-home-alert small { display: block; margin-top: 2px; color: #92400e; opacity: 0.8; }
.simple-home-alert b { color: #92400e; }

/* ---- İstatistik kutuları ------------------------------------------------ */
.stat-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 4px; }
.stat-box {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(165deg, var(--surface) 0%, var(--surface-alt) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.stat-box:hover { transform: translateY(-2px); box-shadow: var(--glow-primary); }
.stat-box.warn:hover { box-shadow: var(--glow-amber); }
.stat-box[data-stat="value"]:hover { box-shadow: var(--glow-purple); }
.stat-box[data-stat="sales"]:hover { box-shadow: var(--glow-blue); }
.stat-box::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--primary);
}
.stat-box.warn::before { background: var(--warn); }
.stat-box[data-stat="value"]::before { background: var(--accent-purple); }
.stat-box[data-stat="sales"]::before { background: var(--accent-blue); }
.stat-icon {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-box.warn .stat-icon { background: var(--warn-soft); color: var(--warn); }
.stat-box[data-stat="value"] .stat-icon { background: var(--accent-purple-soft); color: var(--accent-purple); }
.stat-box[data-stat="sales"] .stat-icon { background: var(--accent-blue-soft); color: var(--accent-blue); }
.stat-box .stat-body { min-width: 0; }
.stat-box .value { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; font-family: var(--font-display); white-space: nowrap; font-variant-numeric: tabular-nums; }
.stat-box .label { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
@media (prefers-reduced-motion: reduce) {
  .stat-box:hover { transform: none; }
}

/* ---- Kart başlığı (başlık + sağda meta/aksiyon) ------------------------- */
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.card-head h2 { margin: 0; }

/* ---- Sekme/çip grupları (tarih aralığı seçimi vb.) ---------------------- */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 4px; }
.chip {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none;
  display: inline-block;
}
.chip.active { background: var(--primary); border-color: transparent; color: white; }
.chip:hover:not(.active) { border-color: var(--primary-light); color: var(--primary); }

.settings-section-label { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin: 26px 0 10px; }
.settings-section-label:first-of-type { margin-top: 0; }

.date-range-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.date-range-form input[type=date] { padding: 7px 9px; font-size: 0.82rem; }

.csv-export-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.8rem; font-weight: 700; color: var(--primary);
  text-decoration: none; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: 999px;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.csv-export-link:hover { background: var(--primary-soft); border-color: var(--primary-light); }
.tel-link { color: var(--primary); font-weight: 700; text-decoration: none; }
.tel-link:hover, .tel-link:active { text-decoration: underline; }
.stock-strategy-row { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.field-checkbox-inline { display: flex; align-items: center; gap: 8px; font-size: 0.84rem; font-weight: 600; color: var(--text); cursor: pointer; }
.field-checkbox-inline input[type=checkbox] { width: 16px; height: 16px; }
@media (min-width: 560px) {
  .stock-strategy-row { flex-direction: row; gap: 18px; }
}

@keyframes nav-alert-pulse {
  0%, 100% { background: rgba(220, 38, 38, 0); }
  50% { background: rgba(220, 38, 38, 0.35); }
}
.sidebar button.nav-alert { animation: nav-alert-pulse 1.4s ease-in-out infinite; border-radius: var(--radius-sm); }
.sidebar button.nav-alert svg { color: #fca5a5; }

/* ---- Tablo arama çubuğu (Stok / Satış Girişi geçmişi vb.) ---------------- */
.search {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-alt);
  padding: 0 12px; max-width: 320px;
  transition: border-color 0.15s;
}
.search:focus-within { border-color: var(--primary-light); }
.search input {
  border: 0; background: none; outline: none; padding: 9px 0; width: 100%; font-size: 0.88rem;
}
.search input:focus { box-shadow: none; }
.search-icon { display: flex; flex-shrink: 0; width: 15px; height: 15px; color: var(--muted-soft); }
.search-icon svg { width: 100%; height: 100%; }

/* ---- KPI kartları (Kâr-Zarar özeti) -------------------------------------- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.kpi-tile {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: linear-gradient(165deg, var(--surface) 0%, var(--surface-alt) 100%);
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: box-shadow 0.18s ease;
}
.kpi-tile:hover { box-shadow: var(--glow-primary); }
.kpi-tile[data-kpi="revenue"]:hover, .kpi-tile[data-kpi="cash-in"]:hover { box-shadow: var(--glow-blue); }
.kpi-tile[data-kpi="opex"]:hover, .kpi-tile[data-kpi="cash-out"]:hover { box-shadow: var(--glow-amber); }
.kpi-tile[data-kpi="gross-profit"]:hover { box-shadow: var(--glow-purple); }
.kpi-tile.kpi-good:hover { box-shadow: var(--glow-ok); }
.kpi-tile.kpi-danger:hover { box-shadow: var(--glow-danger); }
.kpi-tile .kpi-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kpi-icon {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
}
.kpi-icon svg { width: 17px; height: 17px; }
.kpi-tile .kpi-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; }
.kpi-tile .kpi-value { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; border-radius: 4px; font-family: var(--font-display); white-space: nowrap; font-variant-numeric: tabular-nums; }
/* Kategori renkleri: ciro/nakit girişi = mavi, stok maliyeti/stok alımı =
   --primary (teal, zaten "stok" temasıyla eşleşiyor), gider/nakit çıkışı =
   amber, brüt kâr = mor. Net Kâr/Net Nakit rengi DEĞERİN İŞARETİNE göre
   (.kpi-good/.kpi-danger, aşağıda) belirlendiği için burada YOK -- o ikisi
   kasıtlı olarak varsayılan (--primary) kalıyor, sınıf onu ezip geçiyor. */
.kpi-tile[data-kpi="revenue"] .kpi-icon, .kpi-tile[data-kpi="cash-in"] .kpi-icon { background: var(--accent-blue-soft); color: var(--accent-blue); }
.kpi-tile[data-kpi="revenue"], .kpi-tile[data-kpi="cash-in"] { border-top-color: var(--accent-blue); }
.kpi-tile[data-kpi="opex"] .kpi-icon, .kpi-tile[data-kpi="cash-out"] .kpi-icon { background: var(--accent-soft); color: var(--accent-dark); }
.kpi-tile[data-kpi="opex"], .kpi-tile[data-kpi="cash-out"] { border-top-color: var(--accent-dark); }
.kpi-tile[data-kpi="gross-profit"] .kpi-icon { background: var(--accent-purple-soft); color: var(--accent-purple); }
.kpi-tile[data-kpi="gross-profit"] { border-top-color: var(--accent-purple); }
.kpi-tile.kpi-good { border-top-color: var(--ok); }
.kpi-tile.kpi-good .kpi-icon { background: var(--ok-soft); color: var(--ok-dark); }
.kpi-tile.kpi-good .kpi-value { color: var(--ok-dark); }
.kpi-tile.kpi-danger { border-top-color: var(--danger); }
.kpi-tile.kpi-danger .kpi-icon { background: var(--danger-soft); color: var(--danger-dark); }
.kpi-tile.kpi-danger .kpi-value { color: var(--danger-dark); }

/* Bir KPI rakamı bir önceki render'dan GERÇEKTEN farklıysa (ör. tarih
   aralığı değiştirildi) kısa bir "highlight flash" -- kullanıcı hangi
   sayının güncellendiğini fark etsin diye (bkz. app.js kpiTileHtml). */
@keyframes kpi-flash { 0% { background-color: var(--accent-soft); } 100% { background-color: transparent; } }
.kpi-value.kpi-flash { animation: kpi-flash 400ms ease-out; }
@media (prefers-reduced-motion: reduce) {
  .kpi-value.kpi-flash { animation: none; }
}

/* ---- Kâr-Zarar: gider dağılımı / trend ----------------------------------- */
.finance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.finance-grid.finance-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.finance-grid h3 { font-size: 0.85rem; margin: 0 0 12px; font-weight: 800; font-family: var(--font-display); }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.legend-list { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 160px; }
.legend-list li { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 0.82rem; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.legend-name { flex: 1; }
.legend-value { font-weight: 700; }
.legend-pct { width: 34px; text-align: right; }

/* ---- Grafik tooltip'i (donut + trend PAYLAŞIR, bkz. app.js
   showChartTooltip/hideChartTooltip) --------------------------------------- */
.chart-tooltip {
  position: fixed;
  z-index: 60;
  display: none;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  padding: 8px 12px;
  font-size: 0.8rem;
  line-height: 1.4;
  max-width: 220px;
}
.chart-tooltip strong { display: block; margin-bottom: 2px; }
.chart-tooltip .muted { font-size: 0.74rem; }

/* ---- Gider dağılımı donut'u: çizilme animasyonu + hover + tıklanabilirlik */
.donut-chart-holder { position: relative; flex-shrink: 0; }
.donut-center {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  text-align: center; pointer-events: none; width: 78%;
}
.donut-center strong { display: block; font-size: 0.72rem; font-weight: 800; line-height: 1.25; color: var(--text); }
.donut-center span { display: block; font-size: 0.6rem; color: var(--muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.04em; }
.donut-arc {
  cursor: pointer;
  transition: stroke-dasharray 600ms ease, opacity 200ms ease, stroke-width 150ms ease;
}
.legend-row { cursor: pointer; border-radius: 6px; padding: 5px 6px; margin: 0 -6px; transition: background 0.15s ease; }
.legend-row:hover, .legend-row.chart-hover { background: var(--surface-alt); }
@media (prefers-reduced-motion: reduce) {
  .donut-arc { transition: opacity 200ms ease, stroke-width 150ms ease; }
}

/* ---- Ciro/Net Kâr trend grafiği: kademeli çizim + hover + tıklanabilirlik */
.trend-chart-svg { display: block; width: 100%; }
.trend-bar { transition: height 500ms ease, y 500ms ease, opacity 200ms ease; }
.trend-dot { transition: opacity 250ms ease; }
.trend-line { transition: stroke-dashoffset 500ms ease; }
.trend-label { transition: opacity 200ms ease; }
.trend-hit { cursor: pointer; }
@media (prefers-reduced-motion: reduce) {
  .trend-bar, .trend-dot, .trend-line { transition: opacity 200ms ease; }
}

.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 0.86rem; overflow: hidden; }
.plain-list li:last-child { border-bottom: none; }

/* ---- Boş/yükleniyor durumları -------------------------------------------- */
.empty-state {
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
  padding: 28px 16px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}
.empty-state a { color: var(--primary); font-weight: 700; text-decoration: none; }
.empty-state a:hover { text-decoration: underline; }
/* Her boş durumun üstünde tek renkli, muted bir ikon -- ekran "çıplak" tek
   satır yazı yerine hafif bir illüstrasyon hissi versin. TEK yerde
   tanımlanıp CSS ::before ile otomatik eklenir -- app.js'teki 16 farklı
   empty-state çağrısının hiçbirine elle dokunmaya gerek yok. "Her şey
   yolunda/temiz" türü OLUMLU mesajlar (bkz. app.js'teki .empty-state-ok
   sınıfı) yeşil bir onay ikonu alır, geri kalan (nötr "kayıt yok") durumlar
   varsayılan "boş kutu" ikonunu alır. */
.empty-state::before {
  content: "";
  display: block;
  width: 40px; height: 40px;
  margin: 0 auto 10px;
  background-color: var(--muted-soft);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5'%3E%3Cpath d='M3 9l2-5h14l2 5'/%3E%3Cpath d='M3 9v9a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9'/%3E%3Cpath d='M3 9h6a1 1 0 0 1 1 1 2 2 0 0 0 4 0 1 1 0 0 1 1-1h6'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5'%3E%3Cpath d='M3 9l2-5h14l2 5'/%3E%3Cpath d='M3 9v9a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9'/%3E%3Cpath d='M3 9h6a1 1 0 0 1 1 1 2 2 0 0 0 4 0 1 1 0 0 1 1-1h6'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-size: contain; mask-size: contain;
  opacity: 0.6;
}
.empty-state-ok::before {
  background-color: var(--ok);
  opacity: 0.85;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M8 12.5l2.5 2.5L16 9'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M8 12.5l2.5 2.5L16 9'/%3E%3C/svg%3E");
}

.skeleton-line {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--border) 25%, var(--bg) 37%, var(--border) 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  margin-bottom: 10px;
}
@keyframes skeleton-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton-line { animation: none; }
}

/* ---- Kayan/geniş tablolar (dar ekranda yatay kaydırma) -------------------- */
.table-scroll { overflow-x: auto; }
.table-scroll table { min-width: 560px; }
.row-actions { display: flex; gap: 6px; flex-wrap: nowrap; }
.row-actions button { padding: 6px 12px; font-size: 0.8rem; }
.row-actions-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.row-actions-grid button { width: 100%; }

/* ---- Kutu tabanlı form ızgarası (Sabit Giderler vb.) --------------------- */
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px 16px; margin-top: 12px; align-items: end; }
.grid-form .field { display: flex; flex-direction: column; gap: 5px; }
.grid-form label { font-size: 0.74rem; font-weight: 700; color: var(--muted); }
.grid-form button { grid-column: 1 / -1; justify-self: start; }
.record-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.record-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; background: var(--surface-alt); }
.record-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px 18px; margin-bottom: 12px; }
.record-fields.grid-form { margin-bottom: 12px; }
.record-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.record-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.record-value { font-size: 0.92rem; color: var(--text); word-break: break-word; }

/* ---- Kompakt gider ızgarası (Dükkân Bilgileri / Sabit aylık giderler /
   Satış kesintileri) ------------------------------------------------------
   .grid-form ile aynı davranış ama daha DAR sütunlar (160px -> 128px) ve
   daha az dikey boşluk -- 11 alanlı "Sabit aylık giderler" formu geniş
   ekranda 3 satıra yayılıp kartı gereksiz uzatıyordu. Label'ı input'un
   soluna almak yerine bu yaklaşım seçildi çünkü formda "Belediye vergi ve
   harçları (yıllık)" gibi uzun etiketler var -- tek satıra sıkıştırılan
   inline bir etiket bunlarda okunaksız/kırpılmış görünürdü; dar sütunlarla
   satır sayısını azaltmak aynı kompaktlığı daha güvenli sağlıyor. Sadece bu
   üç kart için kullanılıyor, diğer .grid-form'lar (Personel/gider vb.)
   etkilenmesin diye ayrı bir class. */
.grid-form-compact { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px 14px; margin-top: 10px; align-items: end; }
.grid-form-compact .field { display: flex; flex-direction: column; gap: 3px; }
.grid-form-compact label { font-size: 0.72rem; font-weight: 700; color: var(--muted); }
.grid-form-compact input, .grid-form-compact select { padding: 7px 9px; }
.grid-form-compact button { grid-column: 1 / -1; justify-self: start; margin-top: 2px; }
@media (max-width: 880px) {
  .grid-form-compact { grid-template-columns: 1fr; }
}
.field-checkbox label { display: flex; align-items: center; gap: 8px; font-size: 0.84rem; font-weight: 600; color: var(--text); white-space: nowrap; }
.field-checkbox input[type=checkbox] { width: 16px; height: 16px; }

/* ---- Kurulum ilerleme çubuğu / checklist -------------------------------- */
/* Minimal, yanlamasına (satır satır değil, sarılan küçük rozetler halinde)
   özet -- eskiden her adım kendi satırını (tam genişlik, dolgulu bir kutu)
   kaplıyordu, bu da tamamlanana kadar dashboard'ın en üstünde epey dikey yer
   tutuyordu. Kısa etiket rozette görünür, tam metin hover/title'da kalır. */
.setup-status-card { padding-bottom: 18px; }
.setup-progress-track { height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; max-width: 320px; }
.setup-progress-fill { height: 100%; border-radius: 999px; background: var(--ok); transition: width 0.3s ease; }
.setup-checklist-compact { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.setup-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-alt); color: var(--text);
  font-size: 0.76rem; font-weight: 600;
  transition: border-color 0.15s;
}
.setup-chip:hover { border-color: var(--primary-light); }
.setup-chip.done { border-color: #bdeecb; background: var(--ok-soft); color: var(--ok-dark); }
.setup-chip.required:not(.done) { border-color: #f6c3ce; background: var(--danger-soft); color: var(--danger-dark); }
.setup-chip:not(.done):not(.required) { color: var(--muted); }
.setup-chip-icon { display: inline-flex; width: 13px; height: 13px; flex-shrink: 0; }
.setup-chip-icon svg { width: 100%; height: 100%; }

/* ---- Erişilebilirlik: klavye odağı her yerde görünür olsun --------------- */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

/* ---- Mobil hamburger menü / kayar çekmece --------------------------------
   Masaüstünde hiç görünmez -- sadece 880px altında (bkz. aşağıdaki @media)
   devreye girer. Sidebar'ın kendisi position:fixed + transform:translateX
   ile soldan kayar; backdrop arkayı kararttığı gibi tıklanınca da kapatır. */
.hamburger-btn { display: none; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; z-index: 40; background: rgba(15, 15, 20, 0.5); }
.sidebar-backdrop.visible { display: block; }

/* ---- Mobil / dar ekran uyumu --------------------------------------------- */
@media (max-width: 880px) {
  .hamburger-btn {
    display: flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; flex-shrink: 0;
    background: rgba(255, 255, 255, 0.08); border: 1px solid var(--sidebar-border);
    border-radius: var(--radius-sm); color: #ffffff; padding: 0;
  }
  .hamburger-btn svg { width: 20px; height: 20px; }
  .layout { flex-direction: column; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
    width: 268px; max-width: 82vw;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-pop);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar .brand { padding: 18px 16px; }
  .sidebar nav { display: block; overflow-y: auto; padding: 12px 10px; }
  .sidebar-group-label { display: block; }
  .sidebar button { width: 100%; white-space: normal; margin-bottom: 2px; }
  .sidebar button span { display: inline; }
  .main { padding: 16px; max-width: 100%; }
  .topbar { padding: 10px 16px; flex-wrap: wrap; }
  .business-picker { flex-wrap: wrap; row-gap: 6px; }
  .business-picker select { min-width: 0; flex: 1 1 100%; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .finance-grid, .finance-grid.finance-grid-3 { grid-template-columns: 1fr; }
  form.inline, .grid-form { grid-template-columns: 1fr; }
  form.inline .field { width: 100%; }
  .card { padding: 18px 16px; }
  .row-actions button { padding: 8px 14px; font-size: 0.82rem; }
}
@media (max-width: 480px) {
  .kpi-row { grid-template-columns: 1fr; }
}

/* ---- Yazdırılabilir Z raporu -------------------------------------------- */
#print-area { display: none; }
.print-sheet { font-family: "Courier New", monospace; max-width: 380px; margin: 0 auto; }
.print-sheet h1 { font-size: 1.1rem; text-align: center; margin: 0 0 2px; }
.print-sheet h2 { font-size: 0.9rem; text-align: center; margin: 0 0 14px; font-weight: 600; }
.print-sheet h3 { font-size: 0.85rem; margin: 16px 0 6px; border-top: 1px dashed #000; padding-top: 10px; }
.print-sheet table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.print-sheet td, .print-sheet th { padding: 3px 2px; border: none; }
.print-sheet tr.print-total td { font-weight: 700; border-top: 1px dashed #000; padding-top: 6px; }
.print-footnote { font-size: 0.7rem; text-align: center; color: #555; margin-top: 16px; }

/* Vardiya çizelgesi gibi GENİŞ, standart tablo görünümlü yazdırma çıktıları
   için -- .print-sheet'in dar fiş stilini (Courier New, 380px) değil, normal
   bir kağıda sığan, kenarlıklı bir çizelge görünümü kullanır. table-layout:
   fixed + width:100% ile sütun sayısı ne olursa olsun (7 gün de olsa 31 gün
   de olsa) tablo HER ZAMAN sayfa genişliğine tam oturur, kenardan kesilmez.
   "page: shift-landscape" ile bu tablo yazdırılırken sayfa otomatik YATAY
   çevrilir (aşağıdaki @page shift-landscape) -- Z raporu (dar fiş, dikey
   sayfa) bundan etkilenmez. */
.print-sheet-wide { max-width: none; width: 100%; font-family: Arial, Helvetica, sans-serif; page: shift-landscape; }
.print-sheet-wide table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 0.8rem; }
.print-sheet-wide th, .print-sheet-wide td { border: 1px solid #333; padding: 6px 8px; text-align: center; word-break: break-word; }
.print-sheet-wide th:first-child, .print-sheet-wide td:first-child { text-align: left; font-weight: 600; width: 110px; }
.print-sheet-wide thead th { background: #e9e9e9; font-weight: 700; }
.print-sheet-wide tbody tr.shift-row-alt { background: #f6f6f6; }
.print-sheet-wide.shift-print-sm table { font-size: 0.65rem; }
.print-sheet-wide.shift-print-sm th, .print-sheet-wide.shift-print-sm td { padding: 4px 4px; }
.print-sheet-wide.shift-print-xs table { font-size: 0.5rem; }
.print-sheet-wide.shift-print-xs th, .print-sheet-wide.shift-print-xs td { padding: 2px 3px; }
@page shift-landscape { size: landscape; margin: 10mm; }
@media print {
  body.printing > *:not(#print-area) { display: none !important; }
  body.printing #print-area { display: block !important; }
  @page { margin: 12mm; }
}
