:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --danger: #f87171;
  --success: #34d399;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow-x: hidden;
  overscroll-behavior: none;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  max-width: 100vw;
  overflow-x: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: #a5b4fc;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid #334155;
}
.topbar nav {
  display: flex;
  gap: 1rem;
  align-items: center;
}
.logo {
  font-weight: 700;
  color: var(--text);
}

.hero {
  max-width: 640px;
  margin: 3rem auto;
  padding: 0 1.25rem;
}
.hero h1 {
  font-size: 2rem;
  margin: 0 0 0.75rem;
}
.lead {
  font-size: 1.1rem;
  color: var(--muted);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.5rem 0;
}
.hint {
  font-size: 0.85rem;
  color: var(--muted);
}

.container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 1.25rem;
  box-sizing: border-box;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  border: 1px solid #334155;
  max-width: 100%;
  box-sizing: border-box;
}
.card.narrow {
  max-width: 420px;
  margin: 2rem auto;
}
.card h1,
.card h2 {
  margin-top: 0;
}

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}
.btn-secondary {
  background: #334155;
  color: var(--text);
}
.btn-ghost {
  background: transparent;
  color: #a5b4fc;
  border: 1px solid #475569;
}
.btn-lg {
  padding: 0.65rem 1.25rem;
  font-size: 1.05rem;
}
.btn-block {
  width: 100%;
  text-align: center;
}

.form label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.form input,
.form textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #475569;
  background: #0f172a;
  color: var(--text);
}
.grid-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}
.grid-form .full {
  grid-column: 1 / -1;
}
@media (max-width: 600px) {
  .grid-form {
    grid-template-columns: 1fr;
  }
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.alert-error {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.4);
}
.alert-success {
  background: rgba(52, 211, 153, 0.12);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.muted {
  color: var(--muted);
}
.muted-link {
  color: var(--muted);
  font-size: 0.9rem;
}

.grid.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.stat {
  text-align: left;
}
.stat-label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}
.stat-value {
  font-size: 1.25rem;
}

/* Tabela dentro do card: não ultrapassa a largura do viewport */
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  box-sizing: border-box;
}

.table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.table th,
.table td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #334155;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.table th {
  color: var(--muted);
  font-weight: 600;
}

/* Mobile: cada linha vira um bloco centralizado, sem barra saindo da tela */
@media (max-width: 640px) {
  .table-wrap {
    overflow-x: visible;
  }

  .table.table-campaigns {
    table-layout: auto;
  }

  .table.table-campaigns thead {
    display: none;
  }

  .table.table-campaigns tbody tr {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0 auto 0.75rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid #334155;
    border-radius: 10px;
    background: #0f172a;
    box-sizing: border-box;
  }

  .table.table-campaigns tbody tr:last-child {
    margin-bottom: 0;
  }

  .table.table-campaigns td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    width: 100%;
    max-width: 100%;
    padding: 0.4rem 0;
    border-bottom: 1px solid #1e293b;
    box-sizing: border-box;
    text-align: right;
  }

  .table.table-campaigns td:last-child {
    border-bottom: none;
  }

  .table.table-campaigns td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-align: left;
    flex-shrink: 0;
    max-width: 42%;
  }
}

.page-landing .topbar a {
  color: #a5b4fc;
}

.actions-card #btn-push {
  margin-top: 0.5rem;
}

#push-status {
  white-space: pre-line;
  max-width: 100%;
  line-height: 1.45;
}

/* ========== Painel de envio (campanhas) — estilo app premium ========== */
.page-send-panel {
  --send-bg: #060607;
  --send-surface: #121214;
  --send-elevated: #1a1a1d;
  --send-border: rgba(255, 255, 255, 0.07);
  --send-glow: rgba(99, 102, 241, 0.45);
  --send-accent: #6366f1;
  --send-accent2: #8b5cf6;
  --send-text: #f4f4f5;
  --send-muted: #71717a;
  background: var(--send-bg);
  color: var(--send-text);
}

.send-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 0.35rem;
  padding: 0.65rem 1rem;
  padding-top: max(0.65rem, env(safe-area-inset-top));
  background: rgba(6, 6, 7, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--send-border);
}

.send-topbar-title {
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-align: center;
  justify-self: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.send-topbar > button.send-icon-btn {
  justify-self: start;
}
.send-topbar > a.send-icon-btn {
  justify-self: end;
}

.send-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 12px;
  background: var(--send-elevated);
  color: var(--send-text);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.send-icon-btn:active {
  transform: scale(0.96);
}
a.send-icon-btn {
  text-decoration: none;
}

.send-main {
  max-width: 520px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
}

.send-alert {
  padding: 0.85rem 1rem;
  border-radius: 14px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.send-alert-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}
.send-alert-ok {
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: #6ee7b7;
}

.send-card {
  background: var(--send-surface);
  border: 1px solid var(--send-border);
  border-radius: 18px;
  padding: 1rem 1.1rem;
  margin-bottom: 0.85rem;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.send-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.send-label-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--send-muted);
}

.send-dots {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: repeating-linear-gradient(
    90deg,
    var(--send-muted) 0 2px,
    transparent 2px 4px
  );
  opacity: 0.6;
}

.send-selected-preview {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--send-muted);
}

.send-icon-preview {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(145deg, #4f46e5, #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 20px var(--send-glow);
}

.send-icon-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.send-input-url,
.send-input,
.send-textarea {
  width: 100%;
  border: 1px solid var(--send-border);
  border-radius: 14px;
  background: var(--send-bg);
  color: var(--send-text);
  font-size: 1rem;
  padding: 0.75rem 0.9rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.send-input:focus,
.send-textarea:focus,
.send-input-url:focus {
  border-color: rgba(99, 102, 241, 0.55);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.send-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.45;
}

.send-field {
  display: block;
  margin-bottom: 1.1rem;
}
.send-field:last-child {
  margin-bottom: 0;
}

.send-cap {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--send-muted);
  margin-bottom: 0.45rem;
}

.send-req {
  font-weight: 600;
  opacity: 0.85;
}

.send-settings-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.send-settings-desc {
  margin: 0 0 1.1rem;
  font-size: 0.8rem;
  color: var(--send-muted);
  line-height: 1.45;
}

.send-slider-block {
  margin-bottom: 1.15rem;
}

.send-slider-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.send-output {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--send-accent);
  min-width: 3.5rem;
  text-align: right;
}

.send-range {
  width: 100%;
  height: 8px;
  border-radius: 99px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--send-elevated);
  outline: none;
}
.send-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.35), 0 2px 10px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}
.send-range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.35);
  cursor: pointer;
}

.send-toggle-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.send-pill {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.65rem 0.75rem;
  border-radius: 14px;
  border: 1px solid var(--send-border);
  background: var(--send-bg);
  color: var(--send-muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.send-pill-sm {
  padding: 0.5rem 0.65rem;
  font-size: 0.8rem;
}
.send-pill.is-active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(139, 92, 246, 0.25));
  border-color: rgba(99, 102, 241, 0.5);
  color: #e0e7ff;
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.2);
}
.send-pill-ico {
  font-size: 1rem;
  line-height: 1;
}

.send-schedule-later {
  margin-bottom: 1rem;
}

.send-delay-block {
  margin-bottom: 1rem;
}

.send-toggle-unit {
  margin-bottom: 1rem;
}

.send-submit {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 0.25rem;
  padding: 1rem 1.25rem;
  border: none;
  border-radius: 16px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #6366f1 0%, #7c3aed 45%, #a855f7 100%);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.35), 0 1px 0 rgba(255, 255, 255, 0.12) inset;
  transition: transform 0.12s, box-shadow 0.15s;
}
.send-submit:active {
  transform: scale(0.98);
}

.send-muted {
  color: var(--send-muted);
  font-size: 0.9rem;
}

.send-recent-card .table th,
.send-recent-card .table td {
  border-bottom-color: var(--send-border);
}
.send-recent-card .table th {
  color: var(--send-muted);
}

/* Drawer */
.send-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.send-drawer-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.send-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(280px, 86vw);
  z-index: 100;
  background: var(--send-surface);
  border-right: 1px solid var(--send-border);
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  padding: max(1.25rem, env(safe-area-inset-top)) 1rem 1rem;
}
.send-drawer.is-open {
  transform: translateX(0);
}

.send-drawer-inner {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.send-drawer-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--send-muted);
  margin: 0 0 0.75rem;
}
.send-drawer-inner a {
  display: block;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  color: var(--send-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.send-drawer-inner a:hover {
  background: var(--send-elevated);
}

body.send-drawer-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .page-send-panel .table.table-campaigns tbody tr {
    background: var(--send-bg);
  }
}
