*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #000000;
  --text: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.65);
  --border: rgba(255, 255, 255, 0.12);
  --purple: #7c3aed;
  --purple-hover: #6d28d9;
  --purple-active: #5b21b6;
  --card: #0d0d0d;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body.page-login {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 2rem 2rem 2.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1.35rem;
}

.logo-mark {
  flex-shrink: 0;
  width: 3.25rem;
  height: 3.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.9rem;
  background: linear-gradient(145deg, #8b5cf6 0%, var(--purple) 45%, #5b21b6 100%);
  box-shadow:
    0 4px 14px rgba(124, 58, 237, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.logo-monogram {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.06em;
  color: #ffffff;
  line-height: 1;
}

.logo-wordmark {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  gap: 0.1rem;
}

.logo-name {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.logo-name--accent {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--purple);
  letter-spacing: 0.02em;
}

.login-title {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-sub {
  margin: 0 0 1.75rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}

.field-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 1rem;
  color: var(--text);
  background: #000000;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
}

.field-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.field-input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.25);
}

.field-input:-webkit-autofill,
.field-input:-webkit-autofill:hover,
.field-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  transition: background-color 9999s ease-out;
  box-shadow: 0 0 0 1000px #000000 inset;
  border: 1px solid var(--border);
}

.field-input:-webkit-autofill:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.25), 0 0 0 1000px #000000 inset;
}

.login-foot {
  margin: 1.5rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.06em;
}

.login-foot-brand {
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.btn-primary {
  background: var(--purple);
}

.btn-primary:hover {
  background: var(--purple-hover);
}

.btn-primary:active {
  background: var(--purple-active);
}

.hidden {
  display: none !important;
}

.form-error {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  color: #fecaca;
  background: rgba(220, 38, 38, 0.2);
  border: 1px solid rgba(220, 38, 38, 0.45);
  border-radius: 8px;
}

.form-success {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  color: #bbf7d0;
  background: rgba(22, 163, 74, 0.2);
  border: 1px solid rgba(34, 197, 94, 0.45);
  border-radius: 8px;
}

.setup-hint {
  margin: 1rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

.setup-hint a {
  color: var(--purple);
  font-weight: 600;
  text-decoration: none;
}

.setup-hint a:hover {
  text-decoration: underline;
}

.login-card--wide {
  max-width: 440px;
}

/* Admin & cliente */
.page-admin {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.admin-header {
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.admin-header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo--compact {
  margin: 0;
}

.logo--compact .logo-mark {
  width: 2.5rem;
  height: 2.5rem;
}

.logo--compact .logo-name {
  font-size: 1.15rem;
}

.logo--compact .logo-name--accent {
  font-size: 1rem;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-user {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.admin-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.admin-section {
  margin-bottom: 2.5rem;
}

.admin-section-title {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}

.admin-section-desc {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.admin-grid-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 520px;
}

.fieldset-features {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem 1rem;
  margin: 0;
}

.fieldset-features legend {
  padding: 0 0.35rem;
}

.fieldset-hint {
  margin: 0 0 0.65rem;
  padding: 0 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.approval-flow-block {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.approval-flow-block .fieldset-hint {
  margin-bottom: 0.35rem;
}

.checkbox-grid {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.checkbox-grid--features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1.25rem;
}

@media (max-width: 640px) {
  .checkbox-grid--features {
    grid-template-columns: 1fr;
  }
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.check-row input {
  accent-color: var(--purple);
  width: 1.05rem;
  height: 1.05rem;
}

.admin-form-actions {
  margin-top: 0.25rem;
}

.muted {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.btn-secondary {
  background: #27272a;
  color: #fff;
  border: 1px solid var(--border);
  width: auto;
  margin-top: 0;
  padding: 0.5rem 0.85rem;
  font-size: 0.875rem;
}

.btn-secondary:hover {
  background: #3f3f46;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  width: auto;
  margin-top: 0;
  padding: 0.45rem 0.85rem;
  font-size: 0.875rem;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.28);
}

.btn-warning {
  background: #b45309;
  color: #fff;
  width: auto;
  margin-top: 0;
  padding: 0.5rem 0.85rem;
  font-size: 0.875rem;
}

.btn-warning:hover {
  background: #92400e;
}

.btn-sm {
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
}

.client-list-hint {
  margin: 0 0 1rem;
}

.client-name-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 520px;
}

.client-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  text-align: left;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.client-list-row:hover {
  border-color: var(--purple);
  background: #141414;
}

.client-list-row:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.35);
}

.client-detail-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.client-detail-heading {
  margin: 0;
  flex: 1;
  min-width: 160px;
  font-size: 1.25rem;
}

.client-detail-body {
  max-width: 100%;
}

.btn-danger {
  background: #991b1b;
  color: #fff;
  border: none;
  width: auto;
  margin-top: 0;
  padding: 0.5rem 0.85rem;
  font-size: 0.875rem;
  cursor: pointer;
  border-radius: 8px;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.client-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.client-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.15rem 1.25rem 1.35rem;
}

.client-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.client-name {
  margin: 0;
  font-size: 1.1rem;
}

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

.badge-ok {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.badge-warn {
  background: rgba(234, 179, 8, 0.2);
  color: #facc15;
}

.badge-off {
  background: rgba(113, 113, 122, 0.35);
  color: #d4d4d8;
}

.badge-muted {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  text-transform: none;
  letter-spacing: 0.02em;
  font-weight: 600;
}

.client-list-badges {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.client-tools {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.tool-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem;
}

.field-inline {
  flex: 1;
  min-width: 160px;
}

.field-grow {
  flex: 2;
  min-width: 200px;
}

.field-input--sm {
  padding: 0.45rem 0.65rem;
  font-size: 0.9rem;
}

.feat-edit {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.feat-edit .btn-sm {
  margin-top: 0.65rem;
}

.bots-block {
  margin-top: 1rem;
}

.bots-title {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

.bots-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.bot-panel {
  margin-bottom: 0.85rem;
}

.bot-panel:last-child {
  margin-bottom: 0;
}

.bot-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.bot-row-head {
  margin-bottom: 0.5rem;
}

.bot-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 0.85rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 8px;
}

@media (max-width: 640px) {
  .bot-detail-grid {
    grid-template-columns: 1fr;
  }
}

.field-full {
  grid-column: 1 / -1;
}

.bot-detail-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.bot-label {
  flex: 1;
  min-width: 120px;
  font-weight: 500;
}

/* Cliente — lista de bots + painéis por canal */
.client-bot-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.client-bot-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.channel-panels-wrap {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.channel-panel-row {
  padding: 1rem 1.1rem;
  background: #0a0a0a;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.channel-panel-row-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.channel-panel-row-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.channel-panel-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--purple);
}

.field-textarea {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
  font-family: inherit;
  line-height: 1.45;
}
