/* Painel — tema escuro + acentos (WhatsApp / consórcio vibe) */
:root {
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --ink: #0c1222;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --brand: #0d9488;
  --brand-hover: #0f766e;
  --brand-soft: rgba(13, 148, 136, 0.12);
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --sidebar: #0b1220;
  --sidebar-hover: #1e293b;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 48px rgba(15, 23, 42, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface-2);
}

/* ---------- Login / telas sem menu ---------- */
body.page-auth {
  background: linear-gradient(145deg, #042f2e 0%, #0f172a 45%, #134e4a 100%);
  background-attachment: fixed;
}

body.page-auth .layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

body.page-auth .content {
  width: 100%;
  max-width: 440px;
  padding: 0;
}

body.page-auth .login-card {
  margin: 0 auto;
  padding: 2.25rem 2rem 2rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

body.page-auth .login-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--ink);
}

body.page-auth .login-card .subtitle {
  margin: 0 0 1.75rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

body.page-auth .login-card form {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

body.page-auth label {
  margin-top: 0.75rem;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

body.page-auth label:first-of-type {
  margin-top: 0;
}

body.page-auth input {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

body.page-auth input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

body.page-auth button[type="submit"] {
  margin-top: 1.5rem;
  width: 100%;
  padding: 0.95rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--brand) 0%, #0f766e 100%);
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
  transition: transform 0.12s, box-shadow 0.12s;
}

body.page-auth button[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.45);
}

body.page-auth .brand-mark {
  width: 52px;
  height: 52px;
  margin: 0 auto 1.25rem;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand), #0f766e);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.35rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(13, 148, 136, 0.35);
}

/* ---------- App com sidebar ---------- */
body.page-app .layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 252px;
  flex-shrink: 0;
  background: var(--sidebar);
  color: #f1f5f9;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar h2 {
  margin: 0 0 1.25rem;
  padding: 0 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #94a3b8;
}

.sidebar a {
  color: #e2e8f0;
  text-decoration: none;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.95rem;
  transition: background 0.15s, color 0.15s;
}

.sidebar a:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.content {
  flex: 1;
  padding: 1.75rem 2rem 2.5rem;
  min-width: 0;
}

.content > h1 {
  margin: 0 0 1.25rem;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(226, 232, 240, 0.9);
}

.card h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 900px) {
  .stats {
    grid-template-columns: 1fr;
  }
}

.stat {
  text-align: left;
}

.stat h3 {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.stat p {
  font-size: 1.85rem;
  font-weight: 700;
  margin: 0;
  color: var(--brand);
  letter-spacing: -0.02em;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  padding: 0.65rem 0.75rem;
  border-bottom: 2px solid var(--line);
  text-align: left;
}

tbody td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

tbody tr:hover td {
  background: #fafafa;
}

label {
  display: block;
  margin: 0.85rem 0 0.4rem;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
}

input,
select,
button {
  font-family: inherit;
}

input,
select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

button {
  padding: 0.65rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  transition: background 0.15s, transform 0.1s;
}

button:hover {
  background: var(--brand-hover);
}

.card form > button[type="submit"] {
  margin-top: 1rem;
  width: auto;
  min-width: 160px;
}

button.danger {
  background: var(--danger);
}

button.danger:hover {
  background: var(--danger-hover);
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.actions form {
  flex: 1;
  min-width: 120px;
}

.actions button {
  width: 100%;
}

.flash {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-weight: 500;
  font-size: 0.9rem;
}

.flash.success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.flash.error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.login-card {
  max-width: 420px;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-group {
  background: #e0e7ff;
  color: #3730a3;
}

.badge-channel {
  background: #ccfbf1;
  color: #0f766e;
}

.content code {
  background: #f1f5f9;
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
}

p.muted,
.muted {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 0 1rem;
  line-height: 1.55;
}

p.hint,
.hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.35rem 0 0.75rem;
  line-height: 1.45;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

label.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  margin-top: 1rem;
}

label.checkbox-row input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.code-block {
  margin: 0.5rem 0 1rem;
  padding: 0.85rem 1rem;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.45;
}

.code-block code {
  background: transparent;
  color: inherit;
  padding: 0;
  white-space: pre-wrap;
  word-break: break-all;
}

td.cell-wrap {
  max-width: 420px;
  white-space: pre-wrap;
  word-break: break-word;
  vertical-align: top;
}

form.inline-actions {
  margin-top: 0.75rem;
}

form.inline-actions button {
  width: auto;
}

button.secondary {
  background: #475569;
}

button.secondary:hover {
  background: #334155;
}

@media (max-width: 768px) {
  body.page-app .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    padding: 1rem;
  }

  .sidebar h2 {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  .sidebar a {
    flex: 1 1 auto;
    text-align: center;
    min-width: 44%;
  }

  .content {
    padding: 1.25rem 1rem;
  }
}
