/* Portal (login + dashboards) — Greenwich ocean blue, light-first
   Dark mode via [data-theme="dark"] on html/body (tokens in app.css)
   ========================================================================== */

.portal {
  --p-ink: var(--ink);
  --p-muted: var(--ink-2);
  --p-line: var(--line-light);
  --p-surface: var(--card);
  --p-soft: rgba(26, 86, 181, 0.06);
  --p-accent: var(--lime);

  min-height: 100vh;
  background:
    radial-gradient(1000px 520px at 8% -8%, rgba(43, 111, 212, 0.12), transparent 55%),
    radial-gradient(800px 480px at 100% 0%, rgba(197, 218, 247, 0.45), transparent 50%),
    linear-gradient(180deg, #f8fafd 0%, var(--paper) 45%, #e6eef9 100%);
  color: var(--p-ink);
}

.portal-main {
  width: min(1120px, calc(100% - 2 * var(--gutter)));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.portal-main--auth {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.portal-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--p-line);
  color: var(--p-ink);
}

.portal-nav__inner {
  width: min(1120px, calc(100% - 2 * var(--gutter)));
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.85rem 0;
  flex-wrap: wrap;
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-right: auto;
  color: var(--p-ink);
}

.portal-brand__logo .gw-brand__img {
  height: 2.85rem;
  width: auto;
}

.portal-brand__mark {
  width: auto;
  height: auto;
  display: grid;
  place-items: center;
  border-radius: 0;
  background: transparent;
  color: var(--p-ink);
  font-weight: 700;
}

.portal-brand strong { display: block; line-height: 1.1; }
.portal-brand small { color: var(--p-muted); }

.portal-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.portal-links a {
  color: var(--p-muted);
  font-size: 0.95rem;
}

.portal-links a:hover { color: var(--p-accent); }

.portal-user {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--p-ink);
}

.portal-user strong { display: block; font-size: 0.92rem; }
.portal-user small { color: var(--p-muted); font-size: 0.78rem; }
.portal-logout { padding: 0.45rem 0.8rem; font-size: 0.85rem; }

.portal-page__head {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-end;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.portal-page .eyebrow {
  color: var(--moss);
}

.portal-page h1 {
  margin: 0.2rem 0 0.4rem;
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.1;
  color: var(--p-ink);
}

.portal-page__lead {
  margin: 0;
  color: var(--p-muted);
  max-width: 38rem;
}

.portal-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.85rem;
}

.portal-section-head h2,
.portal-page h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  color: var(--p-ink);
}

.portal-section-head a,
.text-link {
  color: var(--p-accent);
  font-weight: 600;
}

.stat-pill,
.stat-card {
  background: var(--card);
  border: 1px solid var(--p-line);
  border-radius: 18px;
  padding: 1rem 1.25rem;
  color: var(--p-ink);
  box-shadow: 0 12px 32px rgba(1, 3, 60, 0.06);
}

.stat-pill span,
.stat-card span {
  display: block;
  color: var(--p-muted);
  font-size: 0.85rem;
}

.stat-pill strong,
.stat-card strong {
  font-family: var(--font-serif);
  font-size: 2rem;
  color: var(--p-accent);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.portal-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 1.75rem;
}

@media (max-width: 860px) {
  .portal-grid { grid-template-columns: 1fr; }
}

.event-rows,
.ledger-list,
.demo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.event-rows li,
.ledger-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  background: var(--p-surface);
  border: 1px solid var(--p-line);
  box-shadow: 0 1px 0 rgba(1, 3, 60, 0.03);
}

.event-rows strong {
  display: block;
  color: var(--p-ink);
}

.event-rows span,
.ledger-list span,
.muted {
  color: var(--p-muted);
  font-size: 0.9rem;
}

.event-rows__actions {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--p-line);
  background: var(--p-soft);
  font-size: 0.8rem;
  color: var(--p-muted);
}

.tag--ok {
  color: #123a8a;
  background: rgba(26, 86, 181, 0.16);
  border-color: transparent;
}

.portal-flash {
  padding: 0.85rem 1rem;
  border-radius: 14px;
  margin-bottom: 1rem;
}

.portal-flash--ok {
  background: rgba(26, 86, 181, 0.12);
  color: #123a8a;
}

.portal-flash--error {
  background: rgba(180, 70, 55, 0.1);
  color: #9a3d32;
}

/* Auth — light composition, soft photo wash
   ========================================================================== */

.auth {
  position: relative;
  isolation: isolate;
  min-height: 100dvh;
  display: grid;
  color: var(--ink);
  overflow: clip;
}

.auth__media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.auth__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  transform: scale(1.04);
}

.auth__veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(105deg, rgba(244, 247, 252, 0.96) 0%, rgba(244, 247, 252, 0.88) 40%, rgba(232, 240, 252, 0.55) 70%, rgba(232, 240, 252, 0.7) 100%),
    radial-gradient(900px 500px at 80% 20%, rgba(43, 111, 212, 0.14), transparent 55%);
}

.auth__shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 2 * var(--gutter)));
  margin: 0 auto;
  padding: 1.4rem 0 3rem;
  display: flex;
  flex-direction: column;
  gap: clamp(2rem, 6vh, 3.5rem);
  min-height: 100dvh;
}

.auth__brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.auth__logo {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
}

.auth__lockup .gw-brand__img {
  height: 4.25rem;
  width: auto;
}

.auth__mark {
  width: auto;
  height: auto;
  display: grid;
  place-items: center;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
}

.auth__mark .icon {
  width: 1.25rem;
  height: 1.25rem;
}

.auth__name {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  line-height: 1;
}

.auth__home {
  color: var(--ink-2);
  font-size: 0.92rem;
  border-bottom: 1px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.auth__home:hover {
  color: var(--lime);
  border-color: rgba(26, 86, 181, 0.35);
}

.auth__grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
}

.auth__intro {
  max-width: 34rem;
  animation: auth-rise 0.7s var(--ease-out) both;
}

.auth__title {
  margin: 0.55rem 0 1rem;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  text-wrap: balance;
  color: var(--ink);
}

.auth__title-line {
  display: block;
}

.auth__title-line--em {
  color: var(--lime);
  font-style: italic;
}

.auth__lead {
  margin: 0;
  max-width: 28rem;
  color: var(--ink-2);
  font-size: 1.05rem;
  line-height: 1.55;
}

.auth__assurances {
  list-style: none;
  margin: 1.75rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.1rem;
}

.auth__assurances li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink-2);
  font-size: 0.9rem;
}

.auth__assurances .icon {
  width: 1rem;
  height: 1rem;
  color: var(--lime);
}

.auth__card {
  background: var(--card);
  color: var(--ink);
  border-radius: 28px;
  border: 1px solid rgba(1, 3, 60, 0.08);
  box-shadow:
    0 30px 80px rgba(1, 3, 60, 0.12),
    0 2px 0 rgba(255, 255, 255, 0.65) inset;
  animation: auth-rise 0.75s var(--ease-out) 0.08s both;
}

.auth__card-core {
  padding: clamp(1.25rem, 2.5vw, 1.75rem);
  display: grid;
  gap: 1.15rem;
}

.auth__card-head h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.auth__card-head p {
  margin: 0.35rem 0 0;
  color: var(--ink-2);
  font-size: 0.92rem;
}

.auth__error {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  background: rgba(180, 70, 55, 0.1);
  color: #9a3d32;
  font-size: 0.92rem;
}

.auth__error .icon {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.auth__form {
  display: grid;
  gap: 0.85rem;
}

.auth__field {
  display: grid;
  gap: 0.4rem;
}

.auth__field > span {
  color: var(--ink-2);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.auth__field input {
  width: 100%;
  border: 1px solid rgba(1, 3, 60, 0.12);
  background: #fff;
  color: var(--ink);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  font: inherit;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.auth__field input::placeholder {
  color: rgba(1, 3, 60, 0.35);
}

.auth__field input:hover {
  border-color: rgba(1, 3, 60, 0.22);
}

.auth__field input:focus {
  outline: none;
  border-color: rgba(26, 86, 181, 0.55);
  box-shadow: 0 0 0 3px rgba(43, 111, 212, 0.18);
}

.auth__submit {
  width: 100%;
  justify-content: center;
  margin-top: 0.25rem;
}

.auth__demo {
  border-top: 1px solid var(--p-line);
  padding-top: 1rem;
  display: grid;
  gap: 0.75rem;
}

.auth__demo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--ink-2);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth__demo-head code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--lime);
  background: rgba(26, 86, 181, 0.1);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}

.auth__demo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
  max-height: min(280px, 36vh);
  overflow: auto;
  padding-right: 0.15rem;
}

.auth__demo-btn {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  text-align: left;
  border: 1px solid transparent;
  background: var(--p-soft);
  color: var(--ink);
  border-radius: 14px;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.auth__demo-btn:hover {
  background: rgba(26, 86, 181, 0.12);
  border-color: rgba(26, 86, 181, 0.2);
}

.auth__demo-btn:active {
  transform: scale(0.985);
}

.auth__demo-avatar {
  width: 2.15rem;
  height: 2.15rem;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.95rem;
}

.auth__demo-meta {
  min-width: 0;
  display: grid;
}

.auth__demo-meta strong {
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth__demo-meta small {
  color: var(--ink-2);
  font-size: 0.78rem;
}

.auth__demo-go {
  color: var(--ink-2);
  display: grid;
  place-items: center;
  transition: color 0.2s var(--ease), transform 0.2s var(--ease);
}

.auth__demo-go .icon {
  width: 1rem;
  height: 1rem;
}

.auth__demo-btn:hover .auth__demo-go {
  color: var(--lime);
  transform: translateX(2px);
}

@keyframes auth-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 920px) {
  .auth__grid {
    grid-template-columns: 1fr;
    align-items: stretch;
    padding-bottom: 1rem;
  }

  .auth__intro { max-width: none; }

  .auth__title {
    font-size: clamp(2.2rem, 9vw, 3rem);
  }

  .auth__demo-list { max-height: none; }
}

@media (max-width: 560px) {
  .auth__shell {
    padding-top: 1rem;
    gap: 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth__intro,
  .auth__card {
    animation: none;
  }
}

.admin-form,
.checkin-form,
.qr-live__board {
  background: var(--p-surface);
  border: 1px solid var(--p-line);
  border-radius: 24px;
  padding: 1.5rem;
  box-shadow: 0 1px 0 rgba(1, 3, 60, 0.03);
}

.checkin-form,
.admin-form {
  display: grid;
  gap: 0.9rem;
  margin-top: 1rem;
}

.checkin-form label,
.admin-form label {
  display: grid;
  gap: 0.35rem;
}

.checkin-form span,
.admin-form span {
  color: var(--p-muted);
  font-size: 0.88rem;
}

.checkin-form input,
.admin-form input,
.admin-form textarea,
.admin-form select {
  width: 100%;
  border: 1px solid rgba(1, 3, 60, 0.12);
  background: #fff;
  color: var(--p-ink);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  font: inherit;
}

.checkin-form input:focus,
.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus {
  outline: none;
  border-color: rgba(26, 86, 181, 0.5);
  box-shadow: 0 0 0 3px rgba(43, 111, 212, 0.16);
}

.admin-form__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.admin-form__grid .span-2 { grid-column: span 2; }

@media (max-width: 700px) {
  .admin-form__grid,
  .admin-form__grid .span-2 {
    grid-column: auto;
    grid-template-columns: 1fr;
  }
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.meta-grid dt {
  color: var(--p-muted);
  font-size: 0.85rem;
}

.meta-grid dd {
  margin: 0.2rem 0 0;
  color: var(--p-ink);
}

.portal-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.qr-live {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.qr-live__board {
  text-align: center;
  background: var(--blue-100);
  border-color: rgba(26, 86, 181, 0.15);
}

.qr-live__code {
  display: grid;
  place-items: center;
  min-height: 220px;
  margin: 1rem auto;
  background: #fff;
  width: fit-content;
  padding: 0.75rem;
  border-radius: 16px;
}

.qr-live__token {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  letter-spacing: 0.18em;
  color: var(--lime);
  margin: 0.4rem 0;
}

.break-all { word-break: break-all; }
.plus { color: var(--lime); }

.portal-page .btn--ghost,
.portal-main:not(.portal-main--auth) .btn--ghost,
.portal-nav .btn--ghost {
  color: var(--ink);
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(1, 3, 60, 0.14);
}

.portal-page .btn--ghost:hover,
.portal-main:not(.portal-main--auth) .btn--ghost:hover,
.portal-nav .btn--ghost:hover {
  background: rgba(1, 3, 60, 0.04);
}

.portal-page .btn--dark,
.portal-main:not(.portal-main--auth) .btn--dark {
  background: var(--blue-950);
  color: var(--on-accent);
}

.portal-auth-tools {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

/* Portal dark mode — full cover */
html[data-theme="dark"] .portal {
  background:
    radial-gradient(1000px 520px at 8% -8%, rgba(43, 111, 212, 0.16), transparent 55%),
    radial-gradient(800px 480px at 100% 0%, rgba(10, 26, 92, 0.45), transparent 50%),
    linear-gradient(180deg, #050816 0%, var(--paper) 45%, #040712 100%);
}

html[data-theme="dark"] .portal-nav {
  background: rgba(8, 12, 28, 0.9);
  border-bottom-color: rgba(238, 243, 255, 0.08);
}

html[data-theme="dark"] .auth__field input,
html[data-theme="dark"] .checkin-form input,
html[data-theme="dark"] .admin-form input,
html[data-theme="dark"] .admin-form textarea,
html[data-theme="dark"] .admin-form select {
  background: rgba(238, 243, 255, 0.05);
  color: var(--ink);
  border-color: rgba(238, 243, 255, 0.14);
}

html[data-theme="dark"] .auth__field input::placeholder {
  color: rgba(238, 243, 255, 0.35);
}

html[data-theme="dark"] .auth__field input:hover,
html[data-theme="dark"] .checkin-form input:hover,
html[data-theme="dark"] .admin-form input:hover,
html[data-theme="dark"] .admin-form textarea:hover,
html[data-theme="dark"] .admin-form select:hover {
  border-color: rgba(238, 243, 255, 0.28);
}

html[data-theme="dark"] .qr-live__code {
  background: #eef3ff;
}

html[data-theme="dark"] .portal-page .btn--ghost,
html[data-theme="dark"] .portal-main:not(.portal-main--auth) .btn--ghost,
html[data-theme="dark"] .portal-nav .btn--ghost {
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(238, 243, 255, 0.16);
}

html[data-theme="dark"] .portal-page .btn--ghost:hover,
html[data-theme="dark"] .portal-main:not(.portal-main--auth) .btn--ghost:hover,
html[data-theme="dark"] .portal-nav .btn--ghost:hover {
  background: rgba(238, 243, 255, 0.08);
}

html[data-theme="dark"] .portal-page .btn--dark,
html[data-theme="dark"] .portal-main:not(.portal-main--auth) .btn--dark {
  background: var(--lime);
  color: var(--on-accent);
}
