:root {
  --bg: #f4f2f7;
  --surface: #ffffff;
  --surface-soft: #f6f1ff;
  --line: rgba(6, 3, 23, 0.12);
  --text: #060317;
  --muted: #625b74;
  --primary: #060317;
  --accent: #8636f8;
  --accent-strong: #6b1fe0;
  --accent-soft: rgba(134, 54, 248, 0.12);
  --danger: #b42318;
  --success: #067647;
  --shadow: 0 24px 54px rgba(6, 3, 23, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", "Segoe UI", sans-serif;
}

body.login-page {
  position: relative;
  overflow-x: hidden;
}

body.login-page::before {
  content: "";
  position: fixed;
  top: -10rem;
  left: 50%;
  width: min(52rem, 92vw);
  height: 26rem;
  transform: translateX(-50%);
  background: radial-gradient(
    circle,
    rgba(134, 54, 248, 0.1) 0%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
}

code {
  font-family: "SFMono-Regular", "SF Mono", Consolas, "Liberation Mono", monospace;
}

.login-shell,
.portal-shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
}

.login-card,
.directory-toolbar,
.table-wrap,
.empty-search {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.login-card {
  width: min(440px, 100%);
  padding: 44px 40px;
  position: relative;
  overflow: hidden;
  border: 0;
  border-radius: 20px;
  box-shadow:
    0 0 0 1px rgba(6, 3, 23, 0.06),
    0 8px 32px rgba(6, 3, 23, 0.06);
  animation: login-card-enter 0.5s ease-out both;
}

.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #8636f8, #a566ff);
  border-radius: 20px 20px 0 0;
}

.login-card--simple h1,
.portal-topbar h1 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.08;
}

.brand-lockup {
  display: block;
  width: fit-content;
}

.brand-lockup--stacked {
  margin-bottom: 28px;
}

.brand-logo {
  width: auto;
  height: 40px;
  flex-shrink: 0;
  object-fit: contain;
  image-rendering: auto;
}

.lede {
  margin: 0 0 28px;
  color: rgba(6, 3, 23, 0.4);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
}

.stack-form {
  display: grid;
  gap: 1rem;
  margin-top: 0;
}

.stack-form label,
.search-form label {
  display: grid;
  gap: 0.45rem;
  font-weight: 600;
}

.stack-form span,
.search-form span {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

input,
button {
  font: inherit;
}

input {
  width: 100%;
  height: 50px;
  padding: 0 1rem;
  border: 1.5px solid rgba(6, 3, 23, 0.12);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input:hover {
  border-color: rgba(6, 3, 23, 0.2);
}

input::placeholder {
  color: rgba(6, 3, 23, 0.4);
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(134, 54, 248, 0.15);
}

.login-input--mono {
  appearance: none;
  -webkit-appearance: none;
  border-radius: 12px;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-weight: 500;
}

.login-input {
  appearance: none;
  -webkit-appearance: none;
  border-radius: 12px;
}

.primary-button,
.ghost-button,
.copy-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.primary-button {
  min-height: 52px;
  padding: 0 1.15rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: none;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.72rem 1rem;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  color: var(--text);
}

.copy-button {
  padding: 0.35rem 0.65rem;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 700;
}

.primary-button:hover,
.ghost-button:hover,
.copy-button:hover {
  transform: translateY(-1px);
}

.primary-button:hover {
  background: #7528e0;
  box-shadow: 0 4px 20px rgba(134, 54, 248, 0.35);
}

.notice {
  margin: 1rem 0 0;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
}

.notice-error {
  background: rgba(180, 35, 24, 0.1);
  color: var(--danger);
}

.notice-success {
  margin-top: 8px;
  background: rgba(134, 54, 248, 0.08);
  color: #8636f8;
  border-color: rgba(134, 54, 248, 0.15);
}

.notice-success + .stack-form {
  margin-top: 24px;
}

.login-help {
  margin: 1rem 0 0;
  color: rgba(6, 3, 23, 0.4);
  font-size: 12px;
  text-align: center;
}

.login-help a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.login-help a:hover {
  color: #7528e0;
}

.portal-topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.portal-topbar__copy {
  min-width: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: end;
}

.directory-toolbar {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  margin-bottom: 1rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 241, 255, 0.96));
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: end;
}

.search-form__search--wide {
  min-width: 0;
}

.toolbar-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.92rem;
  align-items: center;
}

.toolbar-stats__badge {
  padding: 0.36rem 0.72rem;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.table-wrap {
  overflow: hidden;
}

.table-wrap--directory {
  overflow-x: auto;
}

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

.directory-table th,
.directory-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.directory-table th {
  background: rgba(6, 3, 23, 0.97);
  color: #ede7ff;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.directory-table tr:last-child td {
  border-bottom: 0;
}

.copy-chip,
.event-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.event-chip-list {
  align-items: stretch;
}

.copy-chip--event {
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
}

.event-pill {
  display: grid;
  gap: 0.35rem;
  padding: 0.68rem 0.76rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(246, 241, 255, 1), rgba(255, 255, 255, 1));
}

.event-pill__label strong {
  font-size: 0.9rem;
}

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

.empty-search {
  padding: 2rem;
}

.empty-search h2 {
  margin: 0 0 0.35rem;
}

.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  color: var(--muted);
}

.pagination-actions {
  display: flex;
  gap: 0.75rem;
}

@media (max-width: 720px) {
  .portal-topbar,
  .pagination-bar,
  .search-form {
    grid-template-columns: 1fr;
    display: grid;
    align-items: stretch;
  }

  .login-shell,
  .portal-shell {
    width: min(100% - 1rem, 1120px);
  }

  .login-card {
    padding: 36px 28px;
  }

  .login-card--simple h1 {
    font-size: 23px;
  }

  .brand-logo {
    height: 34px;
  }

  .directory-table th,
  .directory-table td {
    padding: 0.85rem 0.75rem;
  }
}

@keyframes login-card-enter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
