:root {
  --accent: #2b7fff;
  --download: #2b7fff;
  --upload: #ff6b2b;
  --ping: #6bd16b;
  --bg: #0b0e14;
  --surface: #141a24;
  --surface-2: #1d2531;
  --text: #eaf0f7;
  --text-dim: #8a94a6;
  --border: #27313f;
  --radius: 16px;
}

/* Paleta clara — usada na tela do admin (chrome). O preview tem vars próprias. */
[data-mode="light"] {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #eef1f7;
  --text: #16202e;
  --text-dim: #5f6c80;
  --border: #e2e7f0;
}

* { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

.app { display: flex; flex-direction: column; min-height: 100vh; }

/* ---------- Topbar ---------- */
.headline { display: flex; justify-content: center; align-items: center; min-height: 52px; }
.headline-logo { max-height: 90px; max-width: min(340px, 78vw); width: auto; object-fit: contain; }
.ghost-btn {
  color: var(--text-dim); text-decoration: none; font-size: .9rem; font-weight: 600;
  padding: 8px 16px; border: 1px solid var(--border); border-radius: 10px;
  transition: .2s; cursor: pointer; background: transparent;
}
.ghost-btn:hover { color: var(--text); border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }

/* ---------- Stage ---------- */
.stage {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 24px 20px 28px; gap: 20px;
}
.title { margin: 0; font-size: clamp(1.5rem, 4vw, 2.3rem); font-weight: 800; text-align: center; }

.gauge-wrap { width: min(410px, 80vw); aspect-ratio: 1 / 0.9; }
.gauge-canvas { width: 100%; height: 100%; display: block; }

/* ---------- Result cards ---------- */
.cards {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  width: min(760px, 92vw);
}
@media (max-width: 560px) { .cards { grid-template-columns: repeat(2, 1fr); } }
.rcard {
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 14px; text-align: center; transition: .25s;
  backdrop-filter: blur(6px);
}
.rcard.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 12px 32px -14px var(--accent);
  transform: translateY(-3px);
}
.rcard.done { opacity: 1; }
.rcard-top { font-size: .82rem; color: var(--text-dim); font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; }
.rcard-val { margin-top: 8px; font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.rcard-val i { font-size: .8rem; font-weight: 500; color: var(--text-dim); font-style: normal; margin-left: 4px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-dl { background: var(--download); }
.dot-ul { background: var(--upload); }
.dot-ping { background: var(--ping); }

/* ---------- Botão start ---------- */
.start-btn {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #fff));
  color: #fff; border: none; padding: 16px 60px; font-size: 1.1rem; font-weight: 800;
  border-radius: 999px; cursor: pointer; transition: .2s; letter-spacing: .3px;
  box-shadow: 0 10px 30px -10px var(--accent);
}
.start-btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.06); }
.start-btn:disabled { opacity: .5; cursor: not-allowed; }
.start-btn.abort { background: linear-gradient(135deg, #e3415e, #ff7a90); box-shadow: 0 10px 30px -12px #e3415e; }

.ip-line { color: var(--text-dim); font-size: .9rem; margin: 0; }
.ip-line span { color: var(--text); font-weight: 600; }
.status { color: var(--text-dim); min-height: 1.2em; margin: 0; font-size: .95rem; }
.footer { text-align: center; padding: 18px; color: var(--text-dim); font-size: .85rem; border-top: 1px solid var(--border); }

/* ---------- Login ---------- */
.auth-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 30px; width: 100%; max-width: 410px;
  box-shadow: 0 30px 60px -30px rgba(0,0,0,.6);
}
.card h2 { margin: 0 0 22px; font-size: 1.4rem; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: .82rem; color: var(--text-dim); font-weight: 600; }
.field input, .field select {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 11px 14px; border-radius: 10px; font-size: 1rem; transition: .15s;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.btn {
  background: var(--accent); color: #fff; border: none; padding: 12px 22px;
  border-radius: 10px; font-weight: 700; cursor: pointer; font-size: .95rem; transition: .2s;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.btn [data-icon] { font-size: 16px; }
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: #e3415e; }
.error { color: #ff7a90; font-size: .9rem; min-height: 1.1em; }
.ok-msg { color: #5fd17a; font-size: .9rem; min-height: 1.1em; font-weight: 600; }

/* ---------- Admin shell (identidade made4it) ---------- */
.admin-shell, .auth-wrap {
  /* cor primária da marca (ciano) e fonte Geist */
  --accent: #04afef;
  font-family: "Geist", "Segoe UI", system-ui, -apple-system, sans-serif;
}
.admin-shell { max-width: 1180px; margin: 0 auto; padding: 28px 24px; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.admin-header h2 { margin: 0; font-size: 1.5rem; letter-spacing: -.02em; }
.tabs { display: flex; gap: 8px; margin-bottom: 24px; }
.tab { padding: 10px 20px; border-radius: 10px; cursor: pointer; background: var(--surface); border: 1px solid var(--border); color: var(--text-dim); font-weight: 600; transition: .18s; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 6px 18px -8px var(--accent); }

/* SVGs de ícone */
[data-icon] svg, .cell-ico svg, .del-btn svg { width: 1em; height: 1em; display: block; }

/* Stat cards com ícone */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
@media (max-width: 760px) { .stats-row { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; display: flex; align-items: center; gap: 14px;
  transition: .18s;
}
.stat-card:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); box-shadow: 0 10px 28px -18px rgba(0,0,0,.35); }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; flex-shrink: 0; }
.ic-cyan { color: #04afef; background: color-mix(in srgb, #04afef 14%, transparent); }
.ic-blue { color: #2b7fff; background: color-mix(in srgb, #2b7fff 14%, transparent); }
.ic-orange { color: #f97316; background: color-mix(in srgb, #f97316 14%, transparent); }
.ic-green { color: #16b364; background: color-mix(in srgb, #16b364 14%, transparent); }
.stat-meta .v { font-size: 1.7rem; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-meta .l { color: var(--text-dim); font-size: .82rem; margin-top: 2px; }
.stat-meta .l i { font-style: normal; opacity: .7; }

/* Card da tabela */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.table-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.table-head h3 { margin: 0; font-size: .95rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.table-head h3 [data-icon] { color: var(--accent); font-size: 18px; }
.page-info { color: var(--text-dim); font-size: .82rem; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
.results-table { width: 100%; border-collapse: collapse; }
.results-table th, .results-table td { padding: 13px 18px; text-align: left; border-bottom: 1px solid var(--border); font-size: .9rem; white-space: nowrap; }
.results-table th { color: var(--text-dim); font-weight: 600; text-transform: uppercase; font-size: .7rem; letter-spacing: .6px; background: color-mix(in srgb, var(--text) 3%, transparent); }
.results-table tbody tr:last-child td { border-bottom: none; }
.results-table tbody tr { transition: background .12s; }
.results-table tbody tr:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.cell-muted { color: var(--text-dim); }
.cell-ico { display: inline-flex; vertical-align: -2px; margin-right: 7px; font-size: 15px; opacity: .8; }
.results-table .num b { font-weight: 700; font-variant-numeric: tabular-nums; }
.results-table .num .u { color: var(--text-dim); font-size: .78rem; margin-left: 2px; }
.geo-link { display: inline-flex; align-items: center; color: var(--accent); text-decoration: none; font-weight: 600; }
.geo-link:hover { text-decoration: underline; }
.cell-action { text-align: right; width: 1%; }
.del-btn {
  background: transparent; border: 1px solid transparent; color: var(--text-dim);
  cursor: pointer; font-size: 17px; padding: 6px; border-radius: 8px; display: inline-grid; place-items: center; transition: .15s;
}
.del-btn:hover { color: #e3415e; background: color-mix(in srgb, #e3415e 12%, transparent); }
.empty-row { text-align: center; color: var(--text-dim); padding: 28px !important; }

.table-foot { display: flex; gap: 10px; align-items: center; padding: 14px 18px; }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); display: inline-flex; align-items: center; gap: 6px; }
.btn.ghost [data-icon] { font-size: 16px; }
.btn.ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Customização (controles + preview) ---------- */
.custom-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
@media (max-width: 920px) { .custom-layout { grid-template-columns: 1fr; } }
.custom-controls { display: flex; flex-direction: column; gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.panel h3 { margin: 0 0 16px; font-size: .8rem; text-transform: uppercase; letter-spacing: .6px; color: var(--text-dim); display: flex; align-items: center; gap: 8px; }
.panel h3 [data-icon] { color: var(--accent); font-size: 16px; }

.swatch-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.swatch-row:last-child { border-bottom: none; }
.swatch {
  width: 46px; height: 46px; border-radius: 12px; border: 2px solid var(--border);
  padding: 0; cursor: pointer; background: none; overflow: hidden; flex-shrink: 0;
}
.swatch::-webkit-color-swatch-wrapper { padding: 0; }
.swatch::-webkit-color-swatch { border: none; border-radius: 10px; }
.swatch-info { display: flex; flex-direction: column; }
.swatch-info .n { font-weight: 600; font-size: .95rem; }
.hex-input {
  margin-top: 4px; width: 110px; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 7px; padding: 5px 9px;
  font-size: .82rem; font-variant-numeric: tabular-nums; text-transform: uppercase; letter-spacing: .5px;
}
.hex-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.hex-input.invalid { border-color: #e3415e; }

.logo-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo-preview { height: 48px; max-width: 200px; object-fit: contain; background: var(--surface-2); border-radius: 10px; padding: 6px; }

/* preview ao vivo */
.preview-sticky { position: sticky; top: 90px; }
.preview-tag { font-size: .78rem; text-transform: uppercase; letter-spacing: .6px; color: var(--text-dim); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #5fd17a; box-shadow: 0 0 0 0 #5fd17a; animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, #5fd17a 70%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.preview-root {
  border: 1px solid var(--border); border-radius: 18px; overflow: hidden;
  background: var(--bg);
  color: var(--text);
}
.pv-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.pv-logo { height: 28px; max-width: 130px; object-fit: contain; }
.pv-brand { font-weight: 800; font-size: .95rem; }
.pv-body { padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pv-headline { display: flex; justify-content: center; align-items: center; min-height: 30px; }
.pv-headline-logo { max-height: 44px; max-width: 160px; object-fit: contain; }
.pv-title { font-weight: 800; font-size: 1.05rem; margin: 0; text-align: center; }
.pv-gauge { width: 210px; height: 190px; }
.pv-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; }
.pv-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 4px; text-align: center; }
.pv-card .l { font-size: .62rem; color: var(--text-dim); font-weight: 600; }
.pv-card .v { font-size: .85rem; font-weight: 800; margin-top: 2px; }
.pv-btn { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #fff)); color: #fff; border: none; padding: 9px 30px; border-radius: 999px; font-weight: 800; font-size: .85rem; box-shadow: 0 8px 22px -10px var(--accent); }
.pv-footer { text-align: center; padding: 8px; font-size: .7rem; color: var(--text-dim); border-top: 1px solid var(--border); }

.hidden { display: none !important; }
