:root {
  color-scheme: light;
  --ink: #1c2430;
  --muted: #667085;
  --line: #d9e0e8;
  --panel: #ffffff;
  --page: #f3f6f8;
  --accent: #176b5f;
  --accent-strong: #0d4e45;
  --danger: #c24135;
  --warning: #b06000;
  --blue: #245ea8;
  --focus: #e3f2ee;
  --shadow: 0 12px 30px rgba(28, 36, 48, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 248px 1fr;
}

.sidebar {
  background: #17212b;
  color: #f8fbfc;
  padding: 24px 18px;
}

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

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #f0c35a;
  color: #17212b;
  font-weight: 800;
}

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

.brand span {
  display: block;
  color: #b9c4cd;
  font-size: 13px;
}

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

.nav-item {
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #d7e0e7;
  padding: 11px 12px;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: #263642;
  color: #ffffff;
}

main {
  min-width: 0;
  padding: 28px;
}

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

.topbar {
  margin-bottom: 22px;
}

.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: 30px;
}

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: 8px;
  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);
}

.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: #eef3f4;
  color: #475467;
  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: #fbfcfd;
}

.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 {
    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;
  }
}
