:root {
  --bg:        #0b1014;
  --bg-soft:   #111a21;
  --panel:     #16222b;
  --panel-2:   #1b2a35;
  --line:      #25323d;
  --text:      #e7eef2;
  --muted:     #8aa0ad;
  --green:     #25d366;
  --green-d:   #1da851;
  --green-glow:#25d36633;
  --blue:      #34b7f1;
  --red:       #f15b5b;
  --amber:     #f1b34b;
  --radius:    14px;
  --radius-sm: 10px;
  --shadow:    0 10px 30px -12px rgba(0,0,0,.6);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 80% -10%, #14323033, transparent),
    radial-gradient(900px 500px at -10% 110%, #1a3a4d33, transparent),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}
code { background: #0d161c; padding: 1px 6px; border-radius: 6px; font-size: .85em; color: #9fe3bd; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; }
button { font-family: inherit; cursor: pointer; }

/* ───────────────── Layout ───────────────── */
.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

.sidebar {
  background: linear-gradient(180deg, var(--bg-soft), #0c141a);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 22px 16px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }
.brand__logo {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--green), var(--green-d));
  display: grid; place-items: center; font-size: 22px;
  box-shadow: 0 6px 18px -6px var(--green-glow);
}
.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__text strong { font-size: 1.05rem; font-weight: 800; }
.brand__text span { font-size: .72rem; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav__item {
  display: flex; align-items: center; gap: 11px;
  background: transparent; border: none; color: var(--muted);
  padding: 11px 12px; border-radius: var(--radius-sm);
  font-size: .92rem; font-weight: 500; text-align: left;
  transition: .15s;
}
.nav__item:hover { background: var(--panel); color: var(--text); }
.nav__item.is-active {
  background: linear-gradient(90deg, var(--green-glow), transparent);
  color: #fff; box-shadow: inset 2px 0 0 var(--green);
}
.nav__icon { font-size: 1.05rem; }

.sidebar__foot { padding-top: 16px; border-top: 1px solid var(--line); }
.conn {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: .82rem; font-weight: 600;
  background: var(--panel);
}
.conn__dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.conn--on  .conn__dot { background: var(--green); box-shadow: 0 0 0 4px var(--green-glow); }
.conn--off .conn__dot { background: var(--red); box-shadow: 0 0 0 4px #f15b5b33; }
.conn--on  { color: #b6f4cf; }
.conn--off { color: #f6b7b7; }

/* ───────────────── Main / Views ───────────────── */
.main { padding: 30px 36px 60px; max-width: 1240px; }
.view { display: none; animation: fade .25s ease; }
.view.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.view__head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; gap: 16px; }
.view__head h1 { font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; }
.view__head .muted { margin-top: 4px; font-size: .9rem; }

/* ───────────────── Grids ───────────────── */
.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid--stats { grid-template-columns: repeat(4, 1fr); }
.grid--stats-6 { grid-template-columns: repeat(3, 1fr); }
.grid--two { grid-template-columns: 1fr 1fr; }
.grid--form-preview { grid-template-columns: 1.3fr .9fr; align-items: start; }

/* ───────────────── Cards ───────────────── */
.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.card__title { font-size: 1rem; font-weight: 700; margin-bottom: 16px; }
.card__title .muted { font-weight: 400; font-size: .85rem; }

.stat-card {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 4px;
}
.stat-card__label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-card__value { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; }
.stat-card__hint { font-size: .76rem; color: var(--muted); }

/* ───────────────── Config / steps ───────────────── */
.config-list { list-style: none; display: flex; flex-direction: column; gap: 9px; margin-bottom: 14px; }
.config-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 12px; background: #0d161c; border-radius: var(--radius-sm);
  border: 1px solid var(--line); font-size: .88rem;
}
.config-list .ok  { color: var(--green); font-weight: 600; }
.config-list .no  { color: var(--red); font-weight: 600; }
.steps { padding-left: 18px; display: flex; flex-direction: column; gap: 9px; margin-bottom: 16px; color: var(--muted); font-size: .9rem; }
.steps li { line-height: 1.5; }
.steps strong, .steps code { color: var(--text); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ───────────────── Forms ───────────────── */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.field--sm { max-width: 140px; }
.field__label { font-size: .82rem; font-weight: 600; color: #c4d3dc; }
.field__hint { font-size: .74rem; color: var(--muted); }
.field-row { display: flex; gap: 12px; }

input, select, textarea {
  background: #0d161c; border: 1px solid var(--line); color: var(--text);
  border-radius: var(--radius-sm); padding: 11px 13px; font-size: .92rem;
  font-family: inherit; width: 100%; transition: .15s; outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--green); box-shadow: 0 0 0 3px var(--green-glow);
}
input::placeholder, textarea::placeholder { color: #5e7382; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath fill='%238aa0ad' d='M0 0h10L5 6z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; background-size: 10px; padding-right: 32px; }

.vars { display: flex; flex-direction: column; gap: 8px; }
.var-item { display: flex; gap: 8px; align-items: center; }
.var-item .var-num {
  width: 34px; height: 38px; flex-shrink: 0; display: grid; place-items: center;
  background: #0d161c; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: .78rem; color: var(--muted); font-weight: 600;
}
.var-item .var-del {
  background: #0d161c; border: 1px solid var(--line); color: var(--muted);
  width: 38px; height: 38px; border-radius: var(--radius-sm); flex-shrink: 0;
}
.var-item .var-del:hover { color: var(--red); border-color: var(--red); }

.advanced { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; background: #0d161c; }
.advanced summary { cursor: pointer; font-size: .85rem; color: var(--muted); font-weight: 600; }
.advanced[open] summary { margin-bottom: 12px; color: var(--text); }

/* ───────────────── Buttons ───────────────── */
.btn {
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 11px 18px; font-size: .9rem; font-weight: 600; color: #fff;
  background: var(--panel-2); transition: .15s; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn--primary { background: linear-gradient(135deg, var(--green), var(--green-d)); box-shadow: 0 8px 20px -8px var(--green-glow); }
.btn--primary:hover { box-shadow: 0 10px 26px -8px var(--green-glow); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn--ghost:hover { background: var(--panel); }
.btn--danger { background: linear-gradient(135deg, #f15b5b, #c43c3c); }
.btn--block { width: 100%; }
.btn--lg { padding: 14px 26px; font-size: .98rem; }
.btn--mini { background: #0d161c; border: 1px dashed var(--line); color: var(--muted); padding: 7px 12px; font-size: .8rem; align-self: flex-start; }
.btn--mini:hover { color: var(--green); border-color: var(--green); }
.link { background: none; border: none; color: var(--green); text-decoration: underline; font-size: inherit; padding: 0; }

/* ───────────────── Phone preview ───────────────── */
.preview-col { position: sticky; top: 24px; }
.phone {
  width: 300px; margin: 0 auto 10px; background: #0c141a;
  border: 8px solid #1c2a33; border-radius: 36px; overflow: hidden;
  box-shadow: 0 24px 50px -20px rgba(0,0,0,.8); position: relative;
}
.phone__notch { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 120px; height: 22px; background: #1c2a33; border-radius: 0 0 14px 14px; z-index: 3; }
.phone__bar {
  display: flex; align-items: center; gap: 10px; padding: 28px 14px 12px;
  background: linear-gradient(135deg, #1f3a32, #143028);
}
.phone__back { color: #cfe9da; font-size: 1.4rem; line-height: 1; }
.phone__avatar { width: 34px; height: 34px; border-radius: 50%; background: #2a4a3e; display: grid; place-items: center; }
.phone__contact { display: flex; flex-direction: column; line-height: 1.2; }
.phone__contact strong { font-size: .9rem; }
.phone__contact span { font-size: .72rem; color: #9bdcb6; }
.phone__chat {
  min-height: 320px; padding: 16px 12px;
  background:
    repeating-linear-gradient(0deg, #0e1a14, #0e1a14 1px, transparent 1px, transparent 6px),
    #0b1510;
}
.bubble {
  background: #075e54; background: linear-gradient(135deg, #0b6b5e, #07564c);
  color: #eafff4; padding: 9px 11px 7px; border-radius: 10px 10px 10px 2px;
  max-width: 85%; font-size: .88rem; line-height: 1.45; box-shadow: 0 2px 6px rgba(0,0,0,.3);
  position: relative; word-wrap: break-word; white-space: pre-wrap;
}
.bubble__img {
  display: block; width: 100%; max-height: 180px; object-fit: cover;
  border-radius: 8px; margin-bottom: 6px;
}
.bubble__meta { display: block; text-align: right; font-size: .66rem; color: #8fd3bf; margin-top: 3px; }
.phone--mini { max-width: 280px; border-radius: 20px; overflow: hidden; border: 1px solid var(--line); margin-top: 12px; }
.phone--mini .phone__chat { min-height: auto; padding: 12px; }

.field--check {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  font-size: .9rem; color: var(--text);
}
.field--check input { width: auto; accent-color: var(--green); }

.camp-preview {
  font-size: .9rem; line-height: 1.5; margin-bottom: 14px;
  padding: 12px 14px; background: #0d161c; border-radius: var(--radius-sm);
  border: 1px solid var(--line); white-space: pre-wrap; word-break: break-word;
}
.csv-area--tall { min-height: 280px; }

/* ───────────────── Dropzone / CSV ───────────────── */
.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 24px;
  text-align: center; transition: .15s; margin-bottom: 14px; background: #0d161c;
}
.dropzone.drag { border-color: var(--green); background: #0f2018; }
.dropzone__icon { font-size: 2rem; display: block; margin-bottom: 6px; }
.dropzone p { font-size: .9rem; margin-bottom: 4px; }
.csv-area { min-height: 120px; resize: vertical; font-family: ui-monospace, monospace; font-size: .82rem; margin-bottom: 12px; }

/* ───────────────── Tables ───────────────── */
.table-wrap { overflow: auto; max-height: 360px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.table thead th { position: sticky; top: 0; background: #0d161c; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; z-index: 1; }
.table tbody tr:hover { background: #0f1c24; }
.table .empty td { text-align: center; color: var(--muted); padding: 24px; }
.st-ok { color: var(--green); font-weight: 600; }
.st-fail { color: var(--red); font-weight: 600; }
.st-pending { color: var(--amber); font-weight: 600; }
.st-read { color: var(--blue); font-weight: 600; }
.st-delivered { color: var(--green); font-weight: 600; }

/* ───────────────── Dashboard Evolution ───────────────── */
.dash-select {
  width: auto; min-width: 150px; padding: 9px 12px; font-size: .85rem;
}
.dash-auto {
  display: flex; align-items: center; gap: 6px;
  font-size: .82rem; color: var(--muted); cursor: pointer;
}
.dash-auto input { width: auto; accent-color: var(--green); }
.dash-banner {
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px;
  font-size: .88rem; border: 1px solid;
}
.dash-banner--warn { background: #2a2210; border-color: #5a4518; color: #f1d89a; }
.dash-banner--info { background: #0f2018; border-color: #1c4030; color: #b6f4cf; }

.stat-card--green .stat-card__value { color: var(--green); }
.stat-card--blue  .stat-card__value { color: var(--blue); }
.stat-card--amber .stat-card__value { color: var(--amber); }

.funnel { display: flex; flex-direction: column; gap: 14px; }
.funnel__row {
  display: grid; grid-template-columns: 90px 1fr 48px; gap: 12px; align-items: center;
  font-size: .88rem;
}
.funnel__bar {
  height: 12px; background: #0d161c; border-radius: 99px; overflow: hidden; border: 1px solid var(--line);
}
.funnel__fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--green), var(--blue));
  transition: width .4s ease;
}
.funnel__row strong { text-align: right; font-size: .95rem; }

.table-wrap--tall { max-height: 480px; }
.dash-table-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.dash-table-head .card__title { margin-bottom: 0; }
.dash-pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 14px; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 99px;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
}
.badge--lido { background: #0f2430; color: var(--blue); border: 1px solid #1a4a60; }
.badge--entregue { background: #0f2018; color: var(--green); border: 1px solid #1c4030; }
.badge--enviado { background: #1a2030; color: #9bb8d4; border: 1px solid #2a3a50; }
.badge--pendente { background: #2a2210; color: var(--amber); border: 1px solid #5a4518; }

/* ───────────────── Bulk action / progress / log ───────────────── */
.sticky-action { margin-top: 18px; }
.bulk-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.progress { flex: 1; min-width: 220px; display: flex; align-items: center; gap: 12px; }
.progress__bar { flex: 1; height: 10px; background: #0d161c; border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.progress__fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--green), var(--blue)); transition: width .25s; }
.progress__label { font-size: .82rem; color: var(--muted); font-weight: 600; min-width: 70px; }

.bulk-report { display: flex; gap: 10px; margin-top: 14px; }
.chip { padding: 6px 12px; border-radius: 99px; font-size: .82rem; font-weight: 600; border: 1px solid var(--line); }
.chip--ok { color: var(--green); background: #0f2018; border-color: #1c4030; }
.chip--fail { color: var(--red); background: #201010; border-color: #4a2020; }

.log { margin-top: 14px; max-height: 240px; overflow: auto; background: #0a1115; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; font-family: ui-monospace, monospace; font-size: .8rem; }
.log__line { padding: 3px 0; border-bottom: 1px solid #11202820; }
.log__line.ok { color: #9fe3bd; }
.log__line.fail { color: #f6a5a5; }

/* ───────────────── Toasts ───────────────── */
.toasts { position: fixed; right: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 50; }
.toast {
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--green);
  padding: 13px 18px; border-radius: var(--radius-sm); box-shadow: var(--shadow);
  font-size: .88rem; max-width: 340px; animation: slideIn .25s ease;
}
.toast--error { border-left-color: var(--red); }
.toast--info  { border-left-color: var(--blue); }
.toast strong { display: block; margin-bottom: 2px; }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ───────────────── Responsive ───────────────── */
@media (max-width: 1000px) {
  .grid--stats, .grid--stats-6 { grid-template-columns: repeat(2, 1fr); }
  .grid--two, .grid--form-preview { grid-template-columns: 1fr; }
  .preview-col { position: static; }
}
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar__foot { border: none; padding: 0; margin-left: auto; }
  .main { padding: 20px; }
  .grid--stats { grid-template-columns: 1fr 1fr; }
}
