/* =================================================================
   BUDGET — desktop
   ================================================================= */
.budget-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  align-items: start;
}

.budget-list-header {
  margin-bottom: 12px;
}
.budget-list-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.budget-list-header-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* ── Summary accordion ─────────────────────────────────────────── */
.budget-summary-details {
  border: 1px solid var(--border-color-soft);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}
.budget-summary-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}
.budget-summary-toggle::-webkit-details-marker { display: none; }
.budget-summary-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.budget-summary-period {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.budget-summary-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  margin-left: auto;
  transition: transform 0.2s;
}
.budget-summary-details[open] .budget-summary-chevron {
  transform: rotate(180deg);
}
.budget-summary-body {
  padding: 0 16px 16px;
}

/* ── Bar group (inside accordion) ──────────────────────────────── */
.budget-bar-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.budget-bar-divider {
  height: 1px;
  background: var(--border-color-soft);
  margin: 4px 0;
}
.budget-bar-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.budget-bar-name {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.budget-bar-name.income {
  color: var(--neon-green);
}
.budget-bar-name.expense {
  color: var(--neon-pink);
}
.budget-bar-nums {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.budget-bar-track {
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  margin-bottom: 8px;
}
.budget-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.budget-bar-fill.income {
  background: linear-gradient(90deg, var(--neon-green), var(--neon-blue));
  box-shadow: 0 0 8px rgba(0, 255, 159, 0.4);
}
.budget-bar-fill.expense {
  background: linear-gradient(90deg, var(--neon-pink), #ff6b35);
  box-shadow: 0 0 8px rgba(255, 0, 110, 0.4);
}

/* ── Planned items list ────────────────────────────────────────── */
.budget-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

/* ── Budget row (mirrors tx-row) ───────────────────────────────── */
.budget-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.budget-row:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border-color-soft);
}

.budget-row-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.budget-row-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
}
.budget-row-icon svg {
  width: 15px;
  height: 15px;
}
.budget-row-icon--income {
  background: rgba(0, 255, 159, 0.12);
  color: var(--neon-green);
}
.budget-row-icon--expense {
  background: rgba(255, 0, 110, 0.12);
  color: var(--neon-pink);
}

.budget-row-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.budget-row-meta-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.budget-row-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.budget-row-acc {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.budget-row-note {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.budget-row-right {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.budget-row-amount {
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
}
.budget-row-amount--income {
  color: var(--neon-green);
}
.budget-row-amount--expense {
  color: var(--neon-pink);
}

.budget-row-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.budget-row:hover .budget-row-actions {
  opacity: 1;
}

.budget-row--posted {
  opacity: 0.5;
}
.budget-row--posted:hover {
  opacity: 0.75;
}
.budget-row-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.budget-row-badge--posted {
  background: rgba(0, 255, 159, 0.12);
  color: var(--neon-green);
}
.budget-row-badge--diverged {
  background: rgba(255, 193, 7, 0.12);
  color: #ffc107;
  cursor: help;
}

.budget-act-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.budget-act-btn svg {
  width: 14px;
  height: 14px;
}
.budget-act-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.budget-act-btn.danger:hover {
  background: rgba(255, 0, 110, 0.2);
  color: var(--neon-pink);
}

/* ── Mobile ────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  #section-root {
    overflow-x: hidden;
    max-width: 100vw;
  }
  .budget-layout {
    grid-template-columns: 1fr;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .budget-form-card {
    display: none;
  }
  #section-root .budget-list-card {
    overflow: hidden !important;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
  }
  .budget-list-header {
    padding: 14px 16px 10px;
  }
  .budget-list-header-pills {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .budget-list-header-pills::-webkit-scrollbar {
    display: none;
  }
  .budget-list-header .tx-form-title {
    margin: 0;
    font-size: 0.78rem;
  }
  .budget-summary-details {
    margin: 0 16px 12px;
    border-radius: 10px;
    min-width: 0;
    overflow: hidden;
  }
  .budget-summary-body {
    padding: 0 12px 12px;
    overflow-x: auto;
  }
  .budget-list {
    padding: 0 16px;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .budget-row {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color-soft);
    border-radius: 0;
  }
  .budget-row:last-child {
    border-bottom: none;
  }
  .budget-row-icon {
    width: 28px;
    height: 28px;
  }
  .budget-row-icon svg {
    width: 13px;
    height: 13px;
  }
  .budget-row-actions {
    opacity: 1;
  }
  .budget-act-btn {
    width: 32px;
    height: 32px;
  }
}
