/* Admin page manager and authored page renderer. */
#pagesView,
#managedPageView {
  min-width: 0;
  width: 100%;
}

.pages-admin-shell {
  --pages-navy: #143f61;
  --pages-blue: #236395;
  --pages-gold: #d4a72c;
  --pages-border: #d6e1ea;
  --pages-muted: #617589;
  display: grid;
  gap: 12px;
  color: #14283b;
}

.pages-admin-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 42px;
  padding: 0 2px;
}

.pages-admin-hero > p,
.pages-admin-hero > div > p {
  margin: 0;
  color: var(--pages-muted);
  font-size: 14px;
}

.pages-admin-hero-actions,
.pages-admin-editor-actions > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.pages-admin-button,
.pages-admin-mini-button,
.pages-admin-visibility-button {
  border: 1px solid var(--pages-border);
  border-radius: 8px;
  background: #fff;
  color: #244158;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.pages-admin-button {
  min-height: 38px;
  padding: 8px 14px;
}

.pages-admin-button:hover:not(:disabled),
.pages-admin-mini-button:hover:not(:disabled),
.pages-admin-visibility-button:hover:not(:disabled) {
  border-color: #8db4d1;
  box-shadow: 0 4px 12px rgba(20, 63, 97, 0.12);
  transform: translateY(-1px);
}

.pages-admin-button:focus-visible,
.pages-admin-mini-button:focus-visible,
.pages-admin-visibility-button:focus-visible,
.pages-admin-tree-select:focus-visible,
.pages-admin-shell input:focus-visible,
.pages-admin-shell select:focus-visible,
.pages-admin-shell textarea:focus-visible {
  outline: 3px solid rgba(42, 131, 190, 0.24);
  outline-offset: 1px;
}

.pages-admin-button.is-primary {
  border-color: var(--pages-blue);
  background: var(--pages-blue);
  color: #fff;
}

.pages-admin-button.is-primary:hover:not(:disabled) {
  border-color: var(--pages-navy);
  background: var(--pages-navy);
}

.pages-admin-button.is-secondary {
  background: #f7fafc;
}

.pages-admin-button.is-danger {
  border-color: #efc5c5;
  color: #a22e2e;
  background: #fffafa;
}

.pages-admin-button:disabled,
.pages-admin-mini-button:disabled,
.pages-admin-visibility-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.pages-admin-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #b9d6e9;
  border-radius: 9px;
  background: #eff8fd;
  color: #164f73;
}

.pages-admin-notice.is-success {
  border-color: #aed8c1;
  background: #f0faf4;
  color: #17633a;
}

.pages-admin-notice.is-error {
  border-color: #efc1c1;
  background: #fff4f4;
  color: #9a2e2e;
}

.pages-admin-notice button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.pages-admin-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--pages-border);
  border-radius: 10px;
  background: #fff;
}

.pages-admin-metrics > div {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  padding: 10px 14px;
  text-align: center;
}

.pages-admin-metrics > div + div {
  border-left: 1px solid var(--pages-border);
}

.pages-admin-metrics strong {
  color: var(--pages-navy);
  font-size: 20px;
  line-height: 1;
}

.pages-admin-metrics span {
  color: var(--pages-muted);
  font-size: 12px;
  font-weight: 700;
}

.pages-admin-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.pages-admin-search {
  flex: 1 1 420px;
  max-width: 620px;
}

.pages-admin-search input,
.pages-admin-filter select,
.pages-admin-field input,
.pages-admin-field select,
.pages-admin-field textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd9e4;
  border-radius: 8px;
  background: #fff;
  color: #183247;
  font: inherit;
}

.pages-admin-search input,
.pages-admin-filter select,
.pages-admin-field input,
.pages-admin-field select {
  min-height: 40px;
  padding: 8px 11px;
}

.pages-admin-filter {
  display: grid;
  grid-template-columns: auto 150px;
  align-items: center;
  gap: 8px;
  color: var(--pages-muted);
  font-size: 12px;
  font-weight: 800;
}

.pages-admin-workspace {
  display: grid;
  grid-template-columns: minmax(240px, 290px) minmax(0, 1fr);
  min-height: 590px;
  overflow: hidden;
  border: 1px solid var(--pages-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(35, 63, 86, 0.08);
}

.pages-admin-catalog,
.pages-admin-editor {
  min-width: 0;
}

.pages-admin-catalog {
  border-right: 1px solid var(--pages-border);
  background: #f8fafc;
}

.pages-admin-catalog > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 58px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--pages-border);
  background: #fff;
}

.pages-admin-catalog > header > div {
  display: grid;
  gap: 2px;
}

.pages-admin-catalog > header span,
.pages-admin-loading {
  color: var(--pages-muted);
  font-size: 11px;
}

.pages-admin-loading::before {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border: 2px solid #bad0df;
  border-top-color: var(--pages-blue);
  border-radius: 50%;
  content: "";
  vertical-align: -2px;
  animation: pages-admin-spin 750ms linear infinite;
}

@keyframes pages-admin-spin {
  to { transform: rotate(360deg); }
}

.pages-admin-tree {
  max-height: 720px;
  overflow: auto;
  padding: 0;
  scrollbar-color: #aabcc9 transparent;
}

.pages-admin-tree-group {
  margin: 0;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid #c8d9e8;
  border-radius: 0;
  background: #f7fafc;
  transition: opacity .16s ease, filter .16s ease;
}

.pages-admin-tree-group:last-child {
  border-bottom: 0;
}

.pages-admin-tree:has(.pages-admin-tree-group.is-active-group) .pages-admin-tree-group:not(.is-active-group) {
  opacity: .46;
  filter: saturate(.55);
}

.pages-admin-tree:has(.pages-admin-tree-group.is-active-group) .pages-admin-tree-group:not(.is-active-group):hover,
.pages-admin-tree:has(.pages-admin-tree-group.is-active-group) .pages-admin-tree-group:not(.is-active-group):focus-within {
  opacity: .82;
  filter: saturate(.85);
}

.pages-admin-tree-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  min-height: 44px;
  border-radius: 0;
}

.pages-admin-tree-page.is-selected {
  border-left-color: var(--pages-gold);
  background: #28679e;
  color: #fff;
}

.pages-admin-tree-select {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.pages-admin-tree-select:hover {
  background: #d8e8f5;
}

.pages-admin-tree-copy {
  display: block;
  min-width: 0;
}

.pages-admin-tree-copy strong,
.pages-admin-tree-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pages-admin-tree-copy strong {
  font-size: 14px;
  font-weight: 800;
}

.pages-admin-tree-copy small,
.pages-admin-tree-empty,
.pages-admin-tree-section-label {
  color: var(--pages-muted);
  font-size: 10px;
}

.pages-admin-tree-badges {
  display: flex;
  gap: 4px;
}

.pages-admin-status,
.pages-admin-type {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 6px;
  border: 1px solid #d5e0e8;
  border-radius: 999px;
  background: #fff;
  color: #617486;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.pages-admin-status.is-published {
  border-color: #b8dbc7;
  background: #eef9f2;
  color: #277149;
}

.pages-admin-status.is-hidden {
  border-color: #ead5ad;
  background: #fff9eb;
  color: #8b6416;
}

.pages-admin-type.is-custom {
  border-color: #b9d7ea;
  color: #26668d;
}

.pages-admin-mini-button,
.pages-admin-visibility-button {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 10px;
}

.pages-admin-mini-button {
  width: 28px;
  padding: 0;
  color: var(--pages-blue);
  font-size: 16px;
}

.pages-admin-tree-children {
  display: grid;
  gap: 0;
  padding: 0;
}

.pages-admin-tree-group:not(.is-expanded) .pages-admin-tree-children {
  display: none;
}

.pages-admin-tree-group-row {
  min-height: 45px;
  background: #e4eef7;
  color: #173f63;
}

.pages-admin-tree-group.is-active-group .pages-admin-tree-group-row {
  border-bottom: 1px solid #c8d9e8;
  background: #d9e9f5;
}

.pages-admin-tree-group-row .pages-admin-tree-select::after {
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-right: 2px solid #61778b;
  border-bottom: 2px solid #61778b;
  content: "";
  transform: rotate(45deg) translateY(-2px);
  transition: transform .16s ease;
}

.pages-admin-tree-group.is-expanded .pages-admin-tree-group-row .pages-admin-tree-select::after {
  transform: rotate(225deg) translate(-1px, -1px);
}

.pages-admin-tree-group-row .pages-admin-tree-copy strong {
  font-weight: 900;
}

.pages-admin-tree-page {
  min-height: 50px;
  border-bottom: 1px solid #d8e3ed;
  border-left: 4px solid transparent;
  background: #f7fafc;
}

.pages-admin-tree-page:last-child {
  border-bottom: 0;
}

.pages-admin-tree-page .pages-admin-tree-select {
  padding-left: 18px;
}

.pages-admin-tree-page .pages-admin-tree-copy strong {
  font-size: 14px;
  font-weight: 750;
}

.pages-admin-tree-page.is-selected .pages-admin-tree-select:hover {
  background: #215b8d;
}

.pages-admin-tree-empty,
.pages-admin-tree-section-label {
  margin: 0;
  padding: 6px 9px;
}

.pages-admin-editor {
  padding: 18px;
  background: #fff;
}

.pages-admin-editor-form {
  display: grid;
  gap: 16px;
  max-width: 980px;
  margin: 0 auto;
}

.pages-admin-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e2e9ee;
}

.pages-admin-editor-head h3 {
  margin: 2px 0 0;
  font-size: 20px;
}

.pages-admin-kicker {
  color: #6d8192;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pages-admin-editor-badges {
  display: flex;
  gap: 5px;
}

.pages-admin-lock-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid #c9dce9;
  border-radius: 8px;
  background: #f1f7fb;
  color: #466378;
  font-size: 12px;
}

.pages-admin-lock-note strong {
  color: #204b6a;
}

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

.pages-admin-field {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  color: #2d485d;
  font-size: 12px;
  font-weight: 800;
}

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

.pages-admin-field small {
  color: #708393;
  font-size: 10px;
  font-weight: 500;
}

.pages-admin-field textarea {
  min-height: 220px;
  padding: 11px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}

.pages-admin-field textarea[readonly],
.pages-admin-field input[readonly] {
  background: #f2f5f7;
  color: #71808c;
}

.pages-admin-publish-field {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #d6e1e9;
  border-radius: 8px;
  background: #f9fbfc;
  cursor: pointer;
}

.pages-admin-publish-field input {
  width: 17px;
  height: 17px;
  accent-color: var(--pages-blue);
}

.pages-admin-publish-field span {
  display: grid;
  gap: 1px;
  font-size: 11px;
}

.pages-admin-publish-field small {
  color: var(--pages-muted);
  font-weight: 500;
}

.pages-admin-preview {
  padding: 18px;
  border: 1px solid #cbdce8;
  border-radius: 10px;
  background: #f8fbfd;
}

.pages-admin-preview h2 {
  margin: 4px 0 14px;
}

.pages-admin-preview p,
.pages-admin-preview li {
  line-height: 1.55;
}

.pages-admin-editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid #e2e9ee;
}

.pages-admin-editor-empty,
.pages-admin-empty,
.pages-admin-access-denied {
  display: grid;
  min-height: 320px;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 28px;
  color: var(--pages-muted);
  text-align: center;
}

.pages-admin-editor-empty span,
.pages-admin-access-denied > span {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 12px;
  background: #eaf2f7;
  color: var(--pages-blue);
  font-size: 24px;
}

.pages-admin-editor-empty h3,
.pages-admin-editor-empty p,
.pages-admin-empty strong,
.pages-admin-empty span,
.pages-admin-access-denied h2,
.pages-admin-access-denied p {
  margin: 0;
}

.managed-page-document {
  width: min(100%, 1080px);
  box-sizing: border-box;
  margin: 0 auto;
  padding: 30px 34px;
  border: 1px solid #d8e2e9;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(25, 57, 82, 0.08);
}

.managed-page-document-head {
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e2e9ee;
}

.managed-page-document-head p {
  margin: 0;
  color: #557083;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.managed-page-document-body {
  color: #233b4f;
  font-size: 15px;
  line-height: 1.65;
}

.managed-page-document-body h2,
.managed-page-document-body h3,
.managed-page-document-body h4,
.managed-page-document-body h5,
.managed-page-document-body h6 {
  margin: 1.25em 0 0.45em;
  color: #153c5a;
  line-height: 1.25;
}

.managed-page-document-body h2:first-child,
.managed-page-document-body h3:first-child,
.managed-page-document-body p:first-child {
  margin-top: 0;
}

.managed-page-document-body p,
.managed-page-document-body ul {
  margin: 0 0 1em;
}

.managed-page-document-body ul {
  padding-left: 22px;
}

.managed-page-empty {
  color: #6e7f8c;
  font-style: italic;
}

.managed-page-state {
  display: grid;
  min-height: 380px;
  place-content: center;
  justify-items: center;
  gap: 9px;
  text-align: center;
}

.managed-page-state-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 50%;
  background: #fff1e7;
  color: #ac5623;
  font-size: 28px;
  font-weight: 900;
}

.managed-page-state h2,
.managed-page-state p {
  margin: 0;
}

/* Pages workspace visual hierarchy. */
#pagesView {
  border-radius: 18px;
  background:
    radial-gradient(circle at 92% 0%, rgba(22, 125, 139, .10), transparent 28%),
    linear-gradient(180deg, #f4f8fb 0%, #edf3f7 100%);
}

.pages-admin-shell {
  gap: 14px;
}

.pages-admin-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

body:not([data-current-view="pages"]) .pages-admin-header-actions {
  display: none;
}

.pages-admin-header-actions .pages-admin-button {
  min-height: 42px;
  padding-inline: 16px;
  white-space: nowrap;
}

.pages-admin-metrics {
  gap: 12px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.pages-admin-metrics > div {
  position: relative;
  justify-content: flex-start;
  min-height: 66px;
  overflow: hidden;
  border: 1px solid #c9d9e6;
  border-radius: 12px;
  padding: 12px 16px 12px 20px;
  background: #fff;
  text-align: left;
  box-shadow: 0 7px 18px rgba(25, 61, 91, .08);
}

.pages-admin-metrics > div::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: #236395;
  content: "";
}

.pages-admin-metrics > div:nth-child(2)::before { background: #0b7c82; }
.pages-admin-metrics > div:nth-child(3)::before { background: #d4a72c; }

.pages-admin-metrics > div + div {
  border-left: 1px solid #c9d9e6;
}

.pages-admin-metrics strong {
  font-size: 25px;
}

.pages-admin-toolbar {
  min-height: 66px;
  border: 1px solid #ccdae6;
  border-radius: 12px;
  padding: 11px 13px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 7px 20px rgba(25, 61, 91, .07);
  backdrop-filter: blur(8px);
}

.pages-admin-search input,
.pages-admin-filter select {
  min-height: 44px;
  border-color: #b9cde0;
  background: #f8fbfd;
  box-shadow: inset 0 1px 2px rgba(35, 63, 86, .04);
}

.pages-admin-workspace {
  grid-template-columns: minmax(260px, 310px) minmax(0, 1fr);
  gap: 14px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.pages-admin-catalog,
.pages-admin-editor {
  overflow: hidden;
  border: 1px solid #c7d7e4;
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(25, 61, 91, .10);
}

.pages-admin-catalog {
  border-right: 1px solid #c7d7e4;
  background: #eef4f8;
}

.pages-admin-catalog > header {
  min-height: 66px;
  border-bottom-color: rgba(255, 255, 255, .15);
  background: linear-gradient(120deg, #173f63, #1f6288);
  color: #fff;
}

.pages-admin-catalog > header strong {
  font-size: 15px;
}

.pages-admin-catalog > header span,
.pages-admin-catalog .pages-admin-loading {
  color: #c9e3ee;
}

.pages-admin-editor {
  padding: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
}

.pages-admin-editor-form {
  width: 100%;
  max-width: 1180px;
}

.pages-admin-editor-head {
  margin: -18px -18px 2px;
  border-bottom: 0;
  padding: 18px 20px;
  background: linear-gradient(115deg, #173f63 0%, #205d82 100%);
  color: #fff;
}

.pages-admin-editor-head h3 {
  color: #fff;
  font-size: 23px;
}

.pages-admin-editor-head .pages-admin-kicker {
  color: #8dd7df;
}

.pages-admin-editor-head .pages-admin-status,
.pages-admin-editor-head .pages-admin-type {
  border-color: rgba(255, 255, 255, .42);
  background: rgba(255, 255, 255, .94);
}

.pages-admin-lock-note {
  border-color: #b7d3e5;
  border-left: 5px solid #d4a72c;
  border-radius: 10px;
  padding: 11px 13px;
  background: linear-gradient(90deg, #edf6fb, #f8fbfd);
}

.pages-admin-form-grid {
  gap: 12px;
}

.pages-admin-field {
  border: 1px solid #d4e0e9;
  border-radius: 11px;
  padding: 11px;
  background: #f3f7fa;
}

.pages-admin-field > span {
  color: #345a78;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.pages-admin-field input,
.pages-admin-field select,
.pages-admin-field textarea {
  border-color: #b9cde0;
  background: #fff;
  box-shadow: 0 2px 6px rgba(25, 61, 91, .04);
}

.pages-admin-publish-field {
  min-height: 64px;
  border-color: #bcd9d7;
  border-left: 5px solid #0b7c82;
  border-radius: 11px;
  padding: 10px 13px;
  background: linear-gradient(90deg, #eff9f8, #f8fcfc);
}

.pages-admin-publish-field:hover {
  border-color: #76b9b6;
  box-shadow: 0 5px 14px rgba(11, 124, 130, .10);
}

.pages-admin-content-field {
  border-color: #c7d9e6;
  border-top: 4px solid #236395;
  padding-top: 13px;
  background: #eef4f8;
}

.pages-admin-editor-actions {
  margin: 0 -18px -18px;
  border-top: 1px solid #cad9e5;
  padding: 14px 18px;
  background: #edf3f7;
}

@media (max-width: 1100px) {
  .pages-admin-workspace {
    grid-template-columns: 270px minmax(0, 1fr);
  }

  .pages-admin-tree-badges {
    display: none;
  }
}

@media (max-width: 840px) {
  .pages-admin-hero,
  .pages-admin-toolbar,
  .pages-admin-editor-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .pages-admin-hero-actions,
  .pages-admin-editor-actions > div {
    width: 100%;
  }

  .pages-admin-hero-actions .pages-admin-button,
  .pages-admin-editor-actions .pages-admin-button {
    flex: 1 1 auto;
  }

  .pages-admin-search {
    flex-basis: auto;
    max-width: none;
  }

  .pages-admin-filter {
    grid-template-columns: auto minmax(0, 1fr);
  }

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

  .pages-admin-catalog {
    border-right: 0;
    border-bottom: 1px solid var(--pages-border);
  }

  .pages-admin-tree {
    max-height: 390px;
  }

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

  .pages-admin-field-wide {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .pages-admin-metrics {
    grid-template-columns: 1fr;
  }

  .pages-admin-metrics > div {
    justify-content: space-between;
  }

  .pages-admin-metrics > div + div {
    border-top: 1px solid var(--pages-border);
    border-left: 0;
  }

  .pages-admin-tree-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .pages-admin-tree-badges {
    display: none;
  }

  .pages-admin-editor {
    padding: 14px;
  }

  .managed-page-document {
    padding: 22px 18px;
    border-radius: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pages-admin-button,
  .pages-admin-mini-button,
  .pages-admin-visibility-button {
    transition: none;
  }

  .pages-admin-loading::before {
    animation-duration: 1.5s;
  }
}
