/* Cépaige host portal (#489, #501). The #480 prototype's PortalSignIn,
 * PortalShell and PortalDashboard (tag prototype-communities-480), rebuilt for
 * server-rendered templates. Tokens are the app's (mobile/src/index.css
 * @theme); none are new. Public CSS, served by WhiteNoise.
 */

:root {
  color-scheme: light;

  --color-bg: #FAF7F2;
  --color-surface-high: #F5EFE6;
  --color-border: #D9CCBE;
  --color-border-light: #E5DCCF;

  --color-text: #1A120A;
  --color-text-sec: #3E2E22;
  --color-text-muted: #5E4D40;

  --color-accent: #4A1020;
  --color-accent-bg: rgba(74, 16, 32, 0.07);
  --color-gold: #C8A96E;
  --color-gold-deep: #8C6F3B;
  --color-gold-bg: rgba(200, 169, 110, 0.10);

  --color-error-text: #8B1A1A;
  --color-error-bg: rgba(139, 26, 26, 0.06);

  --radius-card: 12px;
  --radius-control: 12px;

  --shadow-soft: 0 1px 3px rgba(26, 18, 10, 0.04), 0 0 0 1px rgba(217, 204, 190, 0.4);

  --font-display: 'Cormorant Garamond', serif;
  --font-body: 'DM Sans', sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
}

button,
input,
textarea {
  font-family: inherit;
}

a {
  color: var(--color-accent);
}

.tk-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--color-text-sec);
}

.tk-label-gold {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--color-gold-deep);
}

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

/* CompactWordmark at its default 22px. */
.wordmark {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 22px;
  letter-spacing: 0.05em;
  color: var(--color-accent);
  user-select: none;
}

.wordmark .gold {
  color: var(--color-gold);
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ---------- the sign-in column ---------- */

.portal-center {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
}

.portal-column {
  width: 100%;
  max-width: 420px;
}

.portal-column > .portal-brand {
  margin-bottom: 32px;
}

.portal-heading {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.005em;
  font-size: 32px;
  color: var(--color-accent);
  margin: 0 0 8px;
}

.portal-heading--sent {
  font-size: 30px;
}

.portal-intro {
  font-size: 14px;
  color: var(--color-text-muted);
  margin: 0 0 24px;
  line-height: 1.5;
}

.portal-body {
  font-size: 14px;
  color: var(--color-text-sec);
  margin: 0;
  line-height: 1.55;
}

.portal-icon {
  display: block;
  color: var(--color-accent);
  margin-bottom: 12px;
}

.field {
  display: block;
  margin-bottom: 20px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
}

.input {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-control);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface-high);
  font-size: 15px;
  color: var(--color-text);
  outline: none;
}

.input:focus {
  border-color: var(--color-accent);
}

.input[aria-invalid='true'] {
  border-color: var(--color-error-text);
}

.field-error {
  display: block;
  font-size: 12.5px;
  color: var(--color-error-text);
  margin-top: 6px;
}

.btn-primary {
  width: 100%;
  padding: 15px 16px;
  border: 0;
  border-radius: var(--radius-control);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.2px;
  background: var(--color-accent);
  color: var(--color-bg);
  cursor: pointer;
  transition: transform 100ms;
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-primary:focus-visible,
.link-button:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}

/* ---------- PortalShell ---------- */

.portal-shell {
  min-height: 100dvh;
  background: var(--color-bg);
}

.shell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--color-border-light);
}

.shell-account {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
  text-align: right;
}

.link-button {
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.link-button:hover {
  color: var(--color-accent);
}

.shell-body {
  margin: 0 auto;
  max-width: 1040px;
  padding: 32px;
}

.shell-main {
  max-width: 720px;
  margin: 0 auto;
}

/* ---------- the host pages (#501) ---------- */

.shell-main--wide {
  max-width: none;
}

.portal-body--spaced {
  margin-top: 12px;
}

.club-heading {
  margin-bottom: 24px;
}

.club-heading .tk-label-gold {
  margin-bottom: 4px;
}

.portal-title {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.005em;
  font-size: 36px;
  line-height: 1.1;
  color: var(--color-accent);
  margin: 0;
  overflow-wrap: anywhere;
}

.club-link {
  display: inline-block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}

.step {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--color-text-muted);
}

.card,
.dash-section {
  border-radius: var(--radius-card);
  background: var(--color-bg);
  box-shadow: var(--shadow-soft);
  padding: 24px;
  margin-bottom: 24px;
}

.section-label {
  margin: 0 0 16px;
}

.card-intro {
  font-size: 13.5px;
  color: var(--color-text-muted);
  margin: 0 0 12px;
  line-height: 1.5;
}

.card-foot {
  font-size: 12px;
  color: var(--color-text-muted);
  margin: 12px 0 0;
  line-height: 1.5;
}

.field--tight {
  margin-bottom: 12px;
}

.field-hint {
  display: block;
  font-size: 12.5px;
  color: var(--color-text-muted);
  margin-top: 6px;
}

.field-error--block {
  margin: 0 0 12px;
}

.input--area {
  resize: vertical;
  line-height: 1.45;
}

.input:disabled {
  opacity: 0.6;
}

.btn-primary--fit {
  width: auto;
  min-width: 200px;
}

.btn-link {
  display: inline-block;
  text-align: center;
  text-decoration: none;
}

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

.saved {
  font-size: 13.5px;
  color: var(--color-text-sec);
  margin: 12px 0 0;
}

.actions .saved {
  margin: 0;
}

.link-quiet {
  font-size: 14px;
  color: var(--color-text-muted);
}

.setup-footer {
  margin-top: 20px;
}

/* Grace and read-only notices: above everything, at every width. */
.notice {
  margin-bottom: 24px;
  border-radius: var(--radius-card);
  background: var(--color-gold-bg);
  border-left: 3px solid var(--color-gold);
  padding: 16px 20px;
}

.notice--read-only {
  background: var(--color-error-bg);
  border-left-color: var(--color-error-text);
}

.notice-title {
  font-size: 15px;
  color: var(--color-text);
  margin: 0 0 4px;
}

.notice-body {
  font-size: 14px;
  color: var(--color-text-sec);
  margin: 0;
  line-height: 1.5;
}

.page-error {
  margin: 0 0 24px;
  border-radius: var(--radius-card);
  background: var(--color-error-bg);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--color-error-text);
}

#invites-panel .page-error {
  margin: 12px 0 0;
}

.feedback {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  font-size: 14px;
}

.feedback-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-top: 1px solid var(--color-border-light);
}

.feedback-email {
  overflow-wrap: anywhere;
  color: var(--color-text);
}

.feedback-label {
  color: var(--color-text-sec);
  white-space: nowrap;
}

.feedback-row--muted .feedback-label {
  color: var(--color-text-muted);
}

.table {
  width: 100%;
  margin-top: 24px;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  text-align: left;
  padding-bottom: 8px;
}

.table td {
  padding: 12px 8px 12px 0;
  border-top: 1px solid var(--color-border-light);
  vertical-align: top;
  color: var(--color-text);
}

.cell-email {
  overflow-wrap: anywhere;
}

.cell-detail {
  display: block;
  font-size: 12.5px;
  color: var(--color-text-muted);
}

.table .cell-muted {
  color: var(--color-text-muted);
}

.cell-sec {
  color: var(--color-text-sec);
}

.status-expired {
  color: var(--color-error-text);
}

.cell-actions {
  text-align: right;
  white-space: nowrap;
}

.cell-actions form {
  display: inline;
}

.link-action {
  background: transparent;
  border: 0;
  padding: 0;
  margin-left: 12px;
  font: inherit;
  font-size: 13px;
  color: var(--color-accent);
  text-decoration: underline;
  cursor: pointer;
}

.link-action--muted {
  color: var(--color-text-muted);
}

.badge-inactive {
  color: var(--color-text-muted);
}

.confirm {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px 12px;
  white-space: normal;
}

.cell-actions .confirm {
  display: inline-flex;
}

.confirm-text {
  font-size: 13px;
  color: var(--color-text-sec);
  text-align: right;
}

.btn-danger {
  background: var(--color-error-text);
  color: var(--color-bg);
  border: 0;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}

.link-action:focus-visible,
.btn-danger:focus-visible,
.dash-tab:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}

/* Layout A below 1024px: no nav, every section stacked (invites, members,
 * club details). Layout B from 1024px: a side nav working as tabs, one section
 * at a time, each at its own URL. */
.dash-nav {
  display: none;
}

.dash-tab {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--color-text-sec);
  text-decoration: none;
}

.dash-tab[aria-current='page'] {
  background: var(--color-accent-bg);
  color: var(--color-accent);
  font-weight: 600;
}

@media (min-width: 1024px) {
  .dash {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 40px;
    align-items: start;
  }

  .dash-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .dash-section:not(.is-current) {
    display: none;
  }
}

@media (max-width: 1023px) {
  .shell-main--wide {
    max-width: 720px;
  }
}

@media (max-width: 480px) {
  .shell-header {
    padding: 16px 20px;
  }

  .shell-body {
    padding: 24px 20px;
  }

  .card,
  .dash-section {
    padding: 20px 16px;
  }

  .btn-primary--fit {
    width: 100%;
  }

  .table td {
    display: block;
    border-top: 0;
    padding: 2px 0;
  }

  .table tr {
    display: block;
    padding: 10px 0;
    border-top: 1px solid var(--color-border-light);
  }

  .table thead {
    display: none;
  }

  .cell-actions {
    text-align: left;
  }

  .link-action {
    margin: 0 12px 0 0;
  }

  .confirm {
    justify-content: flex-start;
  }

  .confirm-text {
    text-align: left;
  }
}
