/* =========================================================
   ForgeGuard Admin - identidade forja (laranja/carvao/aco)
   ========================================================= */

:root {
  --bg: #0f1115;
  --bg-elev: #161a21;
  --bg-card: #1c2129;
  --border: #2a3139;
  --text: #e7eaee;
  --text-muted: #8a94a2;
  --accent: #ff6b1a;         /* laranja forja (brasa) */
  --accent-soft: rgba(255, 107, 26, 0.12);
  --accent-hover: #ff8340;
  --steel: #4b7cac;          /* azul aco */
  --gold: #e0a85c;
  --ok: #2dd4a1;
  --warn: #f59e0b;
  --error: #ef4444;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(0,0,0,0.25);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

code, .mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
  background: var(--bg-elev);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--gold);
}
.mono-block {
  display: block;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 13px;
  margin: 8px 0;
}

/* ====== Nav ====== */
.topnav {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  box-shadow: var(--shadow);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-icon { font-size: 1.4rem; filter: drop-shadow(0 0 6px rgba(255,107,26,0.5)); }
.brand-sub { color: var(--accent); font-weight: 500; }
.nav-links { display: flex; gap: 8px; align-items: center; }
.nav-links a {
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
}
.nav-links a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.nav-links a.active { background: var(--accent-soft); color: var(--accent); }
.btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 8px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
}
.btn-link:hover { background: var(--accent-soft); color: var(--accent); }
.btn-link.danger:hover { background: rgba(239, 68, 68, 0.15); color: var(--error); }

/* ====== Container ====== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
  flex: 1;
  width: 100%;
}

h1 { font-size: 1.75rem; margin: 0 0 8px; font-weight: 700; }
h2 { font-size: 1.25rem; margin: 28px 0 12px; font-weight: 600; }
h2.danger { color: var(--error); border-top: 1px solid var(--border); padding-top: 24px; }
p { margin: 0 0 10px; }
.muted { color: var(--text-muted); font-size: 0.92rem; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  gap: 20px;
  flex-wrap: wrap;
}

/* ====== Auth cards ====== */
.auth-wrap {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}
.auth-logo { text-align: center; font-size: 3rem; margin-bottom: 8px; filter: drop-shadow(0 0 12px rgba(255,107,26,0.5)); }
.auth-card h1 { text-align: center; font-size: 1.4rem; }
.auth-card > p { text-align: center; margin-bottom: 24px; }
.qr-wrap { text-align: center; margin: 20px 0; }
.qr { max-width: 220px; border: 8px solid #fff; border-radius: 8px; }

/* ====== Forms ====== */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 12px 0;
}
.danger-card { border-color: rgba(239, 68, 68, 0.3); }
.form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
}
.form small { margin-top: 2px; }
.form input, .form select, .form textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 150ms;
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
}

/* ====== Buttons ====== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 150ms;
  text-decoration: none;
  font-family: inherit;
}
.btn-primary {
  background: var(--accent);
  color: #1a0a00;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; color: #1a0a00; }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg-elev); color: var(--text); text-decoration: none; }
.btn-danger {
  background: var(--error);
  color: #fff;
  border-color: var(--error);
}
.btn-danger:hover { background: #dc2626; text-decoration: none; color: #fff; }

/* ====== Alerts & callouts ====== */
.alert {
  padding: 14px 16px;
  border-radius: var(--radius);
  margin: 12px 0;
  font-size: 0.92rem;
  border-left: 3px solid;
}
.alert p { margin: 4px 0; }
.alert-error { background: rgba(239, 68, 68, 0.1); border-color: var(--error); color: #fca5a5; }
.alert-ok { background: rgba(45, 212, 161, 0.08); border-color: var(--ok); color: #86efac; }
.callout {
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid var(--warn);
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #fde68a;
}

/* ====== Badges ====== */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-elev);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge-ok { background: rgba(45, 212, 161, 0.15); color: var(--ok); border-color: rgba(45, 212, 161, 0.3); }
.badge-warn { background: rgba(245, 158, 11, 0.15); color: var(--warn); border-color: rgba(245, 158, 11, 0.3); }
.badge-error { background: rgba(239, 68, 68, 0.15); color: var(--error); border-color: rgba(239, 68, 68, 0.3); }
.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  background: var(--steel);
  color: white;
  font-weight: 500;
  margin-left: 4px;
}

/* ====== Tables ====== */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.table thead {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
}
.table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}
.table td {
  padding: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.93rem;
}
.table tr:first-child td { border-top: none; }
.table tr:hover { background: var(--bg-elev); }
.site-link { font-weight: 600; color: var(--text); }
.site-link:hover { color: var(--accent); }

/* ====== Stats & info ====== */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 20px 0;
}
@media (max-width: 640px) { .grid-3 { grid-template-columns: 1fr; } }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 20px 0 24px;
}
@media (max-width: 720px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
.stats-grid .stat-value { font-size: 1.4rem; font-weight: 500; }
.stats-grid .stat-value b { font-weight: 700; }
.stats-grid .stat-value b.ok { color: var(--ok); }
.stats-grid .stat-value b.warn { color: var(--warn); }
.stats-grid .stat-value b.error { color: var(--error); }
.stats-grid .stat-value small { font-size: 0.65em; font-weight: 400; }

.actions-row {
  display: flex;
  gap: 10px;
  margin: 10px 0 24px;
  flex-wrap: wrap;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.stat-value { font-size: 1.1rem; font-weight: 500; }

.info {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 20px;
  margin: 12px 0;
}
.info dt { color: var(--text-muted); font-size: 0.9rem; }
.info dd { margin: 0; font-size: 0.95rem; }

.creds {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 6px 16px;
  background: rgba(0,0,0,0.3);
  padding: 14px;
  border-radius: 6px;
  margin-top: 10px;
}
.creds > div { display: contents; }
.creds span:first-child { color: var(--text-muted); font-size: 0.88rem; }
.creds span:last-child { color: var(--gold); font-family: ui-monospace, monospace; font-size: 0.92rem; }

/* ====== Misc ====== */
.empty {
  text-align: center;
  padding: 60px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin: 20px 0;
}
.empty p { color: var(--text-muted); margin-bottom: 16px; }

.inline { display: inline; }

.footer {
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.85rem;
}

details summary { cursor: pointer; padding: 8px 0; user-select: none; }
details[open] summary { margin-bottom: 8px; }

@media (max-width: 720px) {
  .topnav { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 16px; }
  .nav-links { justify-content: center; flex-wrap: wrap; }
  .container { padding: 20px 16px; }
  .section-head { flex-direction: column; align-items: stretch; }
  .info { grid-template-columns: 1fr; }
  .info dt { margin-top: 8px; font-weight: 600; color: var(--accent); }
  .creds { grid-template-columns: 1fr; }
  .creds span:first-child { margin-top: 6px; }
}
