.portal-page {
  padding: 0;
  color: #173456;
  background: #eef2f5;
}

.portal-locked .portal-shell {
  display: none;
}

.portal-locked .login-screen {
  display: grid;
}

.login-screen {
  min-height: 100vh;
  padding: 24px;
  display: none;
  place-items: center;
  background:
    linear-gradient(rgba(0, 30, 68, .76), rgba(0, 30, 68, .76)),
    url("/assets/consultation-hero.webp") center/cover no-repeat;
}

.login-card {
  width: min(100%, 1180px);
  padding: clamp(22px, 5vw, 34px);
  background: rgba(255, 255, 255, .97);
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 10px;
  box-shadow: 0 18px 44px rgba(0, 20, 48, .24);
}

.login-brand img {
  width: 230px;
  height: 72px;
  margin-bottom: 18px;
  object-fit: contain;
}

.login-card h1 {
  margin: 0;
  color: #092c5a;
  font-size: 38px;
  letter-spacing: 0;
}

.login-copy,
.security-note {
  margin: 12px 0 0;
  color: #536274;
  font-size: 13px;
  line-height: 1.55;
}

.login-panels {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.login-form {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 18px;
  background: #f8faf9;
  border: 1px solid #dfe6e7;
  border-radius: 8px;
}

.login-form h2 {
  margin: 0;
  color: #092c5a;
  font-family: "DM Sans", Arial, sans-serif;
  font-size: 20px;
}

.login-form > p {
  min-height: 40px;
  margin: 0;
  color: #536274;
  font-size: 12px;
  line-height: 1.45;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: #173456;
  font-size: 12px;
  font-weight: 800;
}

.login-form input,
.login-form select {
  width: 100%;
  min-height: 44px;
  padding: 10px 11px;
  color: #173456;
  background: #fff;
  border: 1px solid #c9d4d8;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
}

.login-status {
  min-height: 18px;
  margin: 0;
  color: #7b261f;
  font-size: 12px;
  font-weight: 800;
}

#portal-sign-out {
  min-height: 40px;
  padding: 9px 12px;
  color: #0a3f70;
  background: #fff;
  border: 1px solid #c8d4d8;
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.portal-shell {
  min-height: 100vh;
  background: #f8faf9;
}

.portal-topbar {
  min-height: 78px;
  padding: 12px clamp(16px, 4vw, 42px);
  display: grid;
  grid-template-columns: 220px 1fr auto;
  gap: 20px;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #dde4e7;
}

.portal-brand img {
  width: 210px;
  height: 54px;
  object-fit: contain;
}

.portal-switcher {
  display: none;
  justify-self: center;
  min-height: 46px;
  padding: 4px;
  gap: 4px;
  background: #eef3f3;
  border: 1px solid #d8e0e0;
  border-radius: 8px;
}

.portal-switcher button,
.patient-tabs button {
  min-height: 36px;
  padding: 8px 14px;
  color: #37506b;
  background: transparent;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.portal-switcher button.is-active,
.patient-tabs button.is-active {
  color: #fff;
  background: #0a3f70;
}

.portal-exit {
  min-height: 42px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0a3f70;
  border: 1px solid #bf9645;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
}

.portal-account {
  display: flex;
  align-items: center;
  gap: 10px;
}

.portal-account span {
  color: #536274;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.portal-view {
  display: none;
  padding: clamp(16px, 3vw, 34px);
}

.portal-view.is-active {
  display: block;
}

.portal-hero {
  min-height: 190px;
  padding: clamp(22px, 4vw, 42px);
  display: grid;
  grid-template-columns: 1fr minmax(240px, 320px);
  gap: 24px;
  align-items: center;
  color: #fff;
  background:
    linear-gradient(rgba(0, 30, 68, .72), rgba(0, 30, 68, .72)),
    url("/assets/consultation-hero.webp") center/cover no-repeat;
  border-radius: 10px;
}

.practitioner-hero {
  background:
    linear-gradient(rgba(0, 36, 84, .78), rgba(0, 36, 84, .78)),
    url("/assets/google-business-reception.png") center/cover no-repeat;
}

.staff-hero {
  background:
    linear-gradient(rgba(0, 36, 84, .78), rgba(0, 36, 84, .78)),
    url("/assets/google-business-photo.jpg") center/cover no-repeat;
}

.portal-kicker {
  margin: 0 0 8px;
  color: #d6ad55;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.portal-hero h1 {
  max-width: 680px;
  margin: 0;
  color: #fff;
  font-size: clamp(34px, 5vw, 54px);
  letter-spacing: 0;
}

.portal-hero p {
  max-width: 640px;
  margin: 14px 0 0;
  color: #e8eef3;
  font-size: 15px;
}

.next-appointment {
  padding: 20px;
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 8px;
  color: #15365c;
}

.next-appointment span {
  color: #8a641e;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.next-appointment strong {
  display: block;
  margin-top: 7px;
  font-size: 22px;
}

.next-appointment p {
  margin: 6px 0 0;
  color: #4e5d6d;
  font-size: 13px;
}

.action-grid,
.staff-summary {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.action-card,
.portal-panel,
.staff-summary article {
  background: #fff;
  border: 1px solid #dfe6e7;
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(21, 55, 91, .06);
}

.action-card {
  min-height: 218px;
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 12px;
}

.action-card.priority {
  border-color: #bf9645;
  box-shadow: 0 10px 26px rgba(191, 150, 69, .18);
}

.action-card h2,
.portal-panel h2 {
  margin: 0;
  color: #092c5a;
  font-family: "DM Sans", Arial, sans-serif;
  font-size: 21px;
  line-height: 1.18;
}

.action-card p {
  min-height: 42px;
  margin: 0;
  color: #536274;
  font-size: 13px;
}

.status-pill {
  width: max-content;
  min-height: 26px;
  padding: 6px 9px;
  display: inline-flex;
  align-items: center;
  color: #31506a;
  background: #edf3f3;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.status-pill.due {
  color: #7b261f;
  background: #f9e5df;
}

.status-pill.upcoming {
  color: #775614;
  background: #f8edcf;
}

.status-pill.complete {
  color: #236140;
  background: #def2e6;
}

.status-pill.message {
  color: #164f78;
  background: #dceef8;
}

.portal-button {
  min-height: 44px;
  padding: 11px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: #0a3f70;
  border: 1px solid #0a3f70;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.portal-button.secondary {
  color: #0a3f70;
  background: #fff;
  border-color: #c8d4d8;
}

.portal-button:hover,
.portal-exit:hover {
  filter: brightness(.97);
}

.portal-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.lower-grid {
  align-items: stretch;
}

.practitioner-grid {
  grid-template-columns: minmax(280px, .42fr) minmax(0, 1fr);
}

.portal-panel {
  min-width: 0;
  padding: 20px;
}

.panel-heading {
  min-height: 48px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading > strong {
  color: #0a3f70;
  font-size: 26px;
}

.chart-bars {
  height: 210px;
  margin-top: 20px;
  padding: 16px 8px 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  align-items: end;
  border-bottom: 1px solid #dce4e5;
}

.chart-bars span {
  min-height: 28px;
  height: var(--bar);
  position: relative;
  display: block;
  background: linear-gradient(180deg, #d6ad55, #0a3f70);
  border-radius: 7px 7px 0 0;
}

.chart-bars b {
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%);
  color: #536274;
  font-size: 11px;
}

.metric-row,
.patient-metrics {
  margin: 18px 0 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.metric-row div,
.patient-metrics div,
.staff-summary article {
  padding: 13px;
  background: #f5f8f8;
  border: 1px solid #dfe6e7;
  border-radius: 7px;
}

.metric-row dt,
.patient-metrics dt,
.staff-summary span {
  color: #677687;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-row dd,
.patient-metrics dd,
.staff-summary strong {
  margin: 5px 0 0;
  color: #092c5a;
  font-size: 20px;
  font-weight: 800;
}

.program-list,
.message-list,
.resource-list,
.appointment-list,
.record-feed {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.program-list div,
.message-list article,
.appointment-list article,
.record-feed article,
.resource-list a {
  min-height: 62px;
  padding: 13px;
  display: grid;
  gap: 4px;
  background: #f8faf9;
  border: 1px solid #dfe6e7;
  border-radius: 7px;
}

.program-list strong,
.message-list strong,
.appointment-list strong,
.record-feed strong,
.resource-list strong {
  color: #092c5a;
  font-size: 14px;
}

.program-list span,
.message-list p,
.appointment-list span,
.record-feed span,
.resource-list span {
  margin: 0;
  color: #536274;
  font-size: 13px;
}

.portal-form {
  display: grid;
  align-content: start;
  gap: 16px;
}

.form-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-stack label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #173456;
  font-size: 12px;
  font-weight: 800;
}

.form-stack input,
.form-stack select,
.form-stack textarea,
.quick-message input {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  color: #173456;
  background: #fff;
  border: 1px solid #c9d4d8;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
}

.form-stack textarea {
  resize: vertical;
}

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

.portal-status {
  min-height: 18px;
  margin: 0;
  color: #236140;
  font-size: 12px;
  font-weight: 800;
}

.quick-message {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.staff-summary article {
  min-height: 92px;
  display: grid;
  align-content: center;
}

.staff-summary strong {
  font-size: 28px;
}

.role-shell,
.staff-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.role-sidebar,
.staff-sidebar {
  position: sticky;
  top: 18px;
  min-height: calc(100vh - 118px);
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 20px;
  background: #fff;
  border: 1px solid #dfe6e7;
  border-radius: 18px;
  box-shadow: 0 8px 22px rgba(21, 55, 91, .06);
}

.role-sidebar h1,
.staff-sidebar h1 {
  margin: 0;
  color: #092c5a;
  font-family: "DM Sans", Arial, sans-serif;
  font-size: 22px;
  line-height: 1.18;
  letter-spacing: 0;
}

.role-sidebar nav,
.staff-sidebar nav {
  display: grid;
  gap: 9px;
}

.role-sidebar button,
.staff-sidebar button {
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #37506b;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  text-align: left;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}

.role-sidebar button:hover,
.staff-sidebar button:hover {
  color: #0a3f70;
  background: #f2f6f7;
  transform: translateX(2px);
}

.role-sidebar button.is-active,
.staff-sidebar button.is-active {
  color: #fff;
  background: #0a3f70;
  border-color: #0a3f70;
  box-shadow: 0 10px 20px rgba(10, 63, 112, .18);
}

.nav-icon {
  width: 30px;
  height: 30px;
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #0a3f70;
  background: #e9f0f3;
  border-radius: 50%;
}

.role-sidebar button.is-active .nav-icon,
.staff-sidebar button.is-active .nav-icon {
  color: #0a3f70;
  background: #fff;
}

.nav-icon::before,
.nav-icon::after {
  content: "";
  position: absolute;
  display: block;
}

.nav-home::before { width: 14px; height: 11px; bottom: 7px; border: 2px solid currentColor; border-top: 0; border-radius: 2px; }
.nav-home::after { width: 12px; height: 12px; top: 7px; border-left: 2px solid currentColor; border-top: 2px solid currentColor; transform: rotate(45deg); }
.nav-check::before { width: 12px; height: 7px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); }
.nav-chart::before { width: 16px; height: 13px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; }
.nav-chart::after { width: 4px; height: 11px; bottom: 8px; left: 12px; background: currentColor; box-shadow: 6px -4px 0 currentColor, 12px -8px 0 currentColor; border-radius: 2px; }
.nav-program::before { width: 14px; height: 16px; border: 2px solid currentColor; border-radius: 3px; }
.nav-program::after { width: 8px; height: 2px; top: 11px; background: currentColor; box-shadow: 0 5px 0 currentColor; }
.nav-message::before { width: 16px; height: 12px; border: 2px solid currentColor; border-radius: 4px; }
.nav-message::after { left: 10px; bottom: 7px; border: 4px solid transparent; border-top-color: currentColor; border-left-color: currentColor; }
.nav-resource::before,
.nav-posts::before { width: 14px; height: 16px; border: 2px solid currentColor; border-radius: 2px; }
.nav-resource::after,
.nav-posts::after { width: 8px; height: 2px; top: 10px; background: currentColor; box-shadow: 0 5px 0 currentColor; }
.nav-flag::before { width: 2px; height: 17px; left: 10px; background: currentColor; }
.nav-flag::after { width: 12px; height: 8px; left: 12px; top: 8px; background: currentColor; border-radius: 1px 4px 4px 1px; }
.nav-calendar::before { width: 16px; height: 15px; border: 2px solid currentColor; border-radius: 3px; }
.nav-calendar::after { width: 16px; height: 2px; top: 12px; background: currentColor; }
.nav-user::before { width: 8px; height: 8px; top: 7px; border: 2px solid currentColor; border-radius: 50%; }
.nav-user::after { width: 16px; height: 8px; bottom: 6px; border: 2px solid currentColor; border-radius: 10px 10px 4px 4px; }
.nav-assign::before { width: 15px; height: 15px; border: 2px solid currentColor; border-radius: 50%; }
.nav-assign::after { width: 9px; height: 5px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); }
.nav-add::before { width: 14px; height: 2px; background: currentColor; }
.nav-add::after { width: 2px; height: 14px; background: currentColor; }
.nav-settings::before { width: 15px; height: 15px; border: 2px solid currentColor; border-radius: 50%; }
.nav-settings::after { width: 5px; height: 5px; background: currentColor; border-radius: 50%; }

.role-content,
.staff-content {
  min-width: 0;
}

.staff-section {
  display: none;
}

.staff-section.is-active {
  display: block;
}

.staff-section > .portal-panel,
.staff-section > .portal-grid {
  margin-top: 0;
}

.flag-list {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.flag-list button {
  width: 100%;
  min-height: 66px;
  padding: 13px;
  display: grid;
  gap: 4px;
  text-align: left;
  color: inherit;
  background: #fff7f3;
  border: 1px solid #f0c8bb;
  border-radius: 7px;
  font: inherit;
  cursor: pointer;
}

.flag-list strong {
  color: #7b261f;
  font-size: 14px;
}

.flag-list span {
  color: #694941;
  font-size: 12px;
}

.patient-tabs {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-table {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.admin-table div {
  min-height: 58px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  background: #f8faf9;
  border: 1px solid #dfe6e7;
  border-radius: 7px;
}

.admin-table strong {
  color: #092c5a;
  font-size: 14px;
}

.admin-table span {
  color: #536274;
  font-size: 12px;
  font-weight: 800;
}

.admin-table button {
  min-height: 36px;
  padding: 8px 10px;
  color: #0a3f70;
  background: #fff;
  border: 1px solid #c8d4d8;
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

#blog-post-form {
  min-height: calc(100vh - 150px);
}

.wysiwyg-wrap {
  display: grid;
  gap: 8px;
  color: #173456;
  font-size: 12px;
  font-weight: 800;
}

.editor-toolbar {
  min-height: 44px;
  padding: 8px 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: #f3f6f8;
  border: 1px solid #dfe6e7;
  border-radius: 12px 12px 0 0;
}

.editor-group {
  min-height: 36px;
  padding-right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-right: 1px solid #d5dde2;
}

.editor-group:last-child {
  padding-right: 0;
  border-right: 0;
}

.editor-toolbar button,
.editor-toolbar select,
.editor-toolbar input[type="color"] {
  width: auto;
  min-height: 34px;
  padding: 6px 9px;
  color: #0a3f70;
  background: #fff;
  border: 1px solid #c8d4d8;
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.editor-toolbar button,
.editor-toolbar select,
.editor-toolbar input[type="color"] {
  cursor: pointer;
}

.editor-toolbar select {
  width: auto !important;
  min-width: 112px;
  max-width: 160px;
  appearance: auto;
}

.editor-toolbar input[type="color"] {
  width: 38px !important;
  min-width: 38px;
  padding: 4px;
}

.rich-editor {
  min-height: 640px;
  padding: 18px;
  color: #173456;
  background: #fff;
  border: 1px solid #c9d4d8;
  border-top: 0;
  border-radius: 0 0 12px 12px;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.65;
  overflow: auto;
}

.rich-editor:focus {
  outline: 2px solid rgba(10, 63, 112, .16);
  border-color: #0a3f70;
}

.rich-editor:empty::before {
  content: attr(data-placeholder);
  color: #7b8794;
}

.rich-editor img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.plain-editor-field textarea {
  min-height: 220px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.blog-source-hidden .plain-editor-field {
  display: none;
}

@media (max-width: 980px) {
  .portal-topbar {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .portal-account {
    flex-wrap: wrap;
    justify-content: center;
  }

  .portal-hero,
  .portal-grid,
  .practitioner-grid,
  .role-shell,
  .staff-shell {
    grid-template-columns: 1fr;
  }

  .role-sidebar,
  .staff-sidebar {
    position: static;
    min-height: 0;
  }

  .role-sidebar nav,
  .staff-sidebar nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .role-sidebar button,
  .staff-sidebar button {
    width: max-content;
    white-space: nowrap;
  }

  .action-grid,
  .staff-summary,
  .login-panels {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 620px) {
  .portal-view {
    padding: 12px;
  }

  .login-screen {
    padding: 12px;
  }

  .login-panels,
  .admin-table div {
    grid-template-columns: 1fr;
  }

  .portal-hero {
    padding: 22px;
    border-radius: 0;
  }

  .action-grid,
  .staff-summary,
  .form-stack,
  .metric-row,
  .patient-metrics {
    grid-template-columns: 1fr;
  }

  .action-card {
    min-height: 190px;
  }

  .panel-heading {
    display: grid;
  }

  .quick-message {
    grid-template-columns: 1fr;
  }

  .chart-bars {
    height: 170px;
    gap: 8px;
  }
}
