:root {
  --black: #090909;
  --muted: #707070;
  --line: #dedede;
  --soft: #f6f6f6;
  --white: #fff;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  min-width: 0;
  width: 100%;
  overflow-x: hidden;
  font-family: Inter, Arial, sans-serif;
  color: var(--black);
  background: #fff;
}

body {
  margin: 0;
  min-width: 0;
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
}

button, input, textarea, select {
  font: inherit;
}

.topbar {
  width: 100%;
  min-width: 0;
  height: 72px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 max(24px, calc((100vw - 1120px) / 2));
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  min-width: 0;
  font-weight: 800;
  letter-spacing: -1px;
  font-size: 20px;
  color: #000;
  text-decoration: none;
}

.brand span {
  font-weight: 400;
}

.live {
  min-width: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

.live i {
  display: block;
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  background: #111;
  border-radius: 50%;
  box-shadow: 0 0 0 4px #e9e9e9;
}

.shell {
  width: min(1120px, calc(100% - 40px));
  max-width: 1120px;
  min-width: 0;
  margin: 0 auto;
  padding: 72px 0 90px;
}

.hero,
.inbox-section,
.address-card,
.inbox-panel,
.message-list {
  min-width: 0;
  max-width: 100%;
}

.hero {
  max-width: 820px;
  margin: 0 auto 76px;
  text-align: center;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  margin: 0 0 12px;
  color: #555;
}

.hero h1 {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: clamp(36px, 7vw, 68px);
  line-height: 1;
  letter-spacing: -.055em;
  margin: 0;
}

.subtitle {
  max-width: 620px;
  margin: 22px auto 34px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.address-card {
  width: 100%;
  border: 2px solid #111;
  text-align: left;
  background: #fff;
  box-shadow: 8px 8px 0 #111;
}

.address-line {
  min-width: 0;
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid #bdbdbd;
  gap: 18px;
}

.address-line span {
  min-width: 0;
  max-width: 100%;
  font-size: clamp(17px, 3vw, 27px);
  font-weight: 600;
  letter-spacing: -.03em;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.icon-button,
.refresh-button,
.text-button,
.dark-button,
.danger-button {
  cursor: pointer;
  border: 0;
  background: transparent;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}

.icon-button {
  flex: 0 0 auto;
  border: 1px solid #111;
  padding: 11px 15px;
  white-space: nowrap;
}

.address-footer {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  font-size: 13px;
}

.actions {
  min-width: 0;
  display: flex;
  gap: 10px;
}

.text-button {
  padding: 12px 14px;
  border: 1px solid #111;
}

.dark-button {
  padding: 12px 16px;
  background: #111;
  color: #fff;
  border: 1px solid #111;
}

.section-heading {
  min-width: 0;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.section-heading > div {
  min-width: 0;
}

.section-heading h2 {
  max-width: 100%;
  margin: 0;
  font-size: 28px;
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
}

.refresh-button {
  flex: 0 0 auto;
  border-bottom: 1px solid #111;
  padding: 8px 0;
  white-space: nowrap;
}

.inbox-panel {
  width: 100%;
  overflow: hidden;
  border-top: 2px solid #111;
  min-height: 310px;
}

.empty-state {
  max-width: 100%;
  text-align: center;
  padding: 72px 20px;
  color: var(--muted);
}

.empty-state h3 {
  margin: 18px 0 8px;
  color: #111;
}

.empty-state p {
  margin: 0;
}

.mail-icon {
  margin: auto;
  width: 54px;
  height: 54px;
  border: 2px solid #111;
  display: grid;
  place-items: center;
  color: #111;
  font-size: 24px;
  font-weight: 700;
}

.message-list {
  display: none;
  width: 100%;
  overflow: hidden;
}

.message-item {
  appearance: none;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 20px 8px;
  text-align: left;
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(0, 1fr) minmax(150px, max-content);
  gap: 24px;
  align-items: center;
  cursor: pointer;
  font: inherit;
}

.message-item:hover {
  background: var(--soft);
}

.message-item.unread .msg-subject {
  font-weight: 800;
}

.msg-from,
.msg-content,
.msg-subject,
.msg-preview,
.msg-date {
  min-width: 0;
  max-width: 100%;
}

.msg-from {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-content {
  overflow: hidden;
}

.msg-subject {
  margin-bottom: 5px;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-preview {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-date {
  justify-self: end;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Modal responsivo: nunca ultrapassa o viewport e não cria rolagem horizontal na página. */
dialog {
  width: min(960px, calc(100vw - 32px));
  max-width: 960px;
  max-height: min(92dvh, 900px);
  margin: auto;
  border: 2px solid #111;
  padding: 0;
  overflow: hidden;
  box-shadow: 10px 10px 0 #111;
  background: #fff;
}

dialog[open] {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

dialog::backdrop {
  background: rgba(0, 0, 0, .48);
}

.dialog-head {
  flex: 0 0 auto;
  min-width: 0;
  padding: 25px 28px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.dialog-head > div {
  min-width: 0;
  max-width: calc(100% - 48px);
}

.dialog-head h2 {
  max-width: 100%;
  margin: 6px 0;
  font-size: 25px;
  letter-spacing: -.03em;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.dialog-from,
.dialog-date {
  max-width: 100%;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.close-button {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 0;
  background: #fff;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
}

.message-body-wrap {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  overflow: auto;
  background: #fff;
  border-bottom: 1px solid var(--line);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.message-html-host,
.message-text-body {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  background: #fff;
}

.message-html-host {
  display: none;
  overflow: hidden;
}

.message-html-host[style*="display: block"] {
  min-height: 72px;
}

.message-text-body {
  display: none;
  padding: 26px 28px;
  border: 0;
  font: 14px/1.65 Inter, Arial, sans-serif;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.attachments {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  max-height: 28dvh;
  overflow: auto;
  padding: 22px 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
  -webkit-overflow-scrolling: touch;
}

.attachment-preview {
  flex: 1 1 100%;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0 0 8px;
  border: 1px solid var(--line);
  padding: 12px;
  background: #fff;
  overflow: hidden;
}

.attachment-preview img {
  display: block;
  max-width: 100%;
  max-height: 520px;
  width: auto;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.attachment-preview figcaption {
  max-width: 100%;
  margin-top: 9px;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.attachment-button {
  max-width: 100%;
  min-width: 0;
  border: 1px solid #111;
  background: #fff;
  padding: 10px 12px;
  font: 600 11px Inter, Arial, sans-serif;
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: left;
}

.dialog-actions {
  flex: 0 0 auto;
  min-width: 0;
  padding: 18px 28px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
}

.danger-button {
  max-width: 100%;
  border: 1px solid #111;
  padding: 11px 14px;
  white-space: normal;
}

.toast {
  max-width: calc(100vw - 28px);
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 1000;
  transform: translate(-50%, 20px);
  background: #111;
  color: #fff;
  padding: 12px 18px;
  font-size: 12px;
  text-align: center;
  overflow-wrap: anywhere;
  opacity: 0;
  pointer-events: none;
  transition: .2s;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

@media (max-width: 900px) {
  .message-item {
    grid-template-columns: minmax(120px, 180px) minmax(0, 1fr) minmax(125px, max-content);
    gap: 16px;
  }
}

@media (max-width: 700px) {
  .topbar {
    height: 64px;
    padding: 0 18px;
  }

  .brand {
    font-size: 18px;
  }

  .live {
    font-size: 9px;
    letter-spacing: .05em;
  }

  .shell {
    width: calc(100% - 28px);
    padding: 44px 0 64px;
  }

  .hero {
    margin-bottom: 56px;
  }

  .hero h1 {
    font-size: clamp(36px, 13vw, 54px);
  }

  .subtitle {
    font-size: 14px;
  }

  .address-line {
    align-items: stretch;
    flex-direction: column;
    padding: 18px;
  }

  .icon-button {
    width: 100%;
  }

  .address-footer {
    align-items: stretch;
    flex-direction: column;
    padding: 16px 18px;
  }

  .actions {
    width: 100%;
  }

  .actions button {
    flex: 1 1 0;
    min-width: 0;
  }

  .section-heading {
    align-items: flex-start;
    gap: 14px;
  }

  .section-heading h2 {
    font-size: 23px;
  }

  .message-item {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px;
    padding: 18px 4px;
  }

  .msg-from {
    grid-column: 1;
    grid-row: 1;
  }

  .msg-date {
    grid-column: 2;
    grid-row: 1;
    max-width: 44vw;
    justify-self: end;
  }

  .msg-content {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  dialog {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: 96dvh;
    box-shadow: 5px 5px 0 #111;
  }

  .dialog-head {
    padding: 18px 18px 16px;
    gap: 10px;
  }

  .dialog-head > div {
    max-width: calc(100% - 42px);
  }

  .dialog-head h2 {
    font-size: 21px;
  }

  .close-button {
    width: 34px;
    height: 34px;
    font-size: 29px;
  }

  .message-text-body {
    padding: 18px;
  }

  .attachments {
    max-height: 31dvh;
    padding: 16px 18px;
  }

  .attachment-button {
    width: 100%;
  }

  .dialog-actions {
    padding: 14px 18px;
  }

  .danger-button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .topbar {
    padding: 0 14px;
  }

  .live {
    max-width: 48%;
    white-space: normal;
    text-align: right;
    line-height: 1.25;
  }

  .shell {
    width: calc(100% - 20px);
  }

  .address-card {
    box-shadow: 5px 5px 0 #111;
  }

  .actions {
    flex-direction: column;
  }

  .section-heading {
    flex-direction: column;
  }

  .refresh-button {
    align-self: flex-start;
  }

  .message-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }

  .msg-from,
  .msg-date,
  .msg-content {
    grid-column: 1;
    grid-row: auto;
    justify-self: stretch;
    max-width: 100%;
  }

  .msg-date {
    font-size: 10px;
  }

  dialog {
    width: calc(100vw - 10px);
    max-width: calc(100vw - 10px);
    max-height: 98dvh;
    border-width: 1px;
    box-shadow: 3px 3px 0 #111;
  }

  .dialog-head {
    padding: 15px 14px 13px;
  }

  .message-text-body {
    padding: 15px 14px;
  }

  .attachments {
    padding: 14px;
  }

  .dialog-actions {
    padding: 12px 14px;
  }
}


/* =========================================================
   CONTAS, FAVORITOS E DASHBOARD — v17
   ========================================================= */
.topbar-actions,
.account-nav,
.address-tools,
.saved-actions,
.confirm-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.account-button,
.account-nav button,
.account-nav a,
.link-button,
.outline-danger,
.dark-link-button {
  border: 0;
  background: transparent;
  color: #111;
  font: 800 11px/1 Inter, Arial, sans-serif;
  letter-spacing: .08em;
  text-decoration: none;
  cursor: pointer;
}

.account-button,
.account-nav button,
.account-nav a {
  border-bottom: 1px solid #111;
  padding: 8px 0;
  white-space: nowrap;
}

.address-tools { flex: 0 0 auto; }
.favorite-button {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid #111;
  cursor: pointer;
  transition: background .15s, color .15s, transform .15s;
}
.favorite-button:hover,
.favorite-button.working { background: #111; color: #fff; }
.favorite-button:active { transform: translateY(1px); }
.favorite-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.auth-dialog {
  width: min(520px, calc(100vw - 28px));
  max-width: 520px;
  max-height: min(92dvh, 780px);
}
.auth-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 26px 18px;
  border-bottom: 1px solid var(--line);
}
.auth-dialog-head h2 { margin: 4px 0 0; font-size: 28px; letter-spacing: -.04em; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.auth-tabs button { height: 48px; border: 0; background: #fff; font: 800 11px Inter; letter-spacing: .08em; cursor: pointer; }
.auth-tabs button + button { border-left: 1px solid var(--line); }
.auth-tabs button.active { background: #111; color: #fff; }
.auth-dialog-body { min-height: 0; overflow: auto; padding: 24px 26px 28px; }
.auth-form { display: grid; gap: 16px; }
.auth-form[hidden] { display: none; }
.auth-form label,
.settings-card label { display: grid; gap: 7px; font-size: 12px; font-weight: 700; }
.auth-form input,
.settings-card input {
  width: 100%; min-width: 0; height: 46px; border: 1px solid #999; background: #fff; padding: 0 12px; color: #111;
}
.auth-submit { width: 100%; margin-top: 4px; }
.link-button { justify-self: center; border-bottom: 1px solid #111; padding: 6px 0; }
.form-help { margin: -4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.form-alert { padding: 12px 14px; border: 1px solid #b00020; background: #fff4f5; color: #8f0017; font-size: 12px; line-height: 1.5; margin-bottom: 16px; }
.form-alert.success { border-color: #111; background: #f3fff5; color: #111; }
.pending-auth-note { display: grid; gap: 4px; padding: 12px 14px; margin-bottom: 18px; border: 1px solid #111; background: var(--soft); font-size: 12px; overflow-wrap: anywhere; }
.pending-auth-note span { color: var(--muted); }

.status-page { width: min(680px, calc(100% - 28px)); min-height: calc(100vh - 72px); margin: 0 auto; display: grid; place-items: center; padding: 40px 0; }
.status-card { width: 100%; border: 2px solid #111; box-shadow: 8px 8px #111; padding: 34px; }
.status-card h1 { font-size: clamp(34px, 7vw, 54px); line-height: 1; letter-spacing: -.05em; margin: 0 0 18px; }
.status-card > p:not(.eyebrow) { color: var(--muted); line-height: 1.65; margin: 0 0 24px; }
.dark-link-button { display: inline-block; background: #111; color: #fff; padding: 14px 18px; }

.dashboard-topbar { position: relative; }
.dashboard-shell { width: min(1280px, calc(100% - 40px)); margin: 0 auto; padding: 58px 0 90px; }
.dashboard-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; padding-bottom: 34px; border-bottom: 2px solid #111; }
.dashboard-hero h1 { margin: 0; font-size: clamp(38px, 7vw, 64px); letter-spacing: -.055em; line-height: 1; }
.dashboard-hero > div > p:last-child { margin: 14px 0 0; color: var(--muted); }
.limit-card { flex: 0 0 auto; min-width: 190px; border: 2px solid #111; box-shadow: 6px 6px #111; padding: 18px; display: grid; gap: 5px; text-align: right; }
.limit-card strong { font-size: 26px; }
.limit-card span { font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.pending-banner { margin: 28px 0 0; padding: 16px 18px; border: 1px solid #111; display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.pending-banner[hidden] { display: none; }
.pending-banner > div { min-width: 0; display: grid; gap: 5px; }
.pending-banner span { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.dashboard-grid { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 42px; padding: 54px 0; }
.saved-sidebar,
.saved-content { min-width: 0; }
.dashboard-section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 17px; }
.dashboard-section-head h2 { margin: 0; font-size: 25px; letter-spacing: -.04em; overflow-wrap: anywhere; }
.saved-inbox-list { display: grid; border-top: 2px solid #111; }
.saved-inbox-item { appearance: none; width: 100%; min-width: 0; text-align: left; background: #fff; border: 0; border-bottom: 1px solid var(--line); padding: 17px 12px; display: grid; gap: 6px; cursor: pointer; }
.saved-inbox-item:hover,
.saved-inbox-item.active { background: #111; color: #fff; }
.saved-inbox-item strong { font-size: 13px; overflow-wrap: anywhere; }
.saved-inbox-item span,
.saved-inbox-item small { font-size: 11px; color: var(--muted); }
.saved-inbox-item.active span,
.saved-inbox-item.active small,
.saved-inbox-item:hover span,
.saved-inbox-item:hover small { color: #d7d7d7; }
.dashboard-empty { border-top: 2px solid #111; padding: 26px 4px; color: var(--muted); font-size: 13px; }
.dashboard-empty[hidden] { display: none; }
.dashboard-empty a { color: #111; font-weight: 700; }
.selected-head { min-height: 53px; }
.outline-danger { border: 1px solid #111; padding: 11px 13px; }
.dashboard-inbox-panel { min-height: 430px; }
.account-settings { padding-top: 48px; border-top: 2px solid #111; }
.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.settings-card { min-width: 0; border: 1px solid #111; padding: 24px; display: flex; flex-direction: column; gap: 15px; }
.settings-card h3 { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.settings-card > p { margin: 0; min-height: 42px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.settings-card button { margin-top: auto; }
.confirm-dialog { width: min(520px, calc(100vw - 28px)); max-width: 520px; }
.confirm-content { padding: 28px; }
.confirm-content h2 { margin: 0 0 14px; font-size: 28px; letter-spacing: -.04em; }
.confirm-content p:not(.eyebrow) { color: var(--muted); line-height: 1.6; }
.confirm-content > strong { display: block; margin: 18px 0; overflow-wrap: anywhere; }
.confirm-actions { justify-content: flex-end; margin-top: 24px; }

@media (max-width: 960px) {
  .settings-grid { grid-template-columns: 1fr; }
  .settings-card > p { min-height: 0; }
  .dashboard-grid { grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); gap: 28px; }
}

@media (max-width: 760px) {
  .topbar-actions { gap: 10px; }
  .topbar-actions .live { display: none; }
  .address-tools { width: 100%; }
  .favorite-button { flex: 0 0 48px; height: 46px; }
  .address-tools .icon-button { flex: 1 1 auto; width: auto; }
  .dashboard-shell { width: calc(100% - 28px); padding-top: 38px; }
  .dashboard-hero { align-items: stretch; flex-direction: column; }
  .limit-card { width: 100%; text-align: left; }
  .pending-banner { align-items: stretch; flex-direction: column; }
  .pending-banner button { width: 100%; }
  .dashboard-grid { grid-template-columns: 1fr; padding-top: 38px; }
  .saved-inbox-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
  .selected-head { align-items: flex-start; flex-direction: column; }
  .saved-actions { width: 100%; }
  .saved-actions button { flex: 1 1 0; min-width: 0; }
}

@media (max-width: 520px) {
  .topbar { gap: 10px; }
  .account-nav { gap: 9px; }
  .account-nav a,
  .account-nav button,
  .account-button { font-size: 9px; }
  .auth-dialog { width: calc(100vw - 12px); max-height: 97dvh; }
  .auth-dialog-head,
  .auth-dialog-body { padding-left: 17px; padding-right: 17px; }
  .auth-dialog-head h2 { font-size: 23px; }
  .saved-inbox-list { grid-template-columns: 1fr; }
  .saved-actions { flex-direction: column; align-items: stretch; }
  .confirm-actions { flex-direction: column-reverse; align-items: stretch; }
  .confirm-actions button { width: 100%; }
  .status-card { padding: 24px 20px; box-shadow: 5px 5px #111; }
}
