:root {
  --portal-border: rgba(36, 31, 27, 0.12);
  --portal-muted: rgba(36, 31, 27, 0.66);
}

.portal-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 120, 99, 0.15), transparent 30rem),
    radial-gradient(circle at 90% 8%, rgba(247, 187, 74, 0.17), transparent 28rem),
    #fffaf0;
  color: #241f1b;
}

.portal-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.5rem;
  padding: 0.75rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--portal-border);
  background: rgba(255, 250, 240, 0.9);
  backdrop-filter: blur(16px);
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: inherit;
  text-decoration: none;
}

.portal-brand__mark {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: #f06451;
  color: #fffaf0;
  font-size: 1.25rem;
  box-shadow: 0 10px 28px rgba(240, 100, 81, 0.25);
}

.portal-main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 5rem) 0;
}

.portal-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}

.portal-card {
  border: 1px solid var(--portal-border);
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.93);
  padding: clamp(1.25rem, 4vw, 2rem);
  box-shadow: 0 22px 70px rgba(70, 50, 35, 0.1);
}

.portal-eyebrow {
  color: #cf4f3d;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.portal-title {
  margin-top: 0.6rem;
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(2.15rem, 5vw, 4.3rem);
  font-weight: 800;
  line-height: 1.02;
}

.portal-lead {
  margin-top: 1rem;
  color: var(--portal-muted);
  font-size: 1.05rem;
  line-height: 1.75;
}

.portal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.portal-tabs button {
  border: 1px solid var(--portal-border);
  border-radius: 999px;
  background: #fff;
  padding: 0.65rem 1rem;
  font-weight: 700;
  color: #675b52;
}

.portal-tabs button.is-active {
  border-color: #f06451;
  background: #fff0ed;
  color: #b53f31;
}

.portal-form {
  display: grid;
  gap: 1rem;
}

.portal-text-button {
  justify-self: center;
  border: 0;
  background: transparent;
  color: #b53f31;
  padding: 0.2rem;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 0.2rem;
}

.portal-text-button:hover {
  color: #7e2b22;
}

.portal-field {
  display: grid;
  gap: 0.4rem;
  font-size: 0.92rem;
  font-weight: 700;
}

.portal-input,
.portal-select,
.portal-textarea {
  width: 100%;
  border: 1px solid var(--portal-border);
  border-radius: 0.85rem;
  background: #fff;
  color: #241f1b;
  padding: 0.8rem 0.9rem;
  font: inherit;
  font-weight: 500;
}

.portal-input:focus,
.portal-select:focus,
.portal-textarea:focus {
  border-color: #f06451;
  outline: 3px solid rgba(240, 100, 81, 0.15);
}

.portal-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid var(--portal-border);
  border-radius: 999px;
  background: #fff;
  color: #342d28;
  padding: 0.7rem 1rem;
  font-weight: 800;
  text-decoration: none;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.portal-button:hover {
  border-color: #f06451;
  transform: translateY(-1px);
}

.portal-button--primary {
  border-color: #f06451;
  background: #f06451;
  color: #fff;
}

.portal-button--forest {
  border-color: #173f37;
  background: #173f37;
  color: #fff;
}

.portal-button:disabled,
button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.portal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.portal-status {
  margin-top: 1rem;
  border-radius: 0.85rem;
  background: #f2eee8;
  padding: 0.75rem 0.9rem;
  color: #594f47;
  font-size: 0.9rem;
}

.portal-status[data-kind="success"],
#nl-status[data-kind="success"],
#contact-status[data-kind="success"] {
  background: #e5f6ed;
  color: #17613f;
}

.portal-status[data-kind="error"],
#nl-status[data-kind="error"],
#contact-status[data-kind="error"] {
  background: #fff0ed;
  color: #9c3429;
}

.recovery-intro {
  border-left: 4px solid #f06451;
  border-radius: 0.25rem 0.85rem 0.85rem 0.25rem;
  background: #fff7f2;
  padding: 0.9rem 1rem;
}

.recovery-intro strong {
  font-size: 1rem;
}

.recovery-intro p,
.portal-help {
  margin-top: 0.3rem;
  color: var(--portal-muted);
  font-size: 0.85rem;
  line-height: 1.55;
}

.recovery-steps {
  margin-top: 1rem;
  border-radius: 1rem;
  background: #e5f6ed;
  padding: 1rem;
  color: #17613f;
}

.recovery-steps ol {
  margin: 0.55rem 0 0 1.2rem;
  list-style: decimal;
  font-size: 0.88rem;
  line-height: 1.7;
}

.portal-check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--portal-muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.portal-check input {
  width: 1rem;
  height: 1rem;
  accent-color: #f06451;
}

.password-checklist {
  display: grid;
  gap: 0.4rem;
  border-radius: 0.85rem;
  background: #f7f3ed;
  padding: 0.8rem 0.9rem;
  color: #756a61;
  font-size: 0.82rem;
}

.password-checklist li::before {
  content: '○';
  display: inline-block;
  width: 1.25rem;
  font-weight: 900;
}

.password-checklist li.is-valid {
  color: #17613f;
}

.password-checklist li.is-valid::before {
  content: '✓';
}

.role-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #fff0ed;
  color: #b53f31;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 800;
}

.cms-section {
  margin-top: 2rem;
}

.cms-section__header {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

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

.article-card {
  display: flex;
  flex-direction: column;
  min-height: 15rem;
  border: 1px solid var(--portal-border);
  border-radius: 1.2rem;
  background: #fff;
  padding: 1.25rem;
  box-shadow: 0 14px 35px rgba(70, 50, 35, 0.07);
}

.article-card__meta {
  color: #cf4f3d;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-card__title {
  margin-top: 0.75rem;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.2;
}

.article-card__excerpt {
  margin-top: 0.7rem;
  color: var(--portal-muted);
  line-height: 1.6;
}

.article-card__link {
  margin-top: auto;
  padding-top: 1rem;
  color: #c94b3a;
  font-weight: 800;
}

.cms-workspace {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.8fr);
  gap: 1rem;
}

.managed-list {
  display: grid;
  align-content: start;
  gap: 0.6rem;
}

.managed-article {
  display: grid;
  gap: 0.3rem;
  width: 100%;
  border: 1px solid var(--portal-border);
  border-radius: 1rem;
  background: #fff;
  padding: 0.9rem;
  text-align: left;
}

.managed-article:hover {
  border-color: #f06451;
  background: #fffaf8;
}

.managed-article.is-active {
  border-color: #f06451;
  background: #fff0ed;
  box-shadow: 0 0 0 3px rgba(240, 100, 81, 0.1);
}

.managed-article span {
  color: var(--portal-muted);
  font-size: 0.78rem;
}

.editor-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  border: 1px solid var(--portal-border);
  border-bottom: 0;
  border-radius: 0.9rem 0.9rem 0 0;
  background: #f8f5f0;
  padding: 0.6rem;
}

.editor-toolbar button {
  min-width: 2.3rem;
  border: 1px solid transparent;
  border-radius: 0.55rem;
  background: #fff;
  padding: 0.4rem 0.55rem;
  font-weight: 800;
}

.editor-toolbar button:hover {
  border-color: #f06451;
}

#article-editor,
#page-editor {
  min-height: 22rem;
  border: 1px solid var(--portal-border);
  border-radius: 0 0 0.9rem 0.9rem;
  background: #fff;
}

.cms-page-content {
  margin-top: 0.75rem;
  color: rgba(36, 31, 27, 0.75);
  font-size: 1.08rem;
  line-height: 1.75;
}

.cms-page-content h2 {
  margin: 0;
  color: #241f1b;
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(2.25rem, 5vw, 3rem);
  font-weight: 800;
  line-height: 1.08;
}

.cms-page-content h3 {
  margin-top: 1.4rem;
  color: #241f1b;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.55rem;
  font-weight: 800;
}

.cms-page-content p,
.cms-page-content ul,
.cms-page-content ol,
.cms-page-content blockquote {
  margin-top: 1rem;
}

.cms-page-content ul,
.cms-page-content ol {
  padding-left: 1.5rem;
}

.cms-page-content ul {
  list-style: disc;
}

.cms-page-content ol {
  list-style: decimal;
}

.cms-page-content blockquote {
  border-left: 4px solid #f6b644;
  background: #fff8e7;
  padding: 0.8rem 1rem;
}

.tiptap {
  min-height: 22rem;
  padding: 1rem;
  outline: none;
  line-height: 1.7;
}

.tiptap h2,
.article-body h2 {
  margin: 1.5rem 0 0.6rem;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.8rem;
  font-weight: 800;
}

.tiptap h3,
.article-body h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1.3rem;
  font-weight: 800;
}

.tiptap ul,
.tiptap ol,
.article-body ul,
.article-body ol {
  margin: 0.8rem 0;
  padding-left: 1.5rem;
}

.tiptap blockquote,
.article-body blockquote {
  margin: 1rem 0;
  border-left: 4px solid #f6b644;
  background: #fff8e7;
  padding: 0.8rem 1rem;
}

.tiptap pre,
.article-body pre {
  overflow-x: auto;
  border-radius: 0.7rem;
  background: #241f1b;
  color: #fff;
  padding: 0.9rem;
}

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

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

.users-table th,
.users-table td {
  border-bottom: 1px solid var(--portal-border);
  padding: 0.8rem;
  text-align: left;
  vertical-align: middle;
}

.users-table td strong,
.users-table td small {
  display: block;
}

.users-table td small {
  margin-top: 0.2rem;
  color: var(--portal-muted);
}

.article-shell {
  max-width: 820px;
}

.article-meta {
  margin-top: 0.8rem;
  color: var(--portal-muted);
  font-weight: 700;
}

.article-body {
  margin-top: 2rem;
  font-size: 1.05rem;
  line-height: 1.8;
}

.article-body p + p {
  margin-top: 1rem;
}

@media (max-width: 900px) {
  .portal-grid,
  .cms-workspace {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 620px) {
  .article-grid,
  .editor-fields {
    grid-template-columns: 1fr;
  }

  .portal-header {
    align-items: flex-start;
  }

  .portal-actions {
    width: 100%;
  }
}
