:root {
  --bg: #f5f4ef;
  --paper: #fffdf7;
  --ink: #152a25;
  --muted: #64716c;
  --line: #e1dfd4;
  --green: #12634c;
  --green-light: #e5f1e9;
  --gold: #d68437;
  --danger: #ad463d;
  --shadow: 0 18px 48px rgba(30, 40, 35, 0.08);
  font-family: "Segoe UI", "Inter", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

a {
  color: var(--green);
  text-decoration: none;
}

.topbar {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  height: 74px;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1240px;
  padding: 0 28px;
}

.brand {
  align-items: center;
  display: flex;
  gap: 13px;
}

.brand .mark {
  align-items: center;
  background: var(--green);
  border-radius: 12px;
  color: white;
  display: flex;
  font-size: 17px;
  font-weight: 700;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.export {
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 18px;
}

.topbar-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.topbar-actions form {
  margin: 0;
}

.logout {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 10px;
}

.layout {
  margin: 0 auto;
  max-width: 1240px;
  padding: 42px 28px 56px;
}

.hero {
  align-items: center;
  display: grid;
  gap: 62px;
  grid-template-columns: minmax(330px, 1fr) 410px;
  margin-bottom: 28px;
}

.eyebrow {
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  margin: 0 0 14px;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 5vw, 59px);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 1.06;
  margin: 0 0 18px;
  max-width: 640px;
}

.lead {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
  margin: 0;
  max-width: 560px;
}

.search-card,
.results {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.search-card {
  padding: 28px;
}

.search-card h2 {
  font-size: 20px;
  margin: 0 0 21px;
}

label {
  color: #43514c;
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 17px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
input:not([type]) {
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  display: block;
  font: inherit;
  font-size: 15px;
  font-weight: 400;
  height: 48px;
  margin-top: 7px;
  padding: 0 14px;
  width: 100%;
}

input:focus {
  border-color: var(--green);
  outline: 2px solid rgba(18, 99, 76, 0.12);
}

.form-row {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 86px;
}

.primary {
  background: var(--green);
  border: 0;
  border-radius: 9px;
  color: white;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  height: 51px;
  width: 100%;
}

.primary:disabled {
  cursor: wait;
  opacity: 0.62;
}

.status-panel {
  align-items: center;
  background: var(--green-light);
  border: 1px solid #c5dbcc;
  border-radius: 14px;
  display: flex;
  gap: 16px;
  margin: 31px 0;
  padding: 17px 22px;
}

.status-panel p {
  color: #456058;
  font-size: 14px;
  margin: 4px 0 0;
}

.status-panel small {
  color: var(--muted);
}

.pulse {
  background: var(--green);
  border-radius: 50%;
  height: 10px;
  width: 10px;
}

.status-running .pulse {
  animation: pulse 1.3s infinite;
}

.status-failed,
.status-blocked {
  background: #fbeee9;
  border-color: #ebc7c2;
}

.status-failed .pulse,
.status-blocked .pulse {
  background: var(--danger);
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(18, 99, 76, 0.45); }
  70% { box-shadow: 0 0 0 10px rgba(18, 99, 76, 0); }
  100% { box-shadow: 0 0 0 0 rgba(18, 99, 76, 0); }
}

.stats {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 32px;
}

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

.stats-six {
  grid-template-columns: repeat(6, 1fr);
}

.stats-seven {
  grid-template-columns: repeat(7, 1fr);
}

.stats article {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 23px 25px;
}

.stats span {
  color: var(--muted);
  display: block;
  font-size: 14px;
  margin-bottom: 9px;
}

.stats strong {
  font-size: 35px;
  letter-spacing: -0.04em;
}

.stats .opportunity {
  background: #fff8ef;
}

.stats .opportunity strong {
  color: var(--gold);
}

.stats .contacted strong {
  color: var(--green);
}

.stats .pending strong {
  color: #a45a11;
}

.stats .no-phone strong {
  color: var(--muted);
}

.stats .problems {
  background: #fbeee9;
}

.stats .problems strong {
  color: var(--danger);
}

.results {
  padding: 27px 29px 17px;
}

.results-head {
  align-items: stretch;
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 23px;
}

.results h2 {
  font-size: 23px;
  margin: 0;
}

.filter-summary {
  color: var(--muted);
  font-size: 14px;
  margin: 8px 0 0;
}

.filters {
  align-items: center;
  display: grid;
  gap: 13px;
  grid-template-columns: minmax(240px, 1.4fr) minmax(190px, 1fr) minmax(165px, 0.8fr) minmax(165px, 0.8fr) auto auto auto;
  width: 100%;
}

.filters input[type="search"] {
  margin: 0;
  min-width: 0;
}

select {
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  display: block;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  height: 45px;
  padding: 0 12px;
  width: 100%;
}

select:focus {
  border-color: var(--green);
  outline: 2px solid rgba(18, 99, 76, 0.12);
}

.checkbox {
  align-items: center;
  display: flex;
  gap: 8px;
  margin: 0;
  min-width: max-content;
  white-space: nowrap;
}

.filters button {
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
  height: 45px;
  padding: 0 17px;
}

.clear-filters {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 12px 4px;
  white-space: nowrap;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  font-size: 14px;
  min-width: 900px;
  text-align: left;
  width: 100%;
}

th {
  color: #718079;
  font-size: 11px;
  letter-spacing: 0.13em;
  padding: 15px 13px;
  text-transform: uppercase;
}

td {
  border-top: 1px solid #efede6;
  line-height: 1.45;
  padding: 18px 13px;
  vertical-align: top;
}

td strong,
td span,
td small {
  display: block;
}

td span,
td small {
  color: var(--muted);
}

td em,
.missing {
  background: #fceacb;
  border-radius: 20px;
  color: #a45a11;
  display: inline-block;
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
  margin-top: 7px;
  padding: 3px 9px;
}

.wa {
  display: block;
  margin-top: 4px;
}

.contact-action {
  background: var(--green-light);
  border-radius: 7px;
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
}

.contact-badge {
  border-radius: 20px;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
}

.contact-badge.sent {
  background: var(--green-light);
  color: var(--green);
}

.contact-badge.draft {
  background: #eff1ed;
  color: var(--muted);
}

.contact-badge.uncertain,
.contact-badge.delivery_unknown {
  background: #fff2de;
  color: #a45a11;
}

.contact-badge.failed {
  background: #fbeee9;
  color: var(--danger);
}

.empty {
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 40px 20px;
  text-align: center;
}

.empty strong {
  color: var(--ink);
}

.login-page {
  min-height: 100vh;
}

.login-layout {
  align-items: center;
  display: grid;
  gap: 74px;
  grid-template-columns: minmax(340px, 560px) 400px;
  justify-content: center;
  min-height: 100vh;
  padding: 44px 25px;
}

.login-intro .brand {
  margin-bottom: 62px;
}

.login-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 38px 34px 32px;
}

.login-card h2 {
  font-size: 24px;
  letter-spacing: -0.03em;
  margin: 0 0 28px;
}

.login-error {
  background: #fbeee9;
  border: 1px solid #ebc7c2;
  border-radius: 9px;
  color: var(--danger);
  font-size: 14px;
  margin: 0 0 20px;
  padding: 12px 14px;
}

.login-security {
  color: var(--muted);
  display: block;
  margin-top: 19px;
  text-align: center;
}

.contact-layout {
  display: grid;
  gap: 50px;
  grid-template-columns: minmax(290px, 390px) minmax(480px, 690px);
  margin: 0 auto;
  max-width: 1190px;
  padding: 55px 28px;
}

.contact-summary h1 {
  font-size: 45px;
  margin-bottom: 36px;
}

.contact-summary dl {
  margin: 0;
}

.contact-summary dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-top: 19px;
  text-transform: uppercase;
}

.contact-summary dd {
  font-size: 16px;
  line-height: 1.5;
  margin: 6px 0 0;
}

.contact-summary {
  grid-column: 1;
  grid-row: 1;
}

.landing-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  grid-column: 1;
  grid-row: 2;
  padding: 27px 25px;
}

.landing-card h2 {
  font-size: 23px;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
}

.landing-intro {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 23px;
}

.landing-generate {
  margin-top: 7px;
}

.landing-actions {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 19px;
}

.preview-link {
  background: var(--green-light);
  border-radius: 8px;
  display: block;
  font-size: 14px;
  font-weight: 700;
  padding: 13px 16px;
  text-align: center;
}

.landing-actions p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 14px 0 0;
}

.contact-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  grid-column: 2;
  grid-row: 1 / span 2;
  padding: 33px;
}

.contact-card-head {
  align-items: start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 27px;
}

.contact-card-head h2 {
  font-size: 24px;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
}

.contact-card-head p {
  color: var(--muted);
  margin: 0;
}

textarea {
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  display: block;
  font: inherit;
  font-size: 15px;
  line-height: 1.6;
  margin-top: 7px;
  min-height: 190px;
  padding: 13px 14px;
  resize: vertical;
  width: 100%;
}

textarea:focus {
  border-color: var(--green);
  outline: 2px solid rgba(18, 99, 76, 0.12);
}

.notice {
  border: 1px solid;
  border-radius: 9px;
  font-size: 14px;
  line-height: 1.45;
  margin: 0 0 22px;
  padding: 12px 14px;
}

.notice.success {
  background: var(--green-light);
  border-color: #c5dbcc;
  color: var(--green);
}

.notice.warning {
  background: #fff4e3;
  border-color: #efd5a7;
  color: #935413;
}

.notice.failure {
  background: #fbeee9;
  border-color: #ebc7c2;
  color: var(--danger);
}

.contact-buttons {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
  margin-top: 28px;
}

.secondary {
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  height: 51px;
}

.send-now:disabled {
  cursor: not-allowed;
}

.mark-sent {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 20px auto 0;
  text-decoration: underline;
}

.sent-at {
  background: var(--green-light);
  border-radius: 9px;
  color: var(--green);
  margin: 25px 0 0;
  padding: 15px;
}

.send-again {
  margin-top: 18px;
}

.attempt-history {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  grid-column: 2;
  grid-row: 3;
  padding: 27px 33px;
}

.attempt-history h2 {
  font-size: 21px;
  margin: 0 0 18px;
}

.attempt-history article {
  border-top: 1px solid var(--line);
  padding: 17px 0 4px;
}

.attempt-history article strong {
  display: inline-block;
  font-size: 13px;
  margin-left: 9px;
}

.attempt-history article p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 11px 0;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .layout {
    padding: 30px 18px;
  }

  .topbar {
    padding: 0 18px;
  }

  .hero {
    gap: 30px;
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 39px;
  }

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

  .results {
    padding: 22px 16px;
  }

  .results-head,
  .filters {
    align-items: stretch;
    display: flex;
    flex-direction: column;
  }

  .login-layout {
    display: block;
    padding: 34px 18px;
  }

  .login-intro {
    margin-bottom: 30px;
  }

  .login-intro .brand {
    margin-bottom: 35px;
  }

  .contact-layout {
    display: block;
    padding: 34px 18px;
  }

  .contact-summary {
    margin-bottom: 28px;
  }

  .contact-summary h1 {
    font-size: 38px;
    margin-bottom: 25px;
  }

  .contact-card {
    margin-top: 20px;
    padding: 23px 18px;
  }

  .landing-card {
    margin-bottom: 20px;
    padding: 23px 18px;
  }

  .contact-buttons {
    grid-template-columns: 1fr;
  }

  .attempt-history {
    margin-top: 20px;
  }
}
