:root {
  --bg: #f4efe6;
  --bg-accent: rgba(205, 120, 67, 0.22);
  --panel: rgba(255, 250, 241, 0.88);
  --panel-border: rgba(62, 47, 35, 0.12);
  --text: #2f261f;
  --muted: #6f5f53;
  --primary: #b6502f;
  --primary-strong: #8f3f25;
  --success: #1f6b4f;
  --warning: #9c6a11;
  --danger: #9a2f2f;
  --shadow: 0 18px 40px rgba(84, 53, 33, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at top left, var(--bg-accent), transparent 28%),
    linear-gradient(180deg, #fbf7f0 0%, var(--bg) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(47, 38, 31, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 38, 31, 0.04) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.25), transparent 80%);
  pointer-events: none;
}

.page-shell {
  position: relative;
  max-width: 1320px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.hero {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 700;
}

.hero h1,
.panel h2 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-weight: 700;
  line-height: 1.02;
}

.hero h1 {
  font-size: clamp(2.6rem, 5vw, 4.8rem);
  max-width: 10ch;
}

.hero-copy {
  margin: 18px 0 0;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--muted);
}

.hero-session {
  min-width: 220px;
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 249, 241, 0.78);
  border: 1px solid rgba(47, 38, 31, 0.1);
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.session-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.auth-shell {
  display: grid;
  min-height: calc(100vh - 96px);
  place-items: center;
}

.auth-panel {
  width: min(560px, 100%);
}

.auth-eyebrow {
  margin-bottom: 20px;
}

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

.panel {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 24px;
  backdrop-filter: blur(12px);
}

.panel::after {
  content: "";
  position: absolute;
  inset: auto -40px -50px auto;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(182, 80, 47, 0.14), transparent 68%);
  pointer-events: none;
}

.wide {
  grid-column: 1 / -1;
}

.panel-head {
  margin-bottom: 18px;
}

.panel-head p,
.hint {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.stack {
  display: grid;
  gap: 14px;
}

.compact-stack {
  gap: 10px;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 600;
}

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

input,
select {
  width: 100%;
  border: 1px solid rgba(47, 38, 31, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  padding: 13px 14px;
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(182, 80, 47, 0.6);
  box-shadow: 0 0 0 4px rgba(182, 80, 47, 0.14);
  transform: translateY(-1px);
}

.checkbox-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.checkbox input {
  width: 18px;
  height: 18px;
  margin: 0;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, opacity 140ms ease;
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.primary {
  color: #fff5ef;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
}

.secondary {
  color: var(--text);
  background: rgba(47, 38, 31, 0.08);
}

.danger {
  color: #fff5ef;
  background: linear-gradient(135deg, #b74444 0%, #8f3030 100%);
}

.ghost {
  padding: 0;
  background: transparent;
  color: var(--primary-strong);
  border-radius: 0;
}

.ghost:hover {
  transform: none;
  text-decoration: underline;
}

.auth-nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.auth-actions {
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

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

.security-card {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(47, 38, 31, 0.08);
  border-radius: 18px;
  padding: 18px;
}

.security-card h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.cards {
  display: grid;
  gap: 14px;
}

.compact {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.card {
  position: relative;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(47, 38, 31, 0.08);
  border-radius: 18px;
  padding: 18px;
}

.card-header,
.card-actions,
.meta-row,
.status-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.card-header h3,
.card h4 {
  margin: 0;
  font-size: 1rem;
}

.badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badge {
  background: rgba(182, 80, 47, 0.12);
  color: var(--primary-strong);
}

.status-pill.delivered {
  background: rgba(31, 107, 79, 0.14);
  color: var(--success);
}

.status-pill.received {
  background: rgba(156, 106, 17, 0.14);
  color: var(--warning);
}

.status-pill.failed,
.status-pill.rejected {
  background: rgba(154, 47, 47, 0.14);
  color: var(--danger);
}

.card p,
.card li,
.code-block {
  color: var(--muted);
  line-height: 1.55;
}

.meta-row {
  margin-top: 10px;
  font-size: 0.88rem;
}

.code-block {
  margin: 12px 0 0;
  padding: 12px;
  background: #2a221d;
  color: #f7ede6;
  border-radius: 14px;
  overflow: auto;
  font-family: "SFMono-Regular", "Menlo", "Monaco", monospace;
  font-size: 0.84rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.setup-list {
  margin: 12px 0 0;
  padding-left: 18px;
}

.setup-list li + li {
  margin-top: 8px;
}

.empty {
  padding: 18px;
  border: 1px dashed rgba(47, 38, 31, 0.14);
  border-radius: 16px;
  color: var(--muted);
}

.status-banner {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(380px, calc(100vw - 48px));
  padding: 14px 16px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  background: #2f261f;
  color: #fff9f3;
  z-index: 10;
}

.status-banner.error {
  background: #6b1f1f;
}

.status-banner.success {
  background: #214a39;
}

.hidden {
  display: none;
}

@media (max-width: 980px) {
  .hero {
    flex-direction: column;
  }

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

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

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

@media (max-width: 640px) {
  .page-shell {
    padding: 28px 16px 80px;
  }

  .panel {
    padding: 20px;
    border-radius: 20px;
  }
}
