:root {
  --bg: #0d0d0d;
  --surface: #1a1a1a;
  --surface2: #222222;
  --border: #2d2d2d;
  --accent: #f59e0b;
  --accent-hover: #d97706;
  --text: #f3f4f6;
  --muted: #6b7280;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 10px;
}

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

body {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── TOPBAR ── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-brand .logo-icon {
  background: var(--accent);
  color: #000;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
}

.topbar-brand h1 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.topbar-brand span {
  font-size: 11px;
  color: var(--muted);
  display: block;
  line-height: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #000;
}
.btn-primary:hover { background: var(--accent-hover); color: #000; }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: #555; }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid transparent;
}
.btn-danger:hover { background: rgba(239,68,68,0.1); }

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-full { width: 100%; justify-content: center; }

/* ── MAIN LAYOUT ── */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px;
}

/* ── SEARCH / FILTER BAR ── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 14px;
  flex: 1;
  max-width: 380px;
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  width: 100%;
}

.search-box input::placeholder { color: var(--muted); }

.count-badge {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 16px;
  font-size: 13px;
  color: var(--muted);
}

/* ── SITE CARDS ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.site-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s;
}

.site-card:hover { border-color: #444; }

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.card-icon {
  background: var(--accent);
  color: #000;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.card-cnpj {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.card-url {
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 4px;
  word-break: break-all;
}

.card-date {
  font-size: 12px;
  color: var(--muted);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.card-actions .btn-sm {
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  font-size: 12px;
}

.card-actions .btn-sm:hover { color: var(--text); }

.card-actions .btn-del {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 5px;
  border-radius: 6px;
  font-size: 16px;
  line-height: 1;
}

.card-actions .btn-del:hover { color: var(--danger); background: rgba(239,68,68,0.08); }

/* ── MODAL / FORM PAGES ── */
.page-center {
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
}

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  width: 100%;
  max-width: 560px;
}

.form-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.form-card-title .icon {
  background: var(--accent);
  color: #000;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.form-card-title h3 {
  font-size: 15px;
  font-weight: 700;
}

.form-card-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
  padding-left: 42px;
}

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

.form-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group textarea,
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}

.form-group textarea:focus,
.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
}

.form-group textarea {
  resize: vertical;
  min-height: 160px;
}

.domain-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.domain-row input { flex: 1; }

.domain-suffix {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
}

/* ── RESULT CARD ── */
.result-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin-top: 20px;
}

.result-row {
  display: flex;
  font-size: 13px;
  margin-bottom: 6px;
}

.result-row strong {
  color: var(--muted);
  min-width: 90px;
  flex-shrink: 0;
}

.url-copy {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 10px;
}

.url-copy span {
  font-size: 12px;
  color: var(--accent);
  flex: 1;
  word-break: break-all;
}

.url-copy button {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 0;
}

.url-copy button:hover { color: var(--text); }

/* ── TABS / SECTIONS (edit page) ── */
.sections-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 620px;
}

.section-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.section-block .section-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.section-block .section-body {
  padding: 20px;
}

/* ── ADMIN TABLE ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-yellow { background: rgba(245,158,11,0.15); color: var(--accent); }
.badge-red { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-gray { background: rgba(107,114,128,0.15); color: var(--muted); }

/* ── LOGIN PAGE ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo .logo-icon {
  background: var(--accent);
  color: #000;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 900;
  margin: 0 auto 12px;
}

.login-logo h2 { font-size: 20px; font-weight: 800; }
.login-logo p { font-size: 13px; color: var(--muted); margin-top: 2px; }

.alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-error { background: rgba(239,68,68,0.12); color: #fca5a5; border: 1px solid rgba(239,68,68,0.2); }
.alert-success { background: rgba(34,197,94,0.12); color: #86efac; border: 1px solid rgba(34,197,94,0.2); }
.alert-warn { background: rgba(245,158,11,0.12); color: #fcd34d; border: 1px solid rgba(245,158,11,0.2); }

/* ── ADMIN SIDEBAR (optional) ── */
.admin-layout {
  display: flex;
  min-height: calc(100vh - 56px);
}

.sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  flex-shrink: 0;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 14px;
  color: var(--muted);
  transition: all 0.15s;
}

.sidebar a:hover,
.sidebar a.active {
  color: var(--text);
  background: var(--surface2);
}

.sidebar a.active { border-left: 3px solid var(--accent); }

.sidebar-label {
  padding: 6px 20px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  margin-top: 16px;
  font-weight: 600;
}

.content-area {
  flex: 1;
  padding: 28px;
  overflow-y: auto;
}

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.page-header p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── DNS INSTRUCTIONS ── */
.dns-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
}

.dns-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  align-items: flex-start;
}

.dns-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 60px;
  margin-top: 2px;
}

.dns-val {
  font-size: 13px;
  font-family: monospace;
  background: var(--surface);
  padding: 3px 8px;
  border-radius: 4px;
  word-break: break-all;
}

/* ── CODE EDITOR ── */
.code-editor {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  min-height: 300px;
  white-space: pre;
  background: #0a0a0a;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  color: #e5e7eb;
  resize: vertical;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-state .icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h3 { font-size: 15px; color: var(--text); margin-bottom: 6px; }

/* ── LOADING ── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(245,158,11,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .cards-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .main { padding: 20px 16px; }
  .sidebar { display: none; }
}
