:root {
  --primary: #1E3A8A;
  --accent: #2563EB;
  --success: #16A34A;
  --warning: #CA8A04;
  --error: #DC2626;
  --bg: #F9FAFB;
  --card-bg: #FFFFFF;
  --border: #E5E7EB;
  --text: #111827;
  --text-secondary: #6B7280;
}

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

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
}

/* ── Header ── */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--primary);
}

.admin-header h1 {
  font-size: 20px;
  color: var(--primary);
}

.header-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-left: 8px;
}

.header-right .company-id {
  font-size: 14px;
  color: var(--text-secondary);
  background: #EFF6FF;
  padding: 4px 12px;
  border-radius: 6px;
  font-family: monospace;
}

/* ── Cards ── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
}

.card-row .label {
  color: var(--text-secondary);
}

.card-row .value {
  font-weight: 500;
}

/* ── Status Badge ── */
.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.status-badge--trial { background: #2563EB; }
.status-badge--active { background: #16A34A; }
.status-badge--grace { background: #CA8A04; }
.status-badge--suspended { background: #DC2626; }
.status-badge--cancelled { background: #6B7280; }

/* ── Usage Bar ── */
.usage-bar-track {
  width: 100%;
  height: 12px;
  background: #E5E7EB;
  border-radius: 6px;
  overflow: hidden;
  margin: 8px 0;
}

.usage-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.3s ease;
}

.usage-percent-text {
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  margin: 8px 0;
}

.hard-limited-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: var(--error);
}

/* ── Alert Card ── */
.alert-card {
  margin-bottom: 24px;
}

.alert-form-group {
  margin-bottom: 16px;
}

.alert-form-group label {
  display: block;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.alert-form-group input[type="number"] {
  width: 80px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

.alert-form-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  margin-right: 6px;
}

.checkbox-label {
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

/* ── Email Tags ── */
.email-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.email-input-row input[type="text"] {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

.email-input-row button {
  padding: 6px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}

.email-input-row button:hover {
  background: var(--primary);
}

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

.email-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: 6px;
  font-size: 13px;
}

.email-tag--invalid {
  background: #FEF2F2;
  border-color: #FECACA;
  color: var(--error);
}

.email-tag .remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  padding: 0 2px;
  line-height: 1;
}

.email-tag .remove-btn:hover {
  color: var(--error);
}

/* ── Alert Status ── */
.alert-status-row {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}

.alert-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.alert-status-badge--pending {
  background: #F3F4F6;
  color: #6B7280;
}

.alert-status-badge--sent {
  background: #DCFCE7;
  color: #16A34A;
}

/* ── Save Button ── */
.save-btn {
  display: block;
  margin-top: 16px;
  padding: 10px 32px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-left: auto;
  margin-right: auto;
}

.save-btn:hover {
  background: var(--primary);
}

.save-btn:disabled {
  background: #9CA3AF;
  cursor: not-allowed;
}

/* ── Notifications ── */
.error-bar {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #DC2626;
  padding: 12px 18px;
  margin: 0 0 16px;
  border-radius: 8px;
  font-size: 14px;
}

.success-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #16A34A;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
}

/* ── Footer ── */
.admin-footer {
  text-align: center;
  padding: 24px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}
