body.bureau-authenticated,
body.bureau-public,
body.administration-page-shell,
body.eforms-management-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.bureau-authenticated > main,
body.bureau-public > main,
body.administration-page-shell > main,
body.eforms-management-page > main {
  flex: 1 0 auto;
}

.bureau-footer {
  margin-top: auto;
  flex: 0 0 auto;
  border-top: 1px solid var(--theme-outline, var(--line));
  background: color-mix(in srgb, var(--theme-soft-surface, var(--panel)) 88%, transparent);
}

.bureau-footer-inner {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--theme-muted-copy, var(--muted));
  font-size: .88rem;
}

.bureau-footer nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px 22px;
}

.bureau-footer a {
  color: var(--theme-strong-copy, var(--text));
  text-decoration: none;
  transition: color .18s ease, opacity .18s ease;
}

.bureau-footer a:hover,
.bureau-footer a:focus-visible {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.legal-shell {
  padding-top: 34px;
  padding-bottom: 24px;
}

.legal-card {
  max-width: 900px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 58px);
  border: 1px solid var(--theme-outline, var(--line));
  border-radius: 28px;
  background: var(--theme-soft-surface, var(--panel));
  box-shadow: 0 24px 60px var(--theme-shadow, rgba(0,0,0,.16));
}

.legal-card h1 {
  margin: 8px 0 12px;
  color: var(--text);
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.04;
}

.legal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding-bottom: 24px;
  color: var(--theme-muted-copy, var(--muted));
  font-size: .88rem;
  border-bottom: 1px solid var(--theme-section-line, var(--line));
}

.legal-content {
  padding-top: 24px;
  color: var(--theme-module-copy, var(--muted-strong));
  line-height: 1.7;
}

.legal-content h2,
.legal-content h3 {
  color: var(--text);
  margin-top: 30px;
}

.legal-content a {
  color: var(--blue);
}

.environment-shell .invite-grid input,
.environment-shell .invite-grid select,
.environment-shell .inline-form select {
  border-color: var(--line-strong, #b6c8da);
  background: var(--theme-input-background, #fff);
  color: var(--text, #102238);
  box-shadow: 0 2px 8px var(--theme-shadow, rgba(35,68,103,.08));
}

.environment-shell .invite-grid input::placeholder {
  color: var(--theme-muted-copy, #6e8094);
  opacity: .9;
}

.environment-shell .invite-grid input:hover,
.environment-shell .invite-grid select:hover,
.environment-shell .inline-form select:hover {
  border-color: color-mix(in srgb, var(--theme-focus-ring, #1975bd) 55%, var(--line-strong, #b6c8da));
}

.environment-shell .invite-grid input:focus,
.environment-shell .invite-grid select:focus,
.environment-shell .inline-form select:focus {
  border-color: var(--theme-focus-ring, #1975bd);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-focus-ring, #1975bd) 18%, transparent);
}

.environment-shell .invite-grid select,
.environment-shell .inline-form select {
  appearance: auto;
  cursor: pointer;
}

.environment-shell .subscription-icon {
  display: none;
}

.environment-shell .subscription-card h3 {
  margin-top: 22px;
}

.environment-shell .subscription-settings {
  align-self: flex-start;
  margin-top: 14px;
  text-decoration: none;
}

.module-open {
  border: 1px solid var(--theme-primary-button-background);
  background: var(--theme-primary-button-background) !important;
  color: var(--theme-primary-button-color) !important;
  box-shadow: 0 7px 20px var(--theme-shadow, rgba(0,0,0,.08));
}

.module-open:hover,
.module-open:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--blue) 18%, transparent);
}

html[data-theme="light"] .environment-shell .invite-grid input,
html[data-theme="light"] .environment-shell .invite-grid select,
html[data-theme="light"] .environment-shell .inline-form select {
  border-color: #b6c8da;
  background: #ffffff;
  color: #102238;
}

@media (prefers-color-scheme: light) {
  html[data-theme="system"] .environment-shell .invite-grid input,
  html[data-theme="system"] .environment-shell .invite-grid select,
  html[data-theme="system"] .environment-shell .inline-form select {
    border-color: #b6c8da;
    background: #ffffff;
    color: #102238;
  }
}

@media (min-width: 901px) and (max-width: 1500px),
       (min-width: 901px) and (max-height: 820px) {
  .topbar {
    min-height: 64px;
    gap: 18px;
    padding-left: 22px;
    padding-right: 22px;
  }

  .brand-logo {
    height: 30px;
    max-width: min(220px, 25vw);
  }

  .shell,
  .admin-shell {
    width: min(1320px, calc(100% - 36px));
    padding-top: 26px;
    padding-bottom: 42px;
  }

  h1 {
    font-size: clamp(1.95rem, 3.4vw, 3.45rem);
  }

  .bureau-hero {
    min-height: 205px;
    padding: 32px 34px 30px;
    border-radius: 22px;
  }

  .bureau-hero h1 {
    font-size: clamp(1.85rem, 3vw, 2.9rem);
  }

  .bureau-hero .lead {
    margin-top: 14px;
    font-size: .96rem;
    line-height: 1.55;
  }

  .hero-glow {
    left: 34px;
    top: 27px;
  }

  .bureau-section,
  .administration-section {
    margin-top: 26px;
  }

  .section-title-row {
    margin-bottom: 14px;
  }

  .module-card {
    min-height: 292px;
  }

  .module-card-eforms .module-visual,
  .module-visual {
    height: 132px;
  }

  .module-icon-eforms {
    width: 74px;
    height: 74px;
  }

  .module-card-content {
    padding: 12px 16px 7px;
  }

  .module-card-footer {
    padding: 12px 16px 15px;
  }

  .admin-shortcut {
    min-height: 102px;
    padding: 16px 18px;
  }

  .legal-shell {
    padding-top: 24px;
  }

  .legal-card {
    max-width: 860px;
    padding: 34px 38px;
    border-radius: 22px;
  }

  .legal-card h1 {
    font-size: clamp(1.9rem, 3.4vw, 2.75rem);
  }

  .legal-meta {
    padding-bottom: 18px;
  }

  .legal-content {
    padding-top: 18px;
    line-height: 1.62;
  }

  .bureau-footer-inner {
    min-height: 66px;
  }
}

@media (min-width: 901px) and (max-height: 740px) {
  .shell,
  .admin-shell {
    padding-top: 20px;
    padding-bottom: 34px;
  }

  .bureau-hero {
    min-height: 180px;
    padding-top: 28px;
    padding-bottom: 26px;
  }

  .bureau-section,
  .administration-section {
    margin-top: 20px;
  }
}

@media (max-width: 720px) {
  .bureau-footer-inner {
    width: min(100% - 28px, 1180px);
    padding: 22px 0;
    align-items: flex-start;
    flex-direction: column;
  }
  .bureau-footer nav {
    justify-content: flex-start;
  }
  .legal-shell {
    padding-top: 24px;
  }
}
