/* style_components.css */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.card-subtle {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
}

.hero-card {
  background: var(--hero-gradient);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-md);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px 8px;
}

.section-title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--accent);
}

.section-sub {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--text-muted);
}

.section-total {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
}

.badge-pro {
  background: var(--gold);
  color: #0a3647;
}

.badge-accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-gold {
  background: var(--gold-soft);
  color: var(--gold-text);
}

.badge-muted {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  transition: transform 0.1s ease, opacity 0.15s ease, background-color 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-hero {
  background: var(--hero-gradient);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.btn-gold {
  background: var(--gold);
  color: #0a3647;
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-danger {
  background: var(--expense-soft);
  color: var(--expense);
}

.btn-danger-solid {
  background: var(--expense);
  color: #ffffff;
}

.btn-dashed {
  width: 100%;
  padding: 12px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-btn:active {
  background: var(--accent-soft);
  color: var(--accent);
}

.icon-btn-income {
  background: var(--income-soft);
  color: var(--income);
}

.icon-btn-danger {
  background: transparent;
  color: var(--text-muted);
}

.icon-btn-danger:hover {
  color: var(--expense);
  background: var(--expense-soft);
}

.segmented {
  display: flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 4px;
}

.segmented-btn {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.segmented-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.segmented-btn.active-accent {
  background: var(--accent);
  color: #ffffff;
}

.segmented-btn.active-expense {
  background: var(--expense);
  color: #ffffff;
}

.segmented-btn.active-income {
  background: var(--income);
  color: #ffffff;
}

.segmented-btn.active-saving {
  background: var(--saving);
  color: #ffffff;
}

.pills-row {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.pill-btn {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.pill-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.pill-btn.active-gold {
  background: var(--gold);
  border-color: var(--gold);
  color: #0a3647;
}

.banner-warn {
  background: var(--gold-soft);
  border: 1px solid rgba(244, 190, 55, 0.5);
  color: var(--gold-text);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.acc-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.acc-card.archived {
  opacity: 0.78;
  border-style: dashed;
}

.acc-card.editing {
  border-color: var(--gold);
}

.acc-main {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.icon-badge {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-badge-round {
  border-radius: 50%;
}

.icon-badge-sm {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.acc-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acc-balance {
  font-size: 14px;
  font-weight: 800;
  margin-top: 2px;
}

.acc-sub-balance {
  font-size: 11px;
  color: var(--text-muted);
}

.acc-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.donut-wrap {
  display: flex;
  justify-content: center;
  margin: 6px 0;
}

.donut-box {
  position: relative;
  width: 196px;
  height: 196px;
  cursor: pointer;
  user-select: none;
}

.donut-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.donut-center {
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
}

.donut-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.donut-primary {
  font-size: 17px;
  font-weight: 800;
  margin-top: 2px;
}

.donut-secondary {
  font-size: 12px;
  font-weight: 700;
  margin-top: 2px;
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 8px;
}

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

.cat-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 5px;
  position: relative;
  cursor: pointer;
}

.cat-cell-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-cell-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.cat-cell-sum {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
}

.cat-cell-sum.zero {
  color: var(--text-muted);
  font-weight: 500;
}

.reorder-controls {
  display: flex;
  gap: 3px;
}

.reorder-btn {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tx-row {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}

.tx-row.planned {
  border-style: dashed;
  border-color: var(--accent-border);
}

.tx-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.tx-info {
  flex: 1;
  min-width: 0;
}

.tx-title-line {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.tx-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.tx-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.tx-comment {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.tx-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.tx-amount-col {
  text-align: right;
}

.tx-amount {
  font-size: 14px;
  font-weight: 800;
}

.tx-sub-amount {
  font-size: 11px;
  color: var(--text-muted);
}

.kpi-btn {
  border-radius: var(--radius-md);
  padding: 11px 8px;
  text-align: center;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  transition: transform 0.1s ease;
}

.kpi-btn:active { transform: scale(0.97); }
.kpi-btn.active-expense { background: var(--expense); border-color: var(--expense); color: #ffffff; }
.kpi-btn.active-income { background: var(--income); border-color: var(--income); color: #ffffff; }
.kpi-btn.active-saving { background: var(--saving); border-color: var(--saving); color: #ffffff; }

.kpi-label {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.88;
}

.kpi-value {
  font-size: 14px;
  font-weight: 800;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-track {
  width: 100%;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-pill);
}

.trends-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  overflow-x: auto;
  padding: 12px 2px 4px;
  border-top: 1px solid var(--border);
}

.trend-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 54px;
  flex: 1 0 54px;
}

.trend-pct {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

.trend-val {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 5px;
  white-space: nowrap;
}

.trend-bar-track {
  width: 100%;
  max-width: 34px;
  height: 108px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.trend-bar {
  width: 100%;
  border-radius: 7px 7px 2px 2px;
  min-height: 4px;
}

.trend-lbl {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 6px;
  white-space: nowrap;
}

.sheet {
  width: 100%;
  max-width: 460px;
  background: var(--bg-elevated);
  border-radius: 22px 22px 0 0;
  border: 1px solid var(--border);
  padding: 18px 18px calc(18px + var(--safe-bottom));
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.dialog-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-lg);
}

@media (min-width: 820px) {
  .sheet {
    border-radius: 22px;
    padding: 22px;
  }
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.sheet-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
}

.sheet-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.input, .select, .textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
}

.input-lg {
  font-size: 17px;
  font-weight: 800;
}

.input-color {
  height: 41px;
  padding: 4px;
  cursor: pointer;
}

.chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  max-height: 132px;
  overflow-y: auto;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
}

.icon-pick-btn {
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.icon-pick-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  outline: 1.5px solid var(--accent);
}

.toast {
  background: var(--petrol-900);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  max-width: 360px;
  text-align: center;
}

.toast.error {
  background: var(--expense);
}

.toast.success {
  background: var(--income);
}

.empty-state {
  text-align: center;
  padding: 34px 16px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.row-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-google {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.btn-google:hover:not(:disabled) {
  background: var(--bg-subtle);
}

.plan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.plan-card {
  text-align: left;
  background: var(--bg-subtle);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.plan-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.plan-card-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
}

.plan-card-price {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.feature-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
}

.readonly-banner {
  background: var(--gold-soft);
  border: 1px solid rgba(244, 190, 55, 0.55);
  color: var(--gold-text);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
}

.danger-box {
  background: var(--expense-soft);
  border: 1px solid rgba(220, 38, 38, 0.28);
  color: var(--expense);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
}
