@font-face {
  font-family: "Montserrat";
  src: url("/fonts/Montserrat-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #fbfbf9;
  --surface: #ffffff;
  --ink: #000000;
  --muted: #6e6e6e;
  --line: #d9d9d4;
  --line-strong: #c9c9c9;
  --blue: #2400ff;
  --blue-deep: #1700ad;
  --navy: #001d52;
  --coral: #ff8562;
  --coral-soft: #fff0ea;
  --soft-blue: #f0efff;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: "Montserrat", Arial, sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

body {
  margin: 0;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  padding: 24px 18px;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  margin-bottom: 26px;
  font-size: 15px;
  font-weight: 760;
}

.brand-mark {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  background: var(--blue);
  color: #fff;
  border-radius: 8px;
  font-weight: 850;
}

.tree-nav {
  display: grid;
  gap: 4px;
}

.tree-all,
.tree-leaf,
.tree-case,
.tree-node summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 8px;
  color: #1f1f1f;
  font-size: 14px;
  line-height: 1.25;
}

.tree-node {
  margin: 0;
}

.tree-node summary {
  list-style: none;
}

.tree-node summary::-webkit-details-marker {
  display: none;
}

.tree-node summary::before {
  content: "";
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 160ms ease;
}

.tree-node[open] > summary::before {
  transform: rotate(45deg);
}

.tree-node summary a {
  flex: 1;
}

.tree-node summary span,
.tree-all span,
.tree-leaf span {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #efefec;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.tree-children {
  display: grid;
  gap: 2px;
  margin: 2px 0 4px 14px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.tree-case {
  justify-content: flex-start;
  min-height: 32px;
  color: var(--muted);
  font-size: 13px;
}

.tree-all:hover,
.tree-leaf:hover,
.tree-case:hover,
.tree-node summary:hover {
  background: #f4f4f1;
}

.tree-all.is-active,
.tree-leaf.is-active,
.tree-case.is-active,
.tree-node.is-active > summary {
  background: var(--soft-blue);
  color: var(--blue-deep);
}

.content-shell {
  min-width: 0;
  padding: 34px clamp(22px, 5vw, 70px) 64px;
}

.hero-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 24px;
  align-items: end;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 980px;
  margin-bottom: 16px;
  font-size: 48px;
  line-height: 1.02;
  font-weight: 820;
}

.lead {
  max-width: 780px;
  margin-bottom: 0;
  color: #2a2a2a;
  font-size: 18px;
  line-height: 1.55;
}

.hero-stat {
  display: grid;
  gap: 4px;
  min-height: 110px;
  align-content: center;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.hero-stat strong {
  color: var(--blue);
  font-size: 44px;
  line-height: 1;
}

.hero-stat span {
  color: var(--muted);
  font-size: 13px;
}

.case-toolbar {
  display: flex;
  gap: 12px;
  align-items: end;
  justify-content: space-between;
  margin: 26px 0 22px;
}

.search-field {
  display: grid;
  gap: 7px;
  width: min(520px, 100%);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.search-field input,
.admin-field input,
.admin-field select,
.admin-field textarea,
.login-panel input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

.search-field input:focus,
.admin-field input:focus,
.admin-field select:focus,
.admin-field textarea:focus,
.login-panel input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(36, 0, 255, 0.12);
}

.admin-ghost {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--blue);
  font-size: 28px;
  font-weight: 500;
}

.case-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.case-card {
  display: grid;
  grid-template-rows: 178px minmax(210px, auto) auto;
  min-height: 460px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.case-card:hover {
  transform: translateY(-2px);
  border-color: var(--blue);
  box-shadow: var(--shadow);
}

.case-card__media {
  position: relative;
  display: grid;
  min-height: 178px;
  place-items: center;
  overflow: hidden;
  background: #111;
  color: #fff;
}

.case-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.case-card__media.is-empty {
  background:
    linear-gradient(90deg, var(--blue) 0 8px, transparent 8px),
    var(--navy);
}

.case-card__media.is-empty span {
  font-size: 44px;
  font-weight: 850;
}

.case-card__body {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.case-card__category {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.case-card strong {
  font-size: 21px;
  line-height: 1.18;
}

.case-card__body > span:last-child {
  color: #3d3d3d;
  line-height: 1.5;
}

.case-card__meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 0 18px 18px;
  color: var(--muted);
  font-size: 13px;
}

.case-card__meta span {
  padding: 6px 8px;
  border-radius: 8px;
  background: #f4f4f1;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 42px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}

.crumbs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 14px;
}

.crumbs a {
  color: var(--blue-deep);
}

.case-detail {
  max-width: 980px;
}

.case-detail__head {
  padding-bottom: 28px;
}

.meta-line {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.meta-line span {
  display: grid;
  gap: 4px;
  min-width: 150px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.meta-line b {
  color: var(--ink);
  font-size: 12px;
  text-transform: uppercase;
}

.case-cover {
  width: 100%;
  max-height: 520px;
  margin-bottom: 34px;
  border-radius: var(--radius);
  object-fit: cover;
}

.case-prose,
.video-block,
.gallery {
  margin-top: 34px;
}

.case-prose {
  max-width: 780px;
  color: #1f1f1f;
  font-size: 18px;
  line-height: 1.7;
}

.case-prose h2,
.video-block h2,
.gallery h2 {
  margin: 34px 0 14px;
  font-size: 28px;
  line-height: 1.16;
}

.case-prose h3 {
  margin: 28px 0 12px;
  font-size: 22px;
}

.case-prose p,
.case-prose ul,
.case-prose ol,
.case-prose figure {
  margin-bottom: 18px;
}

.case-prose li {
  margin-bottom: 8px;
}

.case-prose a {
  color: var(--blue-deep);
  border-bottom: 1px solid currentColor;
}

.case-prose iframe {
  display: block;
  width: min(880px, 100%);
  height: auto;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: var(--radius);
  background: #101010;
}

.case-prose figure {
  margin: 30px 0;
}

.case-prose figure img {
  width: 100%;
  border-radius: var(--radius);
}

.case-prose figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.video-frame {
  position: relative;
  width: min(880px, 100%);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius);
  background: #101010;
}

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.gallery-grid a {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.gallery-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.button,
.login-panel button,
.logout-form button,
.admin-nav,
.icon-button {
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 13px;
  font-weight: 720;
}

.button-primary,
.login-panel button,
.admin-action-primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.button-danger {
  border-color: var(--coral);
  background: var(--coral-soft);
  color: #a93616;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
  background: var(--bg);
}

.login-panel {
  width: min(430px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand--login {
  margin-bottom: 24px;
}

.login-panel h1 {
  margin-bottom: 22px;
  font-size: 30px;
}

.login-panel form,
.admin-field {
  display: grid;
  gap: 8px;
}

.login-panel label,
.admin-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.login-panel form {
  gap: 16px;
}

.form-error,
.admin-error {
  margin: 0;
  color: #a93616;
  font-size: 14px;
}

.admin-page {
  background: var(--bg);
}

.admin-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100vh;
  padding: 20px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.admin-nav {
  text-align: left;
}

.admin-nav.is-active {
  border-color: var(--blue);
  background: var(--soft-blue);
  color: var(--blue-deep);
}

.logout-form {
  margin-top: auto;
}

.logout-form button {
  width: 100%;
}

.admin-main {
  min-width: 0;
  padding: 26px;
}

.loader {
  padding: 26px;
  color: var(--muted);
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(250px, 330px) minmax(0, 1fr);
  gap: 20px;
}

.admin-list,
.admin-editor,
.admin-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.admin-list {
  align-self: start;
  overflow: hidden;
}

.admin-list-head,
.admin-editor-head,
.admin-panel-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.admin-list-head h1,
.admin-editor-head h1,
.admin-panel-head h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
}

.admin-list-items {
  display: grid;
  max-height: calc(100vh - 150px);
  overflow: auto;
}

.case-row {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.case-row:hover,
.case-row.is-active {
  background: #f4f4f1;
}

.case-row strong {
  line-height: 1.25;
}

.case-row span {
  color: var(--muted);
  font-size: 12px;
}

.admin-editor {
  min-width: 0;
}

.admin-form {
  display: grid;
  gap: 18px;
  padding: 18px;
}

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

.admin-field textarea {
  min-height: 260px;
  resize: vertical;
  line-height: 1.45;
}

.admin-field.short-text textarea {
  min-height: 116px;
}

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

.status-toggle-field {
  align-content: start;
}

.publish-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafc;
  cursor: pointer;
}

.publish-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.publish-toggle__control {
  position: relative;
  flex: 0 0 42px;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #d8dde7;
  transition: background 160ms ease;
}

.publish-toggle__control::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(34, 42, 53, 0.18);
  transition: transform 160ms ease;
}

.publish-toggle input:checked + .publish-toggle__control {
  background: var(--blue-deep);
}

.publish-toggle input:checked + .publish-toggle__control::after {
  transform: translateX(18px);
}

.publish-toggle:focus-within {
  border-color: var(--blue-deep);
  box-shadow: 0 0 0 3px rgba(79, 93, 184, 0.12);
}

.publish-toggle .publish-toggle__text {
  display: grid;
  gap: 2px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  text-transform: none;
}

.publish-toggle__text small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.admin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
}

.admin-actions-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.media-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.media-item {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f4f4f1;
}

.media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-item button {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-color: rgba(0, 0, 0, 0.15);
  background: #fff;
}

.rich-editor-field {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.rich-editor-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #f8f8f6;
}

.rich-editor-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.rich-editor-head > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.editor-toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.editor-toolbar button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  min-height: 34px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0;
  font-size: 13px;
  font-weight: 820;
}

.editor-toolbar button:hover {
  border-color: var(--blue);
  color: var(--blue-deep);
}

.editor-surface {
  min-height: 520px;
  padding: 22px;
  outline: none;
  color: #1f1f1f;
  font-size: 17px;
  line-height: 1.65;
}

.editor-surface:focus {
  box-shadow: inset 0 0 0 3px rgba(36, 0, 255, 0.1);
}

.editor-surface h2 {
  margin: 28px 0 12px;
  font-size: 27px;
  line-height: 1.16;
}

.editor-surface h3 {
  margin: 24px 0 10px;
  font-size: 21px;
  line-height: 1.2;
}

.editor-surface p,
.editor-surface ul,
.editor-surface ol {
  margin: 0 0 16px;
}

.editor-surface figure {
  position: relative;
  margin: 24px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfbf9;
}

.editor-surface figure img {
  width: 100%;
  max-height: 520px;
  border-radius: 6px;
  object-fit: contain;
  background: #f4f4f1;
}

.editor-surface figcaption {
  min-height: 26px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.editor-surface figcaption:empty::before {
  content: "Подпись";
  color: #9a9a9a;
}

.editor-surface [data-remove-embed] {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-grid;
  width: 30px;
  height: 30px;
  min-height: 30px;
  place-items: center;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  background: #fff;
  padding: 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

.editor-video-placeholder {
  display: grid;
  gap: 8px;
  min-height: 180px;
  place-items: center;
  padding: 24px;
  border-radius: 6px;
  background: var(--navy);
  color: #fff;
  text-align: center;
}

.editor-video-placeholder strong {
  font-size: 26px;
}

.editor-video-placeholder span {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.quill-editor {
  background: var(--surface);
}

.rich-editor-field .ql-toolbar.ql-snow {
  border: 0;
  border-bottom: 1px solid var(--line);
  font-family: "Montserrat", Arial, sans-serif;
  padding: 12px;
}

.rich-editor-field .ql-container.ql-snow {
  min-height: 560px;
  border: 0;
  font-family: "Montserrat", Arial, sans-serif;
  font-size: 17px;
}

.rich-editor-field .ql-editor {
  min-height: 560px;
  padding: 22px;
  line-height: 1.65;
}

.rich-editor-field .ql-editor h2 {
  font-size: 27px;
  line-height: 1.16;
}

.rich-editor-field .ql-editor h3 {
  font-size: 21px;
  line-height: 1.2;
}

.rich-editor-field .ql-editor img {
  display: block;
  max-width: 100%;
  max-height: 520px;
  margin: 18px 0;
  border-radius: 8px;
  object-fit: contain;
}

.rich-editor-field .ql-editor .ql-video {
  display: block;
  width: min(760px, 100%);
  height: auto;
  aspect-ratio: 16 / 9;
  margin: 18px 0;
  border-radius: 8px;
  background: #101010;
}

.category-editor {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.category-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(110px, 180px) 108px;
  gap: 8px;
  align-items: center;
}

.category-row.is-child {
  padding-left: 22px;
}

.category-row input {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 9px 10px;
}

.notice {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--soft-blue);
  color: var(--blue-deep);
  font-size: 12px;
  font-weight: 760;
}

.status-pill--draft {
  background: #f2f4f7;
  color: #6f7783;
}

.status-pill--published {
  background: var(--soft-blue);
  color: var(--blue-deep);
}

@media (max-width: 980px) {
  .app-shell,
  .admin-shell,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .admin-sidebar {
    position: relative;
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .admin-sidebar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .admin-sidebar .brand,
  .logout-form {
    grid-column: 1 / -1;
  }

  .hero-bar {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 38px;
  }
}

@media (max-width: 640px) {
  .content-shell,
  .admin-main {
    padding: 20px 16px 44px;
  }

  .case-toolbar,
  .admin-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .case-card {
    grid-template-rows: 150px minmax(190px, auto) auto;
    min-height: 420px;
  }

  .admin-form-grid,
  .category-row,
  .admin-sidebar {
    grid-template-columns: 1fr;
  }

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

  h1 {
    font-size: 32px;
  }

  .lead,
  .case-prose {
    font-size: 16px;
  }
}

/* Dashboard skin inspired by the provided reference */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --ink: #252930;
  --muted: #7b8491;
  --line: #dde2ea;
  --line-strong: #cfd6e1;
  --blue: #7e8be6;
  --blue-deep: #5665c9;
  --navy: #2c3037;
  --coral: #8b95a3;
  --coral-soft: #f0f2ff;
  --soft-blue: #eef1ff;
  --shadow: 0 8px 22px rgba(34, 42, 53, 0.08);
}

html {
  background: var(--bg);
  color: var(--ink);
}

.app-shell,
.admin-shell {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 70px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--bg);
}

.app-body {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  min-height: calc(100vh - 70px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 28px;
  align-items: center;
  min-height: 70px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: #f9fafc;
  box-shadow: 0 1px 10px rgba(34, 42, 53, 0.05);
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  min-width: 164px;
}

.brand-menu {
  position: relative;
  width: 20px;
  height: 14px;
}

.brand-menu::before,
.brand-menu::after,
.brand-menu {
  border-top: 2px solid var(--ink);
}

.brand-menu::before,
.brand-menu::after {
  position: absolute;
  left: 0;
  width: 20px;
  content: "";
}

.brand-menu::before {
  top: 5px;
}

.brand-menu::after {
  top: 12px;
}

.brand-word {
  font-size: 28px;
  font-weight: 840;
  line-height: 1;
  white-space: nowrap;
}

.topbar-path {
  display: flex;
  gap: 16px;
  align-items: center;
  min-width: 0;
  color: #30353c;
  font-size: 18px;
  font-weight: 700;
}

.topbar-path span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: inline-flex;
  gap: 18px;
  align-items: center;
  color: #30353c;
  font-size: 15px;
  font-weight: 700;
}

.topbar-actions a,
.topbar-badge {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.topbar-actions a {
  border-color: var(--line);
  background: var(--surface);
}

.sidebar,
.admin-sidebar {
  position: sticky;
  top: 70px;
  align-self: start;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 70px);
  padding: 26px 8px 18px;
  overflow-y: auto;
  border-right: 1px solid #edf0f5;
  background: var(--surface);
}

.sidebar-label {
  margin: 0 18px 14px;
  color: #a0a8b4;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.sidebar-footer {
  margin-top: auto;
  padding: 18px;
  border-top: 1px solid var(--line);
}

.sidebar-footer a {
  color: #444b55;
  font-size: 14px;
  font-weight: 700;
}

.tree-nav {
  gap: 10px;
}

.tree-all,
.tree-leaf,
.tree-case,
.tree-node summary,
.admin-nav {
  min-height: 58px;
  padding: 14px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #3c434d;
  font-size: 15px;
  font-weight: 720;
}

.tree-all,
.tree-leaf,
.tree-node summary {
  margin: 0 2px;
}

.tree-case {
  min-height: 40px;
  font-size: 13px;
  font-weight: 650;
}

.tree-all:hover,
.tree-leaf:hover,
.tree-case:hover,
.tree-node summary:hover,
.admin-nav:hover {
  background: #f6f8fb;
}

.tree-all.is-active,
.tree-leaf.is-active,
.tree-case.is-active,
.tree-node.is-active > summary,
.admin-nav.is-active {
  background: var(--soft-blue);
  color: #5665c9;
}

.tree-node summary span,
.tree-all span,
.tree-leaf span {
  background: #f2f4f7;
  color: #7d8793;
}

.content-shell,
.admin-main {
  min-width: 0;
  padding: 48px clamp(28px, 4vw, 68px) 72px;
}

.hero-bar {
  grid-template-columns: minmax(0, 1fr) 152px;
  align-items: center;
  padding: 0;
  border: 0;
}

.eyebrow {
  color: var(--blue-deep);
}

h1 {
  margin-bottom: 18px;
  color: #2b3037;
  font-size: 42px;
  letter-spacing: 0;
}

.lead {
  color: #404751;
  font-size: 18px;
}

.hero-stat,
.meta-line span,
.admin-list,
.admin-editor,
.admin-panel,
.login-panel {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-stat {
  min-height: 112px;
  border-radius: 8px;
}

.hero-stat strong {
  color: var(--blue-deep);
}

.case-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 14px;
  margin: 42px 0;
}

.search-field {
  width: 100%;
}

.search-field span {
  display: none;
}

.search-field input {
  min-height: 80px;
  padding: 0 28px;
  border-color: var(--line-strong);
  border-radius: 8px;
  color: #2b3037;
  font-size: 17px;
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(34, 42, 53, 0.03);
}

.search-field input::placeholder {
  color: #c1c7d1;
}

.admin-ghost {
  width: 54px;
  height: 54px;
  align-self: center;
  border-color: var(--line-strong);
  color: var(--ink);
  font-size: 24px;
  box-shadow: var(--shadow);
}

.case-grid {
  gap: 14px;
}

.case-card {
  display: block;
  min-height: 0;
  padding: 20px 22px;
  border-color: transparent;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.case-card:hover {
  border-color: #cdd3ff;
  box-shadow: 0 10px 28px rgba(34, 42, 53, 0.12);
}

.case-card__category {
  color: var(--blue-deep);
}

.case-card strong {
  display: block;
  margin-top: 10px;
  color: #22272e;
  font-size: 18px;
  line-height: 1.24;
}

.case-card__body {
  padding: 0;
}

.case-card__body > span:last-child {
  display: block;
  margin-top: 10px;
  color: #58616d;
  font-size: 14px;
  line-height: 1.55;
}

.case-card__media,
.case-card__meta {
  display: none;
}

.button,
.login-panel button,
.logout-form button,
.admin-nav,
.icon-button {
  border-color: var(--line);
  background: var(--surface);
  color: #30353c;
}

.button-primary,
.login-panel button,
.admin-action-primary {
  border-color: #2c3037;
  background: #2c3037;
  color: #fff;
}

.button-danger {
  border-color: #ffd8cc;
  background: #fff3ef;
  color: #b54822;
}

.admin-layout {
  grid-template-columns: minmax(250px, 336px) minmax(0, 1fr);
}

.admin-sidebar {
  gap: 10px;
}

.logout-form button {
  background: #f6f8fb;
}

.admin-list-head,
.admin-editor-head,
.admin-panel-head {
  min-height: 72px;
  border-bottom-color: var(--line);
}

.case-row {
  border-bottom-color: var(--line);
}

.case-row:hover,
.case-row.is-active {
  background: #f6f8fb;
}

.case-row.is-active {
  box-shadow: inset 4px 0 0 var(--blue);
}

.rich-editor-field .ql-toolbar.ql-snow {
  background: #f9fafc;
}

.rich-editor-field .ql-container.ql-snow,
.admin-field input,
.admin-field select,
.admin-field textarea,
.login-panel input {
  border-color: var(--line);
}

.category-row input {
  border-color: var(--line);
}

.crumbs a,
.case-prose a {
  color: #5665c9;
}

@media (max-width: 980px) {
  .app-shell,
  .admin-shell {
    grid-template-rows: auto auto;
  }

  .topbar {
    position: relative;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 18px;
  }

  .topbar-path,
  .topbar-actions {
    font-size: 14px;
  }

  .app-body {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .admin-sidebar {
    position: relative;
    top: auto;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .content-shell,
  .admin-main {
    padding: 28px 18px 52px;
  }
}

@media (max-width: 640px) {
  .brand-word {
    font-size: 24px;
  }

  h1 {
    font-size: 32px;
  }

  .case-toolbar {
    grid-template-columns: 1fr;
    margin: 28px 0;
  }

  .search-field input {
    min-height: 58px;
  }
}

/* Mature knowledge-base pass */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --ink: #22262d;
  --muted: #6f7783;
  --line: #e2e6ee;
  --line-strong: #cfd5df;
  --blue: #8d97dc;
  --blue-deep: #4f5db8;
  --soft-blue: #f0f2ff;
  --shadow: none;
}

.app-shell,
.admin-shell {
  grid-template-rows: 64px minmax(0, 1fr);
}

.app-body {
  grid-template-columns: 244px minmax(0, 1fr);
  min-height: calc(100vh - 64px);
}

.public-page .app-body {
  grid-template-columns: clamp(360px, 38vw, 488px) minmax(0, 1fr);
}

.topbar {
  grid-template-columns: 1fr;
  min-height: 64px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: none;
}

.topbar-brand {
  min-width: 0;
  gap: 0;
}

.brand-word {
  font-size: 22px;
  font-weight: 780;
}

.topbar-path,
.topbar-actions,
.topbar-badge {
  display: none;
}

.sidebar,
.admin-sidebar {
  top: 64px;
  height: calc(100vh - 64px);
  padding: 24px 10px 18px;
}

.public-page .sidebar {
  padding-right: 14px;
  padding-left: 14px;
}

.sidebar-footer {
  display: none;
}

.tree-nav {
  gap: 4px;
}

.tree-all,
.tree-leaf,
.tree-case,
.tree-node summary,
.admin-nav {
  min-height: 44px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 650;
}

.tree-case {
  min-height: 34px;
  color: #69717d;
  font-size: 12px;
}

.public-page .tree-node summary a {
  min-width: 0;
}

.public-page .tree-node summary span,
.public-page .tree-all span,
.public-page .tree-leaf span {
  flex: 0 0 auto;
}

.content-shell,
.admin-main {
  padding: 38px clamp(28px, 4vw, 64px) 64px;
}

.public-page .content-shell {
  padding: 36px clamp(22px, 3vw, 48px) 64px;
}

.hero-bar {
  display: block;
  max-width: 840px;
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
}

h1 {
  margin-bottom: 12px;
  font-size: 32px;
  line-height: 1.14;
  font-weight: 760;
}

.lead {
  max-width: 720px;
  color: #4a515d;
  font-size: 16px;
  line-height: 1.55;
}

.hero-stat {
  display: none;
}

.case-toolbar {
  display: block;
  max-width: 860px;
  margin: 24px 0 16px;
}

.search-field input {
  min-height: 46px;
  padding: 0 16px;
  border-radius: 8px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  box-shadow: none;
}

.search-field input:focus {
  border-color: var(--blue-deep);
  box-shadow: 0 0 0 3px rgba(79, 93, 184, 0.12);
}

.admin-ghost {
  display: none;
}

.case-grid {
  display: block;
  max-width: 860px;
  margin-right: auto;
  margin-left: auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.case-grid--all {
  display: grid;
  max-width: 1040px;
  align-items: stretch;
  gap: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.case-card {
  display: block;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 13px 16px 14px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.case-card:first-child {
  border-top: 0;
}

.case-grid--all .case-card {
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.case-grid--all .case-card:nth-child(-n + 2) {
  border-top: 0;
}

.case-grid--all .case-card:nth-child(odd) {
  border-left: 0;
}

.case-card:hover {
  transform: none;
  border-color: var(--line);
  background: #f8f9ff;
  box-shadow: none;
}

.case-card__category {
  color: var(--blue-deep);
  font-size: 11px;
  font-weight: 760;
}

.case-card__body {
  display: block;
  padding: 0;
}

.case-card strong {
  display: block;
  margin-top: 6px;
  max-width: 780px;
  max-height: calc(1.24em * 2);
  overflow: hidden;
  font-size: 16px;
  font-weight: 720;
  line-height: 1.24;
}

.case-card__body > span:last-child {
  display: block;
  max-width: 760px;
  max-height: calc(1.45em * 2);
  margin-top: 6px;
  overflow: hidden;
  color: #5d6571;
  font-size: 14px;
  line-height: 1.45;
}

.case-detail {
  max-width: 860px;
}

.case-detail__head {
  padding-bottom: 20px;
}

.meta-line span {
  box-shadow: none;
}

.case-prose {
  max-width: 760px;
  font-size: 17px;
}

.admin-list,
.admin-editor,
.admin-panel,
.login-panel {
  box-shadow: none;
}

@media (max-width: 980px) {
  .app-shell,
  .admin-shell {
    grid-template-rows: auto auto;
  }

  .sidebar,
  .admin-sidebar {
    top: auto;
    height: auto;
  }
}

@media (max-width: 640px) {
  .brand-word {
    font-size: 20px;
  }

  h1 {
    font-size: 28px;
  }

  .case-grid--all {
    display: block;
    max-width: 860px;
  }

  .case-grid--all .case-card {
    border-left: 0;
  }

  .case-grid--all .case-card:nth-child(2) {
    border-top: 1px solid var(--line);
  }
}
