:root {
  --bg: #12151C;
  --surface: #1A1F2B;
  --surface-hover: #212736;
  --border: #2A303F;
  --text: #E8EAED;
  --text-muted: #8B93A7;
  --accent: #E8A33D;
  --accent-dim: #7A5A24;
  --online: #4ADE80;
  --backup-active: #F87171;
  --warning: #FBBF24;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

.view[hidden] { display: none !important; }

#view-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(232, 163, 61, 0.08), transparent 40%),
    var(--bg);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: #12151C;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.brand-name span { color: var(--accent); }

.brand-tagline {
  color: var(--text-muted);
  font-size: 14px;
  margin: 10px 0 32px;
}

.login-shell { display: flex; flex-direction: column; align-items: center; }

.login-card {
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.field input, .field select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.field input:focus, .field select:focus {
  border-color: var(--accent);
}
.field-hint {
  font-size: 12px;
  color: var(--text-muted);
}
.field-hint code {
  font-family: var(--font-mono);
  color: var(--accent);
}
.field-small { max-width: 100px; }

.error-msg {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--backup-active);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 11px 18px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: filter 0.15s, background 0.15s;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-block { width: 100%; }
.btn-primary {
  background: var(--accent);
  color: #12151C;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn-sm { padding: 7px 12px; font-size: 12px; }

#view-app { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
}
.brand-sidebar { padding: 8px 8px 24px; }
.brand-sidebar .brand-mark { width: 32px; height: 32px; font-size: 16px; border-radius: 8px; }
.brand-sidebar .brand-name { font-size: 17px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active { background: rgba(232, 163, 61, 0.1); color: var(--accent); }
.nav-icon { font-size: 12px; width: 14px; text-align: center; }

.sidebar-footer { border-top: 1px solid var(--border); padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.user-info { font-size: 12px; color: var(--text-muted); line-height: 1.5; padding: 0 8px; }
.user-info strong { color: var(--text); display: block; font-size: 13px; }

.main { flex: 1; padding: 32px 40px; overflow-y: auto; }
.panel[hidden] { display: none; }

.panel-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 28px;
  gap: 16px;
}
.panel-header h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.subtitle { color: var(--text-muted); font-size: 14px; margin: 0; }

.header-actions { display: flex; gap: 10px; flex-shrink: 0; }

.banner {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 20px;
}
.banner-warning {
  background: rgba(232, 163, 61, 0.1);
  border: 1px solid rgba(232, 163, 61, 0.3);
  color: var(--accent);
}
.banner-success {
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.3);
  color: var(--online);
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface-hover); }

.service-cell { display: flex; align-items: center; gap: 10px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.status-dot.green { background: var(--online); box-shadow: 0 0 8px rgba(74, 222, 128, 0.5); }
.status-dot.red { background: var(--backup-active); }
.status-dot.orange { background: var(--warning); box-shadow: 0 0 8px rgba(251, 191, 36, 0.5); }
.service-name { font-weight: 500; display: flex; align-items: center; gap: 8px; }
.service-domain { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); display: block; }

.mode-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(232, 163, 61, 0.12);
  color: var(--accent);
  font-weight: 600;
}

.host-cell { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.host-cell.is-active { color: var(--text); }

.status-text { font-size: 12px; font-weight: 600; }
.status-text.ativo { color: var(--online); }
.status-text.inativo { color: var(--backup-active); }

.info-btn {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  font-style: italic;
  font-family: var(--font-display);
}
.info-btn:hover { border-color: var(--accent); color: var(--accent); }

.link-remove-btn {
  background: none;
  border: none;
  color: var(--backup-active);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.link-remove-btn:hover { text-decoration: underline; }

.day-check {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
}
.day-check input { margin: 0; accent-color: var(--accent); }
.day-check:has(input:checked) { color: var(--text); border-color: var(--accent); }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  border: 1px dashed var(--border);
  border-radius: 14px;
}
.empty-icon { font-size: 32px; color: var(--accent); margin-bottom: 12px; }
.empty-state h3 { font-family: var(--font-display); margin: 0 0 8px; }
.empty-state p { color: var(--text-muted); font-size: 14px; margin: 0 0 20px; }

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

.target-group {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.target-group h3 {
  font-size: 13px; font-weight: 600; margin: 0 0 14px;
  display: flex; align-items: center; gap: 8px;
  color: var(--text-muted);
}
.target-group .dot { width: 8px; height: 8px; border-radius: 50%; }
.dot-primary { background: var(--online); }
.dot-backup { background: var(--backup-active); }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: min(520px, 90vw);
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
}
.modal-narrow { width: min(400px, 90vw); }
.modal-text { color: var(--text-muted); font-size: 14px; line-height: 1.6; margin: 0 0 20px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h2 { font-family: var(--font-display); font-size: 18px; margin: 0; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 22px; cursor: pointer; line-height: 1;
}
.modal-close:hover { color: var(--text); }

.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.history-transition { font-family: var(--font-mono); }
.history-time { color: var(--text-muted); font-size: 11px; }
.history-email-badge {
  font-size: 10px; color: var(--online);
  text-transform: uppercase; letter-spacing: 0.03em;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.plan-card.is-addon { border-style: dashed; }
.plan-card-name { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.plan-card-cycle { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.plan-card-price { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--accent); }
.plan-card-price span { font-size: 13px; color: var(--text-muted); font-family: var(--font-body); font-weight: 400; }
.plan-card-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; flex: 1; }

.plan-features {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.plan-features li {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
  display: flex;
  gap: 7px;
  align-items: flex-start;
}
.feature-check {
  color: var(--online);
  font-weight: 700;
  flex-shrink: 0;
}

@media (max-width: 720px) {
  #view-app { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; padding: 12px 16px; }
  .nav { flex-direction: row; }
  .sidebar-footer { display: none; }
  .main { padding: 20px; }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 10px; }
  .panel-header { flex-direction: column; }
  .header-actions { width: 100%; }
  .header-actions .btn { flex: 1; }
}
