:root {
  --portal-bg: #f7f7f7;
  --portal-bg-strong: #f7f7f7;
  --portal-input-bg: #d9d9d9;
  --portal-card: rgba(247, 247, 247, 0.82);
  --portal-card-strong: rgba(247, 247, 247, 0.92);
  --portal-text: #212121;
  --portal-muted: rgba(33, 33, 33, 0.68);
  --portal-line: rgba(33, 33, 33, 0.08);
  --portal-line-strong: rgba(33, 33, 33, 0.22);
  --portal-accent: #e63946;
  --portal-accent-soft: rgba(230, 57, 70, 0.12);
  --portal-success: #2f7c53;
  --portal-warning: #a66a00;
  --portal-radius-lg: 28px;
  --portal-radius-md: 20px;
  --portal-radius-sm: 14px;
  --portal-shadow: none;
  --portal-font-display: "Exo 2", sans-serif;
  --portal-font-body: "Inter", sans-serif;
  --portal-max: 1320px;
  --portal-pad: clamp(1.15rem, 2vw, 1.6rem);
}

body[data-theme="dark"] {
  --portal-bg: #212121;
  --portal-bg-strong: #212121;
  --portal-input-bg: #3a3a3a;
  --portal-card: rgba(26, 29, 36, 0.82);
  --portal-card-strong: rgba(26, 29, 36, 0.94);
  --portal-text: #f4f1eb;
  --portal-muted: rgba(244, 241, 235, 0.68);
  --portal-line: rgba(244, 241, 235, 0.12);
  --portal-line-strong: rgba(244, 241, 235, 0.26);
  --portal-accent-soft: rgba(230, 57, 70, 0.18);
  --portal-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--portal-font-body);
  color: var(--portal-text);
  background: var(--portal-bg);
}

a {
  color: inherit;
}

button,
input,
textarea,
select {
  font: inherit;
}

.portal-shell {
  max-width: var(--portal-max);
  margin: 0 auto;
  padding: 1.2rem;
}

.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 0 1.6rem;
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.portal-brand img {
  width: 2.2rem;
  height: 2.2rem;
}

.portal-theme-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  width: 46px;
  height: 27px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.portal-theme-toggle-track {
  width: 46px;
  height: 27px;
  border-radius: 999px;
  background: var(--portal-accent);
  border: 0;
  position: relative;
  transition: background 180ms ease, border-color 180ms ease;
}

.portal-theme-toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(33, 33, 33, 0.2);
  transition: transform 180ms ease;
}

.portal-theme-toggle[aria-pressed="true"] .portal-theme-toggle-knob {
  transform: translateX(19px);
}

body[data-theme="dark"] .portal-theme-toggle-track {
  background: var(--portal-accent);
}

.portal-topnav {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
}

.portal-topnav a {
  text-decoration: none;
  color: var(--portal-muted);
}

.portal-topnav a[aria-current="page"] {
  color: var(--portal-text);
  font-weight: 700;
}

.portal-main {
  display: grid;
  gap: 1.35rem;
  padding-bottom: 2rem;
}

.portal-main--login {
  min-height: calc(100vh - 6rem);
  align-content: center;
}

.portal-main[aria-busy="true"] {
  opacity: 0.82;
}

.portal-hero,
.admin-hero,
.portal-panel,
.portal-status-banner,
.project-overview {
  border: 1px solid var(--portal-line);
  background: var(--portal-card-strong);
  border-radius: var(--portal-radius-lg);
  box-shadow: var(--portal-shadow);
}

.portal-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.9fr);
  gap: 1.2rem;
  padding: clamp(1.35rem, 2vw, 2rem);
}

.portal-hero--login-only {
  max-width: 980px;
  margin: 0 auto;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.portal-kicker,
.section-label,
.auth-eyebrow {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--portal-muted);
}

.portal-hero h1,
.admin-hero h1 {
  margin: 0;
  font-family: var(--portal-font-display);
  font-size: clamp(2.1rem, 5vw, 4.4rem);
  line-height: 0.95;
  max-width: 12ch;
}

.login-title {
  margin: 0 0 1.75rem;
  font-family: var(--portal-font-display);
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  line-height: 1;
}

.portal-intro,
.auth-copy,
.admin-hero-copy {
  margin: 1rem 0 0;
  font-size: clamp(1rem, 1.45vw, 1.15rem);
  line-height: 1.7;
  color: var(--portal-muted);
  max-width: 58ch;
}

.portal-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.portal-hero-meta span,
.token,
.status-pill,
.resource-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  background: rgba(247, 247, 247, 0.55);
  border: 1px solid var(--portal-line);
  font-size: 0.9rem;
}

.auth-card,
.project-overview,
.portal-panel,
.admin-hero,
.portal-status-banner {
  padding: clamp(1rem, 1.8vw, 1.4rem);
}

.auth-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  max-width: 440px;
  width: min(440px, 92vw);
  margin: 0 auto;
  padding: 0;
}

.auth-state {
  display: grid;
  gap: 1rem;
}

.auth-form,
.admin-form {
  display: grid;
  gap: 0.9rem;
  margin-top: 0;
}

.auth-form--compact {
  margin-top: 0;
}

.auth-copy--login {
  margin: 0;
  max-width: 36ch;
  font-size: 1rem;
  line-height: 1.6;
}

.auth-copy--hint {
  margin-top: 0.65rem;
  text-align: center;
  justify-self: center;
}

.admin-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-form--inline {
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field span {
  font-size: 0.9rem;
  font-weight: 600;
}

.field input,
.field textarea,
.field select,
.project-switcher select {
  width: 100%;
  appearance: none;
  border: 1px solid var(--portal-line);
  background: var(--portal-input-bg);
  color: var(--portal-text);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.field input::placeholder,
.field textarea::placeholder {
  color: rgba(33, 33, 33, 0.42);
}

body[data-theme="dark"] .field input::placeholder,
body[data-theme="dark"] .field textarea::placeholder {
  color: rgba(244, 241, 235, 0.4);
}

body[data-theme="dark"] .field input,
body[data-theme="dark"] .field textarea,
body[data-theme="dark"] .field select,
body[data-theme="dark"] .project-switcher select {
  background: var(--portal-input-bg);
  border-color: var(--portal-line);
}

.field select,
.project-switcher select {
  padding-right: 2.8rem;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(33, 33, 33, 0.72) 50%),
    linear-gradient(135deg, rgba(33, 33, 33, 0.72) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

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

body[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(1.2);
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.project-switcher select:focus {
  border-color: rgba(230, 57, 70, 0.55);
  box-shadow: 0 0 0 4px rgba(230, 57, 70, 0.08);
}

.field--wide {
  grid-column: 1 / -1;
}

.portal-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.6rem;
  border: 1px solid transparent;
  border-radius: 10px;
  text-decoration: none;
  padding: 0.62rem 0.95rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.portal-button:hover {
  transform: translateY(-1px);
}

.portal-button:disabled,
.portal-button[aria-busy="true"] {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.portal-button--primary {
  background: var(--portal-accent);
  color: #fff;
  border-color: var(--portal-accent);
}

.portal-button--primary-solid {
  width: 100%;
  background: var(--portal-accent);
  color: #fff;
  border-color: var(--portal-accent);
}

.portal-button--secondary {
  background: #fff;
  border-color: rgba(33, 33, 33, 0.18);
  color: var(--portal-text);
  font-weight: 600;
}

body[data-theme="dark"] .portal-button--secondary {
  background: var(--portal-bg);
  border-color: rgba(244, 241, 235, 0.14);
  color: var(--portal-text);
}

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

.portal-button--danger-outline {
  background: color-mix(in srgb, var(--portal-bg) 90%, white 10%);
  border-color: rgba(230, 57, 70, 0.45);
  color: var(--portal-accent);
}

.portal-button--text {
  padding-inline: 0;
  min-height: auto;
  color: var(--portal-muted);
}

.auth-feedback {
  min-height: 1.25rem;
  margin: 0.75rem 0 0;
  color: var(--portal-muted);
  font-size: 0.92rem;
  text-align: left;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 1.3rem 0 1rem;
  color: var(--portal-muted);
  font-size: 0.9rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(33, 33, 33, 0.18);
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1rem;
}

.login-meta {
  margin: 0;
  font-size: 0.95rem;
  color: var(--portal-muted);
}

.portal-status-banner {
  display: none;
  font-size: 0.96rem;
  line-height: 1.6;
}

.portal-status-banner.is-visible {
  display: block;
}

.dashboard-toolbar,
.admin-toolbar,
.panel-head,
.admin-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.dashboard-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.admin-session-email {
  color: var(--portal-muted);
  font-size: 0.95rem;
}

.is-hidden {
  display: none !important;
}

.project-switcher {
  display: grid;
  gap: 0.4rem;
  min-width: 220px;
}

.project-switcher span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--portal-muted);
}

.project-overview {
  display: grid;
  gap: 1rem;
  padding: 1.5rem;
}

.dashboard-project-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.dashboard-project-card {
  appearance: none;
  border: 1px solid var(--portal-line);
  background: #fff;
  border-radius: 20px;
  padding: 1.1rem 1.2rem;
  text-align: left;
  display: grid;
  gap: 0.75rem;
  color: var(--portal-text);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

body[data-theme="dark"] .dashboard-project-card {
  background: var(--portal-card-strong);
}

.dashboard-project-card:hover {
  transform: translateY(-2px);
  border-color: var(--portal-line-strong);
}

.dashboard-project-card.is-active {
  border-color: rgba(230, 57, 70, 0.32);
  box-shadow: 0 14px 32px rgba(230, 57, 70, 0.08);
}

.dashboard-project-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.dashboard-project-card strong {
  font-size: 1rem;
  line-height: 1.35;
}

.dashboard-project-card p {
  margin: 0;
  color: var(--portal-muted);
  line-height: 1.55;
  font-size: 0.94rem;
}

.project-overview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.project-overview-title h3 {
  margin: 0;
  font-family: var(--portal-font-display);
  font-size: clamp(1.8rem, 4vw, 3.1rem);
  line-height: 1;
}

.project-summary {
  margin: 0.7rem 0 0;
  color: var(--portal-muted);
  max-width: 56ch;
  line-height: 1.65;
}

.status-pill {
  font-weight: 500;
  font-size: 0.92rem;
  letter-spacing: 0;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
}

.status-pill[data-status="In Progress"] {
  color: var(--portal-muted);
}

.status-pill[data-status="Awaiting Feedback"] {
  color: var(--portal-muted);
}

.status-pill[data-status="Delivered"] {
  color: var(--portal-muted);
}

.status-pill[data-status="On Hold"] {
  color: var(--portal-muted);
}

.project-update {
  display: grid;
  gap: 0.65rem;
  padding: 1rem;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(194, 83, 61, 0.1), rgba(255, 255, 255, 0.5));
  border: 1px solid rgba(194, 83, 61, 0.14);
}

.project-update p {
  margin: 0;
}

.project-update-date {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--portal-muted);
}

.dashboard-grid,
.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.92fr);
  gap: 1.2rem;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: start;
}

.dashboard-main {
  min-width: 0;
}

.dashboard-sidebar {
  position: sticky;
  top: 1.5rem;
  display: grid;
  gap: 1.5rem;
  padding-left: 1.5rem;
  border-left: 1px solid var(--portal-line);
}

.dashboard-content-head {
  margin-bottom: 1.25rem;
}

.dashboard-content-head h3 {
  margin: 0;
  font-family: var(--portal-font-display);
  font-size: clamp(1.6rem, 2.4vw, 2.3rem);
}

.dashboard-content-list {
  display: grid;
  gap: 1rem;
}

.dashboard-column,
.resource-groups,
.notes-list,
.admin-list,
.token-list {
  display: grid;
  gap: 1rem;
}

.portal-panel h2,
.portal-panel h3 {
  margin: 0;
  font-family: var(--portal-font-display);
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.action-card,
.resource-card,
.note-card,
.admin-item {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--portal-line);
  border-radius: 22px;
  background: rgba(247, 247, 247, 0.56);
}

.dashboard-card {
  display: grid;
  gap: 0.7rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--portal-line);
  border-radius: 18px;
  background: #fff;
}

body[data-theme="dark"] .dashboard-card {
  background: var(--portal-card-strong);
}

.dashboard-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--portal-muted);
  font-size: 0.9rem;
}

.dashboard-card-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.dashboard-card-copy {
  margin: 0;
  color: var(--portal-muted);
  line-height: 1.6;
}

.password-card {
  gap: 1rem;
}

.settings-card {
  gap: 1.2rem;
}

.settings-card-head {
  display: grid;
  gap: 0.35rem;
}

.settings-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: end;
}

.settings-form > .portal-button {
  justify-self: start;
}

.password-toggle {
  justify-self: end;
}

.password-row {
  display: grid;
  gap: 0.35rem;
}

.password-label {
  color: var(--portal-muted);
  font-size: 0.9rem;
}

.password-value,
.admin-inline-secret {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--portal-line);
  background: rgba(33, 33, 33, 0.04);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

body[data-theme="dark"] .password-value,
body[data-theme="dark"] .admin-inline-secret {
  background: rgba(244, 241, 235, 0.06);
}

.contact-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--portal-text);
  font-weight: 600;
  border: 1px solid rgba(33, 33, 33, 0.18);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  background: var(--portal-card-strong);
}

.contact-action span {
  border-bottom: 0;
  padding-bottom: 0;
}

.action-card {
  text-decoration: none;
  min-height: 10rem;
  align-content: space-between;
}

.action-card:hover,
.resource-link:hover {
  border-color: var(--portal-line-strong);
}

.action-icon,
.resource-icon {
  width: 2.5rem;
  height: 2.5rem;
  display: inline-grid;
  place-items: center;
  border-radius: 18px;
  background: var(--portal-accent-soft);
  color: var(--portal-accent);
  font-size: 1.1rem;
  font-weight: 700;
}

.action-title,
.resource-title,
.note-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.action-copy,
.resource-meta,
.note-meta,
.empty-state {
  margin: 0;
  line-height: 1.6;
  color: var(--portal-muted);
  font-size: 0.95rem;
}

.resource-group {
  display: grid;
  gap: 0.75rem;
}

.resource-group h4 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--portal-muted);
}

.resource-link {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.9rem;
  text-decoration: none;
}

.resource-link strong {
  display: block;
  margin-bottom: 0.2rem;
}

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

.future-list {
  display: grid;
  gap: 0.8rem;
  padding-left: 1.15rem;
  margin: 0;
  color: var(--portal-muted);
}

.admin-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portal-panel--wide {
  grid-column: 1 / -1;
}

.token-list {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.token {
  justify-content: center;
}

.admin-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.admin-item-copy {
  display: grid;
  gap: 0.35rem;
}

.admin-item-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.admin-item-actions button {
  min-height: auto;
  padding: 0.55rem 0.8rem;
}

.portal-main--simple-admin {
  display: grid;
  gap: 1.2rem;
}

.portal-admin-page .portal-topbar {
  padding-bottom: 1.1rem;
}

.portal-admin-page .portal-status-banner {
  padding: 0.9rem 1rem;
  border: 1px solid rgba(33, 33, 33, 0.12);
  border-radius: 10px;
  background: var(--portal-card-strong);
  box-shadow: none;
}

.admin-auth-panel {
  max-width: 34rem;
}

.admin-simple-layout {
  display: grid;
  grid-template-columns: 540px minmax(0, 1fr);
  gap: 1.2rem;
  align-items: start;
}

.admin-projects-panel,
.admin-project-panel {
  display: grid;
  gap: 1rem;
  align-content: start;
}

[data-project-create-form] {
  grid-template-columns: 1fr;
  align-items: end;
}

.admin-form > .portal-button--primary {
  grid-column: 1 / -1;
  justify-self: start;
  margin-top: 0.3rem;
}

.admin-project-head-form > .portal-button--primary {
  grid-column: auto;
  justify-self: start;
  margin-top: 0;
}

.portal-admin-page .admin-projects-panel,
.portal-admin-page .admin-project-panel {
  padding: clamp(1.4rem, 2vw, 1.9rem);
  border: 1px solid var(--portal-line);
  border-radius: var(--portal-radius-lg);
  background: var(--portal-card-strong);
  box-shadow: var(--portal-shadow);
  gap: 1.15rem;
}

.portal-admin-page .admin-projects-panel h2,
.portal-admin-page .admin-project-panel h2,
.portal-admin-page .admin-project-panel h3 {
  font-size: clamp(1.2rem, 1.6vw, 1.45rem);
  letter-spacing: -0.01em;
}

.admin-project-list {
  display: grid;
  gap: 0.7rem;
}

.admin-project-list-item {
  appearance: none;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  cursor: pointer;
  color: var(--portal-text);
  transition: background 160ms ease, color 160ms ease;
}

.admin-project-list-item strong {
  font-size: 1rem;
  font-weight: 600;
}

.admin-project-list-copy {
  display: grid;
  gap: 0.28rem;
  min-width: 0;
}

.admin-project-list-item:hover {
  background: rgba(33, 33, 33, 0.04);
}

.admin-project-list-item.is-active {
  background: rgba(33, 33, 33, 0.06);
  color: var(--portal-text);
}

body[data-theme="dark"] .admin-project-list-item.is-active {
  background: rgba(244, 241, 235, 0.1);
  border-left: 2px solid var(--portal-accent);
  padding-left: calc(0.85rem - 2px);
}

.admin-project-shell {
  display: grid;
  gap: 1.1rem;
}

.admin-project-head-form {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 260px) auto;
  align-items: end;
  gap: 1rem;
}

.admin-tabs {
  display: flex;
  gap: 1.6rem;
  flex-wrap: wrap;
  padding-bottom: 0.9rem;
}

.admin-tab {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0 0 0.8rem;
  color: var(--portal-muted);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}

.admin-tab:hover {
  color: var(--portal-text);
}

.admin-tab.is-active {
  color: var(--portal-text);
  border-bottom-color: var(--portal-accent);
}

.admin-tab-panel {
  display: grid;
  gap: 1rem;
  padding-top: 0.35rem;
}

.admin-empty-state {
  color: var(--portal-muted);
  line-height: 1.6;
  padding-top: 0.25rem;
}

.admin-helper-copy {
  margin: 0;
  color: var(--portal-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.portal-admin-page .panel-head {
  padding-bottom: 0.2rem;
}

.portal-admin-page .admin-item {
  padding: 0.9rem 0;
  border: 0;
  border-top: 1px solid var(--portal-line);
  border-radius: 0;
  background: transparent;
  gap: 1rem;
}

.portal-admin-page .admin-list > .admin-item:first-child {
  border-top: 0;
}

.portal-admin-page .admin-item .admin-item-copy strong {
  font-weight: 600;
  font-size: 1rem;
}

.portal-admin-page .admin-item .admin-item-copy .visually-muted {
  font-size: 0.9rem;
}

.portal-button--danger-outline {
  min-height: 2.4rem;
  padding: 0.5rem 1rem;
  font-weight: 600;
  font-size: 0.92rem;
  background: #fff;
}

body[data-theme="dark"] .portal-button--danger-outline {
  background: transparent;
}

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

/* ============================================================
   SaaS-style workspace layout (sidebar + main content)
   ============================================================ */

.portal-auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 1.2rem;
  max-width: 1320px;
  margin: 0 auto;
}

.portal-auth-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0 0;
}

.portal-auth-main {
  display: grid;
  place-items: center;
  padding: 2rem 0;
}

.portal-workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--portal-bg);
}

/* ---------- Sidebar ---------- */

.portal-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  padding: 1.3rem 1.1rem 1.1rem;
  background: transparent;
  border-right: 1px solid var(--portal-line);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.4rem 0.3rem 0.9rem;
}

.sidebar-brand-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  flex-shrink: 0;
}

.sidebar-brand-logo {
  width: 1.8rem;
  height: 1.8rem;
}

.sidebar-brand-copy {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.sidebar-brand-row {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-brand-row strong {
  font-family: var(--portal-font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.sidebar-brand-sub {
  font-size: 0.78rem;
  color: var(--portal-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  display: grid;
  gap: 0.35rem;
}

.sidebar-nav-label,
.sidebar-section-head h3 {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--portal-muted);
}

.sidebar-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.3rem 0.45rem;
}

.sidebar-nav-item {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  border: 0;
  background: transparent;
  color: var(--portal-text);
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  text-align: left;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.sidebar-nav-item:hover {
  background: rgba(33, 33, 33, 0.04);
}

.sidebar-nav-item.is-active {
  background: rgba(33, 33, 33, 0.06);
  color: var(--portal-text);
  font-weight: 600;
}

body[data-theme="dark"] .sidebar-nav-item.is-active {
  background: rgba(244, 241, 235, 0.08);
}

.sidebar-nav-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.7;
}

.sidebar-section {
  display: grid;
  gap: 0.6rem;
}

.sidebar-section--list {
  min-height: auto;
}

.sidebar-form {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: 1fr;
  padding: 0 0.2rem;
}

.sidebar-form .field span {
  font-size: 0.8rem;
  font-weight: 600;
}

.sidebar-form .field input,
.sidebar-form .field select {
  padding: 0.65rem 0.8rem;
  font-size: 0.92rem;
  border-radius: 10px;
}

.sidebar-form > .portal-button--primary {
  margin-top: 0.2rem;
  min-height: 2.6rem;
  font-size: 0.92rem;
  justify-self: start;
}

.sidebar-project-list {
  padding: 0 0.1rem;
}

.sidebar-project-list .admin-project-list-item {
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  gap: 0.6rem;
}

.sidebar-project-list .admin-project-list-item strong {
  font-size: 0.92rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-project-list .status-pill {
  padding: 0.25rem 0.55rem;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 0.9rem;
  border-top: 1px solid var(--portal-line);
  display: grid;
  gap: 0.65rem;
}

.sidebar-user {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.2rem;
  border-radius: 0;
  background: transparent;
  border: 0;
}

.sidebar-user-avatar {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  background: var(--portal-accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--portal-font-display);
  font-weight: 700;
  font-size: 0.95rem;
}

.sidebar-user-copy {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.sidebar-user-copy strong {
  font-size: 0.9rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-email {
  font-size: 0.78rem;
  color: var(--portal-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-action {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--portal-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
}

.sidebar-user-action:hover {
  color: var(--portal-accent);
  background: var(--portal-accent-soft);
}

/* ---------- Main content ---------- */

.portal-main-content {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 1.25rem;
  padding: 1.5rem clamp(1.25rem, 3vw, 2.4rem) 2rem;
  min-width: 0;
}

body:not(.portal-admin-page) .portal-sidebar {
  display: none;
}

body:not(.portal-admin-page) .portal-workspace {
  grid-template-columns: 1fr;
}

.content-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.3rem;
}

.content-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--portal-muted);
}

.content-breadcrumb-current {
  color: var(--portal-text);
  font-weight: 600;
}

.content-breadcrumb-sep {
  opacity: 0.5;
}

.client-topbar {
  grid-template-columns: auto 1fr auto;
  display: grid;
  align-items: center;
}

.client-topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.client-topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
}

.client-session-copy {
  display: grid;
  gap: 0.1rem;
  text-align: right;
}

.client-session-copy strong {
  font-size: 0.9rem;
  font-weight: 600;
}

.client-session-copy span {
  font-size: 0.78rem;
  color: var(--portal-muted);
}

.content-card {
  background: transparent;
  border: 0;
  padding: 0;
  display: grid;
  gap: 1.5rem;
  align-self: start;
}

.content-empty {
  display: grid;
  place-items: center;
  gap: 0.5rem;
  padding: 4rem 2rem;
  text-align: center;
  align-self: start;
  background: transparent;
  border: 0;
}

.content-empty h2 {
  margin: 0;
  font-family: var(--portal-font-display);
  font-size: 1.3rem;
}

.content-empty p {
  margin: 0;
  color: var(--portal-muted);
  font-size: 0.95rem;
  max-width: 36ch;
  line-height: 1.55;
}

.content-empty-icon {
  display: none;
}

/* Inline project detail form in the content card */
.portal-admin-page .content-card .admin-project-head-form {
  padding-bottom: 1.2rem;
  border-bottom: 0;
  margin-bottom: 0.2rem;
}

.portal-admin-page .content-card .admin-tabs {
  margin-bottom: 0.25rem;
}

.content-card .client-tabs {
  margin-top: -0.15rem;
  margin-bottom: 0.25rem;
}

/* Client-side: compact project cards in sidebar */
.sidebar-project-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

.sidebar-project-cards .dashboard-project-card {
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  gap: 0.45rem;
  border: 0;
  background: transparent;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 160ms ease, color 160ms ease;
}

.sidebar-project-cards .dashboard-project-card:hover {
  background: rgba(33, 33, 33, 0.04);
}

.sidebar-project-cards .dashboard-project-card-head {
  gap: 0.5rem;
}

.sidebar-project-cards .dashboard-project-card strong {
  font-size: 0.92rem;
  font-weight: 600;
}

.sidebar-project-cards .dashboard-project-card p {
  font-size: 0.82rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sidebar-project-cards .dashboard-project-card.is-active {
  background: transparent;
  border-color: transparent;
}

body[data-theme="dark"] .sidebar-project-cards .dashboard-project-card.is-active {
  background: transparent;
  border-left: 0;
  padding-left: 0.8rem;
}

.sidebar-project-cards .status-pill {
  padding: 0.2rem 0.5rem;
  font-size: 0.68rem;
  letter-spacing: 0.03em;
}

/* Client-side: project-overview sits flush inside content-card (no double border) */
.content-card .project-overview {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
  padding-bottom: 1.3rem;
  border-bottom: 1px solid var(--portal-line);
}

.project-overview-actions {
  display: inline-flex;
  align-items: end;
  gap: 1rem;
}

.client-project-switcher {
  display: grid;
  gap: 0.35rem;
  min-width: 240px;
}

.client-project-switcher span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--portal-muted);
}

.client-project-switcher select {
  width: 100%;
  appearance: none;
  border: 1px solid var(--portal-line);
  border-radius: 12px;
  background: var(--portal-card-strong);
  color: var(--portal-text);
  padding: 0.8rem 2.6rem 0.8rem 0.95rem;
  font-size: 0.95rem;
}

.content-card .dashboard-layout {
  margin-top: 0.3rem;
}

@media (max-width: 980px) {
  .portal-hero,
  .dashboard-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .admin-simple-layout,
  .admin-project-head-form,
  [data-project-create-form] {
    grid-template-columns: 1fr;
  }

  .portal-workspace {
    grid-template-columns: 1fr;
  }

  .portal-sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--portal-line);
  }

  .portal-main-content {
    padding: 1rem 1rem 2rem;
  }

  .client-topbar {
    grid-template-columns: 1fr;
    gap: 1rem;
    justify-items: start;
  }

  .client-topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .project-overview-actions {
    display: grid;
    justify-items: start;
  }

  .portal-admin-page .admin-projects-panel {
    padding: 1.25rem;
  }

  .portal-admin-page .admin-project-panel {
    padding: 1.25rem;
  }

  .admin-form,
  .admin-form--inline,
  .action-grid {
    grid-template-columns: 1fr;
  }

  .portal-topbar,
  .dashboard-toolbar,
  .admin-toolbar,
  .panel-head,
  .admin-hero,
  .project-overview-head {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .portal-shell {
    padding: 0.8rem;
  }

  .portal-topnav {
    width: 100%;
  }

  .portal-hero h1,
  .admin-hero h1 {
    max-width: 100%;
  }

  .resource-link,
  .admin-item,
  .note-row {
    grid-template-columns: 1fr;
  }

  .resource-link {
    align-items: start;
  }
}
