* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  color: var(--ink);
  background: #ffffff;
  font-family: "Manrope", "Trebuchet MS", sans-serif;
}

body {
  min-height: 100vh;
  line-height: 1.5;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Manrope", "Trebuchet MS", sans-serif;
  letter-spacing: -0.01em;
  color: var(--ink-soft);
  font-weight: 800;
}

h1 {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  line-height: 1.1;
}

h2 {
  font-size: clamp(1.3rem, 2.6vw, 1.7rem);
  line-height: 1.2;
}

h3 {
  font-size: 1.05rem;
  line-height: 1.3;
}

p {
  margin: 0;
  color: var(--text-muted);
}

strong {
  color: var(--ink);
  font-weight: 700;
}

a {
  color: var(--teal);
}

.icon {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
  display: inline-block;
  vertical-align: -6px;
  font-size: 26px;
  color: var(--teal);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- App shell ---- */

.app-header {
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.app-header-inner {
  width: min(var(--console-max), calc(100% - 2rem));
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 0.7rem 0;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 800;
}

.app-logo img {
  height: 38px;
  width: auto;
  display: block;
}

.app-org-name {
  font-weight: 700;
  color: var(--ink);
  padding-left: 0.9rem;
  margin-left: 0.2rem;
  border-left: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 100%;
}

.app-nav {
  display: flex;
  gap: 0.3rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.app-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
}

.app-nav a:hover,
.app-nav a.active {
  background: var(--teal-pale);
  color: var(--teal);
}

.app-account {
  position: relative;
}

.app-account-button {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  color: var(--ink-soft);
  font: inherit;
  font-weight: 600;
}

.app-account-button:hover {
  background: var(--teal-pale);
}

.app-account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(12, 45, 91, 0.14);
  min-width: 12rem;
  padding: 0.4rem;
  z-index: 20;
}

.app-account-menu a,
.app-account-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 0.6rem 0.7rem;
  border-radius: 8px;
  font: inherit;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

.app-account-menu a:hover,
.app-account-menu button:hover {
  background: var(--teal-pale);
}

.app-main {
  flex: 1;
  width: min(var(--console-max), calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

/* ---- Page ---- */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.6rem;
  flex-wrap: wrap;
}

.page-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* ---- Buttons ---- */

.btn-solid,
.btn-ghost,
.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  text-decoration: none;
  font: inherit;
  padding: 0.85rem 1.7rem;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 200ms ease, color 200ms ease, border-color 200ms ease;
}

.btn-solid {
  background: var(--ink);
  color: #ffffff;
}

.btn-solid:hover {
  background: var(--ink-soft);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line);
}

.btn-ghost:hover {
  background: var(--teal-pale);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: rgba(179, 38, 30, 0.35);
}

.btn-danger:hover {
  background: rgba(179, 38, 30, 0.08);
}

.btn-solid[disabled],
.btn-ghost[disabled],
.btn-danger[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-solid .icon,
.btn-ghost .icon,
.btn-danger .icon {
  font-size: 20px;
  vertical-align: -4px;
  color: currentColor;
}

/* ---- Fields ---- */

.field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.field label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.field label.req::after {
  content: " *";
  color: var(--teal);
}

.field input,
.field textarea,
.field select {
  font: inherit;
  color: var(--ink);
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}

.field textarea {
  resize: vertical;
  min-height: 4.5rem;
}

.field .field-error {
  font-size: 0.8rem;
  color: var(--danger);
}

/* ---- Dialogs ----
   dialog.dialog is a native <dialog> shown/hidden via showModal()/close() (src/components/Dialog.js),
   styled like the website's dialog#waitlistDialog. */

dialog.dialog {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  width: min(30rem, calc(100vw - 2rem));
  box-shadow: 0 24px 60px rgba(12, 45, 91, 0.25);
  background: #ffffff;
  max-height: calc(100vh - 2rem);
  overflow: auto;
  margin: auto;
}

dialog.dialog::backdrop {
  background: rgba(12, 45, 91, 0.45);
  backdrop-filter: blur(2px);
}

.dialog-inner {
  padding: clamp(1.4rem, 3vw, 1.9rem);
}

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

.dialog-head h2 {
  margin: 0;
}

.dialog-close {
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--ink-soft);
  padding: 0.2rem;
  line-height: 1;
  border-radius: 999px;
}

.dialog-close:hover {
  background: var(--line);
}

.dialog-close .icon {
  color: inherit;
  font-size: 22px;
  vertical-align: -4px;
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
  margin-top: 1.4rem;
}

.form-status {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.form-status.error {
  color: var(--danger);
}

.form-status.success {
  color: var(--teal);
}

/* ---- Banners ---- */

.banner {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.9rem 1.1rem;
  border-radius: 14px;
  margin-bottom: 1.2rem;
  font-size: 0.92rem;
}

.banner .icon {
  font-size: 20px;
  vertical-align: -3px;
}

.banner-info {
  background: var(--teal-pale);
  color: var(--ink);
}

.banner-info .icon {
  color: var(--teal);
}

.banner-warning {
  background: #fff6e5;
  color: var(--warning);
}

.banner-warning .icon {
  color: var(--warning);
}

.banner-error {
  background: #fdecea;
  color: var(--danger);
}

.banner-error .icon {
  color: var(--danger);
}

/* ---- Tables / lists ---- */

.table-scroll {
  overflow-x: auto;
}

.list-table {
  width: 100%;
  border-collapse: collapse;
}

.list-table th,
.list-table td {
  text-align: left;
  padding: 0.75rem 0.6rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.list-table th {
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.list-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem 1.2rem;
  margin-bottom: 0.8rem;
}

/* ---- Empty state ---- */

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 40px;
  margin-bottom: 0.6rem;
}

/* ---- Spinner ---- */

.spinner {
  display: inline-block;
  width: 1.4rem;
  height: 1.4rem;
  border: 3px solid var(--line);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- Landing (signed-out) ---- */

.landing {
  max-width: 40rem;
  margin: 3rem auto;
  text-align: center;
  padding: 0 1rem;
}

.landing img {
  max-width: 260px;
  margin-bottom: 1.5rem;
}

.landing p {
  margin-top: 0.9rem;
}

.landing .landing-actions {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  margin-top: 1.6rem;
  flex-wrap: wrap;
}

/* ---- Site footer ---- */

.site-footer {
  padding: 2rem 0 2.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1.4rem;
}

.site-footer p {
  font-size: 0.85rem;
  color: rgba(12, 45, 91, 0.55);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
}

.footer-links a {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

/* ---- Responsive ---- */

@media (max-width: 700px) {
  .app-header-inner {
    flex-wrap: wrap;
    row-gap: 0.5rem;
    padding: 0.6rem 0;
  }

  .app-logo {
    order: 1;
  }

  .app-org-name {
    order: 2;
    flex: 1 1 0%;
    min-width: 0;
    border-left: none;
    padding-left: 0;
    margin-left: 0.5rem;
  }

  .app-account {
    order: 3;
  }

  .app-nav {
    order: 4;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-left: 0;
    padding-bottom: 0.2rem;
  }

  .app-nav a {
    flex: none;
    white-space: nowrap;
  }
}

@media (max-width: 400px) {
  .app-logo img {
    height: 30px;
  }

  .app-main {
    width: calc(100% - 1rem);
  }

  .page-head {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
