:root {
  --navy: #101a30;
  --navy-2: #172644;
  --ink: #182033;
  --muted: #657087;
  --canvas: #f4f6fa;
  --line: #dce2ed;
  --card: #ffffff;
  --cyan: #32d4cb;
  --cyan-dark: #057f7c;
  --orange: #ff7b42;
  --red: #c94649;
  --green: #188660;
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

/* O atributo nativo hidden deve sempre vencer estilos de layout das telas. */
[hidden] { display: none !important; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .6; }
a { color: var(--cyan-dark); }

.topbar { min-height: 72px; padding: 0 clamp(20px, 5vw, 82px); display: flex; align-items: center; justify-content: space-between; background: var(--navy); color: white; }
.brand { color: white; display: inline-flex; align-items: center; gap: 11px; text-decoration: none; letter-spacing: .04em; }
.brand-symbol, .brand-mark { width: 37px; height: 37px; display: grid; place-items: center; background: var(--cyan); color: var(--navy); border-radius: 10px; font-size: 22px; font-weight: 900; font-family: Georgia, serif; }
.brand strong, .brand small { display: block; line-height: 1; }
.brand strong { font-size: 14px; letter-spacing: .13em; }
.brand small { margin-top: 4px; color: var(--cyan); font-size: 10px; letter-spacing: .22em; }
.topbar-actions { display: flex; align-items: center; gap: 20px; font-size: 13px; }
.topbar-actions a { color: #bcd4e6; text-decoration: none; }

.hero { padding: 56px clamp(20px, 5vw, 82px) 62px; color: white; background: radial-gradient(circle at 88% 15%, #1d6773, transparent 35%), linear-gradient(125deg, #101a30, #162943); display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, .38fr); gap: 46px; align-items: end; }
.hero h1 { max-width: 760px; font-size: clamp(31px, 4.3vw, 59px); line-height: 1.02; letter-spacing: -.055em; margin: 7px 0 16px; }
.hero p:not(.eyebrow) { max-width: 630px; margin: 0; color: #d2dbe9; font-size: 17px; line-height: 1.55; }
.eyebrow { margin: 0; color: var(--cyan-dark); font-size: 11px; font-weight: 800; letter-spacing: .13em; }
.hero .eyebrow { color: var(--cyan); }
.integration-status { justify-self: end; min-width: 255px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); border-radius: 14px; padding: 18px; color: #e5edf8; display: grid; gap: 10px; }
.integration-status .status { background: rgba(255,255,255,.08); color: #dfeaf5; }
.integration-status .status.ok { color: #b9f5e5; }
.integration-status small { color: #b6c4d5; font-size: 11px; }

.metrics { margin: -28px clamp(20px, 5vw, 82px) 0; position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.metrics article { padding: 19px 20px 18px; border-radius: 13px; background: var(--card); box-shadow: 0 8px 24px rgba(26, 42, 70, .09); }
.metrics span, .metrics small { color: var(--muted); display: block; font-size: 12px; }
.metrics strong { display: block; margin: 8px 0 2px; color: var(--navy); font-size: 27px; letter-spacing: -.05em; }

.tabs { padding: 45px clamp(20px, 5vw, 82px) 0; display: flex; gap: 26px; border-bottom: 1px solid var(--line); }
.tab { padding: 0 0 14px; background: transparent; border: 0; color: var(--muted); font-size: 14px; font-weight: 700; }
.tab.active { color: var(--navy); border-bottom: 3px solid var(--cyan-dark); }
.count { display: inline-grid; min-width: 19px; height: 19px; margin-left: 3px; place-items: center; background: #e0f5f4; color: var(--cyan-dark); border-radius: 999px; font-size: 11px; }
.tab-panel { display: none; padding: 34px clamp(20px, 5vw, 82px) 75px; }
.tab-panel.active { display: block; }

.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 22px; margin-bottom: 23px; }
.section-heading h2 { margin: 4px 0 5px; font-size: 26px; letter-spacing: -.04em; }
.section-heading p:not(.eyebrow) { margin: 0; color: var(--muted); line-height: 1.45; }
.section-actions, .draft-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.draft-actions select { min-width: 230px; }

.button { padding: 10px 14px; border: 1px solid transparent; border-radius: 9px; font-weight: 750; font-size: 13px; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: #062c2c; background: var(--cyan); }
.button.primary:hover { background: #69ece4; }
.button.secondary { background: white; color: var(--navy); border-color: var(--line); }
.button.secondary:hover { border-color: #aab7ca; }
.button.quiet { background: transparent; color: var(--muted); }
.button.quiet:hover { background: #e8edf5; color: var(--navy); }
.button.danger { background: var(--red); color: white; }
.button.wide { width: 100%; padding: 13px; margin-top: 5px; }
.button.large { padding: 14px 20px; }
.file-button input { display: none; }

.filters { display: flex; gap: 13px; align-items: center; padding: 13px 14px; background: white; border: 1px solid var(--line); border-radius: 13px 13px 0 0; }
.search-field { flex: 1; min-width: 230px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; }
.search-field span { color: var(--muted); font-size: 20px; }
.search-field input { width: 100%; border: 0; outline: 0; padding: 10px 0; background: transparent; }
.filter-check, .check-label { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.direct-contact-card { display: grid; grid-template-columns: minmax(230px, .85fr) minmax(460px, 1.4fr); gap: 22px; align-items: center; padding: 18px 16px; border: 1px solid #c9e9e7; border-top: 0; background: linear-gradient(100deg, #f1fbfb, #fff); }
.direct-contact-card h3 { margin: 4px 0 6px; color: var(--navy); font-size: 17px; letter-spacing: -.025em; }
.direct-contact-card p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.direct-contact-form { display: grid; grid-template-columns: minmax(145px, 1fr) minmax(180px, 1.25fr); gap: 10px; align-items: end; }
.direct-contact-form .direct-contact-confirm { grid-column: 1 / -1; color: var(--ink); font-weight: 700; }
.direct-contact-form .button { justify-self: start; }
.selection-bar { display: flex; align-items: center; gap: 14px; padding: 11px 14px; border: 1px solid var(--line); border-top: 0; background: #f9fafc; color: var(--muted); font-size: 13px; }
.selection-bar label { display: inline-flex; gap: 7px; align-items: center; color: var(--ink); font-weight: 700; }
.selection-bar .button { margin-left: auto; }

.contacts-table-wrap { overflow: auto; background: white; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 13px 13px; }
.contacts-table { width: 100%; border-collapse: collapse; min-width: 850px; }
.contacts-table th { padding: 12px 14px; background: #f7f8fb; color: var(--muted); text-align: left; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; }
.contacts-table td { padding: 14px; vertical-align: top; border-top: 1px solid #edf0f4; font-size: 13px; }
.contacts-table tr.selected { background: #f0fbfa; }
.contacts-table td:first-child { width: 42px; text-align: center; }
.contacts-table td:last-child { width: 80px; text-align: right; }
.contacts-table strong { display: block; max-width: 480px; color: var(--navy); line-height: 1.35; }
.contacts-table small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.contacts-table a { display: block; max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.direct-contact-label { color: #087955 !important; font-weight: 800; }
.muted { color: var(--muted); }
.status-stack { display: grid; gap: 5px; }
.status { display: inline-flex; width: max-content; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 999px; background: #f1f3f7; color: #6c7688; font-size: 10px; font-weight: 800; }
.status.ok { color: var(--green); background: #e6f8f1; }
.status.pending { color: #7b8598; }
.status.failed { color: #a93a3d; background: #fae7e7; }
.status.neutral { color: #745700; background: #fff5d6; }
.status.recently-emailed { color: #196b59; background: #dff6ef; }
.status.test { color: #6542a2; background: #f0e8ff; }
.status.opted-out { color: #8f2029; background: #ffe6e7; border: 1px solid #efb7bb; }
.status.reactivated { color: #16634d; background: #e3f7ef; }
.sent-copy { display: block; margin-top: 6px; max-width: 220px; color: var(--muted); font-size: 11px; text-align: right; }
.sent-copy.ok { color: var(--green); }
.sent-copy.warning { color: #9a6200; }
.empty { padding: 48px !important; color: var(--muted); text-align: center; }

.compose-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.compose-card, .review-card, .empty-card { padding: 23px; background: white; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(25, 40, 68, .035); }
.card-title { display: flex; gap: 11px; align-items: center; margin-bottom: 20px; }
.card-title h3 { margin: 0 0 3px; color: var(--navy); font-size: 18px; }
.card-title p { margin: 0; color: var(--muted); font-size: 12px; }
.channel-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; font-size: 18px; font-weight: 900; }
.channel-icon.email { color: #2852a7; background: #e9efff; }
.channel-icon.whatsapp { color: #087955; background: #e6f8ef; }
label { display: grid; gap: 6px; color: var(--ink); font-size: 12px; font-weight: 750; }
input, textarea, select { border: 1px solid var(--line); border-radius: 8px; outline: 0; color: var(--ink); background: #fff; }
input:focus, textarea:focus, select:focus { border-color: var(--cyan-dark); box-shadow: 0 0 0 3px rgba(50, 212, 203, .16); }
input, select { padding: 10px; }
textarea { width: 100%; padding: 11px; resize: vertical; line-height: 1.46; }
.compose-card > label:not(.switch) { margin-top: 14px; }
.switch { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; color: var(--ink); font-size: 13px; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: relative; width: 34px; height: 19px; background: #cad2df; border-radius: 20px; transition: .2s; }
.switch span::after { position: absolute; top: 3px; left: 3px; width: 13px; height: 13px; content: ""; background: white; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--cyan-dark); }
.switch input:checked + span::after { transform: translateX(15px); }
.mode-fieldset { margin: 8px 0 13px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.mode-fieldset legend { padding: 0 4px; color: var(--muted); font-size: 11px; font-weight: 800; }
.mode-fieldset label { display: flex; align-items: center; gap: 7px; margin: 8px 0; font-size: 12px; font-weight: 600; }
.notice { margin: 12px 0; padding: 10px 11px; border-left: 3px solid #efbd44; color: #695307; background: #fff9e9; border-radius: 0 7px 7px 0; font-size: 12px; line-height: 1.42; }
.notice.strong { font-weight: 700; }
code { padding: 1px 4px; border-radius: 4px; background: #edf1f7; color: #31405d; }
.review-card { display: flex; align-items: center; justify-content: space-between; gap: 26px; margin-top: 18px; background: linear-gradient(110deg, #f1fbfb, #fff); border-color: #c9e9e7; }
.review-card h2 { margin: 4px 0; color: var(--navy); font-size: 21px; }
.review-card p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 13px; }

.history-list { display: grid; gap: 9px; }
.history-item { display: grid; grid-template-columns: 38px 1fr auto; gap: 11px; align-items: center; padding: 13px; background: white; border: 1px solid var(--line); border-radius: 11px; }
.history-item strong, .history-item p, .history-item small { margin: 0; display: block; }
.history-item p { margin: 3px 0; color: var(--muted); font-size: 12px; }
.history-item small { max-width: 230px; color: var(--muted); font-size: 10px; }
.channel-dot { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 50%; font-size: 13px; }
.channel-dot.email { background: #e9efff; color: #2852a7; }
.channel-dot.whatsapp { background: #e6f8ef; color: #087955; }
.empty-card { color: var(--muted); text-align: center; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 22px; background: radial-gradient(circle at 80% 15%, #246670, transparent 34%), linear-gradient(130deg, #0c1629, #162d4b); }
.login-card { width: min(100%, 445px); padding: 38px; border: 1px solid rgba(255,255,255,.16); border-radius: 20px; background: rgba(255,255,255,.96); box-shadow: 0 24px 70px rgba(0,0,0,.28); }
.login-card .brand-mark { margin-bottom: 20px; }
.login-card h1 { margin: 6px 0 10px; font-size: 30px; letter-spacing: -.05em; }
.login-card > p:not(.eyebrow) { color: var(--muted); line-height: 1.5; }
.login-card form { display: grid; gap: 8px; margin-top: 23px; }
.form-error { min-height: 18px; margin: 10px 0 0; color: var(--red); font-size: 12px; }

.dialog { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 16px; box-shadow: 0 22px 75px rgba(8, 18, 35, .36); }
.dialog::backdrop { background: rgba(8, 18, 35, .68); backdrop-filter: blur(2px); }
.dialog form { padding: 25px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.dialog-heading h2 { margin: 4px 0 0; font-size: 23px; letter-spacing: -.04em; }
.icon-button { width: 30px; height: 30px; border: 0; border-radius: 8px; background: #eff2f6; color: var(--muted); font-size: 23px; line-height: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .check-label { align-self: end; padding: 5px 0; font-size: 12px; font-weight: 600; }
.optout-control { display: grid; gap: 9px; }
.optout-warning { padding: 13px; border: 1px solid #efb7bb; border-left: 5px solid var(--red); border-radius: 8px; background: #fff0f1; color: #7e242c; }
.optout-warning strong { display: block; font-size: 13px; }
.optout-warning p { margin: 6px 0 11px; font-size: 12px; line-height: 1.42; }
.reactivation-fields { display: grid; gap: 10px; padding: 14px; border: 1px solid #efcf85; border-radius: 8px; background: #fff9e9; }
.reactivation-fields p { margin: 0; color: #695307; font-size: 12px; line-height: 1.42; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.send-summary { max-height: 360px; overflow: auto; padding: 13px; background: #f6f8fb; border-radius: 9px; }
.send-summary p { margin: 0 0 9px; }
.send-summary ul { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.send-summary li { display: flex; justify-content: space-between; gap: 15px; padding-top: 7px; border-top: 1px solid var(--line); font-size: 12px; }
.send-summary li span { color: var(--muted); text-align: right; }

.toast { position: fixed; z-index: 5; right: 18px; bottom: 18px; max-width: min(470px, calc(100vw - 36px)); padding: 13px 16px; color: white; background: var(--navy); border-radius: 10px; box-shadow: 0 14px 35px rgba(10,22,45,.25); opacity: 0; transform: translateY(16px); pointer-events: none; transition: .2s ease; font-size: 13px; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast[data-kind="error"] { background: #9d353b; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .integration-status { justify-self: start; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .compose-layout { grid-template-columns: 1fr; }
  .direct-contact-card { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .topbar { padding: 0 18px; }
  .topbar-actions a { display: none; }
  .hero { padding: 40px 20px 54px; }
  .metrics { margin: -24px 20px 0; }
  .tabs { padding: 34px 20px 0; gap: 19px; }
  .tab-panel { padding: 25px 20px 50px; }
  .section-heading, .review-card { display: grid; }
  .section-actions, .draft-actions { width: 100%; }
  .draft-actions select { flex: 1; min-width: 0; }
  .filters { align-items: stretch; flex-direction: column; }
  .direct-contact-form { grid-template-columns: 1fr; }
  .direct-contact-form .direct-contact-confirm { grid-column: auto; }
  .selection-bar { align-items: flex-start; flex-wrap: wrap; }
  .selection-bar .button { margin-left: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .send-summary li { flex-direction: column; gap: 3px; }
  .send-summary li span { text-align: left; }
}
