@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/assets/fonts/BricolageGrotesque-Variable.woff2') format('woff2');
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --portal-bg: #0b1018;
  --portal-surface: #111927;
  --portal-surface-strong: #172235;
  --portal-line: rgba(255, 255, 255, 0.13);
  --portal-line-strong: rgba(255, 255, 255, 0.24);
  --portal-text: #f5f6fb;
  --portal-muted: #a7b0bf;
  --portal-accent: #8c6cff;
  --portal-accent-strong: #a58dff;
  --portal-danger: #ffb4ae;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--portal-bg);
}

body.portal-page {
  min-height: 100vh;
  margin: 0;
  color: var(--portal-text);
  background:
    radial-gradient(circle at 85% 15%, rgba(121, 82, 255, 0.2), transparent 30rem),
    linear-gradient(180deg, #101722 0%, var(--portal-bg) 55%, #080d14 100%);
  font-family: 'Bricolage Grotesque', Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.portal-shell {
  width: min(1180px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
}

.portal-header {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--portal-line);
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--portal-text);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.035em;
}

.portal-brand__mark {
  position: relative;
  width: 29px;
  height: 29px;
  display: inline-block;
}

.portal-brand__mark span {
  position: absolute;
  inset: 4px 3px auto auto;
  width: 17px;
  height: 17px;
  border: 2px solid var(--portal-accent-strong);
  transform: rotate(45deg);
}

.portal-brand__mark span:last-child {
  inset: auto auto 4px 3px;
  border-color: rgba(255, 255, 255, 0.82);
}

.portal-header__back,
.portal-link-button {
  border: 0;
  padding: 0 0 3px;
  color: var(--portal-muted);
  background: transparent;
  border-bottom: 1px solid var(--portal-line-strong);
  text-decoration: none;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}

.portal-header__back:hover,
.portal-link-button:hover {
  color: var(--portal-text);
  border-color: var(--portal-text);
}

.portal-login {
  min-height: calc(100vh - 88px);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: clamp(56px, 9vw, 130px);
  align-items: center;
  padding: 80px 0 110px;
}

.portal-login__intro {
  max-width: 690px;
}

.portal-eyebrow {
  margin: 0 0 18px;
  color: var(--portal-accent-strong);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.portal-login h1,
.portal-dashboard__hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(3.3rem, 8vw, 7.5rem);
  line-height: 0.91;
  letter-spacing: -0.065em;
  font-weight: 560;
}

.portal-login__intro > p:last-child,
.portal-dashboard__hero > div > p:last-child {
  max-width: 600px;
  margin: 30px 0 0;
  color: var(--portal-muted);
  font-size: clamp(1.05rem, 2vw, 1.32rem);
  line-height: 1.55;
}

.portal-card {
  position: relative;
  padding: 34px;
  border: 1px solid var(--portal-line);
  background: rgba(17, 25, 39, 0.88);
  backdrop-filter: blur(18px);
}

.portal-card__topline {
  position: absolute;
  top: -1px;
  left: -1px;
  width: 38%;
  height: 2px;
  background: var(--portal-accent);
}

.portal-card__label {
  margin: 0 0 28px;
  color: var(--portal-text);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portal-feedback {
  margin: 0 0 24px;
  padding: 13px 15px;
  border-left: 2px solid var(--portal-accent);
  background: rgba(140, 108, 255, 0.08);
  color: var(--portal-muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.portal-form {
  display: grid;
  gap: 19px;
}

.portal-form label {
  display: grid;
  gap: 8px;
  color: var(--portal-muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.portal-form input,
.portal-form select {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--portal-line-strong);
  border-radius: 0;
  outline: 0;
  color: var(--portal-text);
  background: rgba(6, 11, 18, 0.7);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.portal-form select {
  appearance: none;
  padding-right: 42px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--portal-muted) 50%),
    linear-gradient(135deg, var(--portal-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.portal-form input:focus,
.portal-form select:focus {
  border-color: var(--portal-accent-strong);
  box-shadow: 0 0 0 1px var(--portal-accent-strong);
}

.portal-form input:disabled,
.portal-form select:disabled,
.portal-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.portal-button {
  min-height: 52px;
  margin-top: 7px;
  padding: 0 18px;
  border: 1px solid var(--portal-accent);
  border-radius: 0;
  color: #fff;
  background: var(--portal-accent);
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.portal-button:not(:disabled):hover {
  background: var(--portal-accent-strong);
  border-color: var(--portal-accent-strong);
}

.portal-dashboard {
  padding: 82px 0 120px;
}

.portal-dashboard__hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 44px;
  padding-bottom: 76px;
  border-bottom: 1px solid var(--portal-line);
}

.portal-dashboard__hero h1 {
  font-size: clamp(3rem, 7vw, 6.8rem);
}

.portal-dashboard__hero form {
  flex: 0 0 auto;
  padding-bottom: 10px;
}

.portal-section {
  display: grid;
  grid-template-columns: minmax(180px, 0.28fr) minmax(0, 0.72fr);
  gap: 50px;
  padding: 58px 0;
  border-bottom: 1px solid var(--portal-line);
}

.portal-section__heading h2 {
  margin: 0;
  font-size: clamp(1.65rem, 3vw, 2.4rem);
  letter-spacing: -0.035em;
}

.portal-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--portal-line);
  border-left: 1px solid var(--portal-line);
}

.portal-detail {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 24px;
  border-right: 1px solid var(--portal-line);
  border-bottom: 1px solid var(--portal-line);
  background: rgba(17, 25, 39, 0.54);
}

.portal-detail span {
  color: var(--portal-muted);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portal-detail strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: clamp(1.3rem, 2.4vw, 2rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.portal-section__content {
  min-width: 0;
  display: grid;
  gap: 28px;
}

.portal-organization-editor {
  margin-top: 0;
  padding: clamp(22px, 3vw, 30px);
  border: 1px solid var(--portal-line);
  background: rgba(17, 25, 39, 0.4);
}

.portal-organization-editor h3 {
  margin: 0 0 22px;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  line-height: 1.15;
}

.portal-organization-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portal-organization-form .portal-button {
  grid-column: 1 / -1;
  justify-self: start;
}


.portal-actions {
  display: grid;
  border-top: 1px solid var(--portal-line);
}

.portal-action {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 20px;
  border: 1px solid var(--portal-line);
  border-top: 0;
  color: var(--portal-text);
  background: rgba(17, 25, 39, 0.4);
  text-decoration: none;
  font-weight: 650;
  transition: background 160ms ease, border-color 160ms ease;
}

.portal-action:hover {
  background: var(--portal-surface-strong);
  border-color: var(--portal-line-strong);
}

.portal-action--primary {
  background: rgba(140, 108, 255, 0.13);
}

.portal-action span {
  color: var(--portal-accent-strong);
  font-size: 1.15rem;
}

@media (max-width: 820px) {
  .portal-shell {
    width: min(100% - 28px, 720px);
  }

  .portal-header {
    min-height: 76px;
  }

  .portal-login {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 48px;
    padding: 68px 0 90px;
  }

  .portal-login h1,
  .portal-dashboard__hero h1 {
    font-size: clamp(3.1rem, 14vw, 5.6rem);
  }

  .portal-dashboard {
    padding-top: 64px;
  }

  .portal-dashboard__hero {
    align-items: flex-start;
    flex-direction: column;
    padding-bottom: 54px;
  }

  .portal-section {
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 48px 0;
  }
}

@media (max-width: 560px) {
  .portal-header__back {
    font-size: 0.84rem;
  }

  .portal-card {
    padding: 24px 20px;
  }

  .portal-detail-grid,
  .portal-organization-form {
    grid-template-columns: 1fr;
  }

  .portal-detail {
    min-height: 126px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
