:root {
  --ink: #142f25;
  --ink-strong: #0d231a;
  --green-950: #0d3528;
  --green-900: #123f30;
  --green-800: #18533e;
  --green: #24694e;
  --green-600: #2f7a5d;
  --green-100: #e5f0ea;
  --green-50: #f1f7f4;
  --cream: #f7f5ef;
  --paper: #fffefa;
  --white: #ffffff;
  --line: #dfe3dd;
  --line-strong: #ced5ce;
  --danger: #bd2d2d;
  --danger-soft: #fff0ef;
  --muted: #68746f;
  --muted-2: #89938f;
  --blue-soft: #e6f0fb;
  --blue-ink: #2164a8;
  --violet-soft: #eee9fb;
  --violet-ink: #6547b8;
  --amber-soft: #fff0dc;
  --amber-ink: #a85b11;
  --shadow-xs: 0 1px 2px rgba(21, 47, 37, .05);
  --shadow-sm: 0 7px 20px rgba(21, 47, 37, .08);
  --shadow-md: 0 16px 38px rgba(21, 47, 37, .11);
  --radius-sm: 9px;
  --radius-md: 13px;
  --radius-lg: 18px;
  --sidebar-width: 220px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    radial-gradient(
      circle at 74% 0%,
      rgba(47, 122, 93, .05),
      transparent 30rem
    ),
    var(--cream);
  -webkit-font-smoothing: antialiased;
}

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

button {
  border: 0;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

button:disabled {
  opacity: .58;
  cursor: wait;
}

/* ---------- Login ---------- */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(
      circle at 15% 15%,
      rgba(36, 105, 78, .13),
      transparent 25rem
    ),
    linear-gradient(
      145deg,
      #f8f5eb,
      #eef4f0
    );
}

.login-shell {
  width: min(94%, 470px);
}

.login-card,
dialog {
  background: rgba(255, 254, 250, .96);
  border: 1px solid rgba(206, 213, 206, .9);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.login-card {
  padding: 34px;
}

.brand {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-bottom: 30px;
}

.brand-mark,
.topbar-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: white;
}

.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background:
    linear-gradient(
      145deg,
      var(--green-800),
      var(--green-950)
    );
  box-shadow:
    0 8px 18px rgba(18, 63, 48, .2);
}

.brand-mark svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand h1 {
  margin: 0;
  font-size: 1.65rem;
  letter-spacing: -.025em;
}

.brand p,
.help {
  margin: .28rem 0 0;
  color: var(--muted);
}

label {
  display: grid;
  gap: 7px;
  margin: 16px 0;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  padding: 11px 12px;
  color: #17221d;
  background: white;
  border: 1px solid #c7cec8;
  border-radius: 10px;
  transition:
    border-color .16s ease,
    box-shadow .16s ease,
    background .16s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--green-600);
  box-shadow:
    0 0 0 4px rgba(47, 122, 93, .12);
}

button {
  padding: 10px 15px;
  border-radius: 10px;
  font-weight: 760;
  transition:
    transform .14s ease,
    box-shadow .14s ease,
    background .14s ease,
    border-color .14s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.primary {
  color: white;
  background:
    linear-gradient(
      180deg,
      var(--green-600),
      var(--green-800)
    );
  box-shadow:
    0 5px 12px rgba(36, 105, 78, .16);
}

.primary:hover {
  box-shadow:
    0 8px 18px rgba(36, 105, 78, .2);
}

.secondary {
  color: var(--ink);
  background: #eef1ef;
}

.danger {
  color: white;
  background: var(--danger);
}

.danger-outline {
  color: var(--danger);
  background: white;
  border: 1px solid #e2b7b3;
}

.login-card .primary {
  width: 100%;
  margin-top: 8px;
}

.error {
  min-height: 1.4em;
  color: var(--danger);
}

/* ---------- App shell ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 72px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 0 30px;
  color: white;
  background:
    radial-gradient(
      circle at 25% 0%,
      rgba(255, 255, 255, .09),
      transparent 22rem
    ),
    linear-gradient(
      120deg,
      var(--green-950),
      #104735 70%,
      #123a2e
    );
  border-bottom:
    1px solid rgba(255, 255, 255, .07);
  box-shadow:
    0 3px 16px rgba(10, 41, 31, .13);
}

.topbar-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.topbar-mark {
  width: 30px;
  height: 30px;
}

.topbar-mark svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topbar-title-wrap {
  display: grid;
  gap: 1px;
  line-height: 1.1;
}

#appTitle {
  font-size: 1.02rem;
  letter-spacing: -.01em;
}

.topbar-title-wrap span {
  color: rgba(255, 255, 255, .68);
  font-size: .71rem;
}

.account {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .86rem;
}

.account-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, .05);
}

#account {
  max-width: 260px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.topbar-signout {
  padding: 8px 11px;
  color: white;
  background: rgba(255, 255, 255, .1);
  border:
    1px solid rgba(255, 255, 255, .16);
}

.topbar-signout:hover {
  background: rgba(255, 255, 255, .16);
}

.workspace-layout {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns:
    var(--sidebar-width)
    minmax(0, 1fr);
  max-width: 1560px;
  margin: 0 auto;
}

.sidebar {
  padding: 26px 14px 32px;
  background: rgba(250, 249, 245, .74);
  border-right: 1px solid var(--line);
}

.sidebar nav {
  position: sticky;
  top: 98px;
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
}

.sidebar nav a {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 10px 13px;
  color: #55635d;
  text-decoration: none;
  font-weight: 680;
  border-radius: 10px;
  transition:
    background .14s ease,
    color .14s ease,
    transform .14s ease;
}

.sidebar nav a:hover {
  color: var(--green-900);
  background: #edf2ef;
}

.sidebar nav a[aria-current="page"] {
  color: var(--green-900);
  background: var(--green-100);
  box-shadow:
    inset 3px 0 0 var(--green-600);
}

.workspace-main {
  min-width: 0;
  padding:
    34px
    clamp(22px, 3vw, 46px)
    56px;
}

#content {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
}

/* ---------- Shared UI ---------- */

.boot-notice {
  max-width: 520px;
  margin: 36px auto;
}

.empty,
.notice {
  margin: 18px 0;
  padding: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-xs);
}

.notice.error-box {
  color: #71231e;
  background: #faeae8;
  border-color: #edcbc7;
}

.empty {
  margin-top: 30px;
  padding: 34px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .14em;
  text-transform: uppercase;
}

main h1 {
  margin: 0;
  color: var(--ink-strong);
  font-size:
    clamp(2rem, 3.5vw, 2.75rem);
  line-height: 1.06;
  letter-spacing: -.035em;
}

main h2,
main h3 {
  color: var(--ink-strong);
}

:focus-visible {
  outline: 3px solid #80aa91;
  outline-offset: 3px;
}

#content:focus {
  outline: none;
}

dialog {
  width: min(620px, 94%);
  padding: 26px;
}

dialog::backdrop {
  background: rgba(12, 31, 24, .58);
  backdrop-filter: blur(2px);
}

.confirm button {
  margin-right: 10px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 22px;
}

/* ---------- CMS toolbar ---------- */

.cms-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 26px;
  margin-bottom: 22px;
}

.cms-toolbar-copy {
  max-width: 690px;
}

.cms-toolbar h1 {
  margin: .12rem 0 7px;
}

.cms-toolbar p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.cms-actions,
.cms-view-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.cms-actions {
  align-items: center;
  justify-content: flex-end;
}

.cms-actions button,
.cms-view-toggle button {
  color: var(--ink);
  background: rgba(255, 255, 255, .78);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}

.cms-actions .primary,
.cms-view-toggle .primary {
  color: white;
  background:
    linear-gradient(
      180deg,
      var(--green-600),
      var(--green-800)
    );
  border-color: transparent;
}

.cms-view-toggle {
  width: fit-content;
  margin: 0 0 20px;
  padding: 3px;
  background: #edf0ee;
  border: 1px solid #e4e8e4;
  border-radius: 11px;
}

.cms-view-toggle button {
  padding: 8px 13px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.cms-view-toggle .primary {
  box-shadow:
    0 2px 5px rgba(20, 47, 37, .12);
}

.cms-action-note {
  max-width: 260px;
  margin: 0;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.35;
}

/* ---------- CMS card view ---------- */

.cms-grid {
  display: grid;
  grid-template-columns:
    repeat(
      auto-fill,
      minmax(220px, 1fr)
    );
  gap: 18px;
  align-items: stretch;
}

.cms-card,
.cms-type-card {
  position: relative;
  min-width: 0;
  color: var(--ink);
  text-align: left;
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow-xs);
  transition:
    transform .16s ease,
    box-shadow .16s ease,
    border-color .16s ease;
}

.cms-card {
  display: block;
  width: 100%;
  min-height: 270px;
  padding: 0;
  overflow: hidden;
}

.cms-card:hover,
.cms-type-card:hover {
  transform: translateY(-3px);
  border-color: #c2d4c9;
  box-shadow: var(--shadow-sm);
}

.cms-card:active {
  transform: translateY(-1px);
}

.cms-card-media {
  position: relative;
  display: block;
  width: 100%;
  height: 140px;
  overflow: hidden;
  background: #e9ece9;
  border-bottom: 1px solid rgba(20, 47, 37, .07);
}

.cms-card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow:
    inset 0 -1px 0 rgba(255, 255, 255, .2);
}

.cms-card-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cms-card-hero {
  transform: scale(1.001);
  transition:
    transform .28s ease,
    filter .28s ease;
}

.cms-card:hover .cms-card-hero {
  transform: scale(1.035);
  filter: saturate(1.03);
}

.cms-card-motif {
  object-fit: cover;
  transform: scale(1.002);
  transition:
    transform .22s ease,
    filter .22s ease;
}

.cms-card:hover .cms-card-motif {
  transform: scale(1.02);
  filter: saturate(1.04);
}

.cms-card-body {
  display: flex;
  min-height: 128px;
  flex-direction: column;
  align-items: stretch;
  padding: 14px 15px 15px;
}

.cms-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 24px;
}

.cms-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 8px;
  color: var(--blue-ink);
  background: var(--blue-soft);
  border-radius: 999px;
  font-size: .66rem;
  font-weight: 850;
  line-height: 1;
  letter-spacing: .025em;
}

.cms-badge-muted {
  color: #3f554b;
  background: #e9eeeb;
}

.cms-badge-warn {
  color: var(--amber-ink);
  background: var(--amber-soft);
}

.cms-card-title {
  display: block;
  margin: 10px 0 7px;
  color: var(--ink-strong);
  font-size: 1.03rem;
  font-weight: 790;
  line-height: 1.28;
  letter-spacing: -.017em;
}

.cms-tags {
  display: block;
  margin: 1px 0 10px;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.45;
}

.cms-card-updated {
  display: block;
  margin-top: auto;
  padding-top: 3px;
  color: var(--muted-2);
  font-size: .78rem;
  line-height: 1.35;
}

/* ---------- List view ---------- */

.cms-list {
  display: grid;
  gap: 8px;
}

.cms-list-row,
.cms-trash-row {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns:
    minmax(260px, 2fr)
    minmax(100px, .7fr)
    minmax(100px, .7fr)
    minmax(160px, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px 15px;
  color: var(--ink);
  text-align: left;
  background: rgba(255, 255, 255, .82);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: var(--shadow-xs);
}

.cms-list-row:hover,
.cms-trash-row:hover {
  border-color: #cad8d0;
  box-shadow:
    0 5px 14px rgba(21, 47, 37, .05);
}

.cms-trash-row {
  grid-template-columns:
    minmax(260px, 2fr)
    1fr
    1.3fr
    auto;
}

/* ---------- Content detail / editor shell ---------- */

.cms-pagebar {
  margin-bottom: 16px;
}

.cms-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 0;
  color: var(--muted);
  font-size: .78rem;
  border: 0;
}

.cms-breadcrumbs strong {
  color: var(--ink);
  font-weight: 700;
}

.cms-breadcrumb-separator {
  color: #a2aaa6;
}

.cms-pagebar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.cms-page-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.cms-page-actions button {
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}

.cms-page-actions .primary {
  border-color: transparent;
}

.cms-back-button {
  background: rgba(255, 255, 255, .82);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}

.cms-publish-note {
  margin: 0 0 14px;
  padding: 11px 14px;
  color: #725016;
  background: #fff5df;
  border: 1px solid #eed7a5;
  border-radius: 10px;
  font-size: .86rem;
}

.cms-detail-cover {
  position: relative;
  width: 100%;
  height: clamp(230px, 28vw, 390px);
  overflow: hidden;
  margin-bottom: 18px;
  background: #e3ebe6;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.cms-detail-cover-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cms-detail-cover-image.is-motif {
  object-fit: cover;
}

.cms-detail-layout {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    minmax(245px, 310px);
  gap: 18px;
  align-items: start;
}

.cms-detail-main,
.cms-side-panel {
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow-xs);
}

.cms-detail-main {
  min-width: 0;
  padding:
    clamp(24px, 3.3vw, 40px);
}

.cms-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 16px;
}

.cms-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: .65rem;
  font-weight: 850;
  line-height: 1;
  letter-spacing: .025em;
}

.cms-pill-article {
  color: var(--blue-ink);
  background: var(--blue-soft);
}

.cms-pill-story {
  color: var(--violet-ink);
  background: var(--violet-soft);
}

.cms-pill-link {
  color: #176c50;
  background: #dff1e8;
}

.cms-pill-draft {
  color: var(--amber-ink);
  background: var(--amber-soft);
}

.cms-pill-published {
  color: #176c50;
  background: #dcf1e6;
}

.cms-detail-title {
  margin: 0;
  font-size:
    clamp(2rem, 4vw, 3rem);
  line-height: 1.06;
  letter-spacing: -.04em;
}

.cms-detail-lead {
  margin: 16px 0 0;
  color: #596761;
  font-size: 1.05rem;
  line-height: 1.65;
}

.cms-detail-body {
  margin-top: 28px;
  padding-top: 27px;
  color: #45534d;
  border-top: 1px solid #e5e8e5;
}

.cms-detail-body > :first-child {
  margin-top: 0;
}

.cms-detail-body p,
.cms-detail-body li {
  line-height: 1.78;
}

.cms-detail-body h2,
.cms-detail-body h3 {
  margin-top: 1.7em;
  letter-spacing: -.02em;
}

.cms-detail-body blockquote {
  margin-left: 0;
  padding-left: 18px;
  color: var(--muted);
  border-left: 4px solid #a9c3b4;
}

.cms-detail-body img {
  max-width: 100%;
  height: auto;
  margin: 20px 0;
  border-radius: 12px;
}

.cms-detail-body a {
  overflow-wrap: anywhere;
}

.cms-empty-body {
  color: var(--muted);
  font-style: italic;
}

.cms-detail-sidebar {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.cms-side-panel {
  padding: 16px;
}

.cms-side-panel > h2 {
  margin: 0 0 13px;
  font-size: .95rem;
  letter-spacing: -.01em;
}

.cms-detail-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 8px 0;
  border-top: 1px solid #edf0ed;
}

.cms-side-panel > h2 + .cms-detail-row {
  border-top: 0;
  padding-top: 0;
}

.cms-detail-label {
  color: var(--muted);
  font-size: .78rem;
}

.cms-detail-value,
.cms-detail-row > span:last-child {
  min-width: 0;
  color: var(--ink);
  font-size: .8rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.cms-tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.cms-tag-chip {
  display: inline-flex;
  padding: 6px 9px;
  color: #4a5a53;
  background: #eef1ef;
  border-radius: 999px;
  font-size: .75rem;
}

.cms-side-muted,
.cms-side-help {
  margin: 0;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.45;
}

.cms-related-list {
  display: grid;
  gap: 7px;
}

.cms-related-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 6px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border-radius: 9px;
}

.cms-related-item:hover {
  background: #f2f5f3;
  transform: none;
}

.cms-related-thumb {
  width: 48px;
  height: 42px;
  overflow: hidden;
  background: #e8ede9;
  border-radius: 8px;
}

.cms-related-thumb-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cms-related-copy {
  min-width: 0;
  display: grid;
  justify-items: start;
  gap: 5px;
}

.cms-related-copy strong {
  width: 100%;
  overflow: hidden;
  color: var(--ink-strong);
  font-size: .76rem;
  line-height: 1.25;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---------- Forms / editor ---------- */

.cms-editor-form {
  display: block;
}

.cms-editor-layout {
  margin-top: 0;
}

.cms-editor-main {
  display: grid;
  gap: 4px;
}

.cms-editor-main .cms-detail-badges {
  margin-bottom: 8px;
}

.cms-field {
  position: relative;
}

.cms-label {
  font-weight: 720;
}

.cms-field-error {
  min-height: 1.2em;
  color: var(--danger);
  font-size: .84rem;
}

.cms-field input[type="checkbox"] {
  width: auto;
}

.cms-title-field {
  margin-top: 4px;
}

.cms-title-field input {
  padding: 8px 0 10px;
  color: var(--ink-strong);
  background: transparent;
  border: 0;
  border-bottom: 1px solid #dfe4df;
  border-radius: 0;
  box-shadow: none;
  font-size:
    clamp(1.4rem, 2.5vw, 2rem);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -.035em;
}

.cms-title-field input:focus {
  border-color: var(--green-600);
  box-shadow: none;
}

.cms-editor-main textarea {
  resize: vertical;
}

.cms-editor-main .cms-field textarea {
  min-height: 104px;
}

.cms-editor-main .cms-field[data-field="bodyMarkdown"] textarea {
  min-height: 460px;
  line-height: 1.6;
}

.cms-counter {
  justify-self: end;
  color: var(--muted);
  font-size: .8rem;
}

.cms-validation-summary {
  margin: 0 0 16px;
}

.cms-inline-check-field {
  display: flex;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid #edf0ed;
}

.cms-inline-check-field .cms-label {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 500;
}

.cms-inline-check-field .cms-field-error {
  display: none;
}

.cms-side-panel .cms-field {
  margin: 12px 0;
}

.cms-side-panel .cms-field:first-of-type {
  margin-top: 0;
}

.cms-side-panel input,
.cms-side-panel select,
.cms-side-panel textarea {
  font-size: .82rem;
}

.cms-tags-field {
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
}

.cms-tags-field legend {
  display: none;
}

.cms-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-weight: 520;
}

.cms-check input {
  width: auto;
}

.cms-tag-manager {
  max-width: 620px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 24px;
}

.cms-tag-manager .cms-field {
  margin: 0;
}

.cms-form {
  display: grid;
  gap: 4px;
  max-width: 900px;
}

/* ---------- Preview / reading surface ---------- */

.cms-preview {
  max-width: 820px;
  overflow: hidden;
  padding:
    clamp(26px, 4vw, 46px);
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.cms-preview-hero {
  width:
    calc(100% + clamp(52px, 8vw, 92px));
  max-width: none !important;
  height: min(34vw, 330px) !important;
  margin:
    calc(clamp(26px, 4vw, 46px) * -1)
    calc(clamp(26px, 4vw, 46px) * -1)
    32px;
  object-fit: cover;
  border-radius: 0 !important;
}

.cms-preview h1 {
  margin-bottom: 20px;
  font-size:
    clamp(2.1rem, 5vw, 3.25rem);
}

.cms-preview p,
.cms-preview li {
  color: #4f5f58;
  line-height: 1.75;
}

.cms-preview blockquote {
  margin-left: 0;
  padding-left: 18px;
  color: var(--muted);
  border-left: 4px solid #a9c3b4;
}

.cms-preview a {
  overflow-wrap: anywhere;
}

.cms-preview img {
  max-width: 100%;
  height: auto;
  border-radius: 13px;
}

/* ---------- Responsive ---------- */

@media (max-width: 1040px) {
  :root {
    --sidebar-width: 188px;
  }

  .workspace-main {
    padding-right: 26px;
    padding-left: 26px;
  }

  .cms-grid {
    grid-template-columns:
      repeat(
        auto-fill,
        minmax(205px, 1fr)
      );
  }
}

@media (max-width: 820px) {
  .topbar {
    position: static;
    min-height: 68px;
    padding: 14px 18px;
  }

  .topbar-title-wrap span {
    display: none;
  }

  #account {
    max-width: 180px;
  }

  .workspace-layout {
    min-height: 0;
    display: block;
  }

  .sidebar {
    padding: 10px 16px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar nav {
    position: static;
    display: flex;
    min-width: max-content;
    gap: 5px;
  }

  .sidebar nav a {
    min-height: 38px;
    padding: 8px 12px;
  }

  .sidebar nav a[aria-current="page"] {
    box-shadow:
      inset 0 -3px 0 var(--green-600);
  }

  .workspace-main {
    padding: 26px 18px 42px;
  }

  .cms-toolbar {
    display: grid;
  }

  .cms-actions {
    justify-content: flex-start;
  }

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

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

  .cms-detail-sidebar .cms-side-panel:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .cms-type-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 650px) {
  .login-card {
    padding: 25px;
  }

  .account-avatar,
  #account {
    display: none;
  }

  .topbar-signout {
    padding: 8px 10px;
  }

  .grid2 {
    grid-template-columns: 1fr;
  }

  .cms-grid {
    grid-template-columns: 1fr;
  }

  .cms-card {
    min-height: 0;
  }

  .cms-card-media {
    height: 190px;
  }

  .cms-list-row,
  .cms-trash-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .cms-detail-sidebar {
    grid-template-columns: 1fr;
  }

  .cms-detail-cover {
    height: 210px;
    border-radius: 13px;
  }

  .cms-pagebar-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .cms-page-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .cms-detail-main {
    padding: 22px 18px;
  }

  .cms-editor-main .cms-field[data-field="bodyMarkdown"] textarea {
    min-height: 340px;
  }

  .cms-tag-manager {
    grid-template-columns: 1fr;
  }

  main h1 {
    font-size: 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
  }
}

.cms-editor-form input, .cms-editor-form textarea, .cms-editor-form select {
  font-weight: 400;
}
.cms-editor-form .cms-title-field input {
  font-weight: 500;
}
.cms-card {
  padding-top: 16px;
  background: white;
}
.cms-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}
.cms-filters .cms-field {
  min-width: 150px;
  margin: 0;
}
.cms-filters .cms-field-error {
  display: none;
}
.cms-new-menu {
  position: relative;
}
.cms-new-menu summary {
  cursor: pointer;
  padding: 12px 18px;
  border-radius: 10px;
}
.cms-new-choices {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 10;
  display: grid;
  gap: 6px;
  min-width: 180px;
  padding: 10px;
  background: white;
  border: 1px solid #ccd6cf;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}
.cms-sensitive-notice, .cms-inline-check-field.is-sensitive {
  padding: 12px;
  border: 2px solid #916112;
  border-radius: 8px;
  background: #fff2cb;
  color: #654008;
  font-weight: 600;
}
.cms-sensitive-notice[hidden] {
  display: none;
}
