/* Foundation */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #000000;
  --muted: rgba(0, 0, 0, 0.54);
  --soft: rgba(0, 0, 0, 0.06);
  --line: rgba(0, 0, 0, 0.1);
  --line-strong: rgba(0, 0, 0, 0.18);
  --accent: #456c2a;
  --accent-soft: rgba(69, 108, 42, 0.12);
  --brand-red: #b42318;
  --danger: #b42318;
  --focus: rgba(69, 108, 42, 0.32);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

a {
  color: var(--text);
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

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

button,
summary,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

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

/* Header and navigation */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 64px;
  padding: 10px max(20px, calc((100vw - 1120px) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.brand {
  display: inline-flex;
  align-items: flex-start;
  min-width: 0;
  width: max-content;
  flex-direction: column;
  gap: 6px;
  color: var(--brand-red);
  text-decoration: none;
  white-space: nowrap;
}

.brand-logo {
  display: block;
  width: 120px;
  height: auto;
}

.brand-caption {
  color: var(--text);
  font-size: 11px;
  font-weight: 400;
  line-height: 1;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
}

.site-nav a {
  text-decoration: none;
  white-space: nowrap;
}

.header-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 500;
  list-style: none;
  text-decoration: none;
}

.header-menu summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-weight: 500;
  list-style: none;
  text-decoration: none;
}

.header-menu summary span[aria-hidden="true"] {
  display: block;
  font-size: 20px;
  letter-spacing: 1px;
  line-height: 14px;
  transform: translateY(-2px);
}

.header-menu summary:hover {
  color: var(--text);
}

.header-action:hover {
  border-color: var(--text);
  color: var(--text);
}

.header-menu {
  position: relative;
}

.header-menu summary::-webkit-details-marker {
  display: none;
}

.header-menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  display: grid;
  min-width: 196px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
}

.header-menu-panel a,
.header-menu-panel .logout-form button {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  text-decoration: none;
}

.header-menu-panel > :last-child,
.header-menu-panel > :last-child button {
  border-bottom: 0;
}

.header-menu-panel a:hover,
.header-menu-panel .logout-form button:hover {
  background: var(--soft);
}

.header-menu-mobile,
.mobile-quick-nav {
  display: none;
}

.logout-form {
  margin: 0;
}

.logout-form button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.desktop-logout-form {
  padding-left: 2px;
}

.desktop-logout-form button {
  font-size: 14px;
  line-height: 20px;
}

/* Page shells and notices */

main {
  min-width: 0;
  flex: 1 0 auto;
}

.messages {
  width: min(1120px, calc(100vw - 40px));
  margin: 18px auto 0;
}

.message,
.notice {
  margin: 0 0 8px;
  padding: 12px 14px;
  border: 1px solid rgba(69, 108, 42, 0.28);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
}

.profile-shell {
  width: min(1120px, calc(100vw - 40px));
  margin: 36px auto 64px;
}

.form-shell {
  width: min(720px, calc(100vw - 40px));
  margin: 48px auto 72px;
}

.compact {
  width: min(520px, calc(100vw - 40px));
}

/* Landing and public pages */

.landing-lead {
  max-width: 620px;
  margin: 16px 0 0;
  color: var(--text);
  font-size: clamp(16px, 1.8vw, 19px);
  line-height: 1.45;
}

.search-form input[type="search"]::placeholder {
  color: var(--muted);
}

.topic-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.topic-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 4px 14px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  line-height: 20px;
  text-decoration: none;
  white-space: nowrap;
}

.topic-chip:hover {
  background: var(--accent);
  color: #ffffff;
}

.lyceum-line {
  margin: 14px 0 0;
  color: var(--accent);
  font-size: clamp(15px, 1.6vw, 18px);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.team-section {
  margin-top: clamp(40px, 7vw, 72px);
  padding-top: clamp(28px, 5vw, 40px);
  border-top: 1px solid var(--line);
}

.team-section h2 {
  margin: 0 0 8px;
  font-size: clamp(24px, 3.4vw, 34px);
}

.team-intro {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 15px;
  line-height: 22px;
}

.team-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.team-list li {
  font-size: 15px;
  line-height: 22px;
}

.team-list .team-name {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.team-list .team-role {
  color: var(--muted);
}

/* Invite wall */
.landing-wall {
  display: flex;
  min-height: 100vh;
  min-height: 100svh;
  flex-direction: column;
}

.chip-ticker {
  display: flex;
  gap: 8px;
  width: 100%;
  padding: 16px clamp(16px, 5vw, 40px);
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.chip-ticker::-webkit-scrollbar {
  display: none;
}

.landing-wall-center {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: clamp(40px, 8vw, 96px) 24px;
  text-align: center;
}

.landing-wall-brand {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.landing-wall-brand .brand-logo {
  width: min(264px, 75vw);
}

.landing-wall-brand .brand-caption {
  font-size: 13px;
}

.landing-wall-center h1 {
  max-width: 16ch;
  font-size: clamp(26px, 5vw, 40px);
  line-height: 1.1;
}

.landing-wall-lead {
  max-width: 46ch;
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 22px;
}

.landing-wall-center .primary-button {
  min-width: 220px;
  margin-top: 8px;
}

.contact-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  margin-top: 4px;
  padding: 9px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 22px;
  text-decoration: none;
}

a.contact-pill:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.form-header {
  margin-bottom: 24px;
}

.page-header {
  width: min(345px, 100%);
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  line-height: normal;
}

.page-header .subtitle {
  margin-top: 6px;
  color: var(--text);
  font-size: 14px;
  line-height: 20px;
}

.form-header-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

/* Profile layout */

.compact .form-header h1 {
  font-size: clamp(34px, 7vw, 52px);
}

.editor-profile-summary {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 18px;
}

.editor-profile-photo,
.profile-photo,
.result-photo {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  object-fit: cover;
}

.editor-profile-photo {
  width: 96px;
  height: 96px;
}

.editor-profile-photo-placeholder,
.result-photo-placeholder {
  box-shadow: inset 0 0 0 10px #ffffff;
}

.profile-status-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 32px;
  padding: 14px 0;
  border-top: 1px solid rgba(69, 108, 42, 0.3);
  border-bottom: 1px solid rgba(69, 108, 42, 0.3);
  color: var(--accent);
}

.profile-status-notice strong {
  font-size: 16px;
}

.profile-status-notice p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.profile-status-notice-muted {
  border-color: var(--line);
  color: var(--text);
}

.profile-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(20px, 4vw, 40px);
  padding: 18px 0 32px;
}

.profile-header-text {
  min-width: 0;
  max-width: 760px;
}

.profile-photo {
  width: clamp(112px, 16vw, 176px);
  height: clamp(112px, 16vw, 176px);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  text-transform: none;
}

h1,
h2,
h3,
p,
li,
dt,
dd {
  overflow-wrap: anywhere;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
}

h2 {
  margin: 0 0 14px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

h3 {
  margin: 22px 0 8px;
  font-size: 15px;
  font-weight: 700;
}

.subtitle {
  margin: 14px 0 0;
  max-width: 720px;
  color: var(--text);
  font-size: 18px;
  line-height: 1.4;
}

.muted {
  color: var(--muted);
}

.contact-hidden-note p {
  margin: 0;
}

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

.panel {
  min-width: 0;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.panel p:last-child,
.panel dl:last-child,
.panel ul:last-child {
  margin-bottom: 0;
}

.span-all {
  grid-column: 1 / -1;
}

.document-section {
  margin-top: 18px;
}

/* Forms and buttons */

.stacked-form {
  display: grid;
  gap: 16px;
}

.login-separator {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin: 20px 0;
  color: var(--muted);
  font-size: 13px;
}

.login-separator::before,
.login-separator::after {
  height: 1px;
  background: var(--line);
  content: "";
}

.telegram-login-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid #168acd;
  border-radius: 999px;
  background: #229ed9;
  color: #ffffff;
  font-weight: 500;
  text-decoration: none;
}

.profile-form-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 4px;
}

.profile-form-tab {
  min-height: 36px;
  padding: 7px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--soft);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
}

.profile-form-tab[aria-selected="true"] {
  background: var(--accent);
  color: #ffffff;
}

.profile-form-section {
  display: grid;
  gap: 14px;
}

.profile-form-section h3 {
  margin: 0;
  font-size: 16px;
}

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

.profile-tab-form-enhanced .profile-form-section[hidden] {
  display: none;
}

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

.field label {
  font-size: 14px;
  font-weight: 500;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-form input[type="search"]:focus {
  border-color: var(--accent);
  outline: 3px solid var(--focus);
}

.field textarea {
  resize: vertical;
}

.photo-field-prominent {
  grid-column: 1 / -1;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.field:has(textarea) {
  grid-column: 1 / -1;
}

.photo-field-prominent input[type="file"] {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.checkbox-field {
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
}

.checkbox-field label {
  grid-column: 2;
  grid-row: 1;
}

.checkbox-field input {
  grid-column: 1;
  grid-row: 1;
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.checkbox-field .help-text,
.checkbox-field ul {
  grid-column: 2;
}

.radio-field > div {
  display: grid;
  gap: 10px;
  margin-top: 2px;
}

.radio-field > div label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 400;
  cursor: pointer;
}

.radio-field input[type="radio"] {
  flex: 0 0 auto;
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #ffffff;
  accent-color: var(--accent);
  cursor: pointer;
}

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

.field ul {
  margin: 0;
  padding-left: 18px;
  color: var(--danger);
  font-size: 13px;
}

.primary-button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid #000000;
  border-radius: 999px;
  background: #000000;
  color: #ffffff;
  cursor: pointer;
  font-weight: 400;
  line-height: 22px;
  text-align: center;
  text-decoration: none;
}

.primary-button:active,
.button-link:active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.button-secondary {
  border-color: var(--line);
  background: transparent;
  color: var(--text);
}

.button-danger {
  border-color: rgba(180, 35, 24, 0.34);
  background: transparent;
  color: var(--danger);
}

.button-danger:active {
  border-color: var(--danger);
  background: var(--danger);
  color: #ffffff;
}

@media (hover: hover) {
  .primary-button:hover,
  .button-link:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
  }

  .button-danger:hover {
    border-color: var(--danger);
    background: var(--danger);
    color: #ffffff;
  }
}

.form-actions {
  display: flex;
  justify-content: flex-start;
  padding-top: 4px;
}

.contact-decision-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.contact-decision-actions form {
  margin: 0;
}

.inline-button {
  width: fit-content;
}

/* Invites */

.invite-form {
  margin-top: 20px;
}

.invite-channel-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.invite-channel-field legend {
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
}

.invite-channel-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.invite-channel-option {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  text-align: center;
  white-space: nowrap;
}

.invite-channel-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.invite-channel-option:has(input:checked) {
  background: var(--accent);
  color: #ffffff;
}

.invite-guidance {
  display: grid;
  gap: 6px;
}

.invite-guidance p {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
}

.invite-trust-note {
  color: var(--text);
}

.invite-created {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 14px 0;
  border-top: 1px solid rgba(69, 108, 42, 0.3);
  border-bottom: 1px solid rgba(69, 108, 42, 0.3);
}

.invite-created h2 {
  margin-bottom: 6px;
}

.invite-created p {
  margin: 0 0 8px;
}

.invite-link {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--accent);
  font-size: 13px;
}

.invite-history {
  margin-top: 32px;
}

.invite-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.invite-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.invite-row p {
  margin: 4px 0 0;
}

.invite-row time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
}

/* Search */

.search-form {
  display: grid;
  gap: 14px;
  margin-bottom: 28px;
}

.search-form input[type="search"] {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  font-size: 16px;
  line-height: 24px;
}

.search-filters {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.search-filters legend {
  margin-bottom: 8px;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-grid label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  line-height: 20px;
}

.filter-grid input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.filter-grid label:has(input:checked) {
  background: var(--accent);
  color: #ffffff;
}

.search-results {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.result-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.result-main {
  display: flex;
  min-width: 0;
  gap: 10px;
}

.result-photo-link {
  display: block;
  flex: 0 0 auto;
  border-radius: 999px;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.result-photo-link:hover {
  opacity: 0.82;
}

.result-photo {
  width: 48px;
  height: 48px;
}

.result-card h2 {
  margin-bottom: 4px;
  font-size: 16px;
  line-height: 20px;
}

.result-card h2 a {
  text-decoration: none;
}

.result-card p {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 20px;
}

.open-to-line {
  color: var(--accent);
}

/* Profile details and documents */

dl {
  display: grid;
  grid-template-columns: minmax(90px, 0.35fr) minmax(0, 1fr);
  gap: 10px 16px;
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 13px;
}

dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.document-list {
  display: grid;
  gap: 18px;
  margin: 0 0 0;
  padding: 0;
  list-style: none;
}

.document-card {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.document-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.document-card-header h3 {
  margin: 0 0 2px;
}

.document-card-header p {
  margin: 0;
}

.document-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.document-delete-form {
  display: inline-flex;
  margin: 0;
}

.document-preview {
  display: block;
  width: 100%;
  height: min(70vh, 640px);
  min-height: 420px;
  border: 0;
  background: var(--soft);
}

.document-preview-placeholder {
  margin: 0;
  padding: 20px;
  color: var(--muted);
}

.document-mobile-fallback {
  display: none;
}

/* Responsive */

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

@media (max-width: 900px) {
  .site-header {
    display: grid;
    grid-template-rows: 38px 20px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    min-height: 0;
    height: 125px;
    overflow: visible;
    padding: 49px 20px 0;
    column-gap: 12px;
    row-gap: 6px;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
    gap: 6px;
    align-self: start;
    justify-self: start;
  }

  .brand-logo {
    width: 148px;
  }

  .brand-caption {
    font-size: 12px;
    line-height: 12px;
  }

  .site-nav-desktop {
    display: none;
  }

  .site-nav-public {
    gap: 8px;
  }

  .site-nav-public .public-search-link {
    display: none;
  }

  .header-menu-mobile {
    display: block;
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    margin-top: -1px;
  }

  .header-menu-mobile .header-menu-panel {
    top: calc(100% + 8px);
  }

  .header-menu-mobile .header-menu-panel a,
  .header-menu-mobile .header-menu-panel .logout-form button {
    padding: 14px 16px;
  }

  .header-menu summary {
    height: 24px;
    width: 24px;
    min-width: 24px;
    min-height: 24px;
    padding: 0;
  }

  .mobile-quick-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    gap: 24px;
    height: 20px;
    overflow: hidden;
    padding-top: 0;
    scrollbar-width: none;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
  }

  .mobile-quick-nav::-webkit-scrollbar {
    display: none;
  }

  .mobile-quick-nav a {
    flex: 0 0 auto;
    color: var(--text);
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
  }

  .profile-shell {
    width: min(100vw - 40px, 720px);
    margin-top: 20px;
    margin-bottom: 44px;
  }

  .form-shell {
    width: min(100vw - 40px, 620px);
    margin-top: 32px;
    margin-bottom: 52px;
  }

  .profile-header {
    gap: 18px;
  }

  .profile-photo {
    width: 112px;
    height: 112px;
  }

  .profile-form-section-grid {
    grid-template-columns: 1fr;
  }

  .search-form .primary-button {
    width: 100%;
  }

  .result-card {
    flex-direction: column;
    gap: 8px;
  }

  .form-header-actions {
    flex-direction: column;
  }

  .invite-created,
  .profile-status-notice {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-status-notice .button-link,
  .invite-created .primary-button {
    width: 100%;
  }

  .editor-profile-summary {
    align-items: flex-start;
  }

  dl {
    grid-template-columns: 1fr;
  }

  .document-card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .document-actions,
  .document-delete-form,
  .contact-decision-actions,
  .contact-decision-actions form,
  .contact-decision-actions button,
  .button-link {
    width: 100%;
  }

  .document-actions {
    justify-content: flex-start;
  }

  .document-preview {
    display: none;
  }

  .document-mobile-fallback {
    display: block;
    margin: 0;
    padding: 16px;
    color: var(--muted);
    font-size: 14px;
  }
}

@media (max-width: 520px) {
  .chip-ticker {
    flex-wrap: wrap;
    justify-content: center;
    overflow-x: visible;
    padding: 22px 18px 0;
  }

  .chip-ticker .topic-chip {
    min-height: 29px;
    border-color: var(--line-strong);
    color: var(--muted);
    font-size: 14px;
  }

  .profile-shell,
  .form-shell {
    width: calc(100vw - 40px);
  }

  .profile-header {
    display: block;
    padding: 16px 0 24px;
  }

  .profile-header-has-photo {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    column-gap: 16px;
    align-items: center;
  }

  .profile-header-has-photo .profile-header-text {
    display: contents;
  }

  .profile-header-has-photo .profile-photo {
    grid-row: 1 / span 2;
    width: 96px;
    height: 96px;
  }

  .profile-header-has-photo .eyebrow,
  .profile-header-has-photo h1 {
    grid-column: 2;
  }

  .profile-header-has-photo .eyebrow {
    align-self: end;
    margin-bottom: 4px;
  }

  .profile-header-has-photo h1 {
    align-self: start;
  }

  .profile-header-has-photo .subtitle,
  .profile-header-has-photo .muted {
    grid-column: 1 / -1;
  }

  .profile-header h1 {
    font-size: clamp(32px, 10vw, 42px);
  }

  .profile-header .subtitle {
    margin-top: 14px;
    font-size: 17px;
  }

  .profile-header .muted {
    margin: 10px 0 0;
  }
}
