
:root {
  color-scheme: dark;
  --bg: #0f1724;
  --card: #182231;
  --card-border: #344256;
  --text: #f5f7fb;
  --muted: #aebbd0;
  --accent: #74d8ce;
  --accent-2: #88aefb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(116, 216, 206, 0.16), transparent 34rem),
    linear-gradient(145deg, #101827, var(--bg));
  color: var(--text);
}

a {
  color: var(--accent);
}

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

.shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(20px, 5vw, 64px);
}

.card {
  border: 1px solid var(--card-border);
  border-radius: 32px;
  padding: clamp(24px, 5vw, 56px);
  background: linear-gradient(145deg, rgba(24, 34, 49, 0.96), rgba(17, 25, 38, 0.96));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 8vw, 5rem);
  line-height: 0.95;
}

.lead {
  max-width: 760px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  line-height: 1.55;
}

.actions {
  margin: 28px 0 0;
}

.actions.tight {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.inline-button-form {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border: 0;
  border-radius: 999px;
  padding: 0 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #07111d;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.secondary {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
}

.button.small {
  min-height: 40px;
  padding: 0 16px;
  font-size: 0.9rem;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.form {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

.form.compact {
  display: block;
}

.inline-form {
  display: inline;
  margin: 0;
}

.moderation-actions {
  display: grid;
  gap: 8px;
  min-width: 260px;
}

.moderation-actions textarea {
  min-height: 72px;
}

.autosave-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: -4px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.autosave-line [data-autosave-status] {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.05);
}

.autosave-line [data-state="dirty"],
.autosave-line [data-state="saving"] {
  border-color: rgba(255, 204, 102, 0.42);
  color: #ffe3a3;
}

.autosave-line [data-state="saved"] {
  border-color: rgba(116, 216, 206, 0.45);
  color: #9ffff5;
}

.autosave-line [data-state="error"] {
  border-color: rgba(255, 100, 130, 0.48);
  color: #ffc7d1;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  margin-top: 28px;
  align-items: center;
}

.filter-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(190px, 1fr) minmax(170px, 0.85fr) minmax(210px, auto);
  gap: 14px;
  margin-top: 28px;
  align-items: end;
}

.compact-filter-form {
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 16px;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  padding: 16px 18px;
  background: rgba(6, 12, 21, 0.72);
  color: var(--text);
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

.markdown-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 10px;
}

.markdown-tool {
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.markdown-tool:hover {
  border-color: rgba(116, 216, 206, 0.55);
  background: rgba(116, 216, 206, 0.12);
}

input[type="checkbox"] {
  width: auto;
  min-width: 20px;
  min-height: 20px;
  padding: 0;
}

.error {
  margin: 24px 0 0;
  border: 1px solid rgba(255, 100, 130, 0.45);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 100, 130, 0.12);
  color: #ffc7d1;
}

.notice,
.warning {
  margin: 24px 0 0;
  border-radius: 18px;
  padding: 14px 16px;
}

.notice {
  border: 1px solid rgba(116, 216, 206, 0.45);
  background: rgba(116, 216, 206, 0.12);
  color: #c9fff8;
}

.warning {
  border: 1px solid rgba(255, 204, 102, 0.45);
  background: rgba(255, 204, 102, 0.10);
  color: #ffe3a3;
}

.userbar {
  display: grid;
  gap: 14px;
  margin: 0 0 24px;
  color: var(--muted);
}

.topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.topnav a,
.nav-form button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.nav-form {
  margin: 0;
}

.nav-form button {
  cursor: pointer;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 36px 0 0;
}

.facts div,
.fact-link,
.secret-box {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.fact-link {
  color: var(--text);
  text-decoration: none;
}

.dashboard-hero,
.entity-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 22px;
  align-items: stretch;
}

.hero-badge,
.entity-status-card,
.panel-card,
.work-card,
.material-card,
.moderation-card,
.details-block {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.045);
}

.hero-badge,
.entity-status-card {
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 22px;
}

.hero-badge span,
.entity-status-card small {
  color: var(--muted);
}

.hero-badge strong,
.entity-status-card strong {
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.dashboard-facts .fact-link,
.dashboard-facts div {
  min-height: 118px;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.fact-link:hover,
.work-card:hover,
.material-card:hover {
  transform: translateY(-2px);
  border-color: rgba(116, 216, 206, 0.55);
  background: rgba(116, 216, 206, 0.08);
}

.workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 18px;
  margin-top: 28px;
}

.panel-card {
  padding: 22px;
}

.panel-card h2 {
  margin-top: 0;
}

.work-card-grid,
.material-card-list,
.moderation-board {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.work-card-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.work-card {
  display: grid;
  gap: 8px;
  min-height: 138px;
  padding: 18px;
  color: var(--text);
  text-decoration: none;
}

.work-icon {
  font-size: 1.8rem;
}

.work-card small,
.material-card small {
  color: var(--muted);
  line-height: 1.45;
}

.primary-work-card {
  background: linear-gradient(145deg, rgba(116, 216, 206, 0.20), rgba(136, 174, 251, 0.13));
}

.attention-card {
  border-color: rgba(255, 204, 102, 0.40);
}

.material-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.material-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  color: var(--text);
  text-decoration: none;
}

.material-card strong {
  font-size: 1.12rem;
}

.material-card-compact {
  min-height: 132px;
}

.material-card-head,
.moderation-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.material-card-meta {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.94rem;
}

.entity-facts {
  margin-top: 24px;
}

.page-status-draft {
  background: rgba(136, 174, 251, 0.16);
  color: #c9d8ff;
}

.page-status-moderation,
.moderation-status-pending {
  background: rgba(255, 204, 102, 0.17);
  color: #ffe3a3;
}

.page-status-published,
.moderation-status-approved {
  background: rgba(116, 216, 206, 0.16);
  color: #9ffff5;
}

.page-status-archived,
.page-status-hidden,
.moderation-status-cancelled {
  background: rgba(255, 255, 255, 0.09);
  color: var(--muted);
}

.moderation-status-rejected {
  background: rgba(255, 100, 130, 0.16);
  color: #ffc7d1;
}

.moderation-card {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.moderation-card h2 {
  margin: 0;
}

.moderation-excerpt {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
}

.details-block {
  margin-top: 24px;
  padding: 16px 18px;
}

.details-block summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 800;
}

.details-mini summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 800;
}

.section-tree {
  display: grid;
  gap: 14px;
  margin: 28px 0 0;
}

.section-tree h2 {
  margin: 0 0 4px;
}

.section-tree-node {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.045);
}

.section-tree-node + .section-tree-node {
  margin-top: 12px;
}

.section-tree-hidden {
  opacity: 0.68;
}

.section-tree-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.section-tree-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.section-tree-children {
  display: grid;
  gap: 12px;
  margin-top: 6px;
  padding-left: 18px;
  border-left: 1px solid rgba(116, 216, 206, 0.22);
}

.inline-action-form {
  display: grid;
  gap: 10px;
  min-width: min(320px, 72vw);
  margin-top: 10px;
}

.hidden-row {
  opacity: 0.72;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 28px 0;
}

.panel-form {
  display: grid;
  gap: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.04);
}

h2 {
  margin: 28px 0 12px;
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.panel-form h2 {
  margin: 0;
}

.table-wrap {
  width: 100%;
  margin-top: 28px;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  padding: 14px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.95rem;
}

.strong-link {
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  margin: 2px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
}

.pill-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 8px;
}

.tab-link {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
}

.tab-link span {
  min-width: 24px;
  border-radius: 999px;
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.10);
  text-align: center;
  color: var(--muted);
}

.tab-link.active {
  border-color: rgba(116, 216, 206, 0.55);
  background: rgba(116, 216, 206, 0.14);
  color: #dffffb;
}

.tab-link.active span {
  background: rgba(116, 216, 206, 0.22);
  color: #f5ffff;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}

.tag-pill {
  border-color: rgba(136, 174, 251, 0.22);
  background: rgba(136, 174, 251, 0.10);
  color: #dbe7ff;
  text-decoration: none;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 18px;
  color: var(--muted);
  font-weight: 700;
}

.breadcrumbs a {
  color: #cfe0ff;
  text-decoration: none;
}

.breadcrumbs strong {
  color: var(--text);
}

.status-active {
  background: rgba(116, 216, 206, 0.16);
  color: #9ffff5;
}

.status-blocked {
  background: rgba(255, 100, 130, 0.16);
  color: #ffc7d1;
}

.status-hidden {
  background: rgba(255, 255, 255, 0.09);
  color: var(--muted);
}

.status-temporarily_limited {
  background: rgba(255, 204, 102, 0.16);
  color: #ffe3a3;
}

.secret-box {
  margin-top: 28px;
}

.check-list {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.check-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: start;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.check-row span {
  display: grid;
  gap: 4px;
}

.check-row small,
.check-row em {
  color: var(--muted);
  font-style: normal;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 12px;
}

.article-preview {
  margin-top: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.65;
}

.article-preview.full {
  margin-top: 32px;
  font-size: clamp(1.05rem, 2vw, 1.2rem);
}

.article-rendered {
  display: grid;
  gap: 14px;
}

.article-rendered p,
.article-rendered ul,
.article-rendered ol,
.article-rendered blockquote,
.article-rendered pre {
  margin: 0;
}

.article-rendered h2,
.article-rendered h3,
.article-rendered h4 {
  margin: 12px 0 0;
}

.article-rendered ul,
.article-rendered ol {
  padding-left: 24px;
}

.article-rendered blockquote {
  border-left: 4px solid rgba(116, 216, 206, 0.55);
  padding: 10px 0 10px 16px;
  color: var(--muted);
}

.article-rendered pre {
  overflow: auto;
  padding: 16px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.22);
}

.article-rendered code {
  border-radius: 8px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.08);
}

.article-rendered pre code {
  padding: 0;
  background: transparent;
}

.article-rendered a {
  color: var(--accent);
}

.diff-toolbar {
  margin-top: 28px;
}

.diff-view {
  display: grid;
  margin-top: 18px;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.035);
}

.diff-row {
  display: grid;
  grid-template-columns: 58px 58px minmax(420px, 1fr);
  gap: 10px;
  padding: 7px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.diff-row:last-child {
  border-bottom: 0;
}

.diff-row code {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

.diff-line-no {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-align: right;
}

.diff-added {
  background: rgba(116, 216, 206, 0.10);
}

.diff-removed {
  background: rgba(255, 100, 130, 0.12);
}

.diff-side-by-side {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.diff-side-by-side pre {
  overflow: auto;
  min-height: 260px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  white-space: pre-wrap;
}

.timeline {
  display: grid;
  gap: 14px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.timeline-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 14px;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  margin-top: 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 6px rgba(116, 216, 206, 0.10);
}

.timeline-body {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.timeline-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
}

.timeline-body p {
  margin: 8px 0 0;
  line-height: 1.5;
}

.kb-section {
  margin-top: 34px;
}

.kb-tree-section {
  border-left: 1px solid rgba(116, 216, 206, 0.20);
  padding-left: 18px;
}

.kb-tree-section[data-depth="0"] {
  border-left: 0;
  padding-left: 0;
}

.kb-section-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.kb-section-head h2 {
  margin: 0;
}

.kb-section-head a {
  color: var(--text);
  text-decoration: none;
}

.kb-section-head a:hover {
  color: var(--accent);
}

.active-kb-section {
  border-color: rgba(116, 216, 206, 0.55);
}

.template-choice-block {
  margin: 26px 0;
}

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

.template-choice {
  display: grid;
  gap: 8px;
  min-height: 112px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  text-decoration: none;
}

.template-choice:hover,
.active-template-choice {
  border-color: rgba(116, 216, 206, 0.55);
  background: rgba(116, 216, 206, 0.12);
}

.kb-children {
  display: grid;
  gap: 20px;
  margin-top: 22px;
}

.comments-section {
  margin-top: 38px;
}

.comment-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.comment-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.045);
}

.addition-card {
  border-color: rgba(116, 216, 206, 0.24);
  background: rgba(116, 216, 206, 0.065);
}

.comment-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 10px;
}

.comment-card p {
  margin: 0;
  line-height: 1.55;
}

.comment-form {
  margin-top: 18px;
}

.page-list {
  display: grid;
  gap: 14px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.page-list li {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.04);
}

dt {
  color: var(--muted);
  font-size: 0.95rem;
}

dd {
  margin: 8px 0 0;
  font-size: 1.1rem;
  font-weight: 700;
}

@media (max-width: 720px) {
  .dashboard-hero,
  .entity-header,
  .workbench-grid,
  .material-grid,
  .work-card-grid {
    grid-template-columns: 1fr;
  }

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

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

  .diff-side-by-side {
    grid-template-columns: 1fr;
  }

  .diff-row {
    grid-template-columns: 42px 42px minmax(260px, 1fr);
  }

  .search-form {
    grid-template-columns: 1fr;
  }

  .filter-form {
    grid-template-columns: 1fr;
  }

  .filter-actions .button {
    width: 100%;
  }

  table {
    min-width: 640px;
  }

  .kb-tree-section {
    padding-left: 12px;
  }

  .section-tree-children {
    padding-left: 10px;
  }

  .section-tree-meta {
    justify-content: flex-start;
  }
}
