/* ===== Suplemail — Design System (Matoxi Dark Style) ===== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --bg:           #1a1c20;
  --bg2:          #212529;
  --surface:      #212529;
  --surface2:     #2c3034;
  --surface3:     #343a40;
  --border:       rgba(255,255,255,.1);
  --border2:      rgba(255,255,255,.07);
  --accent:       #b3f908;
  --accent-dim:   #8ec907;
  --accent-glow:  rgba(179,249,8,.15);
  --text:         #dee2e6;
  --text-secondary: #adb5bd;
  --text-muted:   #6c757d;
  --danger:       #f06548;
  --warning:      #f7b84b;
  --success:      #0ab39c;
  --info:         #4b9ce2;
  --radius:       0.5rem;
  --radius-lg:    0.75rem;
  --radius-xl:    1rem;
  --sidebar-w:    260px;
  --header-h:     70px;
  --font:         'Noto Sans', system-ui, sans-serif;
  --shadow-sm:    0 2px 6px rgba(0,0,0,.25);
  --shadow:       0 4px 16px rgba(0,0,0,.35);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0.3px;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

input::placeholder { color: var(--text-muted) !important; opacity: 1 !important; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== Layout ===== */
.layout { display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
  box-shadow: 2px 0 8px rgba(0,0,0,.2);
}

.sidebar-logo {
  padding: 0 20px;
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}

.sidebar-logo .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.sidebar-logo .brand-icon {
  width: 38px; height: 38px;
  background: var(--accent);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(179,249,8,.3);
}

.sidebar-logo .brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.2px;
  line-height: 1.2;
}

.sidebar-logo .brand-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 14px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all .15s ease;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
}

.nav-item .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

/* ===== Main Area ===== */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

/* ===== Topbar ===== */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.1px;
}

.topbar-actions { display: flex; align-items: center; gap: 14px; }

.content { padding: 28px; flex: 1; }

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.1px;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ===== Stat Cards ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card.blue::before   { background: var(--info); }
.stat-card.red::before    { background: var(--danger); }
.stat-card.yellow::before { background: var(--warning); }
.stat-card.green::before  { background: var(--success); }

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .7px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin: 8px 0 4px;
  line-height: 1;
  letter-spacing: -1px;
}

.stat-change { font-size: 12px; color: var(--text-muted); }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }
.stat-icon {
  position: absolute;
  top: 18px; right: 18px;
  font-size: 22px;
  color: var(--accent);
  opacity: .2;
}
.stat-card.blue   .stat-icon { color: var(--info); }
.stat-card.red    .stat-icon { color: var(--danger); }
.stat-card.yellow .stat-icon { color: var(--warning); }
.stat-card.green  .stat-icon { color: var(--success); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s ease;
  text-decoration: none;
  white-space: nowrap;
  font-family: var(--font);
  letter-spacing: .1px;
}

.btn-primary {
  background: var(--accent);
  color: #1a1c20;
}
.btn-primary:hover {
  background: var(--accent-dim);
  box-shadow: 0 0 14px rgba(179,249,8,.3);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

.btn-danger {
  background: rgba(240,101,72,.12);
  color: var(--danger);
  border: 1px solid rgba(240,101,72,.25);
}
.btn-danger:hover { background: rgba(240,101,72,.2); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover {
  color: var(--text);
  background: var(--surface2);
}

.btn-sm  { padding: 5px 13px; font-size: 12px; }
.btn-lg  { padding: 12px 26px; font-size: 15px; }
.btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }

table { width: 100%; border-collapse: collapse; }

thead th {
  background: var(--surface2);
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .7px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border2);
  transition: background .1s;
}
tbody tr:hover { background: rgba(255,255,255,.025); }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 13px 16px; font-size: 13px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.form-input, .form-select, .form-textarea, .form-control {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  font-size: 13.5px;
  font-family: var(--font);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(179,249,8,.12);
}

.form-input::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-select { cursor: pointer; }
.form-select option, .form-control option { background: var(--surface2); }
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; }
.form-row { display: grid; gap: 16px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .2px;
}

.badge-active       { background: rgba(10,179,156,.15);  color: var(--success); }
.badge-draft        { background: rgba(108,117,125,.15); color: var(--text-muted); }
.badge-sending      { background: rgba(75,156,226,.15);  color: var(--info); }
.badge-scheduled    { background: rgba(247,184,75,.15);  color: var(--warning); }
.badge-sent         { background: var(--accent-glow);    color: var(--accent); }
.badge-paused       { background: rgba(247,184,75,.12);  color: var(--warning); }
.badge-error        { background: rgba(240,101,72,.12);  color: var(--danger); }
.badge-unsubscribed { background: rgba(240,101,72,.12);  color: var(--danger); }

/* ===== Progress bar ===== */
.progress {
  background: var(--surface3);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width .3s ease;
}
.progress-bar.blue { background: var(--info); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(12px) scale(.98);
  transition: transform .2s ease;
  box-shadow: var(--shadow-lg);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }

.modal-header {
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}

.modal-title { font-size: 16px; font-weight: 700; letter-spacing: -.2px; }

.modal-close {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 5px 8px;
  border-radius: var(--radius);
  transition: all .15s;
  line-height: 1;
}
.modal-close:hover { color: var(--text); border-color: var(--text-muted); }

.modal-body { padding: 22px 26px; }

.modal-footer {
  padding: 18px 26px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: var(--surface2);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ===== Alerts ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-left: 3px solid;
}
.alert-success { background: rgba(10,179,156,.1);  border-color: var(--success); color: var(--success); }
.alert-error   { background: rgba(240,101,72,.1);  border-color: var(--danger);  color: var(--danger); }
.alert-info    { background: rgba(75,156,226,.1);  border-color: var(--info);    color: var(--info); }
.alert-warning { background: rgba(247,184,75,.1);  border-color: var(--warning); color: var(--warning); }

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all .15s;
  letter-spacing: .1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ===== Empty state ===== */
.empty-state {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 52px; margin-bottom: 18px; opacity: .25; }
.empty-state h3 { font-size: 16px; color: var(--text-secondary); margin-bottom: 8px; font-weight: 600; }
.empty-state p { font-size: 13px; margin-bottom: 22px; }

/* ===== Search & Filters ===== */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  align-items: center;
}
.search-input-wrap { position: relative; flex: 1; }
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}
.search-input-wrap .form-input { padding-left: 34px; }

/* ===== Pagination ===== */
.pagination { display: flex; align-items: center; gap: 6px; padding: 18px 0; }

.page-btn {
  min-width: 34px;
  height: 34px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  transition: all .15s;
  padding: 0 8px;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.page-btn.active { background: var(--accent); color: #1a1c20; border-color: var(--accent); font-weight: 700; }
.page-btn:disabled { opacity: .35; cursor: not-allowed; pointer-events: none; }

/* ===== Charts placeholder ===== */
.chart-container { position: relative; width: 100%; }

/* ===== Toggle ===== */
.toggle { position: relative; display: inline-flex; align-items: center; cursor: pointer; gap: 8px; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider { width: 38px; height: 22px; background: var(--surface3); border-radius: 11px; transition: background .2s; flex-shrink: 0; position: relative; }
.toggle-slider::after { content: ''; position: absolute; top: 4px; left: 4px; width: 14px; height: 14px; background: var(--text-muted); border-radius: 50%; transition: transform .2s, background .2s; }
.toggle input:checked ~ .toggle-slider { background: var(--accent-glow); border: 1px solid var(--accent); }
.toggle input:checked ~ .toggle-slider::after { transform: translateX(16px); background: var(--accent); }

/* ===== Toasts ===== */
#toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 13px 18px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  animation: slideIn .2s ease;
  max-width: 340px;
  min-width: 220px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--info); }
.toast.warning { border-left: 3px solid var(--warning); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ===== Loading ===== */
.spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--surface3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }

.loading-overlay {
  position: absolute; inset: 0;
  background: rgba(26,28,32,.75);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-lg);
  z-index: 10;
}

/* ===== Segment Cards ===== */
.segment-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  cursor: pointer;
  transition: all .18s ease;
  position: relative;
  overflow: hidden;
}

.segment-card:hover {
  border-color: rgba(179,249,8,.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(179,249,8,.08);
}

.segment-card.active {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.segment-card.active::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.segment-name  { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.segment-desc  { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; line-height: 1.4; }
.segment-count { font-size: 18px; font-weight: 700; }

/* ===== Month Picker ===== */
.month-picker {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 8px;
}

.month-btn {
  padding: 8px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  transition: all .15s;
  text-align: center;
}
.month-btn:hover { border-color: var(--accent); color: var(--accent); }
.month-btn.active { background: var(--accent); color: #1a1c20; font-weight: 700; border-color: var(--accent); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; }
  .content { padding: 18px; }
  .topbar { padding: 0 18px; }
}

/* ===== Utility ===== */
.flex            { display: flex; }
.flex-1          { flex: 1; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2           { gap: 8px; }
.gap-3           { gap: 12px; }
.gap-4           { gap: 16px; }
.mt-1            { margin-top: 4px; }
.mt-2            { margin-top: 8px; }
.mt-4            { margin-top: 16px; }
.mb-4            { margin-bottom: 16px; }
.mb-6            { margin-bottom: 24px; }
.text-muted      { color: var(--text-muted); }
.text-accent     { color: var(--accent); }
.text-sm         { font-size: 12px; }
.text-xs         { font-size: 11px; }
.font-bold       { font-weight: 700; }
.font-semibold   { font-weight: 600; }
.truncate        { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full          { width: 100%; }
.hidden          { display: none !important; }
.grid-2          { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3          { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ===== Legacy aliases (compatibilidade) ===== */
.bg-secondary { background: var(--surface2); }
.text-primary  { color: var(--text); }
.text-secondary { color: var(--text-secondary); }
.border        { border: 1px solid var(--border); }
.rounded       { border-radius: var(--radius); }

/* Variáveis legadas — alias para inline styles que referenciam nomes antigos */
:root {
  --bg-secondary:   var(--surface2);
  --text-primary:   var(--text);
}
