:root {
  --bg: #edf0f4;
  --bg-soft: #f6f8fb;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --ink: #1f2a37;
  --muted: #6f7c8a;
  --line: #d7dde6;
  --line-strong: #c7d0dc;
  --brand: #2d7fd3;
  --brand-strong: #1d5da0;
  --brand-soft: #e6f1fc;
  --ok: #1f8f5f;
  --warn: #d69021;
  --danger: #c24343;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --shadow-soft: 0 12px 36px rgba(17, 37, 62, 0.08);
  --shadow-card: 0 10px 22px rgba(31, 42, 55, 0.07);
  --header-h: 86px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: #edf0f4;
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  line-height: 1.45;
  position: relative;
}

body::before,
body::after {
  display: none;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  display: block;
}

.sidebar {
  position: fixed;
  top: calc(var(--header-h) + 10px);
  left: 18px;
  bottom: 18px;
  width: 270px;
  z-index: 32;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(247, 250, 253, 0.92));
  box-shadow: var(--shadow-soft);
  padding: 12px;
  overflow: auto;
}

.brand-card {
  border: 1px solid #dbe2ea;
  border-radius: var(--radius-md);
  background: #f9fbfe;
  padding: 11px;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 1.18rem;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(145deg, var(--brand), #6ea7e5);
}

.brand h1 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.1;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.brand-note {
  margin: 10px 0 0;
  color: #5d6a78;
  font-size: 0.79rem;
}

.sidebar-label {
  margin: 4px 4px 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
  color: #718193;
  font-weight: 700;
}

.page-nav {
  margin-top: 4px;
  display: grid;
  gap: 6px;
}

.nav-group-title {
  margin: 4px 4px 2px;
  font-size: 0.77rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #728196;
  font-weight: 700;
}

.nav-group-title.collapsible {
  cursor: pointer;
  user-select: none;
}

.group-collapsed {
  min-height: 2px;
}

.nav-item {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 9px 10px;
  color: inherit;
  text-decoration: none;
  display: grid;
  gap: 3px;
  transition: 0.18s ease;
}

.nav-item strong {
  font-weight: 680;
}

.nav-item small {
  color: #6f7d8b;
  font-size: 0.76rem;
}

.nav-item:hover {
  border-color: var(--line);
  background: #fff;
  transform: translateX(2px);
}

.nav-item.active {
  background: linear-gradient(180deg, #eaf3fe, #e3f0fe);
  border-color: #bdd7f3;
  box-shadow: inset 0 0 0 1px rgba(45, 127, 211, 0.06);
}

.main {
  min-width: 0;
  width: 100%;
  max-width: none;
  padding: calc(var(--header-h) + 12px) 20px 24px 306px;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
}

.topbar-shell {
  width: min(1400px, calc(100vw - 24px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
}

.menu-btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px 10px;
  display: none;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 190px;
  border: none;
  background: transparent;
  padding: 4px 6px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
}

.header-brand:hover {
  background: #eef4fb;
}

.header-brand-mark {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.95rem;
  line-height: 1;
  font-weight: 800;
  background-color: #72a8e8;
  background-image: url("/static/playground-logo.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.header-brand-text {
  display: grid;
  line-height: 1.08;
}

.header-brand-text strong {
  font-size: 0.97rem;
}

.header-brand-text small {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.header-menu {
  position: relative;
}

.header-menu-direct .menu-popover {
  display: none !important;
}

.header-link {
  border: none;
  background: transparent;
  font: inherit;
  color: #2f3846;
  padding: 8px 9px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
}

.header-link:hover {
  background: #f3f6fb;
}

.header-link.active {
  background: #eaf2fb;
  color: #244b74;
}

.header-link span {
  color: #8a95a8;
  font-size: 0.82em;
}

.menu-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 210px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-card);
  padding: 6px;
  display: grid;
  gap: 2px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: 0.16s ease;
  z-index: 75;
}

.header-menu:hover .menu-popover,
.header-menu:focus-within .menu-popover {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.menu-item {
  border: none;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font: inherit;
  color: #2c3a49;
  padding: 8px;
  cursor: pointer;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: #edf4fc;
  outline: none;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-search input {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 11px;
  padding: 8px 10px;
  min-width: 195px;
  font: inherit;
}

.action-btn,
.locale-select {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: 0.16s ease;
}

.action-btn:hover,
.locale-select:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.action-btn.active {
  background: var(--brand-soft);
  border-color: #b7d4f4;
}

#addSectionBtn {
  border-color: #f0d3a9;
  background: #fff7ed;
}

#editPageBtn {
  border-color: #c7d5f1;
  background: #f3f6fd;
}

#undoBtn,
#redoBtn {
  border-color: #cfe0cc;
  background: #f2faf1;
}

#saveBtn {
  border-color: #9cc7e4;
  background: #e8f4ff;
}

#logoutBtn {
  border-color: #e3c1c8;
  background: #fdf2f5;
}

.status-bar {
  min-height: 25px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.9rem;
  border-left: 3px solid #c6d6e8;
  padding: 3px 0 3px 10px;
  width: 100%;
  max-width: none;
}

.content {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  animation: none;
  min-height: calc(100vh - var(--header-h) - 58px);
  width: 100%;
  max-width: none;
  display: block;
}

.page-hero {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  width: 100%;
  max-width: none;
}

#sectionsMount {
  width: 100%;
  max-width: none;
}

.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.page-title-row h2 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.78rem);
  letter-spacing: -0.015em;
}

.page-hero p {
  margin: 0;
  color: #596777;
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.metric {
  border: 1px solid #d8e3f0;
  border-radius: 13px;
  background: #f7fbff;
  padding: 11px;
}

.metric-value {
  display: block;
  font-size: 1.45rem;
  font-weight: 760;
  letter-spacing: -0.02em;
}

.metric-label {
  color: #5f6f83;
  font-size: 0.83rem;
}

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

.quick-action {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-alt);
  text-align: left;
  padding: 12px;
  display: grid;
  gap: 5px;
  color: inherit;
  cursor: pointer;
  transition: 0.18s ease;
}

.quick-action strong {
  font-size: 0.95rem;
}

.quick-action span {
  font-size: 0.8rem;
  color: #667587;
}

.quick-action:hover {
  transform: translateY(-2px);
  border-color: #c3d7ed;
  background: #f2f8ff;
}

.home-search-wrap {
  display: grid;
  gap: 8px;
  max-width: 780px;
}

.home-search-input {
  width: 100%;
  border: 1px solid #c6d7ea;
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-size: 1rem;
  background: #fff;
}

.home-search-results {
  display: grid;
  gap: 6px;
}

.home-search-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-align: left;
  font: inherit;
  padding: 8px 10px;
  cursor: pointer;
}

.home-search-item:hover {
  border-color: #bdd3ea;
  background: #f3f8ff;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.quick-link-btn {
  border: 1px solid #d0dbe8;
  border-radius: 999px;
  background: #fff;
  padding: 5px 10px;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.quick-link-btn:hover {
  border-color: #aac7e6;
  background: #eef5ff;
}

.feature-preview {
  margin: 0;
  padding-left: 18px;
  color: #4f5e70;
  font-size: 0.88rem;
}

.wiki-section {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 12px;
  margin: 10px 0;
  scroll-margin-top: 104px;
  width: 100%;
  max-width: none;
}

.wiki-section:target {
  border-color: #8ec0e8;
  box-shadow: 0 0 0 3px #e3f1fc;
}

.section-details {
  border-radius: 10px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}

.section-head::-webkit-details-marker {
  display: none;
}

.section-title {
  margin: 0;
  font-size: 1.02rem;
}

.section-details[open] .section-head {
  padding-bottom: 8px;
}

.section-details[open] .section-title::before {
  content: "▾ ";
}

.section-details:not([open]) .section-title::before {
  content: "▸ ";
}

.section-body {
  color: #263240;
  width: 100%;
  max-width: none;
  display: block;
  white-space: normal !important;
  overflow-wrap: break-word;
}

.section-body img,
.section-body video {
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid #dce3ea;
  display: block;
  margin: 10px 0;
}

.section-body .callout {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid #dbe4ef;
  border-radius: 10px;
  background: #f9fbfe;
  padding: 10px;
  margin: 10px 0;
}

.section-body .callout > div:last-child {
  flex: 1;
  min-width: 0;
}

.section-body [style*="float"],
.section-body figure {
  float: none !important;
  margin: 10px 0 !important;
}

.section-body::after {
  content: "";
  display: block;
  clear: both;
}

.section-body p,
.section-body ul,
.section-body ol,
.section-body table,
.section-body blockquote,
.section-body h1,
.section-body h2,
.section-body h3,
.section-body h4 {
  max-width: 100% !important;
  width: 100%;
  display: block;
  white-space: normal !important;
}

.section-body table {
  table-layout: auto;
  border-collapse: collapse;
}

.section-public-tools,
.section-tools {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tiny-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  background: #fff;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.tiny-btn:hover {
  border-color: var(--line-strong);
}

.remove-btn {
  color: var(--danger);
}

.editor-pane,
.page-editor-pane {
  border: 1px dashed #c8d5e4;
  border-radius: 12px;
  background: #f9fbfd;
  padding: 11px;
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.editor-label {
  margin: 0;
  font-size: 0.84rem;
  color: #5f6f7f;
}

.editor-pane input,
.page-editor-pane input,
.page-editor-pane textarea,
.page-editor-pane select {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px;
  font: inherit;
  background: #fff;
}

.page-editor-pane textarea {
  min-height: 110px;
}

.editor-pane input[type="file"] {
  padding: 6px;
}

.editor-pane .editable,
.page-editor-pane .editable {
  border: 1px solid var(--line);
  border-radius: 9px;
  min-height: 128px;
  padding: 10px;
  background: #fff;
}

.editing-active > .section-body {
  display: none;
}

.toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.toolbar button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 5px 8px;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.kanban-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  align-items: start;
}

.kanban-column {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-alt);
  padding: 8px;
}

.kanban-column h3 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.card-list-empty {
  margin: 8px 0;
  color: #657384;
  font-size: 0.9rem;
}

.roadmap-timeline {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.roadmap-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.roadmap-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.roadmap-item-head h3 {
  margin: 0;
  font-size: 1rem;
}

.roadmap-period {
  border: 1px solid #c6d8ee;
  background: #eef5ff;
  color: #34597f;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.roadmap-item p {
  margin: 10px 0 0;
  color: #455468;
}

@keyframes content-enter {
  from {
    transform: translateY(6px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 1080px) {
  .main {
    padding-left: 20px;
  }

  .sidebar {
    inset: calc(var(--header-h) + 8px) auto 14px 14px;
    width: min(280px, calc(100vw - 88px));
    transform: translateX(-120%);
    transition: transform 0.22s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .menu-btn {
    display: block;
  }
}

@media (max-width: 960px) {
  :root {
    --header-h: 122px;
  }

  .topbar-shell {
    flex-wrap: wrap;
    padding: 8px;
  }

  .header-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .menu-popover {
    position: fixed;
    left: 12px;
    right: 12px;
    min-width: 0;
  }

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

  .header-search input {
    min-width: 160px;
  }

  .content {
    border-radius: 16px;
    padding: 14px;
  }
}
