/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

:root {
  --ink: #112031;
  --muted: #5f6f84;
  --line: rgba(17, 32, 49, 0.12);
  --surface: rgba(255, 255, 255, 0.88);
  --accent: #d95d39;
  --success: #136f63;
  --danger: #b42318;
  --bg-top: #f6d8c8;
  --bg-bottom: #f4efe7;
  --shadow: 0 24px 80px rgba(17, 32, 49, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(217, 93, 57, 0.22), transparent 36%),
    radial-gradient(circle at bottom right, rgba(19, 111, 99, 0.18), transparent 32%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  min-height: 100vh;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  background: rgba(17, 32, 49, 0.08);
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 72px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
  gap: 24px;
  align-items: start;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
  color: var(--muted);
}

.hero h1,
.panel h2 {
  margin: 0;
  line-height: 1;
}

.hero h1 {
  font-size: clamp(2.7rem, 4vw, 4.6rem);
  max-width: 11ch;
}

.hero-copy,
.panel-heading p,
.muted,
.empty-state {
  color: var(--muted);
}

.hero-copy {
  max-width: 62ch;
  font-size: 1.08rem;
  line-height: 1.7;
  margin-top: 16px;
}

.status-card,
.panel,
.flash {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.status-card {
  padding: 22px;
}

.status-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.2rem;
}

.status-card p {
  margin: 0;
  line-height: 1.6;
}

.status-label {
  margin: 0 0 12px;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.is-ready {
  border-color: rgba(19, 111, 99, 0.22);
}

.is-warning {
  border-color: rgba(199, 119, 0, 0.26);
}

.flash {
  padding: 14px 18px;
  margin-bottom: 18px;
}

.flash-notice {
  border-left: 6px solid var(--success);
}

.flash-alert {
  border-left: 6px solid var(--danger);
}

.ghost-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.68);
  cursor: pointer;
}

.status-card-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
}

.status-card-actions-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-card-actions form {
  margin: 0;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.4fr);
  gap: 24px;
  margin-bottom: 24px;
}

.panel {
  padding: 28px;
}

.panel-wide {
  min-width: 0;
}

.panel-heading {
  margin-bottom: 22px;
}

.panel-heading h2 {
  font-size: 1.8rem;
  margin-bottom: 10px;
}

.panel-heading p {
  margin: 0;
  line-height: 1.6;
}

.panel-heading-inline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.panel-heading-spaced {
  margin-top: 28px;
}

.stacked-form {
  display: grid;
  gap: 18px;
}

.variant-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.variant-card {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.5);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field-compact {
  max-width: 180px;
}

label {
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
}

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

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(217, 93, 57, 0.6);
  box-shadow: 0 0 0 4px rgba(217, 93, 57, 0.14);
}

.primary-button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #ef8f54);
  color: #fffdf9;
  padding: 14px 20px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 16px 32px rgba(217, 93, 57, 0.24);
}

.secondary-tone {
  background: linear-gradient(135deg, #136f63, #2ea392);
  box-shadow: 0 16px 32px rgba(19, 111, 99, 0.22);
}

.error-box {
  background: rgba(180, 35, 24, 0.08);
  color: var(--danger);
  border: 1px solid rgba(180, 35, 24, 0.16);
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 18px;
}

.error-box p {
  margin: 0;
}

.error-box p + p {
  margin-top: 8px;
}

.info-box {
  background: rgba(17, 32, 49, 0.06);
  border: 1px solid rgba(17, 32, 49, 0.1);
  border-radius: 20px;
  padding: 16px 18px;
  margin-bottom: 18px;
}

.info-box strong,
.info-box p {
  margin: 0;
}

.info-box p {
  color: var(--muted);
  line-height: 1.6;
}

.info-box p + p {
  margin-top: 8px;
}

.info-box-inline {
  display: grid;
  gap: 4px;
}

.warmup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.warmup-grid p {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.52);
}

.warmup-grid span {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.field-note {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.preview-toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.email-preview {
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.6);
}

.email-preview-meta {
  display: grid;
  gap: 12px;
  padding: 18px 18px 0;
}

.email-preview-meta p {
  margin: 0;
}

.email-preview-meta span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.email-preview-frame {
  width: 100%;
  min-height: 420px;
  border: 0;
  display: block;
  background: #ffffff;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(540px, 100%);
  padding: 32px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 32px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.auth-card h1 {
  margin: 0;
  line-height: 1.1;
}

.auth-copy {
  color: var(--muted);
  line-height: 1.7;
  margin: 16px 0 24px;
}

.auth-form {
  margin-top: 16px;
}

.profile-dialog {
  width: min(920px, calc(100vw - 32px));
  border: 0;
  border-radius: 28px;
  padding: 28px;
  background: #fbf7f1;
  box-shadow: 0 32px 80px rgba(17, 32, 49, 0.28);
  max-height: calc(100vh - 32px);
  overflow: auto;
  z-index: 1000;
}

.profile-dialog[open] {
  position: fixed;
  inset: 0;
  margin: auto;
}

.profile-dialog::backdrop {
  background: rgba(17, 32, 49, 0.42);
}

.profile-dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.dialog-close-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.empty-state {
  color: var(--muted);
}

.profile-list {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.profile-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.55);
}

.profile-card.is-selected {
  border-color: rgba(217, 93, 57, 0.35);
  box-shadow: inset 0 0 0 1px rgba(217, 93, 57, 0.12);
}

.profile-card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}

.profile-card-head p,
.profile-meta-grid p {
  margin: 0;
}

.profile-link {
  color: var(--ink);
  font-weight: 700;
}

.profile-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.profile-meta-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.history-panel {
  overflow: hidden;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.badge-queued {
  background: rgba(17, 32, 49, 0.08);
}

.badge-sending {
  background: rgba(199, 119, 0, 0.14);
  color: #8d5700;
}

.badge-completed {
  background: rgba(19, 111, 99, 0.14);
  color: var(--success);
}

.badge-completed_with_errors {
  background: rgba(180, 35, 24, 0.12);
  color: var(--danger);
}

.campaign-last-error {
  margin: 10px 0 0;
  display: grid;
  gap: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.history-campaign-button {
  display: grid;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.history-campaign-button-title {
  font-weight: 700;
}

.history-campaign-button-note {
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 700;
}

.history-campaign-button:hover .history-campaign-button-title,
.history-campaign-button:focus-visible .history-campaign-button-title {
  color: var(--accent);
}

.campaign-errors {
  margin-top: 14px;
}

.campaign-errors summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 700;
}

.campaign-errors-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.campaign-error-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.6);
}

.campaign-error-card.is-credential {
  border-color: rgba(180, 35, 24, 0.18);
  background: rgba(180, 35, 24, 0.05);
}

.campaign-error-card.is-sent {
  border-color: rgba(19, 111, 99, 0.16);
  background: rgba(19, 111, 99, 0.05);
}

.campaign-error-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 8px;
}

.campaign-error-head strong {
  overflow-wrap: anywhere;
}

.campaign-error-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.error-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font-size: 0.76rem;
  font-weight: 700;
}

.error-chip.is-delivery {
  background: rgba(217, 93, 57, 0.12);
  color: var(--accent);
}

.error-chip.is-credential {
  background: rgba(180, 35, 24, 0.12);
  color: var(--danger);
}

.error-chip.is-sent {
  background: rgba(19, 111, 99, 0.14);
  color: var(--success);
}

.campaign-snippet {
  font-style: italic;
}

.status-note {
  margin: 8px 0 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

.status-note-danger {
  color: var(--danger);
}

@media (max-width: 980px) {
  .hero,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

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

  .preview-toolbar,
  .variant-grid,
  .warmup-grid {
    grid-template-columns: 1fr;
  }

  .profile-card-head,
  .profile-meta-grid {
    grid-template-columns: 1fr;
  }

  .profile-card-head {
    display: grid;
  }

  .field-compact {
    max-width: none;
  }

  .panel-heading-inline,
  .status-card-actions,
  .campaign-error-head {
    display: grid;
  }
}
