:root {
  color-scheme: light;
  --black: #000000;
  --blue: #2453ff;
  --blue-dark: #1738b8;
  --violet: #97a4ff;
  --iceberg: #e9fffc;
  --white: #ffffff;
  --ink: #121827;
  --muted: #5d6576;
  --line: #dde2eb;
  --surface: #f7f8fb;
  --danger: #a61b2b;
  --danger-soft: #fff0f1;
  --warning: #8a5200;
  --warning-soft: #fff7e3;
  --success: #08715c;
  --success-soft: #e8faf4;
  --shadow: 0 14px 35px rgb(27 35 58 / 8%);
  font-family: "Century Gothic", "Avenir Next", Avenir, Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--surface);
}

body {
  min-width: 20rem;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% -10%, rgb(151 164 255 / 24%), transparent 26rem),
    var(--surface);
  font-size: 0.95rem;
  line-height: 1.5;
}

a {
  color: var(--blue-dark);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--blue);
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.65rem 0.8rem;
  color: var(--white);
  background: var(--black);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-header {
  border-bottom: 1px solid rgb(221 226 235 / 80%);
  background: rgb(255 255 255 / 92%);
  backdrop-filter: blur(12px);
}

.app-header__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  width: min(92rem, calc(100% - 3rem));
  min-height: 5rem;
  margin: 0 auto;
  gap: 2rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--black);
  text-decoration: none;
}

.brand:hover {
  color: var(--black);
}

.brand__mark {
  display: grid;
  width: 2.55rem;
  height: 2.55rem;
  place-items: center;
  border-radius: 0.65rem;
  color: var(--white);
  background: var(--black);
  font-size: 1.25rem;
  font-weight: 800;
}

.brand strong,
.brand small,
.identity strong,
.identity small {
  display: block;
}

.brand strong {
  line-height: 1.15;
}

.brand small {
  margin-top: 0.16rem;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.main-nav a {
  padding: 0.55rem 0.75rem;
  border-radius: 0.55rem;
  color: #394153;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
}

.main-nav a:hover {
  background: var(--surface);
}

.main-nav a[aria-current="page"] {
  color: var(--blue-dark);
  background: #edf0ff;
}

.identity {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  max-width: 16rem;
}

.identity__logout {
  margin-left: 0.35rem;
}

.identity__logout button {
  padding: 0.38rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  color: var(--muted);
  background: var(--white);
  font: inherit;
  font-size: 0.7rem;
  cursor: pointer;
}

.identity__logout button:hover {
  color: var(--danger);
  border-color: #efb4bb;
}

.identity__dot {
  width: 0.55rem;
  height: 0.55rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #17a37f;
  box-shadow: 0 0 0 0.22rem var(--success-soft);
}

.identity strong,
.identity small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity strong {
  font-size: 0.82rem;
}

.identity small {
  color: var(--muted);
  font-size: 0.66rem;
}

.environment-banner {
  padding: 0.38rem 1rem;
  color: #075649;
  background: var(--iceberg);
  border-bottom: 1px solid #ccece7;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
}

.page-shell {
  width: min(92rem, calc(100% - 3rem));
  min-height: calc(100vh - 10rem);
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.auth-card {
  width: min(30rem, 100%);
  margin: 2rem auto;
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--white);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin-bottom: 0.5rem;
}

.auth-card__intro,
.auth-card__help {
  color: var(--muted);
}

.auth-form {
  display: grid;
  margin: 1.5rem 0;
  gap: 1rem;
}

.form-field {
  display: grid;
  gap: 0.35rem;
}

.form-field label {
  font-size: 0.8rem;
  font-weight: 800;
}

.form-field input {
  width: 100%;
  padding: 0.7rem 0.75rem;
  border: 1px solid #aeb6c6;
  border-radius: 0.5rem;
  color: var(--ink);
  background: var(--white);
  font: inherit;
}

.form-field input:focus {
  border-color: var(--blue);
  outline: 0.15rem solid rgb(36 83 255 / 18%);
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.78rem;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 2rem;
}

.eyebrow {
  margin: 0 0 0.3rem;
  color: var(--blue-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.45rem;
  color: var(--black);
  font-size: clamp(1.75rem, 3vw, 2.55rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
}

h2 {
  margin-bottom: 1rem;
  color: var(--black);
  font-size: 1.16rem;
  letter-spacing: -0.02em;
}

h3 {
  margin-bottom: 0.45rem;
  font-size: 0.98rem;
}

.lede,
.muted {
  color: var(--muted);
}

.lede {
  max-width: 50rem;
  margin-bottom: 0;
  font-size: 1rem;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 1.3rem;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.breadcrumbs a {
  color: var(--muted);
}

.breadcrumbs > * {
  overflow-wrap: anywhere;
}

.campaign-tabs {
  display: flex;
  overflow-x: auto;
  margin: -0.35rem 0 1.5rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--white);
  gap: 0.2rem;
}

.campaign-tabs a {
  flex: 0 0 auto;
  padding: 0.58rem 0.75rem;
  border-radius: 0.52rem;
  color: #455064;
  font-size: 0.76rem;
  font-weight: 800;
  text-decoration: none;
}

.campaign-tabs a:hover {
  background: var(--surface);
}

.campaign-tabs a[aria-current="page"] {
  color: var(--blue-dark);
  background: #edf0ff;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 1.5rem;
  gap: 0.8rem;
}

.metrics--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
  min-height: 7.2rem;
  padding: 1rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: var(--white);
  box-shadow: 0 5px 18px rgb(27 35 58 / 4%);
}

.metric-card__label {
  display: block;
  min-height: 2.2rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.metric-card__value {
  display: block;
  margin-top: 0.35rem;
  color: var(--black);
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1;
}

.metric-card__value--small {
  font-size: 1.15rem;
  line-height: 1.25;
}

.metric-card__detail {
  display: block;
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.7rem;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(18rem, 1fr);
  align-items: start;
  gap: 1rem;
}

.layout-grid > *,
.stack,
.panel {
  min-width: 0;
}

.stack {
  display: grid;
  gap: 1rem;
}

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

.panel {
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--white);
  box-shadow: var(--shadow);
}

.panel--flat {
  box-shadow: none;
}

.panel--ice {
  border-color: #ccece7;
  background: var(--iceberg);
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
  gap: 1rem;
}

.panel__header h2,
.panel__header p {
  margin-bottom: 0;
}

.notice {
  padding: 0.85rem 1rem;
  border: 1px solid #d7ddff;
  border-left: 0.25rem solid var(--blue);
  border-radius: 0.5rem;
  background: #f2f4ff;
  color: #293760;
  font-size: 0.82rem;
}

.notice--warning {
  border-color: #f0ddb0;
  border-left-color: #d08100;
  background: var(--warning-soft);
  color: #6f4300;
}

.notice--success {
  border-color: #b9e6d9;
  border-left-color: var(--success);
  background: var(--success-soft);
  color: #075649;
}

.notice--error {
  border-color: #efc7cc;
  border-left-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.flash-stack {
  display: grid;
  margin-bottom: 1rem;
  gap: 0.6rem;
}

.flash-stack .notice {
  margin: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.45rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--blue);
  border-radius: 0.55rem;
  color: var(--white);
  background: var(--blue);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

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

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

.button--secondary:hover {
  color: var(--blue-dark);
  background: #f1f3ff;
}

.button--danger {
  border-color: var(--danger);
  background: var(--danger);
}

.button--danger:hover {
  background: #7d1421;
}

.suspension-panel {
  margin: -0.5rem 0 1.5rem;
  padding: 0.85rem 1rem;
  border: 1px solid #efc7cc;
  border-radius: 0.75rem;
  background: var(--danger-soft);
}

.suspension-panel summary {
  color: var(--danger);
  font-weight: 800;
  cursor: pointer;
}

.suspension-panel p {
  max-width: 60rem;
  margin: 0.8rem 0;
  color: #6d2730;
  font-size: 0.8rem;
}

.suspension-form {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) minmax(18rem, 2fr) auto;
  align-items: end;
  gap: 0.75rem;
}

.text-link {
  font-size: 0.8rem;
  font-weight: 800;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 1.7rem;
  padding: 0.22rem 0.52rem;
  border-radius: 999px;
  color: #374054;
  background: #edf0f4;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
}

.status--success,
.status--pass,
.status--eligible,
.status--approved_company,
.status--contact_ready,
.status--qualified,
.status--assigned_to_chf,
.status--succeeded,
.status--automated_pass,
.status--available {
  color: var(--success);
  background: var(--success-soft);
}

.status--danger,
.status--fail,
.status--excluded,
.status--failed,
.status--do_not_contact {
  color: var(--danger);
  background: var(--danger-soft);
}

.status--warning,
.status--to_review,
.status--needs_review,
.status--pending,
.status--pending_human,
.status--pending_external,
.status--suspended,
.status--not_recorded {
  color: var(--warning);
  background: var(--warning-soft);
}

.filters {
  display: grid;
  grid-template-columns: minmax(12rem, 2fr) repeat(2, minmax(10rem, 1fr)) auto;
  align-items: end;
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: #fafbfc;
  gap: 0.75rem;
}

.field label {
  display: block;
  margin-bottom: 0.28rem;
  color: #3d4658;
  font-size: 0.7rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 2.45rem;
  padding: 0.48rem 0.62rem;
  border: 1px solid #cfd5df;
  border-radius: 0.48rem;
  color: var(--ink);
  background: var(--white);
  font: inherit;
  font-size: 0.82rem;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 0.18rem solid rgb(36 83 255 / 30%);
  outline-offset: 0.12rem;
}

textarea {
  resize: vertical;
}

.decision-actions {
  display: grid;
  gap: 0.75rem;
}

.action-form {
  display: grid;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  gap: 0.55rem;
}

.action-form:first-child {
  padding-top: 0;
  border-top: 0;
}

.action-form label {
  color: #3d4658;
  font-size: 0.7rem;
  font-weight: 800;
}

.action-form--danger {
  border-top-color: #efc7cc;
}

.account-form-panel {
  max-width: 48rem;
}

.account-form {
  display: grid;
  gap: 1rem;
}

.account-form .field-help {
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.account-form .field-help ul {
  margin: 0.35rem 0 0;
  padding-left: 1.15rem;
}

.account-form .field--roles > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0.35rem;
  gap: 0.45rem;
}

.account-form .field--roles label,
.checkbox-label {
  display: flex;
  align-items: center;
  margin: 0;
  gap: 0.45rem;
  font-size: 0.76rem;
  font-weight: 700;
}

.account-form input[type="checkbox"] {
  width: 1rem;
  min-height: 1rem;
}

.form-actions,
.role-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 0.72rem;
  background: var(--white);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

th,
td {
  padding: 0.72rem 0.75rem;
  border-bottom: 1px solid #e7eaf0;
  text-align: left;
  vertical-align: top;
}

th {
  color: #4d5668;
  background: #f8f9fb;
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #fbfcff;
}

.company-cell {
  min-width: 13rem;
}

.company-cell strong,
.company-cell small {
  display: block;
}

.company-cell small {
  margin-top: 0.18rem;
  color: var(--muted);
}

.reason-list {
  display: flex;
  flex-wrap: wrap;
  max-width: 19rem;
  gap: 0.25rem;
}

.reason-code {
  padding: 0.13rem 0.35rem;
  border-radius: 0.3rem;
  color: #4f596c;
  background: #eff1f5;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.65rem;
}

.empty-state {
  padding: 2.5rem 1rem;
  color: var(--muted);
  text-align: center;
}

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

.definition {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.definition dt {
  margin-bottom: 0.15rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.definition dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.84rem;
}

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

.section-spacer {
  margin-top: 1rem;
}

.message-preview {
  min-height: 6rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: #fafbfc;
  font-size: 0.78rem;
  white-space: pre-line;
}

.masked-value {
  color: var(--muted);
  font-style: italic;
}

.timeline {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  gap: 0.65rem;
}

.gate-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  gap: 0.65rem;
}

.gate-list li {
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: #fafbfc;
}

.gate-list p {
  margin: 0.45rem 0 0.3rem;
  font-size: 0.78rem;
}

.timeline li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: #fafbfc;
  gap: 1rem;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.list-rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.list-rows li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.list-rows li:last-child {
  border-bottom: 0;
}

.row-between {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.timestamp {
  color: var(--muted);
  font-size: 0.68rem;
  white-space: nowrap;
}

.campaign-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
  gap: 1rem;
}

.campaign-card:first-child {
  padding-top: 0;
}

.campaign-card:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.campaign-card p {
  margin-bottom: 0.35rem;
}

.campaign-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.1rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  width: min(92rem, calc(100% - 3rem));
  margin: 0 auto;
  padding: 1.3rem 0 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.7rem;
}

@media (max-width: 68rem) {
  .app-header__inner {
    grid-template-columns: 1fr auto;
    padding: 0.8rem 0;
  }

  .main-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    overflow-x: auto;
  }

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

  .layout-grid {
    grid-template-columns: 1fr;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 44rem) {
  .app-header__inner,
  .page-shell,
  .app-footer {
    width: min(100% - 1.4rem, 92rem);
  }

  .identity {
    display: none;
  }

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

  .filters {
    grid-template-columns: 1fr;
  }

  .suspension-form {
    grid-template-columns: 1fr;
  }

  .definition-grid {
    grid-template-columns: 1fr;
  }

  .page-header,
  .row-between,
  .timeline li,
  .app-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-footer {
    display: flex;
    gap: 0.3rem;
  }
}
