:root {
  --paper: #F4F0E7;
  --paper-sage: #DCE5D9;
  --card: #FDFBF6;
  --card-soft: #F7F4EC;
  --ink: #1F2621;
  --ink-soft: #546158;
  --rule: #DFD8CA;
  --rule-strong: #C9C1B1;
  --accent: #4E7255;
  --accent-hover: #3D5C43;
  --accent-italic: #4E667A;
  --gold: #A97A2B;
  --hl-yellow: #FFF8DC;
  --hl-yellow-bd: #DFC770;
  --hl-blue: #E3F0FF;
  --hl-blue-bd: #9DC1EE;
  --hl-green: #E6F7EE;
  --hl-green-bd: #9BD7B6;
  --hl-pink: #FDE4EC;
  --hl-pink-bd: #ECA4BA;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.is-hidden {
  display: none !important;
}

h1, h2, h3, .card-title, .lead, .band-sub, .editorial-headline, .brand-name {
  text-wrap: balance;
}

/* Auth Stage: zero visible topbar, warm editorial cream-to-sage atmosphere */
body.is-auth-mode {
  background: var(--paper);
  min-height: 100dvh;
}

body.is-auth-mode .topbar {
  display: none !important;
}

body.is-auth-mode .main-wrap {
  max-width: none;
  padding: 0;
  margin: 0;
}

.auth-stage {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 28px;
  background: radial-gradient(ellipse 85% 75% at 15% 15%, #F6F1E6 0%, #EDE9DC 44%, var(--paper-sage) 100%);
}

/* Delicate architectural corner framing in ::before so .auth-layout needs zero stacking context */
.auth-stage::before {
  content: "";
  position: fixed;
  inset: 22px;
  pointer-events: none;
  background:
    linear-gradient(var(--rule-strong), var(--rule-strong)) top left / 48px 1px no-repeat,
    linear-gradient(var(--rule-strong), var(--rule-strong)) top left / 1px 48px no-repeat,
    linear-gradient(var(--rule-strong), var(--rule-strong)) top right / 48px 1px no-repeat,
    linear-gradient(var(--rule-strong), var(--rule-strong)) top right / 1px 48px no-repeat,
    linear-gradient(var(--rule-strong), var(--rule-strong)) bottom left / 48px 1px no-repeat,
    linear-gradient(var(--rule-strong), var(--rule-strong)) bottom left / 1px 48px no-repeat,
    linear-gradient(var(--rule-strong), var(--rule-strong)) bottom right / 48px 1px no-repeat,
    linear-gradient(var(--rule-strong), var(--rule-strong)) bottom right / 1px 48px no-repeat;
}

.auth-layout {
  width: 100%;
  max-width: 1060px;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 440px);
  align-items: center;
  gap: 64px;
}

.auth-editorial {
  min-width: 0;
}

.crest-stage {
  width: 112px;
  height: 112px;
  margin-bottom: 22px;
}

.crest-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  mix-blend-mode: multiply;
}

.editorial-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
  text-transform: uppercase;
  margin-bottom: 16px;
}

.eyebrow-rule {
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--rule-strong);
  flex-shrink: 0;
}

.editorial-headline {
  margin: 0 0 22px;
  font-family: "EB Garamond", Georgia, serif;
  font-weight: 500;
  font-size: clamp(32px, 4.2vw, 54px);
  line-height: 1.07;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.serif-accent {
  font-style: italic;
  font-weight: 500;
  color: var(--accent-italic);
}

.editorial-divider {
  width: 44px;
  height: 2px;
  background: var(--gold);
  opacity: 0.72;
  margin-bottom: 20px;
}

.editorial-points {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 46ch;
}

.editorial-points li {
  position: relative;
  padding-left: 22px;
  font-size: 14.5px;
  color: var(--ink-soft);
}

.editorial-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}

.auth-card-col {
  width: 100%;
  max-width: 440px;
  justify-self: center;
}

.auth-card {
  background: var(--card);
  border: 1px solid rgba(31, 38, 33, 0.06);
  border-radius: 20px;
  padding: 40px 38px 36px;
  box-shadow:
    0 1px 2px rgba(27, 47, 30, 0.04),
    0 10px 26px rgba(27, 47, 30, 0.07),
    0 32px 64px rgba(27, 47, 30, 0.11);
}

.card-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--ink-soft);
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 8px;
}

.card-title {
  margin: 0 0 10px;
  font-family: "EB Garamond", Georgia, serif;
  font-weight: 500;
  font-size: 32px;
  line-height: 1.15;
  color: var(--ink);
  text-align: center;
}

.lead {
  margin: 0 0 24px;
  color: var(--ink-soft);
  font-size: 14.5px;
  line-height: 1.5;
  text-align: center;
}

.field-group {
  margin-bottom: 16px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 7px;
}

.field-input {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid #C6CCBE;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: var(--card);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

textarea.field-input {
  min-height: 110px;
  resize: vertical;
}

.field-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(78, 114, 85, 0.18);
}

.pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.pw-input {
  padding-right: 68px;
}

.pw-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pw-toggle:hover {
  color: var(--ink);
  background: rgba(31, 38, 33, 0.05);
}

.pw-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.auth-caption {
  margin: 16px 0 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-soft);
}

/* Authenticated Workspace Topbar */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 22px;
}

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 70px;
  padding-top: 10px;
  padding-bottom: 10px;
  flex-wrap: wrap;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-copy {
  min-width: 0;
}

.brand-name {
  font-family: "EB Garamond", Georgia, serif;
  font-weight: 600;
  font-size: 23px;
  line-height: 1.15;
  color: var(--ink);
}

.brand-sub {
  font-size: 12.5px;
  color: var(--ink-soft);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.env-pill,
.user-pill,
.pill-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.env-pill {
  background: var(--card-soft);
  color: var(--ink-soft);
  border: 1px solid var(--rule);
}

.user-pill {
  background: var(--hl-green);
  color: #0F5132;
  border: 1px solid var(--hl-green-bd);
}

.pill-teal { background: #E4EFE6; color: #2D4D35; border: 1px solid #C0D8C4; }
.pill-green { background: var(--hl-green); color: #0F5132; border: 1px solid var(--hl-green-bd); }
.pill-blue { background: var(--hl-blue); color: #0F2B5B; border: 1px solid var(--hl-blue-bd); }
.pill-yellow { background: var(--hl-yellow); color: #543D00; border: 1px solid var(--hl-yellow-bd); }
.pill-pink { background: var(--hl-pink); color: #7C1334; border: 1px solid var(--hl-pink-bd); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--rule-strong);
  background: var(--card);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease);
}

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

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: #FDFBF6;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-subtle {
  background: var(--card-soft);
  min-height: 40px;
  padding: 7px 13px;
  font-size: 13px;
}

.btn-full {
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  font-size: 15px;
}

.form-msg {
  margin-top: 12px;
  margin-bottom: 6px;
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
}

.form-msg.is-error {
  background: var(--hl-pink);
  color: #7C1334;
  border: 1px solid var(--hl-pink-bd);
}

.form-msg.is-ok {
  background: var(--hl-green);
  color: #0F5132;
  border: 1px solid var(--hl-green-bd);
}

/* Dashboard Bands */
.main-wrap {
  padding-top: 28px;
  padding-bottom: 64px;
}

.band {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 18px;
  padding: 28px 30px;
  margin-bottom: 22px;
  box-shadow: 0 2px 10px rgba(27, 47, 30, 0.04);
}

.band-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.band-head h1 {
  margin: 0 0 6px;
  font-family: "EB Garamond", Georgia, serif;
  font-weight: 500;
  font-size: 32px;
  line-height: 1.15;
  color: var(--ink);
}

.band-head h2 {
  margin: 0 0 5px;
  font-family: "EB Garamond", Georgia, serif;
  font-weight: 500;
  font-size: 26px;
  line-height: 1.2;
  color: var(--ink);
}

.band-sub {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14.5px;
  max-width: 68ch;
}

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

.hl-box {
  padding: 15px 17px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.hl-box strong {
  display: block;
  margin-bottom: 4px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hl-yellow { background: var(--hl-yellow); border: 1px solid var(--hl-yellow-bd); color: #3D2D00; }
.hl-blue { background: var(--hl-blue); border: 1px solid var(--hl-blue-bd); color: #0F2B5B; }
.hl-green { background: var(--hl-green); border: 1px solid var(--hl-green-bd); color: #0F5132; }
.hl-pink { background: var(--hl-pink); border: 1px solid var(--hl-pink-bd); color: #7C1334; }

.chart-card {
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 10px;
  background: var(--card);
  overflow-x: auto;
}

.chart-card svg {
  width: 100%;
  min-width: 680px;
  height: auto;
  display: block;
}

.mobile-flow-stack {
  display: none;
  flex-direction: column;
  gap: 8px;
}

.flow-step {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
}

.flow-step strong {
  display: block;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.flow-y { background: var(--hl-yellow); border: 1px solid var(--hl-yellow-bd); color: #3D2D00; }
.flow-b { background: var(--hl-blue); border: 1px solid var(--hl-blue-bd); color: #0F2B5B; }
.flow-m { background: #FAF7F4; border: 1px solid #D5C6CF; color: #3C0219; }
.flow-g { background: var(--hl-green); border: 1px solid var(--hl-green-bd); color: #0F5132; }

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

.update-card {
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 17px 18px;
  background: var(--card-soft);
}

.update-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
  font-size: 12.5px;
  color: var(--ink-soft);
  font-weight: 600;
}

.update-card h3 {
  margin: 0 0 6px;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ink);
}

.update-card p {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-soft);
}

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

.ad-card {
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 18px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.ad-img-wrap {
  background: var(--card-soft);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--rule);
}

.ad-img-wrap img {
  width: 100%;
  height: auto;
  display: block;
}

.ad-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ad-card h3 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 600;
  color: var(--ink);
}

.copy-pre {
  background: var(--card-soft);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.ad-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.two-col-band {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

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

.kv-list,
.links-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kv-row,
.link-row {
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--card-soft);
  font-size: 13.5px;
}

.kv-row strong {
  display: block;
  color: var(--ink);
}

.kv-row span {
  color: var(--ink-soft);
}

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

.link-row > div {
  flex: 1 1 auto;
  min-width: 0;
}

.link-row .btn {
  flex-shrink: 0;
}

.feedback-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 22px;
}

.feedback-form {
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 20px;
  background: var(--card-soft);
}

.feedback-form .field-label {
  margin-top: 12px;
}

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

.feedback-feed-wrap h3 {
  margin: 0 0 12px;
  font-family: "EB Garamond", Georgia, serif;
  font-weight: 500;
  font-size: 22px;
  color: var(--ink);
}

.feedback-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fb-item {
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--card);
}

.fb-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.fb-item-note {
  margin: 6px 0;
  font-size: 14px;
  white-space: pre-wrap;
}

.fb-item-meta {
  font-size: 12px;
  color: var(--ink-soft);
}

.slack-box,
.invite-preview-box {
  margin-top: 14px;
  border: 1px solid var(--hl-blue-bd);
  background: var(--hl-blue);
  border-radius: 12px;
  padding: 14px;
}

.slack-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.slack-pre {
  margin: 0;
  padding: 12px;
  background: var(--card);
  border-radius: 8px;
  border: 1px solid #C8D9EE;
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-word;
}

.muted {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13.5px;
}

.hub-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 6px 4px 0;
  font-size: 13px;
  color: var(--ink-soft);
}

@media (max-width: 959px) {
  .auth-stage {
    align-items: flex-start;
    padding: 32px 18px 44px;
  }

  .auth-stage::before {
    inset: 12px;
  }

  .auth-layout {
    grid-template-columns: 1fr;
    gap: 24px;
    max-width: 440px;
  }

  .auth-editorial {
    text-align: center;
  }

  .crest-stage {
    width: 82px;
    height: 82px;
    margin: 0 auto 14px;
  }

  .editorial-eyebrow {
    font-size: 10px;
    letter-spacing: 0.14em;
    gap: 8px;
    margin-bottom: 10px;
  }

  .eyebrow-rule {
    width: 16px;
  }

  .editorial-headline {
    font-size: 31px;
    line-height: 1.1;
    margin-bottom: 0;
  }

  .editorial-divider,
  .editorial-points {
    display: none;
  }

  .auth-card {
    padding: 28px 22px 26px;
    border-radius: 18px;
  }

  .card-title {
    font-size: 28px;
  }

  .highlight-grid,
  .updates-grid,
  .ads-grid,
  .two-col-band,
  .feedback-layout {
    grid-template-columns: 1fr;
  }

  .band {
    padding: 20px 18px;
    border-radius: 14px;
  }

  .band-head h1 {
    font-size: 26px;
  }

  .band-head h2 {
    font-size: 22px;
  }
}

@media (max-width: 760px) {
  .chart-card svg {
    display: none;
  }

  .mobile-flow-stack {
    display: flex;
  }

  .topbar-inner {
    gap: 10px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .brand-name {
    font-size: 20px;
  }

  .topbar-actions {
    width: 100%;
    gap: 6px;
  }
}

@media (max-width: 520px) {
  .auth-stage::before {
    display: none;
  }
}
