:root {
  --bg: #0b1020;
  --panel: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.1);
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --accent: #38bdf8;
  --success: #10b981; /* Green */
  --danger: #ef4444;  /* Red */
  --font-stack: system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background-color: var(--bg);
  color: var(--text-main);
  font-family: var(--font-stack);
  min-height: 100vh;
  padding: 20px;
}

/* Background Blob */
.background-decor {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(circle at 10% 20%, rgba(56, 189, 248, 0.1), transparent 50%),
              radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.1), transparent 50%);
  z-index: -1;
}

main { max-width: 1000px; margin: 0 auto; }

.app-header {
  text-align: center;
  margin-bottom: 40px;
}
.app-header h1 {
  background: linear-gradient(to right, #38bdf8, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 2.5rem;
  letter-spacing: -1px;
}
.subtitle { color: var(--text-muted); }

/* --- Cards & Layout --- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  backdrop-filter: blur(8px);
}

.budget-card {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

/* --- Typography & Inputs --- */
label, legend {
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: block;
}

.input-wrapper { position: relative; }
.unit {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.8rem;
}

input, select {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  color: white;
  font-family: inherit;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(0, 0, 0, 0.5);
}

/* Dynamic Inputs Row */
.input-container label {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 10px;
  text-transform: none;
}

/* --- Buttons --- */
.action-row {
  display: flex;
  gap: 10px;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn:hover { opacity: 0.9; }

.primary-btn { background: var(--accent); color: #0f172a; flex: 1; }
.success-btn { background: var(--success); color: #0f172a; font-size: 1.1rem; width: 100%; padding: 15px; }
.secondary-btn { background: transparent; border: 1px solid var(--border); color: var(--text-muted); width: 100%; }

.action-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 30px;
}

/* --- Output Dashboard --- */
.output {
  margin-top: 30px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  animation: slideUp 0.3s ease-out;
}
.hide { display: none; }

.output span {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 20px;
}
.surplus { color: var(--danger); }
.deficit { color: var(--success); }

.output hr { border-color: var(--border); margin: 20px 0; }
.output p { color: var(--text-muted); margin: 8px 0; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
