:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #18202a;
  background: #f5f6f7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button {
  font: inherit;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(480px, 100%);
  padding: 48px;
  background: white;
  border: 1px solid #e2e5e9;
  border-radius: 22px;
  box-shadow: 0 18px 60px rgba(0,0,0,.08);
}

.login-card h1 {
  margin: 8px 0 12px;
  font-size: 42px;
}

.login-card p {
  line-height: 1.6;
  color: #626b76;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 12px;
  font-weight: 700;
  color: #68717d;
}

.primary-button {
  border: 0;
  border-radius: 10px;
  padding: 13px 18px;
  background: #18202a;
  color: white;
  cursor: pointer;
}

.login-card .primary-button {
  width: 100%;
  margin-top: 20px;
}

#login-button:disabled {
  background: #626b76;
  cursor: not-allowed;
  opacity: .65;
}

.environment {
  font-size: 12px;
  text-align: center;
  margin-top: 24px;
}

.access-request-shell {
  width: min(620px, 100%);
}

.request-account-email {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.interest-fieldset {
  display: grid;
  gap: 10px;
  margin: 28px 0 22px;
  padding: 0;
  border: 0;
}

.interest-fieldset legend,
.reason-field {
  font-weight: 700;
  color: #18202a;
}

.interest-fieldset label {
  display: flex;
  align-items: center;
  gap: 9px;
}

.field-hint {
  margin: 3px 0 5px;
  font-size: 14px;
}

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

.reason-field span {
  font-weight: 400;
  color: #626b76;
}

#request-reason {
  width: 100%;
  resize: vertical;
  padding: 12px;
  border: 1px solid #cfd5dc;
  border-radius: 10px;
  font: inherit;
}

.privacy-notice {
  margin-top: 22px;
  padding: 16px;
  border-radius: 12px;
  background: #f5f6f7;
}

.privacy-notice p {
  margin: 6px 0;
}

.privacy-notice small {
  color: #626b76;
}

.retention-fieldset {
  margin: 24px 0 0;
  padding: 20px;
  border: 2px solid #18202a;
  border-radius: 14px;
}

.retention-fieldset legend {
  padding: 0 8px;
  font-size: 24px;
  font-weight: 750;
}

.retention-explanation h2 {
  margin: 18px 0 6px;
  font-size: 18px;
}

.retention-fieldset > label {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #cfd5dc;
  border-radius: 10px;
  line-height: 1.45;
}

.retention-fieldset input {
  margin-top: 4px;
}

.retention-fieldset > small {
  display: block;
  margin-top: 14px;
  color: #626b76;
}

.decision-reason {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid #cfd5dc;
  border-radius: 8px;
  font: inherit;
  resize: vertical;
}

.form-error {
  min-height: 1.5em;
  margin-bottom: 0;
  color: #a22929 !important;
}

.request-summary {
  margin: 24px 0;
}

.request-summary div {
  padding: 10px 0;
  border-top: 1px solid #e2e5e9;
}

.request-summary dt {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #68717d;
}

.request-summary dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
}

.app-shell {
  min-height: 100vh;
  grid-template-columns: 260px 1fr;
}

.app-shell:not([hidden]) {
  display: grid;
}

.sidebar {
  background: #18202a;
  color: white;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
}

.brand {
  font-weight: 750;
  font-size: 20px;
}

.brand-domain {
  color: #9ca5af;
  font-size: 12px;
  margin-top: 4px;
}

nav {
  margin-top: 40px;
  flex: 1;
}

.nav-label {
  margin: 26px 12px 8px;
  color: #8d97a3;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.nav-item,
.logout-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: #cfd5dc;
  text-align: left;
  padding: 11px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.nav-item.active {
  color: white;
  background: #2a3541;
}

.logout-button {
  color: #9ca5af;
}

.main {
  padding: 44px;
  max-width: 1500px;
  width: 100%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar h1 {
  margin: 4px 0 0;
}

.user-chip {
  background: white;
  border: 1px solid #e0e3e7;
  padding: 9px 13px;
  border-radius: 999px;
  font-size: 13px;
}

.hero {
  margin-top: 36px;
  background: white;
  border: 1px solid #e1e4e8;
  border-radius: 18px;
  padding: 34px;
  display: flex;
  justify-content: space-between;
  gap: 30px;
  align-items: center;
}

.hero h2 {
  font-size: 30px;
  margin: 7px 0 10px;
}

.hero p {
  color: #65707b;
  max-width: 680px;
  line-height: 1.6;
}

.grid,
.study-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 18px;
}

.card,
.study-card {
  background: white;
  border: 1px solid #e1e4e8;
  border-radius: 14px;
  padding: 22px;
}

.card span {
  color: #68717d;
  font-size: 13px;
}

.card strong {
  display: block;
  font-size: 22px;
  margin-top: 10px;
}

.card p,
.study-card p {
  color: #69737d;
  line-height: 1.5;
}

.section {
  margin-top: 42px;
}

.section h2 {
  margin: 5px 0;
}

.study-code {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #eef0f2;
  font-weight: 750;
}

.study-card h3 {
  margin-bottom: 6px;
}

@media (max-width: 800px) {
  .app-shell:not([hidden]) {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .main {
    padding: 24px;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .grid,
  .study-grid {
    grid-template-columns: 1fr;
  }
}

/* Global visibility state: HTML hidden must always win */
[hidden] {
  display: none !important;
}


/* Header authentication control */
.topbar {
  position: relative;
  display: block;
  margin-bottom: 36px;
}

.topbar > div:first-of-type {
  padding-right: 150px;
}

.topbar-logout {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 108px;
  height: 42px;
  padding: 0 18px;
  border: 1px solid #d7dce2;
  border-radius: 999px;
  background: #ffffff;
  color: #18202a;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.topbar-logout:hover {
  background: #f3f5f7;
}

@media (max-width: 520px) {
  .topbar {
    padding-top: 58px;
  }

  .topbar > div:first-of-type {
    padding-right: 0;
  }

  .topbar-logout {
    top: 0;
    right: 0;
  }
}

/* Admin Board */

.admin-view {
  padding-top: 8px;
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}

.admin-header h2 {
  margin: 4px 0 8px;
  font-size: 36px;
}

.admin-header p {
  margin: 0;
  color: #66717d;
}

.admin-section {
  background: #ffffff;
  border: 1px solid #dfe3e7;
  border-radius: 20px;
  padding: 28px;
}

.admin-section h3 {
  margin-top: 0;
}

.access-request-card {
  border-top: 1px solid #e4e7ea;
  padding: 24px 0;
}

.access-request-card:first-child {
  border-top: 0;
}

.request-email {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
}

.request-meta {
  margin: 0 0 20px;
  color: #66717d;
}

.permission-grid {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.permission-grid label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.request-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.secondary-button,
.approve-button,
.reject-button {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.secondary-button {
  border: 1px solid #d7dce2;
  background: #ffffff;
}

.approve-button {
  border: 0;
  background: #18202a;
  color: #ffffff;
}

.reject-button {
  border: 1px solid #d7dce2;
  background: #ffffff;
}

.role-select {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid #d7dce2;
  border-radius: 8px;
  background: #ffffff;
}

@media (max-width: 800px) {
  .admin-header {
    flex-direction: column;
  }

  .request-actions {
    flex-direction: column;
  }
}

/* Responsive navigation: keep navigation accessible */
@media (max-width: 800px) {

  .sidebar {
    display: flex !important;
    position: relative;
    width: 100%;
    padding: 12px 20px;
    background: #18202a;
    flex-direction: row;
    align-items: center;
    gap: 18px;
    overflow-x: auto;
  }

  .sidebar > div:first-child {
    flex: 0 0 auto;
  }

  .sidebar .brand {
    font-size: 16px;
    white-space: nowrap;
  }

  .sidebar .brand-domain {
    display: none;
  }

  .sidebar nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
  }

  .sidebar .nav-label {
    display: none;
  }

  .sidebar .nav-item {
    width: auto;
    flex: 0 0 auto;
    padding: 9px 12px;
    white-space: nowrap;
  }

  .main {
    padding: 24px;
  }
}

/* Shared section / module view */

.section-page-header {
  margin-bottom: 38px;
}

.section-page-header h2 {
  margin: 4px 0 8px;
  font-size: 36px;
}

.section-page-header p {
  max-width: 760px;
  margin: 0;
  color: #66717d;
  line-height: 1.6;
}

.study-card-button {
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.study-card-button:hover {
  border-color: #18202a;
}

.study-card-button:focus-visible,
.breadcrumbs button:focus-visible {
  outline: 3px solid #8ab4f8;
  outline-offset: 3px;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 22px;
  color: #68717d;
  font-size: 14px;
}

.breadcrumbs button {
  border: 0;
  padding: 0;
  background: transparent;
  color: #384b60;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.card-progress,
.module-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  color: #52606d;
  font-size: 13px;
}

.card-progress {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #e5e8eb;
}

.card-progress strong,
.module-progress strong {
  color: #18202a;
}

.card-progress[data-state="completed"] strong,
.module-progress[data-state="completed"] strong {
  color: #17643a;
}

.module-progress {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid #dfe3e7;
  border-radius: 12px;
  background: #ffffff;
}

.study-meta {
  margin: 0;
  font-size: 12px;
  color: #68717d;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.module-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
}

.module-header h2 {
  margin: 4px 0 4px;
  font-size: 30px;
}

.module-status {
  min-height: 1.4em;
  margin: 0;
  font-size: 13px;
  color: #68717d;
}

.module-frame-host {
  background: white;
  border: 1px solid #e1e4e8;
  border-radius: 14px;
  overflow: hidden;
}

.module-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 220px);
  min-height: 520px;
  border: 0;
}

@media (max-width: 800px) {
  .module-header {
    flex-direction: column;
  }

  .module-frame {
    height: calc(100vh - 180px);
  }
}

.empty-state {
  grid-column: 1 / -1;
  padding: 32px;
  border: 1px dashed #d7dce2;
  border-radius: 16px;
  color: #66717d;
  background: #fafbfc;
}
