/* Flow Step — Bütçe (Kurum destekleri + Takım kasası; yönetim Bütçe sayfası da aynı bd- sınıflarını kullanır)
   Sayfa görünümü .bd-page altında; modallar <body>'ye eklendiği için modal içi stiller kapsamsız.
   Yalnızca variables.css token'ları; aydınlık ve koyu temada çalışır. */

/* ─── Ortak yardımcılar (yükleniyor / yetki / hata mesajları ve pencerelerdeki açıklamalar) ─── */
.bud-muted { color: var(--text-muted); font-size: 12px; }
#page-budget .bud-empty { padding: var(--space-xl) var(--space-md); text-align: center; font-size: 13px; color: var(--text-muted); background: var(--bg-secondary); border: 1px dashed var(--border-default); border-radius: var(--radius-lg); }
#page-budget .bud-error { margin-bottom: 12px; padding: 10px 14px; font-size: 13px; font-weight: 500; color: var(--accent-danger); background: color-mix(in srgb, var(--accent-danger) 10%, transparent); border-radius: var(--radius-md); }

/* ═══ Sayfa görünümü (bd-; takım budget.js ve yönetim admin-budget.js ortak; kök .bd-page, yönetimde ayrıca .bd-admin)
   Ölçüler inventory.css .iv-page ile aynı (stat kartları, araç çubuğu, tablo, rozetler). ═══ */

/* Araç çubuğu: sekmeler / takım seçimi solda, birincil düğme sağda */
.bd-page .bd-toolbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 16px;
  margin-bottom: 20px;
}
.bd-page .bd-toolbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.bd-page .bd-toolbar .btn,
.bd-page .bd-card-head .btn { height: 36px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.bd-page .bd-toolbar .btn .msr,
.bd-page .bd-card-head .btn .msr { font-size: 18px; }
.bd-page .bd-select {
  width: auto; min-width: 170px; height: 36px; min-height: 36px;
  padding-top: 0; padding-bottom: 0; line-height: 34px; font-size: 14px;
}
.bd-page .bd-error { margin-bottom: 16px; }
.bd-page .bd-muted { font-size: 13px; color: var(--text-muted); }
.bd-page .bd-neg { color: var(--c-red); }
.bd-page .bd-pos { color: var(--c-green); }

/* Kasa gizlilik notu */
.bd-page .bd-private {
  display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
  font-size: 14px; color: var(--text-muted);
}
.bd-page .bd-private .msr { flex-shrink: 0; font-size: 18px; }

/* Stat kartları */
.bd-page .bd-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px; margin-bottom: 20px;
}
.bd-page:not(.bd-admin) .bd-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bd-page .bd-stat { margin: 0; }
.bd-page .bd-stat .stat-card-label { font-size: 14px; }
.bd-page .bd-stat .stat-card-icon { width: 32px; height: 32px; border-radius: var(--radius-control); }
.bd-page .bd-stat .stat-card-icon .msr { font-size: 18px; }
.bd-page .bd-stat .stat-card-value { font-size: 40px; font-weight: 700; letter-spacing: -1px; }
.bd-page .bd-stat .stat-card-value.bd-pos { color: var(--c-green); }
.bd-page .bd-stat .stat-card-value.bd-neg { color: var(--c-red); }
.bd-page .bd-stat .stat-card-sub { font-size: 14px; font-weight: 500; }
.bd-page .bd-pending-note { margin: -8px 0 20px; font-size: 13px; color: var(--text-muted); }
.bd-page .bd-pending-note strong { font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.bd-page .bd-pending-note strong.bd-neg { color: var(--c-red); }

/* Destek kartları */
.bd-page .bd-supports {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px; margin-bottom: 20px;
}
.bd-page .bd-support { display: flex; flex-direction: column; min-width: 0; margin: 0; padding: 24px; }
.bd-page .bd-support.is-closed { opacity: .7; }
.bd-page .bd-support-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.bd-page .bd-support-who { min-width: 0; }
.bd-page .bd-support-name { font-size: 17px; font-weight: 600; line-height: 1.3; color: var(--text-primary); overflow-wrap: anywhere; }
.bd-page .bd-support-period { margin-top: 2px; font-size: 13px; color: var(--text-muted); }
.bd-page .bd-closed { flex-shrink: 0; background: var(--bg-tertiary); color: var(--text-muted); }
.bd-page .bd-remaining-label { margin-top: 20px; font-size: 13px; color: var(--text-muted); }
.bd-page .bd-remaining {
  margin-top: 2px; font-size: 32px; font-weight: 700; line-height: 1.15; letter-spacing: -0.5px;
  color: var(--text-primary); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.bd-page .bd-remaining.bd-neg { color: var(--c-red); }
.bd-page .bd-bar {
  display: flex; height: 8px; margin-top: 16px; overflow: hidden;
  border-radius: var(--radius-badge); background: var(--bg-tertiary);
}
.bd-page .bd-bar-approved,
.bd-page .bd-mini-bar .bd-bar-approved { display: block; height: 100%; background: var(--accent-primary); }
.bd-page .bd-bar-pending,
.bd-page .bd-mini-bar .bd-bar-pending { display: block; height: 100%; background: color-mix(in srgb, var(--accent-primary) 35%, transparent); }
.bd-page .bd-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 12px; font-size: 13px; color: var(--text-muted); }
.bd-page .bd-legend-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bd-page .bd-dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; }
.bd-page .bd-dot-approved { background: var(--accent-primary); }
.bd-page .bd-dot-pending { background: color-mix(in srgb, var(--accent-primary) 35%, transparent); }
.bd-page .bd-note { margin-top: 12px; font-size: 13px; color: var(--text-muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.bd-page .bd-empty { margin-bottom: 20px; }
.bd-page .bd-empty > .msr { font-size: 40px; }

/* Kart başlık satırı (Harcamalar, Hareketler, Takımlar, Destekler) */
.bd-page .bd-spends,
.bd-page .bd-cash,
.bd-page .bd-section { margin: 0 0 20px; padding: 0; overflow: hidden; }
.bd-page .bd-card-head {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 16px;
  padding: 16px 24px; border-bottom: 1px solid var(--border-subtle);
}
.bd-page .bd-card-title { margin: 0; font-size: 18px; font-weight: 600; color: var(--text-primary); }
.bd-page .bd-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.bd-page .bd-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.bd-page .bd-chips .filter-chip { height: 36px; }
.bd-page .bd-search { position: relative; flex: 0 0 220px; width: 220px; }
.bd-page .bd-search > .msr {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  font-size: 18px; color: var(--text-muted); pointer-events: none;
}
.bd-page .bd-search input {
  width: 100%; height: 36px; padding: 0 12px 0 34px;
  font: inherit; font-size: 14px; color: var(--text-primary);
  background: var(--bg-secondary); border: 1px solid var(--border-default); border-radius: var(--radius-control);
  outline: none; transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.bd-page .bd-search input::placeholder { color: var(--text-muted); }
.bd-page .bd-search input:focus { border-color: var(--accent-primary); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Tablolar */
.bd-page .bd-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.bd-page .bd-table { min-width: 760px; }
.bd-page .bd-table th {
  padding: 16px 12px 12px;
  font-size: 15px; font-weight: 400; color: var(--text-muted);
  text-transform: none; letter-spacing: normal;
  background: none; border-bottom: 1px solid var(--border-subtle);
}
.bd-page .bd-table td {
  height: 68px; padding: 0 12px;
  font-size: 15px; border-bottom: 1px solid var(--border-subtle);
}
.bd-page .bd-table tbody tr:last-child td { border-bottom: none; }
.bd-page .bd-table tbody tr:hover { background: var(--bg-primary); }
.bd-page .bd-table th:first-child,
.bd-page .bd-table td:first-child { padding-left: 24px; }
.bd-page .bd-table th:last-child,
.bd-page .bd-table td:last-child { padding-right: 24px; }
.bd-page .bd-table .bd-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bd-page .bd-table-empty { padding: 24px; font-size: 14px; color: var(--text-muted); }

.bd-page .bd-date { white-space: nowrap; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.bd-page .bd-col-title { min-width: 0; }
.bd-page .bd-title { font-size: 15px; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.bd-page .bd-desc { margin-top: 2px; font-size: 13px; color: var(--text-muted); overflow-wrap: anywhere; }
.bd-page .bd-reporter { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 13px; color: var(--text-muted); }
.bd-page .bd-reporter .avatar { flex-shrink: 0; }
.bd-page .bd-amount { font-weight: 600; }
.bd-page .bd-amount.bd-pos { color: var(--c-green); }
.bd-page .bd-amount.bd-neg { color: var(--c-red); }

/* Rozetler */
.bd-page .bd-st,
.bd-page .bd-dir,
.bd-page .bd-auto,
.bd-page .bd-support-st { white-space: nowrap; }
.bd-page .bd-st-ok,
.bd-page .bd-dir-in,
.bd-page .bd-support-st.is-open { background: var(--success-soft);   color: var(--success-text); }
.bd-page .bd-st-warn             { background: var(--warning-soft);   color: var(--c-orange); }
.bd-page .bd-st-bad,
.bd-page .bd-dir-out             { background: var(--danger-soft);    color: var(--c-red); }
.bd-page .bd-st-muted,
.bd-page .bd-auto,
.bd-page .bd-support-st.is-closed { background: var(--bg-tertiary);   color: var(--text-muted); }
.bd-page .bd-reason { margin-top: 4px; font-size: 12px; color: var(--text-muted); white-space: pre-wrap; overflow-wrap: anywhere; }

/* İşlem hücresi ve ikon düğmeleri */
.bd-page .bd-col-doc { white-space: nowrap; }
.bd-page .bd-actions { text-align: right; white-space: nowrap; }
.bd-page .bd-actions > * { vertical-align: middle; }
.bd-page .bd-actions > * + * { margin-left: 6px; }
.bd-page .bd-icon-btn {
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--radius-control);
  background: transparent; color: var(--text-secondary); cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.bd-page .bd-icon-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.bd-page .bd-icon-btn:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 1px; }
.bd-page .bd-icon-btn .msr { font-size: 20px; }
.bd-page .bd-inv-note { font-size: 13px; }

/* Satır menüsü */
.bd-page .bd-menu-wrap { position: relative; display: inline-block; }
.bd-page .bd-menu {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 20;
  min-width: 160px; padding: 6px; text-align: left;
  background: var(--bg-secondary); border: 1px solid var(--border-default);
  border-radius: var(--radius-control); box-shadow: var(--shadow-md);
}
.bd-page .bd-menu[hidden] { display: none; }
.bd-page .bd-menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px;
  font: inherit; font-size: 14px; text-align: left; color: var(--text-primary);
  background: none; border: none; border-radius: var(--radius-sm); cursor: pointer;
}
.bd-page .bd-menu-item .msr { font-size: 18px; }
.bd-page .bd-menu-item:hover { background: var(--bg-tertiary); }
.bd-page .bd-menu-item.is-danger { color: var(--c-red); }

/* Yönetim: Takımlar tablosu */
.bd-page .bd-team { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.bd-page .bd-team-icon {
  width: 28px; height: 28px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-control); background: var(--tc, var(--accent-primary)); color: var(--text-on-accent);
}
.bd-page .bd-team-icon .msr { font-size: 16px; color: inherit; }
.bd-page .bd-team-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-page .bd-remain-cell { display: inline-flex; align-items: center; justify-content: flex-end; gap: 10px; }
.bd-page .bd-mini-bar {
  display: inline-flex; width: 80px; height: 6px; flex-shrink: 0; overflow: hidden;
  border-radius: var(--radius-badge); background: var(--bg-tertiary);
}
.bd-page .bd-table tr.is-closed td { opacity: .7; }

/* Yönetim: desteği olmayan takımlar satırı (Takımlar kartının altında) */
.bd-page .bd-nosupport {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 16px 24px; border-top: 1px solid var(--border-subtle);
}
.bd-page .bd-nosupport > .bd-muted { margin-right: 4px; font-size: 14px; color: var(--text-muted); }
.bd-page .bd-team-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px 0 6px;
  font: inherit; font-size: 14px; color: var(--text-primary); white-space: nowrap;
  background: var(--bg-secondary); border: 1px solid var(--border-default); border-radius: var(--radius-badge);
}
.bd-page button.bd-team-chip { cursor: pointer; transition: border-color var(--t-fast), color var(--t-fast); }
.bd-page button.bd-team-chip:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.bd-page button.bd-team-chip:hover .bd-team-chip-add { color: var(--accent-primary); }
.bd-page button.bd-team-chip:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; }
.bd-page .bd-team-chip .bd-team-icon {
  width: 20px; height: 20px; border-radius: var(--radius-control);
  background: var(--tc, var(--accent-primary)); color: var(--text-on-accent);
}
.bd-page .bd-team-chip .bd-team-icon .msr { font-size: 13px; }
.bd-page .bd-team-chip-add { font-size: 16px; color: var(--text-muted); }
.bd-page .bd-table .team-pill { white-space: nowrap; }

/* 1100px altı: destek kartları ikişerli */
@media (max-width: 1100px) {
  .bd-page .bd-supports { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* 900px altı: stat kartları ikişerli; ikincil sütunlar (Tür, Destek, Kasadan, Bekleyen) gizli */
@media (max-width: 900px) {
  .bd-page .bd-stats,
  .bd-page:not(.bd-admin) .bd-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bd-page .bd-search { flex: 1 1 200px; width: auto; }
  .bd-page .bd-table { min-width: 560px; }
  /* Takım: Harcamalar (Tarih, Başlık, Tür, Destek, Fatura, Destekten, Kasadan, Durum, işlem) */
  .bd-page:not(.bd-admin) .bd-spends .bd-table th:nth-child(3), .bd-page:not(.bd-admin) .bd-spends .bd-table td:nth-child(3),
  .bd-page:not(.bd-admin) .bd-spends .bd-table th:nth-child(4), .bd-page:not(.bd-admin) .bd-spends .bd-table td:nth-child(4),
  .bd-page:not(.bd-admin) .bd-spends .bd-table th:nth-child(7), .bd-page:not(.bd-admin) .bd-spends .bd-table td:nth-child(7),
  /* Yönetim: Takımlar (Takım, Destek, Toplam, Onaylanan, Bekleyen, Kalan) */
  .bd-admin #abud-summary .bd-table th:nth-child(2), .bd-admin #abud-summary .bd-table td:nth-child(2),
  .bd-admin #abud-summary .bd-table th:nth-child(5), .bd-admin #abud-summary .bd-table td:nth-child(5),
  /* Yönetim: Destekler (Takım, Destek, Tutar, Onaylanan, Bekleyen, Kalan, Durum, işlem) */
  .bd-admin #abud-supports .bd-table th:nth-child(5), .bd-admin #abud-supports .bd-table td:nth-child(5),
  /* Yönetim: Harcamalar (Takım, Tarih, Başlık, Tür, Destek, Fatura, Destekten, Durum, işlem) */
  .bd-admin .bd-spends .bd-table th:nth-child(4), .bd-admin .bd-spends .bd-table td:nth-child(4),
  .bd-admin .bd-spends .bd-table th:nth-child(5), .bd-admin .bd-spends .bd-table td:nth-child(5) { display: none; }
}
@media (max-width: 700px) {
  .bd-page .bd-supports { grid-template-columns: minmax(0, 1fr); }
  .bd-page .bd-card-head { padding: 14px 16px; }
}

/* ─── Harcama Bildir modalı ───────────────────────────────── */
/* "Takım kasasından karşılanacak" satırı: hafif vurgulu kutu (boşken gizli) */
#bud-e-cash-share:not(:empty) {
  padding: 8px 12px;
  font-size: 13px; font-weight: 500; color: var(--text-primary);
  background: color-mix(in srgb, var(--accent-primary) 8%, var(--bg-secondary));
  border: 1px solid color-mix(in srgb, var(--accent-primary) 20%, transparent);
  border-radius: var(--radius-md);
  font-variant-numeric: tabular-nums;
}
.bud-error-text {
  margin-top: 6px; padding: 8px 12px;
  font-size: 13px; font-weight: 500; color: var(--accent-danger);
  background: color-mix(in srgb, var(--accent-danger) 10%, transparent);
  border-radius: var(--radius-md);
}
