:root {
  --bg: #f6f0e4;
  --bg-soft: #fbf7ef;
  --surface: #fffdf7;
  --surface-strong: #ffffff;
  --text: #1f2a2f;
  --muted: #5b686f;
  --brand: #0f6d73;
  --brand-strong: #0a5055;
  --accent: #b5593d;
  --danger: #b13a35;
  --danger-strong: #932d2b;
  --success: #2d8052;
  --warning: #9a6a18;
  --border: #d8d2c5;
  --border-strong: #c9c1b0;
  --focus: #144a8f;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 6px 18px rgba(22, 30, 36, 0.08);
  --shadow-md: 0 18px 38px rgba(22, 30, 36, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Trebuchet MS", "Lucida Sans", sans-serif;
  color: var(--text);
  background: #efe8db;
  line-height: 1.5;
  position: relative;
  overflow-x: hidden;
}

.container {
  width: min(1160px, 94vw);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
  background: linear-gradient(95deg, rgba(21, 39, 52, 0.93), rgba(14, 47, 64, 0.9));
  border-bottom: 1px solid rgba(221, 235, 246, 0.23);
  box-shadow: 0 8px 24px rgba(12, 22, 31, 0.22);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.78rem;
  text-decoration: none;
  color: #edf4fb;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 0.74rem;
  color: #fff;
  background: linear-gradient(155deg, #1a8ea0, #13566f 62%, #0f3c56 100%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.3), 0 8px 18px rgba(0, 0, 0, 0.2);
}

.brand-text-wrap {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand {
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.015em;
}

.brand-tagline {
  font-size: 0.75rem;
  opacity: 0.82;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.inline-form {
  display: inline;
}

.nav-link {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.38rem 0.74rem;
  color: #d8ebf7;
  background: transparent;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease;
}

.nav-link:hover {
  background: rgba(240, 250, 255, 0.12);
  border-color: rgba(208, 234, 246, 0.35);
}

.nav-link:focus-visible {
  outline: 3px solid rgba(126, 189, 250, 0.6);
  outline-offset: 1px;
}

.nav-link.is-active {
  background: rgba(236, 247, 255, 0.2);
  color: #ffffff;
  border-color: rgba(207, 231, 246, 0.55);
}

.nav-link-quiet {
  color: #f8d4cf;
}

.nav-link-quiet:hover {
  background: rgba(255, 211, 201, 0.14);
  border-color: rgba(255, 221, 213, 0.35);
}

.main-content {
  padding: 1.3rem 0 2.6rem;
}

.panel {
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1rem, 1.4vw + 0.65rem, 1.6rem);
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow-sm);
  animation: panel-rise 240ms ease;
}

.panel-wide {
  padding: clamp(1rem, 1.8vw + 0.72rem, 1.9rem);
}

.panel-tight {
  max-width: 860px;
}

.hero-panel {
  background:
    linear-gradient(157deg, rgba(15, 109, 115, 0.14) 0%, rgba(15, 109, 115, 0) 36%),
    linear-gradient(18deg, rgba(181, 89, 61, 0.14) 0%, rgba(181, 89, 61, 0) 42%),
    linear-gradient(180deg, var(--surface-strong), var(--surface));
}

.split-panel {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: 1.1fr 1fr;
}

.settings-shell {
  display: grid;
  gap: 1rem;
  grid-template-columns: 210px minmax(0, 1fr);
  align-items: start;
}

.settings-side-nav {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 0.75rem;
  box-shadow: 0 10px 24px rgba(31, 53, 67, 0.05);
  position: sticky;
  top: 1.1rem;
}

.settings-side-nav h3 {
  margin: 0;
  font-family: inherit;
  font-size: 0.83rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #4f5f68;
}

.settings-side-links {
  margin-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.36rem;
}

.settings-side-link {
  display: flex;
  min-height: 44px;
  align-items: center;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: #32566a;
  padding: 0.34rem 0.8rem;
  text-decoration: none;
  font-weight: 600;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.settings-side-link:hover {
  border-color: #bfd0db;
  background: #edf5f8;
  color: #1f4f66;
}

.settings-side-link:focus-visible {
  outline: 3px solid rgba(20, 74, 143, 0.3);
  outline-offset: 1px;
}

.settings-side-link.is-active,
.settings-side-link[aria-current="page"] {
  background: linear-gradient(180deg, #178790, var(--brand));
  color: #fff;
  border-color: #0d5c62;
  box-shadow: 0 7px 14px rgba(9, 70, 78, 0.2);
}

.settings-content {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.settings-content [data-settings-sections-target='section'][hidden] {
  display: none;
}

.settings-section-anchor {
  scroll-margin-top: 1rem;
}

.settings-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.9rem;
  background: rgba(255, 255, 255, 0.72);
}

.settings-stat {
  margin: 0.6rem 0 0.2rem;
}

.settings-copy-inline {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 36px;
  border: 1px solid #bcd3dd;
  border-radius: 10px;
  background: #ffffff;
  color: #114c66;
  padding: 0.32rem 0.62rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.settings-copy-inline:hover {
  background: #deeff6;
  border-color: #a9c6d4;
}

.settings-copy-inline:active {
  transform: translateY(1px);
}

.settings-copy-inline:focus-visible {
  outline: 3px solid rgba(20, 74, 143, 0.32);
  outline-offset: 1px;
}

.settings-copy-inline:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.settings-copy-inline__icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.settings-copy-inline__label {
  pointer-events: none;
}

.panel-section {
  padding: 0.25rem;
}

.panel-intro {
  border-right: 1px solid var(--border);
  padding-right: 1.2rem;
}

.toolbar {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.toolbar-spread {
  justify-content: space-between;
}

.eyebrow {
  margin: 0 0 0.24rem;
  color: var(--brand-strong);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4 {
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  line-height: 1.15;
  margin-top: 0;
  color: #1b262b;
}

h2 {
  font-size: clamp(1.46rem, 1.6vw + 0.95rem, 2rem);
  margin-bottom: 0.4rem;
}

h3 {
  font-size: 1.08rem;
  margin-bottom: 0.35rem;
}

.lead {
  margin-top: 0.12rem;
  max-width: 66ch;
  color: #2c3a41;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.14rem 0 0;
}

.flash {
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  padding: 0.75rem 0.95rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.flash p {
  margin: 0;
}

.flash-notice {
  background: #e9f6ef;
  border-color: #b9dec7;
  color: #164d2f;
}

.flash-alert,
.flash-danger {
  background: #fceaea;
  border-color: #efbfbd;
  color: #672321;
}

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

.actions form,
.nav-links form {
  margin: 0;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.54rem 0.95rem;
  min-height: 44px;
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: 3px solid rgba(20, 74, 143, 0.36);
  outline-offset: 1px;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.56;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(180deg, #178790, var(--brand));
  color: #ffffff;
  border-color: #0d5c62;
  box-shadow: 0 7px 14px rgba(9, 70, 78, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #1294a0, #116e76);
}

.btn-secondary {
  background: #edf6fa;
  color: #114c66;
  border-color: #bcd3dd;
}

.btn-secondary:hover {
  background: #deeff6;
  border-color: #a9c6d4;
}

.btn-ghost {
  background: #f6f3ec;
  color: #3d505d;
  border-color: #d8d0c2;
}

.btn-ghost:hover {
  background: #efe9de;
}

.btn-danger {
  background: linear-gradient(180deg, #c44b45, var(--danger));
  color: #fff;
  border-color: var(--danger-strong);
}

.btn-danger:hover {
  background: linear-gradient(180deg, #cb5149, #9f332f);
}

.btn-small {
  min-height: 35px;
  padding: 0.33rem 0.72rem;
  font-size: 0.86rem;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.compose-form .actions {
  margin-top: 0.2rem;
}

.compose-section-nav {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.75rem;
  background: rgba(248, 251, 252, 0.95);
  box-shadow: 0 5px 14px rgba(31, 53, 67, 0.06);
}

.compose-section-nav-hint {
  margin: 0 0 0.45rem;
  color: #4f616b;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.compose-section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.compose-section-tab {
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid #c4d2db;
  background: #eef4f8;
  color: #315366;
  padding: 0.4rem 0.92rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition:
    background-color 170ms ease,
    border-color 170ms ease,
    color 170ms ease,
    box-shadow 170ms ease,
    transform 170ms ease;
}

.compose-section-tab:hover {
  background: #e4eef5;
  border-color: #acc0cc;
}

.compose-section-tab:active {
  transform: translateY(1px);
}

.compose-section-tab:focus-visible {
  outline: 3px solid rgba(20, 74, 143, 0.3);
  outline-offset: 1px;
}

.compose-section-tab.is-active {
  background: linear-gradient(180deg, #178790, var(--brand));
  border-color: #0d5c62;
  color: #ffffff;
  box-shadow: 0 7px 14px rgba(9, 70, 78, 0.2);
}

.compose-section-tab:disabled,
.compose-section-tab[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.compose-section-panels {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.compose-section-panel {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  animation: panel-rise 190ms ease;
}

.compose-section-panel[hidden] {
  display: none;
}

.form-section {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-md);
  padding: 0.9rem;
}

.section-heading {
  margin-bottom: 0.7rem;
}

.section-heading h3 {
  margin-bottom: 0.1rem;
}

.section-heading-spread {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
}

.field,
.field-row {
  margin-bottom: 0.8rem;
}

.field:last-child {
  margin-bottom: 0;
}

.field-row {
  display: flex;
  gap: 0.9rem;
}

.field-row-compact .field {
  flex: 1;
  margin-bottom: 0;
}

label {
  display: block;
  margin-bottom: 0.3rem;
  color: #405058;
  font-size: 0.89rem;
  font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="datetime-local"],
input[type="file"],
textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  padding: 0.58rem 0.7rem;
  font: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

select,
select.input,
.input.select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  padding: 0.58rem 0.7rem;
  font: inherit;
  color: var(--text);
  background: #fff;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #8b98a0 50%),
    linear-gradient(135deg, #8b98a0 50%, transparent 50%);
  background-position: calc(100% - 0.9rem) calc(50% - 0.1rem), calc(100% - 0.5rem) calc(50% - 0.1rem);
  background-size: 0.25rem 0.25rem, 0.25rem 0.25rem;
  background-repeat: no-repeat;
}

select:focus,
.input.select:focus {
  outline: none;
  border-color: #3e6aa1;
  box-shadow: 0 0 0 3px rgba(20, 74, 143, 0.18);
}

textarea {
  resize: vertical;
  min-height: 140px;
}

input::placeholder,
textarea::placeholder {
  color: #8c979e;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="datetime-local"]:focus,
input[type="file"]:focus,
textarea:focus {
  outline: none;
  border-color: #3e6aa1;
  box-shadow: 0 0 0 3px rgba(20, 74, 143, 0.18);
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.checkbox-card {
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  padding: 0.55rem 0.68rem;
  background: #fbf8f2;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.52rem;
  margin: 0;
}

.mail-merge-card {
  background:
    linear-gradient(160deg, rgba(15, 109, 115, 0.1), rgba(15, 109, 115, 0) 44%),
    rgba(255, 255, 255, 0.85);
}

.mail-merge-controls {
  display: flex;
  gap: 0.68rem;
  align-items: center;
  flex-wrap: wrap;
}

.input-file {
  max-width: 360px;
  background: #fff;
}

.status-line {
  margin-top: 0.65rem;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  border: 1px solid transparent;
}

.status-neutral {
  color: #44555f;
  border-color: #c8d2d8;
  background: #f1f5f7;
}

.status-loading {
  color: #5f4f16;
  border-color: #dec895;
  background: #fef4de;
}

.status-success {
  color: #1f643e;
  border-color: #b6dbbf;
  background: #e8f7ec;
}

.status-error {
  color: #762522;
  border-color: #e4bfbc;
  background: #fdeceb;
}

.placeholder-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.72rem;
}

.placeholder-chip,
.placeholder-empty {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.56rem;
  font-size: 0.8rem;
  border: 1px solid #c1d8dd;
  background: #edf8fa;
  color: #145a63;
}

.placeholder-empty {
  border-color: #d8d5cd;
  background: #f6f3ee;
  color: #5f6a6f;
}

.mail-merge-chip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.72rem;
  margin-top: 0.72rem;
}

.mail-merge-chip-label {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #4b5d67;
  font-weight: 700;
}

.header-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.56rem;
  font-size: 0.8rem;
  border: 1px solid #aecdde;
  background: #e5f1fb;
  color: #1f4d73;
}

.mail-merge-preview-shell {
  margin-top: 0.88rem;
  border: 1px solid #bfd1d8;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.7);
  padding: 0.72rem;
}

.mail-merge-preview-shell h4 {
  margin: 0;
}

.mail-merge-preview-meta {
  margin: 0.5rem 0 0;
}

.mail-merge-table-wrap {
  margin-top: 0.55rem;
  border: 1px solid #d2dde3;
  border-radius: 10px;
  overflow: auto;
  max-height: 280px;
  background: #fff;
}

.mail-merge-table {
  min-width: 620px;
}

.mail-merge-table th,
.mail-merge-table td {
  font-size: 0.84rem;
  padding: 0.46rem 0.5rem;
}

.mail-merge-table td {
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.variable-chip-row {
  margin-top: 0.45rem;
}

.mail-merge-editor-field {
  position: relative;
}

.mail-merge-textarea-shell {
  position: relative;
}

.mail-merge-textarea-highlight {
  position: absolute;
  inset: 1px;
  margin: 0;
  border-radius: 10px;
  padding: 0.58rem 0.7rem;
  color: #1f2b33;
  background: transparent;
  pointer-events: none;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  line-height: 1.45;
}

.mail-merge-highlight-input {
  position: relative;
  z-index: 2;
  background: transparent;
  color: transparent;
  caret-color: #1f2b33;
}

.mail-merge-highlight-input::placeholder {
  color: #8c979e;
}

.mail-merge-inline-token-valid {
  background: rgba(132, 200, 169, 0.22);
  color: #134b3b;
  border-radius: 6px;
}

.mail-merge-inline-token-invalid {
  background: rgba(227, 158, 153, 0.24);
  color: #6f2522;
  border-radius: 6px;
}

.mail-merge-autocomplete {
  position: absolute;
  z-index: 40;
  margin-top: 0;
  border: 1px solid #bfd1da;
  border-radius: 11px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(30, 53, 69, 0.08);
  overflow: hidden;
  min-width: 210px;
  max-width: min(360px, calc(100% - 12px));
}

.mail-merge-autocomplete-option {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #e7edf1;
  background: transparent;
  color: #22485f;
  font: inherit;
  text-align: left;
  padding: 0.44rem 0.62rem;
  cursor: pointer;
}

.mail-merge-autocomplete-option:last-child {
  border-bottom: 0;
}

.mail-merge-autocomplete-option:hover,
.mail-merge-autocomplete-option.is-active {
  background: #e8f1fa;
  color: #123d60;
}

.variable-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.56rem;
  font-size: 0.8rem;
  border: 1px solid transparent;
}

.variable-chip-valid {
  border-color: #97cfb6;
  background: linear-gradient(120deg, #e8f8ed, #e7f1fb);
  color: #1e5a49;
}

.variable-chip-invalid {
  border-color: #e3b0ae;
  background: #fde9e8;
  color: #7b2723;
}

.mail-merge-field-valid {
  border-color: #64b38c !important;
  box-shadow: 0 0 0 3px rgba(100, 179, 140, 0.16);
}

.mail-merge-field-invalid {
  border-color: #d77973 !important;
  box-shadow: 0 0 0 3px rgba(215, 121, 115, 0.16);
}

input.mail-merge-field-valid:focus,
textarea.mail-merge-field-valid:focus {
  border-color: #64b38c !important;
  box-shadow: 0 0 0 3px rgba(100, 179, 140, 0.16) !important;
}

input.mail-merge-field-invalid:focus,
textarea.mail-merge-field-invalid:focus {
  border-color: #d77973 !important;
  box-shadow: 0 0 0 3px rgba(215, 121, 115, 0.16) !important;
}

.mail-merge-body-preview-shell {
  margin-top: 0.35rem;
  border: 1px solid #c3d0d8;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.84);
  padding: 0.72rem;
}

.mail-merge-body-preview-shell h4 {
  margin: 0;
}

.mail-merge-preview-status {
  margin-bottom: 0.6rem;
}

.mail-merge-preview-body {
  margin: 0;
  border: 1px solid #d0dce2;
  border-radius: 10px;
  background: #f8fbfd;
  color: #1d2c35;
  padding: 0.64rem;
  min-height: 120px;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.84rem;
  line-height: 1.4;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.21rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-soft {
  color: #145661;
  background: #e6f2f5;
  border: 1px solid #bfd2db;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.attachment-section {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.attachment-status {
  align-self: flex-start;
  margin: 0;
}

.attachment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.68rem;
  border: 1px dashed #c9d2d8;
  border-radius: 14px;
  padding: 0.68rem;
  background: #f9fcfd;
}

.attachment-grid.is-drag-over {
  border-color: var(--focus);
  background: #edf4fb;
}

.attachment-slot {
  border: 1px solid #cfd8de;
  border-radius: 12px;
  background: #ffffff;
  padding: 0.56rem;
  display: flex;
  flex-direction: column;
  gap: 0.52rem;
  min-height: 236px;
  transition: border-color 170ms ease, box-shadow 170ms ease, background-color 170ms ease;
}

.attachment-slot.is-empty {
  background: #fbfcfd;
}

.attachment-slot.is-filled {
  border-color: #adc4cf;
}

.attachment-slot.is-drag-over {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(20, 74, 143, 0.18);
}

.attachment-slot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.attachment-slot-label {
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #62707a;
  font-weight: 700;
}

.attachment-preview {
  border: 1px solid #d8e0e4;
  border-radius: 10px;
  background: #f7fafc;
  min-height: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.attachment-preview img,
.attachment-preview video {
  width: 100%;
  height: 132px;
  object-fit: cover;
  display: block;
}

.attachment-placeholder {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  border: 1px dashed #afbdc5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #7a8a94;
}

.attachment-icon {
  min-width: 72px;
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid #c8d3db;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.54rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #345266;
  background: #edf4f8;
}

.attachment-icon-pdf {
  background: #fdeceb;
  border-color: #e6bdbc;
  color: #7f2d2a;
}

.attachment-icon-doc {
  background: #eaf1fd;
  border-color: #b8cbef;
  color: #1e4d8a;
}

.attachment-icon-sheet {
  background: #e7f7ef;
  border-color: #b4dcc4;
  color: #22613d;
}

.attachment-icon-slide {
  background: #fff1e5;
  border-color: #ebc9aa;
  color: #8d4a12;
}

.attachment-icon-audio {
  background: #f2eefb;
  border-color: #cbc0e7;
  color: #4f3f7b;
}

.attachment-icon-archive {
  background: #f6f1e7;
  border-color: #d9c7a7;
  color: #6a522f;
}

.attachment-meta {
  min-height: 56px;
}

.attachment-name {
  display: block;
  font-size: 0.92rem;
  color: #1f2b33;
  line-height: 1.2;
  word-break: break-word;
}

.attachment-size {
  display: block;
  margin-top: 0.2rem;
  color: #5f6d76;
  font-size: 0.81rem;
}

.attachment-slot-actions {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.error-list {
  margin: 0.48rem 0 0;
  padding-left: 1.05rem;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 840px;
  background: #fff;
}

.message-table {
  table-layout: fixed;
}

.message-table-outbox-manager {
  min-width: 1130px;
}

.message-table-outbox {
  min-width: 980px;
}

.message-table-sent {
  min-width: 1100px;
}

.table th,
.table td {
  border-bottom: 1px solid #e7e1d4;
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.52rem;
  font-size: 0.93rem;
}

.table th {
  white-space: nowrap;
  color: #42515b;
  font-weight: 700;
  font-size: 0.81rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: #fbf8f2;
}

.table tr:hover td {
  background: #fcfaf5;
}

.table.mail-merge-table {
  min-width: 620px;
}

.table.mail-merge-table th,
.table.mail-merge-table td {
  font-size: 0.84rem;
  padding: 0.46rem 0.5rem;
}

.table.mail-merge-table th {
  text-transform: none;
  letter-spacing: 0.01em;
}

.checkbox-column {
  width: 44px;
  text-align: center;
}

.message-table .column-send-on {
  width: 9.25rem;
}

.message-table .column-to {
  width: 28%;
}

.message-table .column-subject {
  width: 24%;
}

.message-table .column-status {
  width: 16%;
}

.message-table .column-attachments {
  width: 7.5rem;
}

.message-table .column-schedule {
  width: 7.5rem;
}

.message-table .column-actions {
  width: 13rem;
}

.message-table .column-preview {
  width: 22%;
}

.message-table-sent .column-to {
  width: 20%;
}

.message-table-sent .column-subject {
  width: 17%;
}

.message-table-sent .column-status {
  width: 12%;
}

.message-table-sent .column-preview {
  width: 26%;
}

.truncate-cell {
  max-width: 220px;
}

.message-table .truncate-cell {
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sent-preview-snippet {
  margin: 0 0 0.42rem;
  color: #4d616c;
  font-size: 0.83rem;
  line-height: 1.36;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(2 * 1.36em);
}

.sent-preview-open-btn {
  min-width: 8.25rem;
}

.sent-preview-open-btn:active {
  transform: translateY(0);
}

.sent-preview-modal {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(860px, 92vw);
  max-height: min(88vh, 860px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  box-shadow: var(--shadow-md);
}

.sent-preview-modal::backdrop {
  background: rgba(17, 30, 39, 0.58);
}

.sent-preview-modal-card {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  padding: 1.05rem;
  border: 1px solid #d3d8dc;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafb 100%);
}

.sent-preview-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.72rem;
}

.sent-preview-modal-title-group h3 {
  margin: 0;
  font-size: 1.04rem;
  line-height: 1.32;
}

.sent-preview-eyebrow {
  margin-bottom: 0.3rem;
}

.sent-preview-meta {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.58rem;
}

.sent-preview-meta-item {
  margin: 0;
  border: 1px solid #d3dde3;
  border-radius: var(--radius-sm);
  background: #eef5f8;
  padding: 0.54rem 0.58rem;
}

.sent-preview-meta-item dt {
  margin: 0;
  color: #45606f;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sent-preview-meta-item dd {
  margin: 0.2rem 0 0;
  color: #253641;
  font-size: 0.87rem;
  line-height: 1.34;
  word-break: break-word;
}

.sent-preview-body-section {
  border: 1px solid #d3dce2;
  border-radius: var(--radius-sm);
  background: #ffffff;
  padding: 0.62rem;
}

.sent-preview-body-heading {
  margin: 0 0 0.42rem;
  font-size: 0.82rem;
  color: #4a5e68;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.sent-preview-body {
  margin: 0;
  border: 1px solid #d8dfe4;
  border-radius: 10px;
  background: #f7f9fb;
  color: #243640;
  font-size: 0.83rem;
  line-height: 1.36;
  padding: 0.56rem 0.64rem;
  max-height: 20rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.table-actions {
  white-space: nowrap;
}

.table-note {
  margin: 0.34rem 0 0;
  color: #6a5d56;
  font-size: 0.82rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.53rem;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.status-draft {
  color: #4d5f6d;
  background: #ecf1f5;
  border-color: #cad7e1;
}

.status-queued,
.status-sending {
  color: #6a500f;
  background: #fbf0d2;
  border-color: #e3cc90;
}

.status-sent {
  color: #1f653f;
  background: #e5f4ea;
  border-color: #b5d7bf;
}

.status-failed {
  color: #7b2723;
  background: #fcebe9;
  border-color: #e8bbb8;
}

.status-deferred-quota {
  color: #6c4b1b;
  background: #f9efd9;
  border-color: #dfc694;
}

.inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #4a5a64;
  font-weight: 600;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.stat-card {
  border: 1px solid #d7d0c1;
  background: linear-gradient(180deg, #fff, #f8f4eb);
  border-radius: 14px;
  padding: 0.68rem;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  box-shadow: 0 4px 14px rgba(21, 26, 33, 0.06);
}

.stat-card strong {
  font-size: 1.34rem;
  line-height: 1.1;
}

.stat-card-inline {
  max-width: 530px;
  margin-bottom: 0.8rem;
}

.stat-label {
  font-size: 0.78rem;
  color: #52616a;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.feature-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 0.8rem;
  margin: 1rem 0;
}

.feature-card {
  border-radius: 14px;
  border: 1px solid #d8d1c2;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(249, 243, 233, 0.8));
  padding: 0.75rem;
}

.feature-card h3 {
  margin-bottom: 0.22rem;
}

.feature-card p {
  margin: 0;
  color: #4f5e67;
  font-size: 0.9rem;
}

.empty-state {
  border: 1px dashed var(--border-strong);
  border-radius: 16px;
  background: #fbf9f3;
  padding: 1rem;
}

.empty-state h3 {
  margin-bottom: 0.2rem;
}

.empty-state p {
  margin-top: 0;
  color: #5a6870;
}

code {
  border-radius: 6px;
  border: 1px solid #dccfb8;
  background: #f6efe2;
  padding: 0.03rem 0.3rem;
  font-size: 0.85rem;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

@keyframes panel-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1080px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .feature-row {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

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

@media (max-width: 900px) {
  .topbar {
    position: static;
  }

  .topbar-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .split-panel {
    grid-template-columns: 1fr;
  }

  .settings-shell {
    grid-template-columns: 1fr;
  }

  .settings-side-nav {
    position: static;
  }

  .panel-intro {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.95rem;
    padding-right: 0;
    margin-bottom: 0.3rem;
  }

  .toolbar,
  .toolbar-spread,
  .field-row {
    flex-direction: column;
  }

  .field-row-compact .field {
    width: 100%;
  }

  .mail-merge-chip-grid {
    grid-template-columns: 1fr;
  }

  .settings-side-links {
    gap: 0.32rem;
  }

  .sent-preview-modal-card {
    padding: 0.9rem;
    gap: 0.8rem;
  }

  .sent-preview-modal-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .sent-preview-meta {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .container {
    width: min(1180px, 95vw);
  }

  .nav-links {
    width: 100%;
    gap: 0.35rem;
  }

  .nav-link,
  .btn {
    width: 100%;
    justify-content: center;
  }

  .actions {
    width: 100%;
  }

  .actions .btn,
  .actions form {
    width: 100%;
  }

  .message-table .table-actions .actions .btn,
  .message-table .table-actions .actions form {
    width: auto;
  }

  .message-table .column-preview .sent-preview-open-btn {
    width: auto;
  }

  .sent-preview-modal {
    width: min(94vw, 94vw);
  }

  .sent-preview-modal .btn {
    width: auto;
  }

  .table {
    min-width: 700px;
  }

  .feature-row,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .section-heading-spread {
    flex-direction: column;
  }

  .compose-section-tabs {
    flex-direction: column;
  }

  .compose-section-tab {
    width: 100%;
  }

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

  .attachment-slot {
    min-height: 210px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
