* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #0f172a; color: #e2e8f0;
}
.hidden { display: none !important; }
.err { color: #f87171; font-size: 13px; min-height: 18px; margin-top: 6px; }

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box {
  background: #1e293b; padding: 32px; border-radius: 14px; width: 320px;
  display: flex; flex-direction: column; gap: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.4);
}
.login-box h1 { margin: 0 0 8px; font-size: 20px; text-align: center; }

/* App */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; background: #1e293b; position: sticky; top: 0; z-index: 5;
  border-bottom: 1px solid #334155;
}
header h1 { margin: 0; font-size: 20px; }
.actions { display: flex; gap: 8px; }
main { padding: 24px; max-width: 1000px; margin: 0 auto; }

input, select, textarea, button {
  font: inherit; padding: 9px 11px; border-radius: 8px; border: 1px solid #334155;
  background: #0f172a; color: #e2e8f0;
}
textarea { width: 100%; min-height: 60px; resize: vertical; }
button { background: #2563eb; border: none; cursor: pointer; color: #fff; }
button:hover { background: #1d4ed8; }
button.ghost { background: transparent; border: 1px solid #475569; }
button.ghost:hover { background: #334155; }
button.danger { background: #dc2626; }
button.small { padding: 5px 9px; font-size: 13px; }

/* Card de perfil */
.card {
  background: #1e293b; border: 1px solid #334155; border-radius: 12px;
  margin-bottom: 14px; overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer;
}
.card-head:hover { background: #243449; }
.card-title { font-weight: 600; }
.card-id { font-family: monospace; color: #64748b; font-size: 12px; }
.badge {
  font-size: 11px; padding: 2px 8px; border-radius: 20px; background: #334155; color: #cbd5e1;
}
.badge.off { opacity: .5; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #475569; flex: none; }
.dot.on { background: #22c55e; }
.spacer { flex: 1; }
.card-body { padding: 0 18px 18px; border-top: 1px solid #334155; }

.meta-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.meta-row label { display: flex; flex-direction: column; font-size: 12px; color: #94a3b8; gap: 4px; }

.cfg-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.cfg-table th { text-align: left; font-size: 12px; color: #94a3b8; padding: 6px 6px; }
.cfg-table td { padding: 4px 6px; vertical-align: top; }
.cfg-table input[type=text], .cfg-table textarea { width: 100%; }
.k-input { font-family: monospace; }
.row-actions { display: flex; gap: 8px; margin-top: 14px; align-items: center; }
.saved { color: #22c55e; font-size: 13px; }
.muted { color: #64748b; font-size: 12px; }
.group-title { margin: 22px 0 10px; color: #94a3b8; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }

/* Cabeçalho só leitura (Nome/Script/País) */
.meta-ro { display: flex; gap: 28px; flex-wrap: wrap; margin: 16px 0 6px; }
.meta-ro > div { display: flex; flex-direction: column; gap: 3px; }
.ro-label { font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: .04em; }
.ro-val { font-size: 15px; color: #e2e8f0; font-weight: 600; }
.obs-row { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #94a3b8; margin: 10px 0 4px; }
.obs-row input { max-width: 420px; }

/* Campos editáveis */
.fields { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.field {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 14px; background: #0f172a; border: 1px solid #283449; border-radius: 10px;
}
.field.field-col { flex-direction: column; align-items: stretch; }
.field-info { display: flex; flex-direction: column; gap: 2px; }
.field-label { font-size: 14px; color: #e2e8f0; }
.field-hint { font-size: 12px; color: #64748b; }
.field.field-col .f-input { width: 100%; margin-top: 8px; }

/* Toggle (switch) */
.switch { position: relative; display: inline-block; width: 48px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0; background: #475569;
  transition: .2s; border-radius: 999px;
}
.switch .slider::before {
  content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px;
  background: #fff; transition: .2s; border-radius: 50%;
}
.switch input:checked + .slider { background: #22c55e; }
.switch input:checked + .slider::before { transform: translateX(22px); }
