:root {
  --bg-primary: #050510;
  --bg-secondary: #0a0a1a;
  --bg-card: #0e1028;
  --bg-input: #080818;
  --text-primary: #e8e8f0;
  --text-secondary: #6a6a80;
  --accent-cyan: #0099ff;
  --accent-pink: #4466ff;
  --accent-green: #00e676;
  --accent-orange: #ffab00;
  --accent-gray: #555;
  --border-glow: rgba(0, 120, 255, 0.15);
  --shadow-glow: 0 0 24px rgba(0, 100, 255, 0.1), 0 1px 2px rgba(0,0,0,0.4);
  --radius: 14px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius);
  box-shadow: var(--shadow-glow);
  padding: 16px;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}

.card h3 {
  font-size: 0.8rem;
  color: var(--accent-cyan);
  margin-bottom: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Buttons ── */
.btn-primary {
  background: linear-gradient(135deg, #0077ff 0%, #00bbff 100%);
  color: #000;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  padding: 13px 24px;
  width: 100%;
  font-size: 0.9rem;
  transition: opacity 0.2s, transform 0.1s;
}
.btn-primary:active { transform: scale(0.97); opacity: 0.9; }

.btn-secondary {
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.3);
  color: var(--accent-cyan);
  border-radius: 10px;
  padding: 12px 20px;
  width: 100%;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s;
}
.btn-secondary:active { background: rgba(0, 229, 255, 0.15); }

.btn-danger {
  background: rgba(255, 68, 68, 0.08);
  border: 1px solid rgba(255, 68, 68, 0.3);
  color: #ff5252;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.btn-add {
  background: transparent;
  border: 1px dashed rgba(0, 229, 255, 0.3);
  color: var(--accent-cyan);
  border-radius: 10px;
  padding: 10px 16px;
  width: 100%;
  font-size: 0.85rem;
  transition: background 0.2s;
}
.btn-add:hover { background: rgba(0, 229, 255, 0.05); }

/* ── Inputs ── */
input, select, textarea {
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 11px 14px;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-size: 15px;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(0, 229, 255, 0.5);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.1);
}

input::placeholder, textarea::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: block;
  font-weight: 500;
}

/* ── Badge ── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.form-group {
  margin-bottom: 12px;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: calc(14px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}
.modal-overlay.hidden { display: none; }

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 400px;
  width: 90%;
  max-height: calc(100vh - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  max-height: calc(100dvh - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 0 40px rgba(0, 229, 255, 0.1), 0 20px 60px rgba(0,0,0,0.5);
}
.modal-card h3 {
  margin-bottom: 16px;
  color: var(--accent-cyan);
}

@media (max-width: 520px) {
  .modal-overlay {
    align-items: flex-start;
    padding-left: 12px;
    padding-right: 12px;
  }

  .modal-card {
    width: 100%;
    padding: 18px 16px;
    border-radius: 12px;
  }

  .modal-card .calc-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

/* ── Toast ── */
.toast {
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.88rem;
  animation: toastIn 0.3s ease-out;
  margin-bottom: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.toast.success { background: var(--accent-green); color: #000; }
.toast.error { background: #ff5252; color: #fff; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
