.portal-page {
  --portal-navy: #0d1c33;
  --portal-blue: #1d3553;
  --portal-red: #a12d42;
  --portal-gold: #f0cb91;
  --portal-line: #d9e2ec;
  --portal-muted: #53657d;
  --portal-canvas: #eef2f7;
  --shell: min(1312px, calc(100% - 88px));
  color: var(--portal-navy);
  background: var(--portal-canvas);
}

.portal-page .masthead {
  border-top-color: var(--portal-red);
}
.portal-page .masthead-inner {
  min-height: 78px;
}
.portal-page .desktop-nav {
  gap: clamp(16px, 2.1vw, 29px);
}
.portal-page .portal-link[aria-current="page"] {
  background: #243a56;
  border-color: #657993;
}

.portal-hero {
  color: #fff;
  background:
    linear-gradient(90deg, #0b1a30 6%, #0b1a30eb 28%, #10233b87 58%, #101c3580 100%),
    url('/assets/administration.webp') center 49% / cover no-repeat,
    var(--portal-navy);
  border-bottom: 3px solid var(--portal-red);
}
.portal-hero-inner {
  min-height: 206px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px 30px;
  padding-block: 36px 44px;
}
.portal-hero .overline {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--portal-gold);
}
.portal-hero .overline::before {
  content: "";
  width: 21px;
  height: 2px;
  background: #c45a6d;
}
.portal-hero h1 {
  margin-top: 8px;
  font-size: clamp(3.3rem, 6.7vw, 5.9rem);
  letter-spacing: -.061em;
  line-height: .95;
}
.portal-register-link {
  color: #fff;
  background: #14243bd9;
  border-color: #8ea0b6;
}
.portal-register-link:hover {
  background: #263d58;
  border-color: #d0dbe8;
}
.portal-register-link span { color: var(--portal-gold); }

.portal-session {
  position: sticky;
  top: 8px;
  z-index: 3;
  margin-top: 15px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  column-gap: 11px;
  row-gap: 8px;
  min-height: 65px;
  padding: 10px 14px;
  color: var(--portal-navy);
  background: #fff;
  border: 1px solid var(--portal-line);
  border-radius: 12px;
  box-shadow: 0 3px 12px #1022380a;
}
.portal-session-marker {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #b07a34;
  box-shadow: 0 0 0 4px #f8eddd;
  margin-inline: 5px;
}
.portal-session:has(#sign-out:not([hidden])) .portal-session-marker {
  background: #268568;
  box-shadow: 0 0 0 4px #e4f3ed;
}
.portal-session #admin-status {
  font-size: .88rem;
  font-weight: 630;
  overflow-wrap: anywhere;
}
.portal-session:has(#sign-out:not([hidden])) #admin-status[data-state="error"] {
  color: #8e2437;
}
.portal-session #admin-status[data-state="success"] {
  color: #1c694f;
}
.portal-session-actions {
  grid-column: 3 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.portal-workspace {
  padding-block: 19px 62px;
}
.portal-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 27px;
}
.portal-tools a {
  flex: 1 1 160px;
  min-width: 0;
  min-height: 60px;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 13px;
  border: 1px solid var(--portal-line);
  border-radius: 11px;
  background: #f9fbfe;
  color: var(--portal-navy);
  font-size: .89rem;
  font-weight: 720;
}
.portal-tools a:hover {
  background: #fff;
  border-color: #7c93af;
}
.portal-tools a[aria-current="location"] {
  color: #fff;
  background: #223b5b;
  border-color: #223b5b;
  box-shadow: 0 4px 12px #1a324526;
}
.portal-tools a[aria-current="location"] .portal-tool-arrow {
  color: var(--portal-gold);
}
.portal-tools .portal-tool-arrow {
  margin-left: auto;
  color: #526883;
  padding-right: 2px;
}

.portal-icon {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 8px;
  color: #224a75;
  background: #e7eff9;
}
.portal-icon::before,
.portal-icon::after {
  position: absolute;
  content: "";
}
.portal-icon--publishing::before {
  top: 9px;
  left: 10px;
  width: 14px;
  height: 17px;
  border: 1.6px solid currentColor;
  border-radius: 2px;
}
.portal-icon--publishing::after {
  top: 15px;
  left: 14px;
  width: 6px;
  height: 1.6px;
  background: currentColor;
  box-shadow: 0 4px currentColor;
}
.portal-icon--chat::before {
  top: 10px;
  left: 8px;
  width: 18px;
  height: 14px;
  border: 1.6px solid currentColor;
  border-radius: 4px;
}
.portal-icon--chat::after {
  bottom: 8px;
  left: 11px;
  width: 5px;
  height: 5px;
  border-bottom: 1.6px solid currentColor;
  border-left: 1.6px solid currentColor;
  background: #e7eff9;
  transform: skewY(-26deg);
}
.portal-icon--access {
  color: #863143;
  background: #f5e8ec;
}
.portal-icon--access::before {
  top: 8px;
  left: 13px;
  width: 8px;
  height: 10px;
  border: 1.6px solid currentColor;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
}
.portal-icon--access::after {
  bottom: 8px;
  left: 10px;
  width: 14px;
  height: 10px;
  border: 1.6px solid currentColor;
  border-radius: 2px;
}

.portal-layout > section[data-portal-panel]:not([data-portal-current]) {
  display: none;
}
.portal-section {
  min-width: 0;
  scroll-margin-top: 86px;
}
.portal-section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.portal-section-heading::before {
  content: "";
  flex: 0 0 3px;
  height: 21px;
  border-radius: 2px;
  background: var(--portal-red);
}
.portal-section-heading h2 {
  color: #172b45;
  font-size: clamp(1.65rem, 2.5vw, 2.05rem);
  letter-spacing: -.039em;
}
.portal-page :is(#website-access-check, #terminations-check) {
  padding: 10px 13px;
  margin: 0 0 16px;
  border: 1px solid #ecd5dc;
  border-radius: 9px;
  color: #8e2437;
  background: #fcf7f8;
}
.portal-page .editor-panel {
  min-width: 0;
  border: 1px solid var(--portal-line);
  border-radius: 12px;
  box-shadow: 0 4px 12px #10223808;
  padding: clamp(15px, 1.65vw, 22px);
}
.portal-publishing-grid {
  display: grid;
  grid-template-columns: minmax(170px, .34fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.portal-page .portal-library {
  padding: 14px 12px;
  background: #f9fbfe;
}
.portal-page .editor-heading {
  flex-wrap: wrap;
  gap: 8px;
}
.portal-page .editor-panel h3 {
  font-size: .98rem;
  letter-spacing: -.01em;
  line-height: 1.25;
}
.portal-library [id="new-record"] {
  width: 100%;
}
.portal-page #admin-record-list {
  max-height: 480px;
  overflow: auto;
  margin-inline: -4px;
  padding: 4px;
  scrollbar-width: thin;
}
.portal-page .admin-empty {
  padding: 9px;
  border: 1px dashed #cbd8e8;
  border-radius: 7px;
  color: var(--portal-muted);
  font-size: .8rem;
}
.portal-page #admin-record-list button {
  display: grid;
  gap: 4px;
  min-width: 0;
  overflow-wrap: anywhere;
  background: #fff;
  border-radius: 7px;
}
.portal-page #admin-record-list button[aria-pressed="true"] {
  border-color: #557ca8;
  background: #eaf1fa;
}
.portal-page .admin-record-title {
  font-size: .83rem;
}
.portal-page .admin-record-meta {
  color: var(--portal-muted);
  font-size: .72rem;
}

.portal-page .button {
  border-radius: 8px;
}
.portal-page .primary {
  background: var(--portal-red);
  border-color: var(--portal-red);
}
.portal-page .primary:hover:not(:disabled) {
  background: #89243a;
  border-color: #89243a;
}
.portal-page .subtle {
  border-color: #bccbdb;
}
.portal-page .subtle:hover:not(:disabled) {
  background: #edf3fa;
  border-color: #849bb7;
}
.portal-page button:disabled {
  opacity: .62;
}
.portal-page .editor-panel label {
  color: #304761;
}
.portal-page .editor-panel form input,
.portal-page .editor-panel form select,
.portal-page .editor-panel form textarea {
  min-width: 0;
  border-radius: 7px;
  border-color: #c4d2e2;
}
.portal-page .editor-panel :is(input, select, textarea):disabled {
  background: #f1f5fa;
  color: #5d6e84;
  opacity: 1;
}
.portal-page .editor-panel .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.portal-page #record-form .admin-actions {
  justify-content: flex-end;
  border-top: 1px solid #e6edf5;
  padding-top: 14px;
  margin-top: 2px;
}

.portal-page .chat-status {
  color: var(--portal-muted);
  font-size: .83rem;
}
.portal-page .chat-messages {
  max-height: 367px;
  padding: 3px;
  margin-inline: -3px;
  scrollbar-width: thin;
}
.portal-page .chat-messages:empty {
  display: none;
}
.portal-page .chat-messages li {
  background: #f3f6fb;
  border-color: #e0e8f2;
  border-radius: 8px;
}
.portal-page .chat-meta {
  flex-wrap: wrap;
  gap: 0 9px;
  overflow-wrap: anywhere;
}
.portal-page .portal-chat-panel .admin-actions {
  justify-content: flex-end;
}
.portal-page .website-access-slot {
  background: #f8fafd;
  border-color: var(--portal-line);
  border-radius: 9px;
}

@media (max-width: 1120px) {
  .portal-page { --shell: min(100% - 58px, 1312px); }
}
@media (max-width: 760px) {
  .portal-page { --shell: calc(100% - 32px); }
  .portal-page .masthead-inner { min-height: 68px; }
  .portal-hero {
    background-image:
      linear-gradient(90deg, #0b1a30f5 5%, #0b1a30cb 43%, #10233b80 100%),
      url('/assets/administration.webp');
    background-position: center, 62% center;
  }
  .portal-hero-inner { min-height: 165px; padding-block: 29px 25px; }
  .portal-hero h1 { font-size: clamp(2.8rem, 10vw, 4.4rem); }
  .portal-session {
    position: static;
    grid-template-columns: auto minmax(0, 1fr);
    padding: 10px 11px;
  }
  .portal-session-actions { grid-column: 2; }
  .portal-session-actions:has(> :not([hidden])) .button { min-height: 42px; }
  .portal-session-actions:not(:has(> :not([hidden]))) { display: none; }
  .portal-section { scroll-margin-top: 11px; }
}
@media (max-width: 560px) {
  .portal-publishing-grid { grid-template-columns: minmax(0, 1fr); }
  .portal-tools a { flex-basis: calc(50% - 5px); gap: 8px; padding-inline: 9px; font-size: .82rem; }
  .portal-tools .portal-tool-arrow { display: none; }
  .portal-tools { margin-bottom: 22px; }
  .portal-workspace { padding-block: 14px 40px; }
  .portal-page #admin-record-list { max-height: 210px; }
  .portal-page .portal-library #new-record { width: auto; }
}
@media (max-width: 390px) {
  .portal-page .editor-panel .form-grid { grid-template-columns: minmax(0, 1fr); }
  .portal-page .editor-panel input[type="date"] { max-width: 100%; }
}

.portal-icon--termination {
  color: #863143;
  background: #f5e8ec;
}
.portal-icon--termination::before {
  top: 8px;
  left: 10px;
  width: 14px;
  height: 17px;
  border: 1.6px solid currentColor;
  border-radius: 2px;
}
.portal-icon--termination::after {
  top: 16px;
  left: 14px;
  width: 7px;
  height: 1.6px;
  background: currentColor;
}
.portal-termination-privacy {
  margin-bottom: 13px;
  color: var(--portal-muted);
  font-size: .87rem;
}
.portal-termination-status:not(:empty) {
  margin-bottom: 12px;
  padding: 9px 13px;
  color: #284664;
  background: #f8fafd;
  border: 1px solid var(--portal-line);
  border-radius: 8px;
  font-size: .86rem;
}
.portal-termination-status[data-state="error"] {
  color: #8e2437;
  background: #fcf2f3;
  border-color: #ecd5dc;
}
.portal-termination-status[data-state="success"] {
  color: #1c694f;
  background: #edf7f2;
  border-color: #cae7d9;
}
.portal-termination-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.portal-page .portal-termination-library {
  background: #f9fbfe;
}
.portal-termination-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.portal-page #terminations-list {
  display: grid;
  gap: 7px;
  max-height: 340px;
  overflow: auto;
  margin-inline: -4px;
  padding: 4px;
  scrollbar-width: thin;
}
.portal-page .termination-empty {
  padding: 10px;
  color: var(--portal-muted);
  border: 1px dashed #cbd8e8;
  border-radius: 7px;
  font-size: .84rem;
}
.portal-page .termination-record {
  display: grid;
  gap: 4px;
  min-width: 0;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #cdd7e2;
  border-radius: 8px;
  background: #fff;
  color: var(--portal-navy);
  text-align: left;
  overflow-wrap: anywhere;
}
.portal-page .termination-record:hover:not(:disabled),
.portal-page .termination-record[aria-pressed="true"] {
  border-color: #557ca8;
  background: #eaf1fa;
}
.termination-record-name {
  font-size: .87rem;
}
.termination-record-meta {
  color: var(--portal-muted);
  font-size: .77rem;
}
.portal-page #termination-form .admin-actions {
  justify-content: flex-end;
  border-top: 1px solid #e6edf5;
  padding-top: 14px;
  margin-top: 2px;
}
@media (max-width: 700px) {
  .portal-termination-grid { grid-template-columns: minmax(0, 1fr); }
  .portal-page #terminations-list { max-height: 212px; }
}
