:root {
  --bg: #f7f2ea;
  --panel: rgba(255, 252, 248, 0.9);
  --panel-border: rgba(54, 38, 28, 0.1);
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #fffdf9;
  --text: #2d2017;
  --muted: #786150;
  --accent: #d25b2f;
  --accent-soft: rgba(210, 91, 47, 0.14);
  --success: #2a8252;
  --danger: #a63f36;
  --shadow: 0 20px 50px rgba(63, 43, 27, 0.12);
  font-family: "Aptos", "Yu Gothic UI", "Hiragino Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(210, 91, 47, 0.18), transparent 35%),
    radial-gradient(circle at bottom right, rgba(93, 157, 110, 0.16), transparent 30%),
    linear-gradient(160deg, #f9f5ef 0%, #f1e5d7 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  transition: transform 120ms ease, opacity 120ms ease;
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.page-shell {
  width: min(1560px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.hidden {
  display: none !important;
}

.panel {
  backdrop-filter: blur(18px);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  border-radius: 28px;
}

.topbar {
  margin-bottom: 24px;
  padding: 18px 22px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 16px;
  align-items: center;
}

.hero {
  padding: 24px 28px;
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
}

.hero-actions {
  display: grid;
  align-content: start;
  gap: 12px;
}

.info-panel {
  margin-top: 20px;
  padding: 20px 24px;
  display: grid;
  gap: 16px;
}

.auth-card {
  padding: 28px;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
  align-items: center;
}

.signin-box {
  min-height: 44px;
  display: grid;
  justify-content: start;
}

.auth-options {
  display: grid;
  gap: 18px;
}

.content-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(340px, 0.75fr);
  gap: 24px;
  align-items: start;
}

.main-panel {
  padding: 20px 24px;
}

.side-column {
  display: grid;
  gap: 24px;
}

.section-head,
.detail-card-head,
.user-meta,
.recipient-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.head-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filters,
.notification-form {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) repeat(3, minmax(140px, 0.6fr));
  gap: 12px;
}

.notification-form {
  grid-template-columns: 140px minmax(120px, 0.8fr) minmax(220px, 1.4fr) auto;
}

.shared-login-form {
  grid-template-columns: minmax(140px, 0.9fr) minmax(140px, 0.9fr) minmax(220px, 1.2fr) auto;
}

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

.field span {
  color: var(--muted);
  font-size: 0.85rem;
}

.field-small {
  min-width: 120px;
}

.table-shell {
  margin-top: 16px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid rgba(61, 43, 29, 0.08);
  border-radius: 20px;
  background: var(--surface);
}

.listing-table {
  width: 100%;
  min-width: 1160px;
  border-collapse: collapse;
}

.listing-table th,
.listing-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(61, 43, 29, 0.08);
  vertical-align: top;
  text-align: left;
}

.listing-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: rgba(248, 240, 231, 0.98);
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.sticky-col {
  position: sticky;
  z-index: 3;
  background: rgba(255, 252, 248, 0.98);
}

.listing-table thead .sticky-col {
  z-index: 5;
}

.sticky-col-1 {
  left: 0;
  min-width: 88px;
}

.sticky-col-2 {
  left: 88px;
  min-width: 170px;
}

.sticky-col-3 {
  left: 258px;
  min-width: 180px;
}

.listing-row:hover td {
  background: rgba(255, 255, 255, 0.55);
}

.listing-row.expanded td {
  background: rgba(210, 91, 47, 0.05);
}

.detail-row td {
  background: rgba(255, 249, 243, 0.96);
}

.detail-grid {
  display: grid;
  gap: 18px;
}

.detail-main {
  display: grid;
  gap: 14px;
}

.detail-actions,
.detail-meta,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.detail-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.detail-channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.detail-card,
.marketplace-card,
.feed-item,
.notice-card,
.recipient-card {
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(61, 43, 29, 0.08);
  border-radius: 20px;
  padding: 16px;
}

.detail-card {
  display: grid;
  gap: 12px;
}

.recipient-card,
.notice-card {
  margin-top: 12px;
}

.cell-stack,
.stack-list {
  display: grid;
  gap: 4px;
}

.title-cell {
  min-width: 340px;
}

.mono-cell {
  font-family: "Consolas", "Cascadia Mono", monospace;
  font-size: 0.9rem;
}

.subtext,
.support,
.card-label,
.eyebrow,
.empty,
.feed-item time,
.external-link {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h4,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.75rem, 3vw, 2.4rem);
}

h2 {
  font-size: clamp(1.18rem, 2vw, 1.5rem);
}

.hero-copy {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.6;
}

input,
select {
  border: 1px solid rgba(61, 43, 29, 0.12);
  background: var(--surface-strong);
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--text);
}

pre {
  margin: 0;
  padding: 14px;
  border-radius: 16px;
  background: rgba(250, 243, 234, 0.95);
  white-space: pre-wrap;
  line-height: 1.5;
}

.primary,
.secondary,
.ghost,
.tiny {
  border-radius: 999px;
  padding: 11px 16px;
}

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

.secondary {
  background: rgba(69, 48, 31, 0.1);
  color: var(--text);
}

.ghost,
.tiny {
  background: transparent;
  border: 1px solid rgba(61, 43, 29, 0.14);
  color: var(--text);
}

.tiny {
  padding: 8px 12px;
  font-size: 0.88rem;
}

.danger {
  color: var(--danger);
  border-color: rgba(166, 63, 54, 0.28);
}

.pill,
.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 600;
}

.pill {
  background: rgba(69, 48, 31, 0.08);
}

.pill.subtle {
  background: rgba(69, 48, 31, 0.05);
}

.status-chip {
  background: rgba(69, 48, 31, 0.08);
  color: var(--text);
}

.status-chip.published,
.status-chip.sent {
  background: rgba(42, 130, 82, 0.12);
  color: var(--success);
}

.status-chip.paused,
.status-chip.suppressed {
  background: rgba(120, 97, 80, 0.12);
  color: var(--muted);
}

.status-chip.sold {
  background: rgba(210, 91, 47, 0.12);
  color: var(--accent);
}

.status-chip.manual_action_required,
.status-chip.delivery_failed {
  background: rgba(166, 63, 54, 0.12);
  color: var(--danger);
}

.status-chip.draft_ready {
  background: rgba(84, 118, 171, 0.12);
  color: #305688;
}

.status-chip.disabled,
.status-chip.unsupported {
  background: rgba(61, 43, 29, 0.08);
  color: var(--muted);
}

.marketplace-grid,
.feed {
  display: grid;
  gap: 12px;
}

.draft-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.draft-details summary {
  cursor: pointer;
  color: var(--muted);
}

.draft-content {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}

.pagination {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 1180px) {
  .content-grid,
  .hero,
  .auth-card {
    grid-template-columns: 1fr;
  }

  .filters,
  .notification-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 14px;
  }

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

  .filters,
  .notification-form {
    grid-template-columns: 1fr;
  }

  .main-panel,
  .info-panel,
  .hero {
    padding: 18px;
  }

  .sticky-col,
  .listing-table thead th {
    position: static;
  }
}
