* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  min-height: 100%;
}

body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  color: var(--color-black);
  font-family: var(--font-body);
  background: var(--color-neutral-50);
}

:root {
  --dv-side-space: clamp(1rem, 3vw, 2rem);
  --dv-max-width: 74rem;
  --dv-action-bar-bottom: 0px;
  --dv-action-bar-height: 5.9rem;
}

@supports (height: 100dvh) {
  html,
  body {
    min-height: 100dvh;
  }
}

:focus-visible {
  outline: 3px solid var(--color-brand-400);
  outline-offset: 3px;
}

.deputies-header,
.deputies-page {
  width: min(100% - var(--dv-side-space), var(--dv-max-width));
  margin: 0 auto;
}

.deputies-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 0;
}

.brand-link {
  flex: 1 1 auto;
  min-width: 0;
}

.deputies-page {
  padding: 1.25rem 0 3rem;
  display: grid;
  gap: 0.9rem;
}

.brand-link,
.button {
  text-decoration: none;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1.1;
}

.brand-link img {
  border: 2px solid var(--color-black);
  border-radius: 50%;
}

.deputies-hero {
  border: 2px solid var(--color-black);
  border-radius: 8px;
  padding: 1.2rem;
  background: linear-gradient(180deg, rgba(18, 19, 24, 0.92), rgba(18, 19, 24, 0.82)),
    url("../emails/assets/main-image.jpg") center / cover no-repeat;
  color: var(--color-white);
}

.section-kicker,
.source-pill {
  width: fit-content;
  border-radius: var(--radius-pill);
  border: 2px solid var(--color-brand-300);
  padding: 0.32rem 0.6rem;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 700;
  text-transform: uppercase;
}

.source-pill {
  margin-top: 0.7rem;
  display: inline-flex;
  background: rgba(212, 138, 249, 0.2);
  border-color: rgba(255, 255, 255, 0.65);
  color: rgba(255, 255, 255, 0.92);
}

.deputies-hero h1 {
  margin: 0.55rem 0;
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}

.deputies-hero p {
  margin: 0.35rem 0;
  max-width: 62ch;
  color: rgba(255, 255, 255, 0.88);
  overflow-wrap: break-word;
  word-break: break-word;
}

.server-hint {
  margin: 0;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--color-black);
  border-radius: 8px;
  background: #fff6de;
  font-size: 0.9rem;
  overflow-wrap: break-word;
  word-break: break-word;
}

.server-hint a {
  color: inherit;
  font-weight: 800;
}

.flow {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.flow-item {
  appearance: none;
  border: 2px solid var(--color-black);
  background: var(--color-white);
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  min-height: 2.2rem;
  padding: 0.48rem 0.85rem;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  gap: 0.35rem;
  width: 100%;
  justify-content: flex-start;
}

.flow-item > span:first-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  margin-right: 0.35rem;
  border: 2px solid var(--color-black);
  border-radius: 50%;
}

.flow-item__label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.flow-item.is-active {
  background: var(--color-brand-400);
}

.step-panel {
  border: 2px solid var(--color-black);
  border-radius: 12px;
  padding: 1rem;
  min-width: 0;
  background: var(--color-white);
  box-shadow: 3px 3px 0 var(--color-brand-200);
}

.step-panel[hidden] {
  display: none;
}

.step-panel__head h2 {
  margin: 0;
  text-transform: uppercase;
  font-family: var(--font-display);
}

.step-panel__head p {
  margin: 0.45rem 0 0.9rem;
  color: var(--color-neutral-700);
  overflow-wrap: break-word;
  line-height: 1.3;
}

.field-grid,
.filter-grid {
  display: grid;
  gap: 0.65rem;
}

.filter-summary {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: 1fr auto;
  align-items: end;
}

.field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.filter-grid {
  grid-template-columns: minmax(170px, 1.35fr) repeat(4, minmax(95px, 0.95fr));
  align-items: end;
  gap: 0.55rem;
}

label {
  display: grid;
  gap: 0.34rem;
  min-width: 0;
}

label span,
.muted {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 2.45rem;
  border: 1px solid var(--color-black);
  border-radius: 8px;
  padding: 0.52rem 0.65rem;
}

textarea {
  resize: vertical;
  min-height: 7rem;
}

.toggle {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.42rem;
  font-size: 0.72rem;
}

.toggle input {
  margin: 0;
  width: 1rem;
  height: 1rem;
}

.button {
  appearance: none;
  border: 2px solid var(--color-black);
  border-radius: var(--radius-pill);
  padding: 0.62rem 1rem;
  background: var(--color-white);
  color: var(--color-black);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
  min-height: 2.65rem;
  transition: transform 160ms ease, background-color 160ms ease;
}

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

.button-primary {
  background: var(--color-brand-400);
}

.button-dark {
  background: var(--color-black);
  color: var(--color-white);
}

.button-ghost {
  background: var(--color-white);
}

.button-provider {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.55rem;
  min-height: 2.9rem;
  padding-inline: 0.75rem;
}

.provider-icon {
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 0.65rem;
  border: 2px solid var(--color-black);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 1.65rem;
}

.provider-icon svg {
  width: 1rem;
  height: 1rem;
}

.provider-icon-gmail {
  background: #ea4335;
  color: var(--color-white);
}

.provider-icon-hotp {
  background: #0078d4;
  color: var(--color-white);
}

.provider-icon-yahoo {
  background: #5f01d1;
  color: var(--color-white);
}

.provider-icon-mailto {
  background: #111827;
  color: var(--color-white);
}

.provider-icon-whatsapp {
  background: #25d366;
  color: var(--color-white);
}

.button-provider:focus-visible {
  transform: translate(1px, 1px);
}

.provider-grid {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.share-panel {
  display: grid;
  gap: 0.45rem;
  margin-top: 1rem;
}

.share-panel__label {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--color-neutral-700);
}

.button-share-whatsapp {
  justify-content: flex-start;
  gap: 0.65rem;
  width: 100%;
  background: #eafbf4;
  border-color: #128c7e;
  color: #0f6f62;
}

.button-share-whatsapp:disabled {
  background: #f2f5f4;
  border-color: var(--color-border);
  color: var(--color-neutral-500);
}

.deputy-item.is-sent {
  background: linear-gradient(0deg, rgba(37, 211, 102, 0.07), rgba(37, 211, 102, 0.07)),
    var(--color-white);
}

.deputy-badge {
  display: inline-flex;
  width: fit-content;
  margin-top: 0.38rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid #128c7e;
  border-radius: 999px;
  background: #eafbf4;
  color: #0f6f62;
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1;
}

.deputy-badge[hidden] {
  display: none;
}

.manual-copy {
  border: 1px solid var(--color-black);
  border-radius: 8px;
  margin-top: 0.8rem;
  padding: 0.8rem;
  background: var(--color-white);
}

.step-panel[data-step="1"] [data-next-step] {
  margin-top: 0.8rem;
}

.manual-copy summary {
  cursor: pointer;
  font-weight: 900;
  margin-bottom: 0.55rem;
}

.recipients-wrap input,
.manual-copy textarea {
  font-size: 0.9rem;
}

.recipients-wrap input {
  width: 100%;
}

.filter-toggle {
  white-space: nowrap;
}

.filter-grid[data-collapsed="true"] {
  display: none;
}

.filter-grid:focus-within {
  display: grid;
}
.step-actions,
.selection-head,
.selection-actions,
.step3-copy {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  flex-wrap: wrap;
}

.step-actions {
  justify-content: flex-end;
}

.selection-actions,
.step3-copy {
  justify-content: flex-end;
}

.selection-head {
  justify-content: space-between;
  margin: 0.8rem 0 0.55rem;
  gap: 0.5rem;
}

.selection-head p {
  margin: 0;
  font-weight: 700;
  min-width: 0;
  overflow-wrap: break-word;
}

.selection-head strong {
  font-weight: 900;
}

.status {
  margin: 0.65rem 0;
  padding: 0.62rem;
  border: 1px solid var(--color-border-strong);
  background: var(--color-brand-100);
  font-weight: 800;
  overflow-wrap: break-word;
}

.error {
  margin: 0.6rem 0 0;
  color: #a11;
  font-weight: 700;
}

.deputy-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
  max-height: 58vh;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--color-black);
  border-radius: 8px;
  background: var(--color-white);
}

.deputy-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 0.65rem;
  min-width: 0;
  border-bottom: 1px solid var(--color-border);
}

.deputy-item:last-child {
  border-bottom: 0;
}

.deputy-item__check {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 0.55rem;
  min-width: 0;
  max-width: 100%;
  align-items: center;
}

.deputy-item__check > div {
  min-width: 0;
  max-width: 100%;
}

.deputy-avatar {
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--color-border);
  background: var(--color-neutral-100);
}

.deputy-avatar.is-empty {
  display: none;
}

.deputy-item h3 {
  margin: 0;
  font-size: 1rem;
  text-transform: uppercase;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.deputy-item p {
  margin: 0.24rem 0 0;
  color: var(--color-neutral-700);
  font-size: 0.76rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.deputy-item.no-email {
  opacity: 0.52;
}

.recipients-wrap {
  display: block;
  margin-top: 0.8rem;
}

.recipients-wrap span {
  display: inline-block;
  margin-bottom: 0.4rem;
}

.foot-note {
  color: var(--color-neutral-700);
  font-size: 0.82rem;
  font-weight: 700;
}

.recipients-wrap textarea {
  width: 100%;
}

.source-pill,
.section-kicker {
  max-width: 100%;
}

.step-panel[data-step="2"] {
  padding-bottom: var(--dv-action-bar-height);
}

@media (max-width: 1024px) {
  :root {
    --dv-side-space: clamp(1rem, 2.5vw, 1.5rem);
  }

  .filter-grid {
    grid-template-columns: minmax(150px, 1fr) repeat(2, minmax(95px, 0.95fr));
    gap: 0.5rem;
  }

  .provider-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .deputies-header,
  .deputies-page {
    width: min(100% - 0.85rem, var(--dv-max-width));
    --dv-side-space: 0.85rem;
    gap: 0.8rem;
  }

  .brand-link {
    width: 100%;
    font-size: 0.84rem;
  }

  .deputies-hero {
    padding: 1rem;
    border-radius: 12px;
  }

  .deputies-hero h1 {
    font-size: clamp(1.6rem, 8vw, 2.3rem);
  }

  .deputies-hero p {
    max-width: 100%;
  }

  .filter-summary,
  .selection-head,
  .step-actions,
  .selection-actions,
  .step3-copy {
    grid-template-columns: 1fr;
    display: grid;
  }

  .step-panel[data-step="1"] [data-next-step] {
    width: 100%;
  }

  .flow {
    gap: 0.45rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .flow-item {
    width: 100%;
    text-align: left;
    min-height: 2.7rem;
    font-size: 0.84rem;
    overflow: hidden;
  }

  .flow-item > span:first-child {
    width: 1.25rem;
    height: 1.25rem;
  }

  .flow-item__label {
    display: none;
  }

  .flow-item::after {
    content: attr(data-step-short);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }

  .step-actions {
    justify-content: stretch;
  }

  .step-actions-selection {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--dv-action-bar-bottom);
    z-index: 1000;
    display: grid;
    grid-template-columns: 0.7fr 1.3fr;
    gap: 0.55rem;
    padding: 0.7rem max(0.85rem, env(safe-area-inset-left))
      calc(0.7rem + env(safe-area-inset-bottom))
      max(0.85rem, env(safe-area-inset-right));
    border-top: 2px solid var(--color-black);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -4px 0 rgba(212, 138, 249, 0.28);
  }

  .step-actions-selection .button {
    min-height: 3rem;
    width: 100%;
  }

  .step-actions .button,
  .step3-copy .button {
    width: 100%;
    min-height: 2.9rem;
  }

  .button,
  input,
  select,
  textarea {
    min-height: 2.55rem;
    border-radius: 12px;
  }

  .step-panel {
    padding: 0.9rem;
    border-radius: 12px;
  }

  .step-panel[data-step="2"] {
    padding-bottom: calc(var(--dv-action-bar-height) + var(--dv-action-bar-bottom));
  }

  .step-actions .button,
  .step3-copy .button {
    width: 100%;
  }

  .field-grid,
  .filter-grid {
    grid-template-columns: 1fr;
  }

  .deputy-item {
    gap: 0.45rem;
    padding: 0.55rem 0.62rem;
  }

  .deputy-item__check {
    width: 100%;
    gap: 0.52rem;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: start;
  }

  .deputy-avatar {
    width: 2.2rem;
    height: 2.2rem;
  }

  .deputy-item h3 {
    font-size: 0.94rem;
  }

  .deputy-item p {
    font-size: 0.72rem;
    line-height: 1.25;
  }

  .deputy-item__check input {
    width: 1.15rem;
    height: 1.15rem;
  }

  .filter-summary {
    grid-template-columns: 1fr;
    gap: 0.48rem;
    margin-top: 0.05rem;
  }

  .filter-toggle {
    width: 100%;
    min-height: 2.6rem;
    padding-inline: 0.9rem;
  }

  .filter-grid[data-collapsed="true"] {
    display: none;
  }

  .filter-grid {
    grid-template-columns: 1fr;
    margin-top: 0.4rem;
    gap: 0.45rem;
  }

  .filter-grid label span,
  .manual-copy summary {
    font-size: 0.7rem;
  }

  .selection-head {
    display: grid;
    gap: 0.45rem;
    margin-top: 0.45rem;
    margin-bottom: 0.32rem;
  }

  .selection-head p {
    font-size: 0.86rem;
  }

  .selection-actions .button,
  .step3-copy .button {
    width: 100%;
  }

  .provider-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .provider-grid .button-provider {
    min-height: 3rem;
  }

  .provider-icon {
    width: 1.8rem;
    height: 1.8rem;
    flex: 0 0 1.8rem;
    border-radius: 0.65rem;
  }

  .provider-icon svg {
    width: 1.1rem;
    height: 1.1rem;
  }

  .manual-copy textarea,
  .recipients-wrap textarea {
    min-height: 9rem;
  }
}

@media (min-width: 761px) {
  .filter-toggle {
    display: none;
  }

  .step-actions-selection {
    position: fixed;
    left: 50%;
    bottom: calc(1rem + var(--dv-action-bar-bottom));
    z-index: 1000;
    display: grid;
    width: min(calc(100% - 1.5rem), var(--dv-max-width));
    grid-template-columns: 0.7fr 1.3fr;
    gap: 0.55rem;
    padding: 0.85rem;
    border-top: 2px solid var(--color-black);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -4px 0 rgba(212, 138, 249, 0.28);
    transform: translateX(-50%);
  }

  .step-actions-selection .button {
    min-height: 3rem;
  }

  .step-panel[data-step="2"] {
    padding-bottom: calc(6.75rem + var(--dv-action-bar-bottom));
  }
}

@media (max-width: 520px) {
  .deputy-item__check {
    gap: 0.4rem;
  }

  .deputy-item__check input {
    width: 1.1rem;
    height: 1.1rem;
  }

  .flow {
    font-size: 0.8rem;
  }

  .step-panel__head h2 {
    font-size: 1.05rem;
  }
}
