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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f1117;
  color: #e1e4e8;
  min-height: 100vh;
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-box {
  background: #1a1d27;
  padding: 2rem;
  border-radius: 12px;
  width: 360px;
}

.login-box h2 {
  margin-bottom: 1.5rem;
  text-align: center;
}

.login-box input {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid #333;
  border-radius: 8px;
  background: #0f1117;
  color: #e1e4e8;
  font-size: 1rem;
}

.login-box button { width: 100%; }

header {
  background: #1a1d27;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #2d3139;
}

header h1 { font-size: 1.25rem; }

.monitoring-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toggle-switch {
  width: 48px;
  height: 26px;
  background: #444;
  border-radius: 13px;
  position: relative;
  cursor: pointer;
  transition: background 0.3s;
}

.toggle-switch.on { background: #22c55e; }

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s;
}

.toggle-switch.on::after { transform: translateX(22px); }

main { padding: 1.5rem 2rem; max-width: 1200px; margin: 0 auto; }

.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #2d3139;
}

.tab {
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: #8b949e;
  transition: all 0.2s;
}

.tab:hover { color: #e1e4e8; }
.tab.active { color: #58a6ff; border-bottom-color: #58a6ff; }

.tab-content { display: none; }
.tab-content.active { display: block; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.card {
  background: #1a1d27;
  border-radius: 10px;
  padding: 1.25rem;
  border: 1px solid #2d3139;
}

.card h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card .badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
}

.badge.active { background: #22c55e33; color: #22c55e; }
.badge.inactive { background: #6b737c33; color: #6b737c; }

.card .stat {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  font-size: 0.9rem;
}

.card .stat .label { color: #8b949e; }
.card .stat .value { font-weight: 600; }
.value.warning { color: #f59e0b; }
.value.danger { color: #ef4444; }
.value.good { color: #22c55e; }

/* Settings */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.settings-section {
  background: #1a1d27;
  border-radius: 10px;
  padding: 1.5rem;
  border: 1px solid #2d3139;
}

.settings-section h3 { margin-bottom: 1rem; }

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  margin-bottom: 0.4rem;
  color: #8b949e;
  font-size: 0.85rem;
}

.field input {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid #333;
  border-radius: 6px;
  background: #0f1117;
  color: #e1e4e8;
  font-size: 0.95rem;
}

button, .btn {
  padding: 0.6rem 1.2rem;
  background: #58a6ff;
  color: #0f1117;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: opacity 0.2s;
}

button:hover { opacity: 0.85; }
.btn-danger { background: #ef4444; color: white; }
.btn-success { background: #22c55e; color: white; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

/* Phone numbers */
.phone-list {
  list-style: none;
}

.phone-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid #2d3139;
}

.phone-actions { display: flex; gap: 0.5rem; }

/* Alert history */
.alert-table {
  width: 100%;
  border-collapse: collapse;
}

.alert-table th, .alert-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #2d3139;
  font-size: 0.85rem;
}

.alert-table th { color: #8b949e; font-weight: 600; }

.alert-type {
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.alert-type.low_funds { background: #f59e0b33; color: #f59e0b; }
.alert-type.high_spend_no_sales { background: #ef444433; color: #ef4444; }
.alert-type.bad_3day_performance { background: #ef444433; color: #ef4444; }
.alert-type.high_cpp { background: #f97316 33; color: #f97316; }

.loading {
  text-align: center;
  padding: 2rem;
  color: #8b949e;
}

.add-phone-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.add-phone-form input { flex: 1; }

@media (max-width: 768px) {
  .settings-grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  main { padding: 1rem; }
}
