/* =========================================================================
   Bütçe Sistemi — Tek CSS dosyası
   Mobile-first. CSS değişkenleri ile temalanır. Karanlık mod hazır altyapı.
   ========================================================================= */

:root {
  /* Renkler (açık tema, Excel paleti ile senkron) */

  /* Arka plan: Excel'deki siyahı hafif yumuşatıp açık temaya uyarladık;
     siyahın tam tersi beyaz ama "kağıt hissi" için hafif gri ton */
  --color-bg: #f5f7fb;
  --color-surface: #ffffff;
  --color-surface-alt: #f4f6fa;
  --color-border: #dfe5ef;
  --color-border-strong: #c7d0e0;

  --color-text: #1a1f2e;
  --color-text-muted: #5a6b8a;
  --color-text-strong: #0b1221;

  /* Ana vurgu: Excel başlık rengi #223962 (koyu mavi) */
  --color-primary: #223962;
  --color-primary-contrast: #ffffff;
  --color-primary-hover: #1a2d50;

  /* Excel'den: gösterge paneli koyu mavi, portföy çelik mavisi */
  --color-gosterge: #002060;
  --color-portfoy:  #2D4D6A;

  /* Excel cam göbeği vurgusu (planlama toplamlarında mavi rakamlar) */
  --color-accent: #00B0F0;

  /* Excel kırmızı (negatif) ve yeşil (pozitif) */
  --color-success: #00B050;
  --color-success-bg: #e7f7ec;
  --color-success-border: #9ad9ad;
  --color-success-text: #006d30;

  --color-danger: #FF0000;
  --color-danger-bg: #fdecec;
  --color-danger-border: #f5a9a9;
  --color-danger-text: #b30000;

  --color-neutral-bg: #f4f6fa;
  --color-neutral-text: #5a6b8a;

  /* Option B: Tür renkleri (Gelir=yeşil, Gider=kırmızı, Birikim=mavi) */
  --color-income:        #15803d;
  --color-income-bg:     rgba(21, 128, 61, 0.07);
  --color-income-border: #16a34a;

  --color-expense:        #b91c1c;
  --color-expense-bg:     rgba(185, 28, 28, 0.07);
  --color-expense-border: #dc2626;

  --color-saving:        #1d4ed8;
  --color-saving-bg:     rgba(29, 78, 216, 0.07);
  --color-saving-border: #2563eb;

  /* Ölçek (spacing) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* Yarıçap */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 999px;

  /* Tipografi */
  --font-stack: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-size-xs: 11.5px;
  --font-size-sm: 13px;
  --font-size-base: 14px;
  --font-size-md: 15px;
  --font-size-lg: 20px;
  --font-size-xl: 26px;
  --font-size-2xl: 30px;

  /* Gölge — çok katmanlı, daha yumuşak */
  --shadow-card: 0 1px 3px rgba(17,24,39,0.04), 0 4px 12px rgba(17,24,39,0.04);
  --shadow-md:   0 4px 8px rgba(17,24,39,0.06), 0 10px 24px rgba(17,24,39,0.05);
  --shadow-lg:   0 8px 16px rgba(17,24,39,0.07), 0 20px 40px rgba(17,24,39,0.06);

  /* Diğer */
  --form-height: 40px;
  --container-max: 1400px;
}

/* Karanlık mod için hazır altyapı — istersen body'e class="dark" verince aktifleşir.
   Faz 2'de bir toggle eklenecek. */
.dark {
  --color-bg: #0f172a;
  --color-surface: #1e293b;
  --color-surface-alt: #0f172a;
  --color-border: #334155;
  --color-border-strong: #475569;
  --color-text: #e2e8f0;
  --color-text-muted: #94a3b8;
  --color-text-strong: #f1f5f9;
  --color-primary: #e2e8f0;
  --color-primary-contrast: #0f172a;
  --color-neutral-bg: #1e293b;
  --color-neutral-text: #94a3b8;
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* ------------------------------------------------------------------------- */
/* Reset ve tabanlar                                                          */
/* ------------------------------------------------------------------------- */

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-stack);
  font-size: var(--font-size-base);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
}

/* ------------------------------------------------------------------------- */
/* Düzen (layout)                                                             */
/* ------------------------------------------------------------------------- */

.container {
  width: min(var(--container-max), 94%);
  margin: var(--space-6) auto;
}

@media (min-width: 640px) {
  .container {
    margin: var(--space-8) auto;
  }
}

/* ------------------------------------------------------------------------- */
/* Üst navigasyon                                                             */
/* ------------------------------------------------------------------------- */

.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 6px 6px 6px 18px;
  margin-bottom: var(--space-6);
  box-shadow: 0 2px 12px rgba(17, 24, 39, 0.07);
}

/* Marka (logo + isim) */
.topnav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.topnav-brand-icon {
  width: 34px;
  height: 34px;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  flex-shrink: 0;
}

.topnav-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.02em;
}

/* Link grubu */
.topnav-links {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
}

/* Tek link */
.topnav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: var(--radius-lg);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.topnav-link:hover:not(.active) {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.topnav-link.active {
  background: var(--color-primary);
  color: #fff;
}

.topnav-svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.85;
}

.topnav-link.active .topnav-svg {
  opacity: 1;
}

.topnav-user {
  display: inline-flex;
  align-items: center;
  padding: 9px 12px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  white-space: nowrap;
  text-decoration: none;
  border-radius: var(--radius);
  transition: color 0.15s;
}
.topnav-user:hover {
  color: var(--color-text);
}

.topnav-logout {
  margin-left: 2px;
}
.topnav-logout:hover {
  color: var(--color-danger, #ef4444);
}

/* Gizlilik modu butonu */
.topnav-privacy {
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 9px 10px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  border-radius: var(--radius);
  transition: color 0.15s;
}
.topnav-privacy:hover {
  color: var(--color-text);
}
body.privacy-mode .topnav-privacy {
  color: var(--color-accent, #6c63ff);
}

/* Gizlilik modu — rakamları blur et */
body.privacy-mode .bs-v2-value,
body.privacy-mode .bs-v2-remain-val,
body.privacy-mode .total-cell,
body.privacy-mode .cat-bar-actual,
body.privacy-mode .cat-bar-plan-label,
body.privacy-mode .value,
body.privacy-mode td.text-right,
body.privacy-mode canvas,
body.privacy-mode .amount-input,
body.privacy-mode input[type="number"] {
  filter: blur(6px);
  transition: filter 0.2s;
  user-select: none;
}
body.privacy-mode .bs-v2-value:hover,
body.privacy-mode .bs-v2-remain-val:hover,
body.privacy-mode .total-cell:hover,
body.privacy-mode .cat-bar-actual:hover,
body.privacy-mode .value:hover,
body.privacy-mode td.text-right:hover {
  filter: blur(0);
}

/* ------------------------------------------------------------------------- */
/* Sayfa başlığı ve araç çubuğu                                               */
/* ------------------------------------------------------------------------- */

.page-header {
  margin-bottom: var(--space-6);
}

.page-header h1 {
  margin: 0 0 var(--space-1);
  font-size: var(--font-size-2xl);
  color: var(--color-text-strong);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.page-header p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

@media (min-width: 900px) {
  .page-header.with-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-6);
  }
}

.toolbar {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
  margin-top: var(--space-3);
}

.toolbar select,
.toolbar input,
.toolbar button,
.toolbar a {
  height: var(--form-height);
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--font-size-base);
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}

@media (min-width: 900px) {
  .toolbar {
    margin-top: 0;
  }
}

/* ------------------------------------------------------------------------- */
/* Header sağ köşe: toggle + navigasyon formu dikey sıralı                   */
/* ------------------------------------------------------------------------- */

.header-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

@media (min-width: 900px) {
  .header-controls { margin-top: 0; }
}

/* Yıllık / Aylık toggle */
.view-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  width: fit-content;
}
.view-btn {
  padding: 4px 14px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  background: var(--color-surface);
  transition: background 0.15s, color 0.15s;
}
.view-btn:hover  { background: var(--color-bg); color: var(--color-text); }
.view-btn.active { background: var(--color-primary); color: #fff; }

/* ◀ ▶ ok butonları */
.btn-icon {
  padding: 0 10px;
  font-size: 0.8rem;
  min-width: unset;
}

/* Aylık görünüm: 3 sütunlu grid */
.monthly-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  align-items: start;
  margin-bottom: var(--space-5);
}

/* Aylık plan: Gelir+Birikim üstte yan yana, Gider altta tam genişlik */
.plan-donut-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  padding: var(--space-4);
  align-items: start;
}

.plan-donut-col--full {
  grid-column: 1 / -1;
}

.plan-donut-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.plan-donut-label {
  font-size: var(--font-size-sm);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  text-align: center;
}

/* Üst iki kolon için daha küçük yükseklik */
.plan-donut-col .donut-holder {
  height: 260px;
}

/* Gider kolonu altta tam genişlik — biraz daha yüksek */
.plan-donut-col--full .donut-holder {
  height: 320px;
}

@media (max-width: 900px) {
  .plan-donut-grid {
    grid-template-columns: 1fr;
  }
  .plan-donut-col .donut-holder,
  .plan-donut-col--full .donut-holder {
    height: 300px;
  }
}

/* Bant tıklama vurgusu — donut col ve liste paneli */
.plan-highlight-income {
  outline: 2px solid var(--color-income);
  outline-offset: 2px;
  border-radius: var(--radius-md);
  transition: outline 0.2s;
}
.plan-highlight-expense {
  outline: 2px solid var(--color-expense);
  outline-offset: 2px;
  border-radius: var(--radius-md);
  transition: outline 0.2s;
}
.plan-highlight-saving {
  outline: 2px solid var(--color-saving);
  outline-offset: 2px;
  border-radius: var(--radius-md);
  transition: outline 0.2s;
}

/* Panel arka plan tonu (panel sınıfı üzerinde) */
.panel.plan-highlight-income  { background: linear-gradient(180deg, var(--color-income-bg, #f0fdf4) 0%, var(--bg-panel) 120px); }
.panel.plan-highlight-expense { background: linear-gradient(180deg, var(--color-expense-bg, #fef2f2) 0%, var(--bg-panel) 120px); }
.panel.plan-highlight-saving  { background: linear-gradient(180deg, var(--color-saving-bg, #eff6ff) 0%, var(--bg-panel) 120px); }

/* Aylık plan: 3 sütunlu kategori grid (her panel tam genişlik) */
/* Donut + liste yan yana (aylık plan paneli içinde) */
.plan-panel-split {
  display: grid;
  grid-template-columns: 460px 1fr;   /* chart sütunu: 3 panelde eşit */
  gap: 0;
  align-items: stretch;
}
.plan-panel-donut {
  padding: var(--space-4);
  border-right: 1px solid var(--color-border);
  display: flex;
  align-items: center;
}
.plan-panel-donut .donut-holder {
  height: 420px;   /* 3 panelde de aynı yükseklik */
  width: 100%;
}
.plan-panel-list {
  min-width: 0;
}
/* Gider paneli — chart daha uzun, liste scroll */
.plan-panel-split--expense .plan-panel-donut .donut-holder {
  height: 560px;
}
.plan-panel-split--expense .plan-panel-list {
  overflow-y: auto;
  max-height: 560px;
}

/* Gelir / Birikim — tek sütun liste */
.monthly-plan-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: var(--space-1) 0;
}
/* Gider — iki sütun, daha sıkışık */
.monthly-plan-cols--2col {
  grid-template-columns: repeat(2, 1fr);
}

.monthly-plan-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
  padding: 4px var(--space-3);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--font-size-xs);
}
/* 1 sütun — son öge */
.monthly-plan-cols:not(.monthly-plan-cols--2col) .monthly-plan-item:last-child {
  border-bottom: none;
}
/* 2 sütun — son satır */
.monthly-plan-cols--2col .monthly-plan-item:nth-last-child(-n+2):nth-child(2n+1),
.monthly-plan-cols--2col .monthly-plan-item:last-child {
  border-bottom: none;
}

.monthly-plan-name {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.monthly-plan-name span:first-of-type {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1100px) {
  .plan-panel-split {
    grid-template-columns: 320px 1fr;
  }
  .plan-panel-donut .donut-holder { height: 300px; }
}
@media (max-width: 800px) {
  .plan-panel-split {
    grid-template-columns: 1fr;
  }
  .plan-panel-donut {
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }
  .plan-panel-donut .donut-holder { height: 260px; }
}

@media (max-width: 600px) {
  .monthly-plan-cols {
    grid-template-columns: 1fr;
  }
}

/* Eski tablo stili (geriye dönük uyumluluk için bırakıldı) */
.monthly-plan-table {
  width: 100%;
  border-collapse: collapse;
}
.monthly-plan-table td {
  padding: 5px var(--space-3);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--font-size-sm);
  vertical-align: middle;
}
.monthly-plan-table tr:last-child td { border-bottom: none; }
.monthly-plan-table .amount-cell { width: 90px; text-align: right; }
.monthly-plan-table .amount-input {
  width: 82px;
  text-align: right;
  padding: 2px 6px;
  height: 28px;
  font-size: var(--font-size-sm);
}

/* Yeni grid layout için input genişliği */
.monthly-plan-item .amount-input {
  width: 72px;
  flex-shrink: 0;
  text-align: right;
  padding: 2px 4px;
  height: 24px;
  font-size: var(--font-size-xs);
}

/* ------------------------------------------------------------------------- */
/* Bütçe bant göstergesi (planlama üst bant)                                  */
/* ------------------------------------------------------------------------- */

/* ── Pill yıl seçici (açılır/kapanır dropdown) ───────────────────── */
.year-pill-wrap {
  position: relative;
  display: inline-block;
}
.year-pill-btn {
  background: var(--color-primary);
  color: #fff;
  border: none;
  padding: 3px 12px 3px 14px;
  border-radius: 999px;
  font-size: var(--font-size-sm);
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: filter 0.15s;
}
.year-pill-btn:hover { filter: brightness(1.1); }
.year-pill-arrow {
  font-size: 0.6em;
  opacity: 0.8;
  transition: transform 0.15s;
  display: inline-block;
}
.year-pill-wrap.open .year-pill-arrow { transform: rotate(180deg); }
.year-pill-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  overflow: hidden;
  min-width: 90px;
  z-index: 200;
}
.year-pill-wrap.open .year-pill-dropdown { display: block; }
.year-pill-option {
  display: block;
  padding: 7px 18px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  transition: background 0.1s;
}
.year-pill-option:hover { background: var(--color-bg); }
.year-pill-option.active {
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
}

/* ── Yeni dikey bant bütçe bandı (Planlama) ──────────────────────── */
.bs-v2 {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-4) var(--space-3);
  box-shadow: var(--shadow-card);
}
/* Gelir barı: label solda, kalan/aşım sağda */
.bs-v2-income--split {
  justify-content: space-between;
  align-items: center;
}
.bs-v2-left  { display: flex; align-items: baseline; gap: var(--space-2); }
.bs-v2-right { display: flex; flex-direction: column; align-items: flex-end; gap: 0; flex-shrink: 0; }
.bs-v2-remain-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  font-style: italic;
}
.bs-v2-remain-val {
  font-size: var(--font-size-sm);
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
}

/* Gider + Birikim + ghost: flex dağılım, sarılma yok */
.bs-v2-sub-row {
  display: flex;
  gap: var(--space-2);
  flex-wrap: nowrap;
}
/* Ghost kalan bandı */
.bs-v2-ghost {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-2);
  border-radius: var(--radius-md);
  background: rgba(21,128,61,0.08);
  border: 1.5px dashed var(--color-income-border);
  color: var(--color-income);
  min-width: 40px;
  overflow: hidden;
}
.bs-v2-ghost-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.8;
}
.bs-v2-ghost-pct {
  font-size: var(--font-size-sm);
  font-weight: 700;
}
.bs-v2-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: #fff;
  font-weight: 600;
  transition: filter 0.15s;
  overflow: hidden;
  white-space: nowrap;
  box-sizing: border-box;
  flex-basis: 0;   /* flex:N ile orantılı büyüsün */
  flex-shrink: 1;
  min-width: 60px; /* çok dar olmasın */
}
a.bs-v2-bar:hover { filter: brightness(1.1); }
.bs-v2-income  { background: var(--color-income-border);  flex: 1; }
.bs-v2-expense { background: var(--color-expense-border); }
.bs-v2-saving  { background: var(--color-saving-border);  }
/* Aktif tab (yıllık görünümde) */
.bs-v2-bar.bs-v2-active {
  filter: brightness(1.12);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.55);
}
.bs-v2-icon  { font-size: 1em; flex-shrink: 0; }
.bs-v2-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.bs-v2-value {
  font-size: var(--font-size-base);
  font-weight: 800;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.bs-v2-pct {
  font-size: var(--font-size-xs);
  opacity: 0.75;
  flex-shrink: 0;
  margin-left: auto;
  padding-left: var(--space-2);
}
/* Kalan bütçe (sağda) — eski tanım, artık kullanılmıyor */

/* ── Eski kart tabanlı bant (Girdi panelinde hâlâ kullanılıyor) ─── */
.budget-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

@media (min-width: 900px) {
  .budget-strip {
    grid-template-columns: repeat(4, 1fr);
  }
  .budget-strip--3col {
    grid-template-columns: repeat(3, 1fr);
  }
}

.bs-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-4) var(--space-3);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  display: block;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
a.bs-item:hover:not(.bs-active) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}
.bs-item.bs-income  { border-top-color: var(--color-income-border); }
.bs-item.bs-expense { border-top-color: var(--color-expense-border); }
.bs-item.bs-saving  { border-top-color: var(--color-saving-border); }
.bs-item.bs-net     { border-top-color: var(--color-accent); }

/* Aktif tab durumu — renkli zemin, beyaz yazı */
.bs-item.bs-income.bs-active  { background: var(--color-income-border);  border-color: var(--color-income-border);  border-top-color: var(--color-income-border); }
.bs-item.bs-expense.bs-active { background: var(--color-expense-border); border-color: var(--color-expense-border); border-top-color: var(--color-expense-border); }
.bs-item.bs-saving.bs-active  { background: var(--color-saving-border);  border-color: var(--color-saving-border);  border-top-color: var(--color-saving-border); }
.bs-item.bs-active .bs-label { color: rgba(255,255,255,0.8); }
.bs-item.bs-active .bs-value { color: #fff !important; }
.bs-item.bs-active .bs-pct   { color: rgba(255,255,255,0.7); }
.bs-item.bs-active .bs-bar-wrap { background: rgba(255,255,255,0.2); }
.bs-item.bs-active .bs-bar-fill { background: rgba(255,255,255,0.65) !important; }

.bs-label {
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: var(--space-1);
}
.bs-value {
  font-size: var(--font-size-lg);
  font-weight: 800;
  color: var(--color-text-strong);
  margin-bottom: var(--space-2);
  white-space: nowrap;
  letter-spacing: -0.02em;
}
.bs-item.bs-income  .bs-value { color: var(--color-income); }
.bs-item.bs-expense .bs-value { color: var(--color-expense); }
.bs-item.bs-saving  .bs-value { color: var(--color-saving); }

.bs-bar-wrap {
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: var(--space-1);
}
.bs-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.bs-income  .bs-bar-fill { background: var(--color-income-border); }
.bs-expense .bs-bar-fill { background: var(--color-expense-border); }
.bs-saving  .bs-bar-fill { background: var(--color-saving-border); }
.bs-net     .bs-bar-fill { background: var(--color-accent); }

.bs-pct {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  font-weight: 600;
}

/* ------------------------------------------------------------------------- */
/* Kategori ilerleme çubuğu (girdi + gösterge paneli)                        */
/* ------------------------------------------------------------------------- */

.progress-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-5);
}

.progress-panel-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--color-border);
  font-weight: 700;
  font-size: var(--font-size-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.progress-panel-total {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.progress-panel-total .pp-label { color: var(--color-text-muted); font-size: var(--font-size-sm); font-weight: 500; }
.progress-panel-total .pp-val   { font-weight: 700; font-size: var(--font-size-base); }

/* Büyük ilerleme çubuğu (toplam) */
.progress-bar-main {
  height: 8px;
  background: var(--color-border);
  border-radius: 4px;
  overflow: hidden;
  margin: var(--space-3) var(--space-5);
}
.progress-bar-main-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}
.progress-bar-main-fill.fill-income  { background: var(--color-income-border); }
.progress-bar-main-fill.fill-expense { background: var(--color-expense-border); }
.progress-bar-main-fill.fill-saving  { background: var(--color-saving-border); }

/* Kategori satır listesi */
.progress-cat-list {
  padding: 0 var(--space-5) var(--space-4);
}

.progress-cat-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
  align-items: center;
}
.progress-cat-row:last-child { border-bottom: none; }

.pcr-name {
  font-size: var(--font-size-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.pcr-amounts {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-align: right;
  white-space: nowrap;
}
.pcr-amounts strong { color: var(--color-text); font-weight: 600; }

.pcr-bar-wrap {
  grid-column: 1 / -1;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  overflow: hidden;
}
.pcr-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}
.pcr-bar-fill.fill-income  { background: var(--color-income-border); }
.pcr-bar-fill.fill-expense { background: var(--color-expense-border); }
.pcr-bar-fill.fill-saving  { background: var(--color-saving-border); }
.pcr-bar-fill.fill-over    { background: var(--color-danger); }

/* Kompakt progress panel (yeni tasarım) */
.pp-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  flex-wrap: wrap;
}
.pp-summary-title {
  font-weight: 700;
  font-size: var(--font-size-md);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.pp-summary-nums {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  flex-wrap: wrap;
}
.pp-sep { color: var(--color-border); }

/* Kategori ızgarası — 2 sütun kompakt kart */
.pp-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-2) var(--space-3);
  padding: var(--space-2) var(--space-5) var(--space-4);
}
.pp-cat-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pp-cat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
}
.pp-cat-name {
  font-size: var(--font-size-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pp-cat-bar {
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  overflow: hidden;
}
.pp-cat-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}
.pp-cat-bar-fill.fill-income  { background: var(--color-income-border); }
.pp-cat-bar-fill.fill-expense { background: var(--color-expense-border); }
.pp-cat-bar-fill.fill-saving  { background: var(--color-saving-border); }
.pp-cat-bar-fill.fill-over    { background: var(--color-danger); }
.pp-cat-amounts {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}
.pp-cat-amounts strong { color: var(--color-text); font-weight: 600; }

/* ------------------------------------------------------------------------- */
/* Sekmeler (tab'lar)                                                         */
/* ------------------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.tab {
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--font-size-base);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  font-family: inherit;
}

.tab.active {
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  border-color: var(--color-primary);
}

/* Tür bazlı aktif sekme renkleri */
.tab.tab--income.active  { background: var(--color-income);  border-color: var(--color-income-border); }
.tab.tab--expense.active { background: var(--color-expense); border-color: var(--color-expense-border); }
.tab.tab--saving.active  { background: var(--color-saving);  border-color: var(--color-saving-border); }

/* ------------------------------------------------------------------------- */
/* Kartlar (üstteki özet kartları)                                            */
/* ------------------------------------------------------------------------- */

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

@media (min-width: 640px) {
  .cards {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
  }
}

@media (min-width: 1024px) {
  .cards {
    grid-template-columns: repeat(4, 1fr);
  }
}

.cards.cards-3 { }
@media (min-width: 1024px) {
  .cards.cards-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card.highlight {
  border-color: var(--color-accent);
  background: linear-gradient(135deg, rgba(0,176,240,0.04) 0%, var(--color-surface) 60%);
}

/* Tür bazlı kart sol kenarlık varyantları */
.card.card--income  { border-top: 3px solid var(--color-income-border); }
.card.card--expense { border-top: 3px solid var(--color-expense-border); }
.card.card--saving  { border-top: 3px solid var(--color-saving-border); }

.card .label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.card .value {
  font-size: var(--font-size-xl);
  font-weight: 800;
  color: var(--color-text-strong);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.card .card-details {
  display: grid;
  gap: var(--space-2);
  font-size: var(--font-size-base);
  margin-top: var(--space-2);
}

.card .card-details strong {
  color: var(--color-text-muted);
  font-weight: 600;
  margin-right: var(--space-1);
}

/* ------------------------------------------------------------------------- */
/* Paneller (beyaz bloklar)                                                   */
/* ------------------------------------------------------------------------- */

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: visible;
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-5);
}

.panel-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border);
  font-weight: 700;
  color: var(--color-text-strong);
  font-size: var(--font-size-base);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

/* Tür bazlı panel başlığı varyantları */
.panel-header--income {
  color: var(--color-income);
  border-bottom-color: var(--color-income-bg);
  background: linear-gradient(135deg, var(--color-income-bg) 0%, transparent 60%);
}

.panel-header--expense {
  color: var(--color-expense);
  border-bottom-color: var(--color-expense-bg);
  background: linear-gradient(135deg, var(--color-expense-bg) 0%, transparent 60%);
}

.panel-header--saving {
  color: var(--color-saving);
  border-bottom-color: var(--color-saving-bg);
  background: linear-gradient(135deg, var(--color-saving-bg) 0%, transparent 60%);
}

/* KPI satır tür renkleri (gösterge aylık) */
.kpi-income { border-left: 3px solid var(--color-income-border); }
.kpi-expense { border-left: 3px solid var(--color-expense-border); }
.kpi-saving { border-left: 3px solid var(--color-saving-border); }

.panel-body {
  padding: var(--space-5);
}

.panel-body.flush {
  padding: 0;
}

.panel-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------------- */
/* Formlar                                                                    */
/* ------------------------------------------------------------------------- */

/* Tek satır form (Girdi: Yeni Hareket + Filtreler) */
.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
}

.form-row-wrap {
  padding: 0;
}

.form-row .field { gap: var(--space-1); }

/* Alan genişlikleri */
.field-date   { width: 130px; flex-shrink: 0; }
.field-amount { width: 110px; flex-shrink: 0; }
.field-cat    { width: 200px; flex-shrink: 1; min-width: 140px; }
.field-note   { flex: 1; min-width: 140px; }
.field-shift  { flex-shrink: 0; }
.field-action { flex-shrink: 0; }

/* Açılır/kapanır filtre başlığı */
.filter-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.filter-toggle-arrow {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  transition: transform 0.15s;
}

/* Panel başlığı flex (kayıt sayısı) */
.panel-header--flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.record-count-badge {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0;
  text-transform: none;
  opacity: 0.85;
}

@media (max-width: 700px) {
  .form-row {
    flex-direction: column;
    align-items: stretch;
  }
  .field-date, .field-amount, .field-cat,
  .field-note, .field-action { width: 100%; }
}

/* Portföy formu — tek satır */
.form-row--portfoy {
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  align-items: flex-end;
}
.form-row--portfoy .field { flex-shrink: 0; gap: var(--space-1); }
.pf-date   { width: 120px; }
.pf-select { width: 130px; }
.pf-name   { width: 155px; }
.pf-num    { width: 100px; }
.pf-note   { flex: 1; min-width: 80px; flex-shrink: 1; }
.form-row--portfoy .field-action { display: flex; flex-direction: row; gap: var(--space-2); align-items: flex-end; flex-shrink: 0; }
.form-row--portfoy .field-action label { display: none; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  padding: var(--space-5);
}

@media (min-width: 640px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .form-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  height: var(--form-height);
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--font-size-base);
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(34,57,98,0.1);
}

.field input:hover:not(:focus),
.field select:hover:not(:focus) {
  border-color: var(--color-primary);
}

.field.note-field {
  grid-column: span 1;
}

@media (min-width: 640px) {
  .field.note-field {
    grid-column: span 2;
  }
}

.form-inline-fields {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
}

.form-input {
  height: var(--form-height);
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--font-size-base);
}

.form-input.name-input {
  min-width: 240px;
  flex: 1 1 240px;
}

.form-input.sort-input {
  width: 120px;
}

.form-input.hint-input {
  width: 140px;
}

/* ------------------------------------------------------------------------- */
/* Buton stilleri                                                             */
/* ------------------------------------------------------------------------- */

.btn,
button.primary,
.primary {
  height: var(--form-height);
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  letter-spacing: 0.01em;
}

.btn:hover:not(.primary):not(:disabled) {
  background: var(--color-surface-alt);
  border-color: var(--color-primary);
}

.btn.primary,
button.primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 1px 2px rgba(34,57,98,0.25), 0 3px 8px rgba(34,57,98,0.12);
}

.btn.primary:hover,
button.primary:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 2px 4px rgba(34,57,98,0.3), 0 6px 16px rgba(34,57,98,0.18);
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.btn-link {
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text);
  padding: 0 var(--space-2);
  text-decoration: underline;
  cursor: pointer;
}

.action-buttons {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------------- */
/* Tablolar                                                                   */
/* ------------------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table.plan-table {
  min-width: 1400px;
}

table.wide {
  min-width: 900px;
}

thead th {
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  padding: 11px 14px;
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}

tbody td,
tfoot td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
  font-size: var(--font-size-base);
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover {
  background: rgba(34,57,98,0.025);
}

tfoot td {
  background: var(--color-surface-alt);
  font-weight: 700;
  border-top: 2px solid var(--color-border);
  border-bottom: none;
}

.category-col {
  min-width: 240px;
  font-weight: 500;
}

.month-input {
  width: 100%;
  min-width: 90px;
  height: 36px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  background: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--font-size-base);
}

.total-cell {
  font-weight: 700;
  color: var(--color-text-strong);
  white-space: nowrap;
}

.action-cell {
  white-space: nowrap;
}

.muted {
  color: var(--color-text-muted);
}

/* Gösterge fark renkleri */
.diff-positive {
  color: var(--color-success-text);
  background: var(--color-success-bg);
  font-weight: 700;
}

.diff-negative {
  color: var(--color-danger-text);
  background: var(--color-danger-bg);
  font-weight: 700;
}

.diff-neutral {
  color: var(--color-neutral-text);
  background: var(--color-neutral-bg);
  font-weight: 600;
}

/* ------------------------------------------------------------------------- */
/* Rozet (kategori zaman ipucu gibi küçük etiketler)                          */
/* ------------------------------------------------------------------------- */

.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  margin-left: var(--space-1);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* Meta rozet (Oğuzhan, Şule, Yapıkredi gibi) — hafif mavi tonu */
.badge-meta {
  background: #eff6ff;
  color: #1e40af;
  border-color: #bfdbfe;
}

/* Kategori shift kural ikonu (Planlama'da "↻ 26+") — turuncu */
.badge-shift {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

/* İşlem satırında "→ Mart 2026" — mor */
.badge-shifted {
  background: #f3e8ff;
  color: #6b21a8;
  border-color: #e9d5ff;
  margin-left: 0;
  margin-top: 4px;
}

/* Yüzdelik gerçekleşme rozeti — gösterge paneli */
.pct-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.pct-high  { background: #dcfce7; color: #166534; }
.pct-mid   { background: #fef9c3; color: #854d0e; }
.pct-low   { background: #fee2e2; color: #991b1b; }

/* ---- Kategori bant grid (Gösterge) ---- */
.cat-bar-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: var(--space-2) 0 var(--space-3);
}
/* Panel içi tek sütun (Gelir / Birikim) */
.cat-bar-grid--panel {
  grid-template-columns: 1fr;
  padding: 0;
}
.cat-bar-grid--panel .cat-bar-cell { border-right: none; }
.cat-bar-grid--panel .cat-bar-cell:last-child { border-bottom: none; }
/* Panel içi iki sütun (Gider) */
.cat-bar-grid--panel-2col {
  grid-template-columns: repeat(2, 1fr);
}
.cat-bar-grid--panel-2col .cat-bar-cell:nth-child(2n)       { border-right: none; }
.cat-bar-grid--panel-2col .cat-bar-cell:nth-last-child(-n+2):nth-child(2n+1),
.cat-bar-grid--panel-2col .cat-bar-cell:last-child           { border-bottom: none; }

.cat-bar-cell {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
}
/* Son sütundaki sağ kenarlığı kaldır */
.cat-bar-cell:nth-child(3n) { border-right: none; }
/* Son satır alt kenarlığı kaldır (son 1-3 öge) */
.cat-bar-cell:nth-last-child(-n+3) { border-bottom: none; }

.cat-bar-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: 6px;
}

.cat-bar-name {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-sm);
  font-weight: 500;
  min-width: 0;
  flex: 1;
}
.cat-bar-name span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cat-bar-nums {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-shrink: 0;
  font-size: var(--font-size-sm);
}
.cat-bar-actual { font-weight: 700; }
.cat-bar-diff   { font-weight: 600; font-size: var(--font-size-xs); }

.cat-bar-plan-label {
  font-size: var(--font-size-xs);
  margin-top: 4px;
}

/* Track — plan tutarı %100 */
.cat-bar-track {
  height: 5px;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

/* Dolum — gerçekleşen */
.cat-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* Tür renkleri */
.cat-bar-cell--income  .cat-bar-fill { background: var(--color-income-border); }
.cat-bar-cell--expense .cat-bar-fill { background: var(--color-expense-border); }
.cat-bar-cell--saving  .cat-bar-fill { background: var(--color-saving-border); }

/* Track arka planı (soluk tür tonu) */
.cat-bar-cell--income  .cat-bar-track { background: var(--color-income-bg,  #f0fdf4); }
.cat-bar-cell--expense .cat-bar-track { background: var(--color-expense-bg, #fef2f2); }
.cat-bar-cell--saving  .cat-bar-track { background: var(--color-saving-bg,  #eff6ff); }

/* Aşım — fill rengi koyulaşır */
.cat-bar-cell--income  .cat-bar-fill--over { background: #14532d; }
.cat-bar-cell--expense .cat-bar-fill--over { background: #7f1d1d; }
.cat-bar-cell--saving  .cat-bar-fill--over { background: #1e3a8a; }

/* Donut / kategori bölümü başlığındaki yıl|ay navigasyonu */
.cat-period-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.cat-period-sep {
  color: var(--color-text-muted, #9ca3af);
  padding: 0 var(--space-1);
  pointer-events: none;
  font-weight: 400;
  opacity: 0.6;
}
/* .cat-period-toggle view-toggle'dan miras alır, ek stil gerekmez */

/* Dağılım bölümü pill navigasyonu: yıl + ay pills */
.dist-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) 0;
}
.dist-nav-pill {
  padding: 4px 0;
  border-radius: 999px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  border: none;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
}
/* Yıl pill wrapper: dist-nav içinde ay pilleriyle aynı flex */
.dist-nav .year-pill-wrap {
  flex: 1;
}
.dist-nav .year-pill-btn {
  width: 100%;
  justify-content: center;
  padding: 4px 0;
  font-weight: 800;
  font-size: var(--font-size-sm);
}
/* Ay pills: kalan alanı 12'ye eşit böl */
.dist-nav-month {
  flex: 1;
  background: var(--color-surface);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.dist-nav-month:hover { background: var(--color-bg); color: var(--color-text); }
.dist-nav-month.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* Ay navigasyon (kategori detay panel başlığında) */
.cat-month-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-sm);
}
.cat-month-nav--hidden { display: none; }
.cat-month-label {
  font-weight: 600;
  min-width: 60px;
  text-align: center;
  font-size: var(--font-size-sm);
}

@media (max-width: 900px) {
  .cat-bar-grid { grid-template-columns: repeat(2, 1fr); }
  .cat-bar-cell:nth-child(3n)       { border-right: revert; }
  .cat-bar-cell:nth-child(2n)       { border-right: none; }
  .cat-bar-cell:nth-last-child(-n+3) { border-bottom: revert; }
  .cat-bar-cell:nth-last-child(-n+2) { border-bottom: none; }
}
@media (max-width: 600px) {
  .cat-bar-grid { grid-template-columns: 1fr; }
  .cat-bar-cell { border-right: none !important; }
}

/* Tür noktası (gösterge kategori tablosu) */
.type-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
  flex-shrink: 0;
}
.type-dot--income  { background: var(--color-income-border); }
.type-dot--expense { background: var(--color-expense-border); }
.type-dot--saving  { background: var(--color-saving-border); }

/* Kategori ikon emojisi — planlama tablosu ve girdi listesi */
.cat-icon {
  font-style: normal;
  margin-right: 4px;
  font-size: 1em;
  line-height: 1;
}

/* SVG ikon (cat-svg-icon) — tablo ve liste görünümü */
.cat-svg-icon {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  vertical-align: middle;
  margin-right: 5px;
  flex-shrink: 0;
}

/* Otomatik SVG ikon — catsvg() context processor çıktısı */
.cat-svg-icon {
  display: inline-block;
  vertical-align: middle;
  margin-right: 5px;
  margin-top: -2px;
  flex-shrink: 0;
}

/* Girdi formunda shift checkbox label'ı */
.shift-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: var(--font-size-base);
  color: var(--color-text);
  font-weight: 500;
  padding: 10px 12px;
  background: var(--color-surface-alt);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
}

.shift-checkbox-label input[type="checkbox"] {
  width: auto;
  height: auto;
  margin: 0;
}

/* Gösterge panelinde grafik sekmesi + canvas konteyner */
.chart-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 20px 0;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-alt);
}

.chart-tab {
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.chart-tab:hover {
  color: var(--color-primary);
}

.chart-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 700;
}

/* ── External Chart.js tooltip ──────────────────────────────── */
#chartjs-ext-tooltip {
  position: fixed;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  max-width: 380px;
}
#chartjs-ext-tooltip .ext-tt-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 5px;
}
#chartjs-ext-tooltip .ext-tt-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  line-height: 1.6;
}
#chartjs-ext-tooltip .ext-tt-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.chart-holder {
  padding: 20px;
  height: 320px;
  position: relative;
}

.chart-holder canvas {
  max-height: 100%;
}

.donut-holder {
  height: 360px;
}

/* Birden fazla donut canvas'ı aynı alanda tutan konteyner (lazy-init: biri gizli, biri görünür) */
.multi-donut-holder {
  position: relative;
}
.multi-donut-holder canvas {
  max-height: 100%;
}

/* Birleşik sütun grafik — 12 ay × 3 grup için daha yüksek alan */
.chart-holder--combined {
  height: 420px;
  padding: 16px 20px 20px;
}

@media (min-width: 900px) {
  .chart-holder { height: 380px; }
  .donut-holder { height: 420px; }
  .chart-holder--combined { height: 480px; }
}

/* ------------------------------------------------------------------------- */
/* Flash mesajları                                                            */
/* ------------------------------------------------------------------------- */

.flash-wrap {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.flash {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: var(--font-size-base);
  font-weight: 500;
}

.flash.success {
  border-color: var(--color-success-border);
  background: var(--color-success-bg);
  color: var(--color-success-text);
}

.flash.error {
  border-color: var(--color-danger-border);
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
}

/* ------------------------------------------------------------------------- */
/* Yardımcı utility sınıflar                                                  */
/* ------------------------------------------------------------------------- */

.text-center { text-align: center; }
.text-right  { text-align: right;  }
.mt-0 { margin-top: 0; }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mb-0 { margin-bottom: 0; }
.hidden { display: none !important; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── Login sayfası ──────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  padding: var(--space-5);
}

.login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: var(--space-8, 40px);
  width: 100%;
  max-width: 400px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.login-brand-icon {
  font-size: 28px;
  width: 44px;
  height: 44px;
  background: var(--color-primary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.login-brand-name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--color-text-strong);
}

.login-title {
  font-size: var(--font-size-xl, 20px);
  font-weight: 700;
  color: var(--color-text-strong);
  margin: 0 0 var(--space-1);
}

.login-sub {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin: 0 0 var(--space-5);
}

.login-remember {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  cursor: pointer;
}

.login-btn {
  width: 100%;
  justify-content: center;
  height: 44px;
  font-size: var(--font-size-base);
}
