@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&family=Outfit:wght@500;600;700&display=swap');

:root {
  --white: #ffffff;
  --navy: #0f2744;
  --navy-mid: #1a365d;
  --teal: #0d9488;
  --teal-hover: #0f766e;
  --blue: #0369a1;
  --blue-hover: #075985;
  --green: #059669;
  --green-hover: #047857;
  --accent: #0d9488;
  --accent-hover: #0f766e;
  --accent-soft: #ecfdf5;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --red: #b91c1c;
  --red-soft: #fef2f2;
  --radius: 10px;
  --radius-sm: 6px;
  --font: 'DM Sans', system-ui, sans-serif;
  --font-display: 'Outfit', 'DM Sans', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

:root,
[data-theme='dark'] {
  color-scheme: dark;
  --bg-deep: #0f172a;
  --bg: #1e293b;
  --surface: #1e293b;
  --surface-solid: #334155;
  --surface-hover: #334155;
  --surface-card: #1e293b;
  --hero-bg: #1e293b;
  --border: #334155;
  --border-strong: #475569;
  --text: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --mono-fg: #e2e8f0;
  --chip-text: #e2e8f0;
  --chip-bg: #334155;
  --table-head-bg: #0f172a;
  --row-hover: #334155;
  --msg-bg: #334155;
  --msg-border: #475569;
  --empty-icon-bg: #334155;
  --input-hover-border: #64748b;
  --header-scrim: #0f2744;
  --header-text: #f8fafc;
  --header-subtext: #94a3b8;
  --blue-soft: #1e3a5f;
  --green-soft: #064e3b;
  --stat-bg: #064e3b;
  --stat-border: #059669;
  --user-pill-text: #e2e8f0;
  --user-pill-bg: #334155;
  --shadow: 0 1px 3px #00000040;
  --link-hover: #5eead4;
  --brand-mark-bg: #0d9488;
  --btn-ghost-bg: #334155;
  --btn-ghost-text: #f1f5f9;
  --btn-ghost-border: #475569;
}

[data-theme='light'] {
  color-scheme: light;
  --bg-deep: #f1f5f9;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --surface-hover: #f8fafc;
  --surface-card: #ffffff;
  --hero-bg: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --mono-fg: #334155;
  --chip-text: #334155;
  --chip-bg: #f8fafc;
  --table-head-bg: #f8fafc;
  --row-hover: #f1f5f9;
  --msg-bg: #ffffff;
  --msg-border: #e2e8f0;
  --empty-icon-bg: #f1f5f9;
  --input-hover-border: #94a3b8;
  --header-scrim: #0f2744;
  --header-text: #ffffff;
  --header-subtext: #94a3b8;
  --blue-soft: #f0f9ff;
  --green-soft: #ecfdf5;
  --stat-bg: #ecfdf5;
  --stat-border: #99f6e4;
  --user-pill-text: #e2e8f0;
  --user-pill-bg: #1a365d;
  --shadow: 0 1px 3px #0f172a14;
  --link-hover: #0f766e;
  --brand-mark-bg: #0d9488;
  --btn-ghost-bg: #ffffff;
  --btn-ghost-text: #334155;
  --btn-ghost-border: #cbd5e1;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-deep);
  -webkit-font-smoothing: antialiased;
  transition: color 0.25s ease, background-color 0.25s ease;
}

body::before,
body::after {
  display: none;
}

a {
  color: var(--blue);
  text-decoration: none;
  transition: color 0.15s;
}

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

/* —— Shell —— */
.app-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  margin: 0 -1.5rem;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--header-scrim);
  border-bottom: 1px solid var(--border-strong);
  transition: background 0.25s ease, border-color 0.25s ease;
}

.app-header .brand-text h1 {
  color: var(--header-text);
}

.app-header .brand-text p {
  color: var(--header-subtext);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--brand-mark-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-mark svg {
  width: 22px;
  height: 22px;
  fill: var(--white);
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.brand-text p {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  background: var(--user-pill-bg);
  border: 1px solid var(--border-strong);
  font-size: 0.8125rem;
  line-height: 1.3;
  color: var(--header-text);
  max-width: 100%;
  box-sizing: border-box;
}

.user-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--teal);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--teal-hover);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: var(--btn-ghost-bg);
  color: var(--btn-ghost-text);
  border: 1px solid var(--btn-ghost-border);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--header-text);
}

[data-theme='light'] .btn-ghost:hover {
  color: var(--text);
}

.btn-outline {
  background: var(--white);
  color: var(--blue);
  border: 1px solid var(--border-strong);
}

.btn-outline:hover {
  background: var(--blue-soft);
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.8125rem;
}

.btn-icon {
  font-size: 1rem;
  line-height: 1;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--blue);
  cursor: pointer;
}

.btn-link:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

/* —— Main content —— */
.page-intro {
  margin: 1.75rem 0 1.25rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.page-intro strong {
  color: var(--text);
  font-weight: 600;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.82em;
  color: var(--mono-fg);
}

.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.alert-error {
  background: var(--red-soft);
  border: 1px solid var(--red);
  color: var(--red);
}

.alert-success {
  background: var(--green-soft);
  border: 1px solid var(--teal);
  color: var(--teal-hover);
}

/* —— Opt-out inbox —— */
.app-shell.inbox-shell {
  max-width: none;
  width: 100%;
  margin: 0;
  padding-left: clamp(1rem, 2vw, 2rem);
  padding-right: clamp(1rem, 2vw, 2rem);
}

.inbox-page .app-header {
  margin-left: calc(-1 * clamp(1rem, 2vw, 2rem));
  margin-right: calc(-1 * clamp(1rem, 2vw, 2rem));
  padding-left: clamp(1rem, 2vw, 2rem);
  padding-right: clamp(1rem, 2vw, 2rem);
  flex-wrap: wrap;
  align-items: center;
  row-gap: 0.75rem;
  column-gap: 1rem;
}

.inbox-page .brand {
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(100%, 280px);
}

.inbox-page .brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
  line-height: 1.25;
}

.inbox-page .brand-text h1 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-page .brand-text p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-page .header-actions {
  flex: 1 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
  gap: 0.5rem;
}

.inbox-page .user-pill {
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
}

.inbox-page {
  background: var(--bg-deep);
}

.inbox-page .app-header,
.inbox-header {
  margin-bottom: 1.5rem;
}

.inbox-page .theme-toggle {
  background: var(--btn-ghost-bg);
  border: 1px solid var(--btn-ghost-border);
  color: var(--header-text);
}

[data-theme='light'] .inbox-page .theme-toggle {
  color: var(--text-muted);
}

.btn-svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.inbox-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 1200px;
  margin: 0 auto;
  padding-bottom: 3rem;
  position: relative;
  z-index: 1;
  width: 100%;
}

.inbox-hero {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.25rem 1.35rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-card);
  box-shadow: var(--shadow);
}

.inbox-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.3;
}

.inbox-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--teal-hover);
  background: var(--stat-bg);
  border: 1px solid var(--stat-border);
}

.inbox-count-badge #statCount {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.inbox-lead {
  margin: 0;
  max-width: 32rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.inbox-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
}

.inbox-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--chip-text);
  background: var(--chip-bg);
  border: 1px solid var(--border);
}

.inbox-card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-card);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.inbox-filters {
  padding: 1rem 1.25rem;
}

.inbox-filters-grid {
  display: grid;
  grid-template-columns: 10.5rem 10.5rem 11rem minmax(11rem, 1fr) auto;
  gap: 0.75rem 1rem;
  align-items: end;
  justify-content: start;
}

.field-search {
  min-width: 11rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.field-grow {
  min-width: 0;
}

.field-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.field-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  color-scheme: light dark;
}

.field-input:hover {
  border-color: var(--input-hover-border);
}

.field-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-action {
  white-space: nowrap;
  align-self: end;
}

.inbox-list {
  min-height: 12rem;
  width: 100%;
}

.inbox-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
}

.inbox-pagination-summary {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.inbox-pagination-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.inbox-pagination-label {
  font-size: 0.875rem;
  color: var(--text);
  white-space: nowrap;
}

.inbox-page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.inbox-table-wrap {
  overflow: auto;
  max-height: calc(100vh - 17rem);
  min-height: 12rem;
}

table.inbox-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  table-layout: fixed;
}

table.inbox-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

table.inbox-table th {
  padding: 0.55rem 0.75rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--table-head-bg);
  border-bottom: 1px solid var(--border-strong);
}

table.inbox-table th:nth-child(1) {
  width: 13rem;
}

table.inbox-table th:nth-child(2),
table.inbox-table th:nth-child(3) {
  width: 9.5rem;
}

table.inbox-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  line-height: 1.4;
}

table.inbox-table tbody tr {
  transition: background 0.12s ease;
}

table.inbox-table tbody tr:hover td {
  background: var(--row-hover);
}

table.inbox-table tbody tr:last-child td {
  border-bottom: none;
}

.cell-when {
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
}

.cell-phone {
  white-space: nowrap;
}

.cell-sub {
  display: none;
}

.cell-num {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--mono-fg);
  letter-spacing: -0.01em;
}

.cell-msg {
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 500;
  word-break: break-word;
}

.inbox-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 1.5rem;
  text-align: center;
}

.inbox-empty-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--empty-icon-bg);
  border: 1px solid var(--border);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--btn-ghost-border);
  background: var(--btn-ghost-bg);
  color: var(--header-text);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

[data-theme='light'] .theme-toggle {
  color: var(--text-muted);
}

.theme-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.theme-toggle svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: currentColor;
}

.theme-toggle .icon-moon {
  display: none;
}

.theme-toggle .icon-sun {
  display: block;
}

[data-theme='light'] .theme-toggle .icon-sun {
  display: none;
}

[data-theme='light'] .theme-toggle .icon-moon {
  display: block;
}

.inbox-empty-icon--warn {
  color: var(--amber);
  border-color: var(--amber);
  background: var(--amber-soft);
}

.inbox-empty p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.inbox-empty-title {
  margin: 0 0 0.35rem !important;
  font-family: var(--font-display);
  font-size: 1rem !important;
  font-weight: 600;
  color: var(--text) !important;
}

.inbox-empty-desc {
  font-size: 0.85rem !important;
  max-width: 18rem;
}

@media (max-width: 900px) {
  .inbox-page .app-header {
    flex-wrap: wrap;
  }

  .inbox-page .brand {
    max-width: 100%;
    flex: 1 1 100%;
  }

  .inbox-page .header-actions {
    flex: 1 1 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .inbox-page .user-pill {
    flex: 1 1 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    justify-content: center;
  }
}

@media (max-width: 800px) {
  .inbox-filters-grid {
    grid-template-columns: 1fr 1fr;
  }

  .field-search,
  .field-action {
    grid-column: 1 / -1;
  }

  .field-action {
    width: 100%;
  }

  .inbox-table-wrap {
    max-height: none;
  }
}

@media (max-width: 520px) {
  .inbox-filters-grid {
    grid-template-columns: 1fr;
  }
}

/* —— Message table (other pages) —— */
.messages-panel {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
}

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

table.messages-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.messages-table th {
  text-align: left;
  padding: 0.85rem 1rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--table-head-bg);
  border-bottom: 1px solid var(--border);
}

table.messages-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

table.messages-table tbody tr:hover {
  background: var(--row-hover);
}

table.messages-table tbody tr:last-child td {
  border-bottom: none;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-in {
  background: var(--blue-soft);
  color: var(--blue);
  border: 1px solid var(--border-strong);
}

.badge-out {
  background: var(--green-soft);
  color: var(--teal-hover);
  border: 1px solid var(--stat-border);
}

.badge-optout {
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid var(--border-strong);
}

.msg-body {
  max-width: 28rem;
  word-break: break-word;
  color: var(--text);
}

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

.empty-state-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: 16px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* —— Forms (send page) —— */
.form-card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  animation: rise 0.5s ease-out;
}

.form-grid {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.form-grid label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-top: 0.75rem;
  margin-bottom: 0.35rem;
}

.form-grid label:first-child {
  margin-top: 0;
}

.form-grid input,
.form-grid textarea,
.form-grid select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  color-scheme: light dark;
}

.form-grid input:focus,
.form-grid textarea:focus,
.form-grid select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.form-grid textarea {
  resize: vertical;
  min-height: 5rem;
}

.form-grid textarea.recipients {
  min-height: 9rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0;
}

.form-actions {
  margin-top: 1.25rem;
}

.form-actions .btn-primary {
  width: 100%;
  padding: 0.75rem;
  font-size: 0.95rem;
}

.status-panel {
  margin-top: 1.25rem;
  padding: 1rem 1.15rem;
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.send-layout {
  max-width: 1024px;
}

/* —— Bulk send page —— */
.send-page {
  background: var(--bg-deep);
  min-height: 100vh;
}

.app-shell.send-shell {
  max-width: 1024px;
  width: min(1024px, 94vw);
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2rem) 3rem;
}

.send-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  margin: 0 calc(-1 * clamp(1rem, 3vw, 2rem)) 1.5rem;
  padding: 1rem clamp(1rem, 3vw, 2rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--header-scrim);
  border-bottom: 1px solid var(--border-strong);
}

.send-topbar .brand-text h1,
.send-topbar .brand-text p {
  color: var(--header-text);
}

.send-topbar .brand-text p {
  color: var(--header-subtext);
}

.send-main {
  width: 100%;
  padding-bottom: 3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.send-panel {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-card);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.send-panel-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem 1.5rem;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border);
}

.send-panel-banner-icon {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--teal);
  color: var(--white);
  font-size: 0.8rem;
  font-weight: 700;
  font-style: normal;
  line-height: 1.5rem;
  text-align: center;
}

.send-panel-banner p {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.send-panel-banner strong {
  color: var(--text);
  font-weight: 600;
}

.send-form {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.send-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: stretch;
}

.send-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
}

.send-field label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.send-field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.send-recipient-count {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--teal);
  text-transform: none;
  letter-spacing: 0;
}

.send-recipient-count--warn {
  color: var(--amber);
}

.send-field textarea {
  width: 100%;
  flex: 1;
  min-height: 14rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.55;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
  color-scheme: light dark;
}

.send-field textarea::placeholder {
  color: var(--text-muted);
}

.send-field textarea:hover {
  border-color: var(--input-hover-border);
}

.send-field textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.send-recipients {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.65;
}

.send-field .form-hint {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.send-actions {
  display: flex;
  justify-content: center;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.send-actions .btn-primary {
  min-width: 14rem;
  padding: 0.85rem 2rem;
  font-size: 0.9375rem;
}

.send-page .alert,
.send-page .status-panel {
  border: 1px solid var(--border);
  background: var(--surface-card);
  box-shadow: var(--shadow);
}

.send-page .status-panel {
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .send-form-grid {
    grid-template-columns: 1fr;
  }

  .send-field textarea {
    min-height: 10rem;
  }

  .send-actions .btn-primary {
    width: 100%;
    max-width: 20rem;
  }
}

.bulk-results {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.bulk-results-summary {
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.bulk-results-section h3 {
  margin: 0 0 0.45rem;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bulk-results-ok h3 {
  color: var(--green);
}

.bulk-results-fail h3 {
  color: var(--red);
}

.bulk-results-skip h3 {
  color: var(--text-muted);
}

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

.bulk-results-list li {
  padding: 0.35rem 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.bulk-results-list li:last-child {
  border-bottom: none;
}

.bulk-results-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* —— Auth overlay —— */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--navy);
  animation: fadeIn 0.25s ease;
}

[data-theme='light'] .auth-overlay {
  background: #e2e8f0;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 2.25rem 2rem 2rem;
  border-radius: var(--radius);
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  color: var(--text);
  animation: cardPop 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes cardPop {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.auth-card .brand-mark {
  margin: 0 auto 1.5rem;
  width: 52px;
  height: 52px;
  border-radius: 14px;
}

.auth-card h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin: 0 0 0.5rem;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.25;
}

.auth-card .auth-sub {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0 0 1.75rem;
  line-height: 1.55;
}

.auth-field {
  margin-bottom: 1.15rem;
}

.auth-field:last-of-type {
  margin-bottom: 1.35rem;
}

.auth-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.auth-field input,
.auth-field select {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  color-scheme: light dark;
}

.auth-field input::placeholder {
  color: var(--text-muted);
  opacity: 0.85;
}

.auth-field input:hover {
  border-color: var(--input-hover-border);
}

.auth-field input:focus,
.auth-field select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-error {
  color: var(--red);
  font-size: 0.85rem;
  margin: 0 0 1rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  background: var(--red-soft);
  border: 1px solid var(--red);
  display: none;
  line-height: 1.45;
}

.auth-card .btn-primary {
  width: 100%;
  padding: 0.85rem;
  margin-top: 0.25rem;
  font-size: 0.95rem;
}

.auth-user-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.auth-user-list .btn-primary {
  width: 100%;
}

@media (max-width: 640px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
  }

  table.messages-table th:nth-child(3),
  table.messages-table td:nth-child(3) {
    min-width: 100px;
  }
}
