:root {
  color-scheme: light;
  --bg: #f3f5f0;
  --panel: #ffffff;
  --ink: #17211d;
  --muted: #66716b;
  --line: #dbe1d8;
  --green: #23715d;
  --blue: #235c80;
  --gold: #a66a20;
  --red: #a63232;
  --accent: var(--green);
  --accent-strong: #195846;
  --danger: var(--red);
  --warning: var(--gold);
  --focus: #e8f2ed;
  --shadow: 0 18px 46px rgba(27, 38, 33, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 Arial, Helvetica, sans-serif;
}

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

button {
  cursor: pointer;
}

.access-message {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin: 60px auto;
  max-width: 620px;
  padding: 34px;
  text-align: center;
}

.access-message > img,
.login-card > img {
  height: 58px;
  width: 58px;
}

.access-message p {
  color: var(--muted);
}

.access-message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 22px;
}

.access-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.account-name {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.login-dialog {
  background: transparent;
  border: 0;
  max-width: 440px;
  padding: 12px;
  width: calc(100% - 24px);
}

.login-dialog::backdrop {
  background: rgba(5, 18, 14, 0.78);
  backdrop-filter: blur(4px);
}

.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
  display: grid;
  gap: 14px;
  padding: 30px;
  position: relative;
}

.login-card h2,
.login-card p {
  margin: 0;
}

.login-card label {
  display: grid;
  font-size: 0.86rem;
  font-weight: 700;
  gap: 6px;
}

.login-card input[type="text"],
.login-card input[type="password"] {
  background: #f7f9f5;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 44px;
  padding: 10px 12px;
  width: 100%;
}

.remember-login {
  align-items: center;
  display: flex !important;
  font-weight: 500 !important;
}

.remember-login input {
  height: 18px;
  width: 18px;
}

.login-help {
  color: var(--muted);
}

.login-status {
  color: var(--danger);
  font-size: 0.84rem;
  min-height: 20px;
}

.dialog-close {
  background: #eef1ed;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.4rem;
  height: 38px;
  position: absolute;
  right: 14px;
  top: 14px;
  width: 38px;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 250px minmax(0, 1fr);
}

.sidebar {
  background: rgba(255, 255, 255, 0.94);
  border-right: 1px solid var(--line);
  color: var(--ink);
  height: 100vh;
  padding: 22px 16px;
  position: sticky;
  top: 0;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-logo {
  height: 42px;
  object-fit: contain;
  width: 42px;
}

.brand span,
.eyebrow,
.section-header p,
.metric span,
dt {
  color: var(--muted);
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 11px 12px;
  text-align: left;
  text-decoration: none;
}

.nav-item.active,
.nav-item:hover {
  background: var(--green);
  color: #ffffff;
}

main {
  min-width: 0;
  padding: clamp(16px, 3vw, 32px);
}

.topbar,
.section-header,
.panel-heading,
.button-row,
.composer-meta,
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  padding: 16px 18px;
  position: sticky;
  top: 14px;
  z-index: 10;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
}

h2 {
  margin-bottom: 8px;
  font-size: 21px;
}

h3 {
  margin-bottom: 12px;
  font-size: 17px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.top-actions,
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
}

.primary-button,
.secondary-button,
.text-button,
.icon-button {
  border-radius: 999px;
  min-height: 38px;
  border: 1px solid transparent;
  padding: 9px 13px;
  font-weight: 700;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button,
.icon-button {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.text-button:focus-visible,
.icon-button:focus-visible,
.nav-item:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(35, 113, 93, 0.28);
  outline-offset: 2px;
}

.text-button {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
}

.icon-button {
  min-width: 42px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel,
.send-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric {
  padding: 16px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.metric.warning strong {
  color: var(--warning);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.7fr);
  gap: 18px;
}

.panel,
.send-preview {
  padding: 18px;
}

.section-header {
  margin-bottom: 18px;
}

.section-header p {
  margin-bottom: 0;
}

.toolbar {
  margin-bottom: 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--accent);
}

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #eef3ee;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

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

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill,
.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill {
  background: #eef3f4;
  color: #344054;
}

.status.opted-in {
  background: #e5f5ef;
  color: #116047;
}

.status.opted-out {
  background: #fde9e7;
  color: #9d2f27;
}

.status.unknown {
  background: #fff2d6;
  color: #8a4b00;
}

.event-list,
.health-list,
.card-list,
.audit-list {
  display: grid;
  gap: 10px;
}

.event,
.health-item,
.group-card,
.audit-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8faf7;
}

.event strong,
.health-item strong,
.group-card strong,
.audit-item strong {
  display: block;
}

.event span,
.health-item span,
.group-card span,
.audit-item span {
  color: var(--muted);
  font-size: 13px;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
}

.composer .panel {
  display: grid;
  gap: 14px;
}

.composer-meta {
  color: var(--muted);
  font-size: 13px;
}

.phone-preview {
  min-height: 190px;
  border-radius: 24px;
  background: #203040;
  padding: 20px 14px;
}

.sms-bubble {
  max-width: 92%;
  min-height: 80px;
  border-radius: 16px;
  background: #e8f6f1;
  color: #13251f;
  padding: 12px;
  overflow-wrap: anywhere;
}

dl {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
}

dt {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 3px 0 0;
}

dialog {
  width: min(680px, calc(100vw - 24px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 28px 70px rgba(28, 36, 48, 0.25);
}

dialog::backdrop {
  background: rgba(23, 33, 43, 0.5);
}

#contactForm {
  display: grid;
  gap: 16px;
  padding: 20px;
}

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

.full-field {
  display: grid;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    height: auto;
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 14px;
  }

  .brand {
    margin-bottom: 12px;
  }

  nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    overflow-x: auto;
  }

  .nav-item {
    text-align: center;
    white-space: nowrap;
  }

  main {
    padding: 18px;
  }

  .metric-grid,
  .content-grid,
  .composer,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-header,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    flex-wrap: wrap;
  }
}
