﻿:root {
  --bg: #f4f7fb;
  --bg2: #eaf2ff;
  --card: #ffffff;
  --text: #182032;
  --muted: #5f6d83;
  --line: #d9e2ee;
  --brand: #0b7285;
  --brand-2: #1262cc;
  --danger: #c92a2a;
  --ok: #2b8a3e;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(900px 420px at 0% -10%, #dfeeff 0%, transparent 60%),
    radial-gradient(700px 300px at 100% -5%, #def7ff 0%, transparent 55%),
    var(--bg);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.container { max-width: 1180px; margin: 0 auto; padding: 24px 20px 48px; }
.hero {
  border: 1px solid var(--line);
  background: linear-gradient(130deg, #ffffff 0%, #f5fbff 45%, #eef4ff 100%);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 14px 34px rgba(31, 66, 135, 0.10);
}
h1 { margin: 0; font-size: 34px; }
h2 { margin: 0 0 10px; font-size: 20px; }
p { margin: 8px 0 0; color: var(--muted); line-height: 1.7; }
.topnav { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 10px; }
.topnav a, button, .btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 9px 13px;
  text-decoration: none;
  cursor: pointer;
  font-size: 14px;
}
.topnav a.active, .btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent;
  color: #fff;
}
.grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.card {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 14px;
  padding: 14px;
}
.badge {
  display: inline-block;
  font-size: 12px;
  border-radius: 999px;
  background: #e6f4ff;
  color: #1864ab;
  padding: 4px 8px;
}
.layout {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 14px;
}
.panel {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 14px;
  padding: 14px;
}
.list {
  margin: 10px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 540px;
  overflow: auto;
}
.list-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px;
  background: #fff;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.list-item.active { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.field { margin-top: 10px; }
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 4px; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 14px;
  background: #fff;
}
textarea { min-height: 160px; resize: vertical; }
.actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.btn-danger { border-color: #f1aeb5; color: var(--danger); background: #fff5f5; }
.btn-ok { border-color: #b2f2bb; color: var(--ok); background: #ebfbee; }
.tree { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; max-height: 620px; overflow: auto; }
.node {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px;
}
.node.active {
  border-color: #1c7ed6;
  box-shadow: inset 0 0 0 1px #1c7ed6;
  background: #f1f8ff;
}
.node-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.node-title { font-weight: 600; cursor: pointer; }
.node-meta { font-size: 12px; color: var(--muted); }
.indent-1 { margin-left: 0; }
.indent-2 { margin-left: 20px; }
.indent-3 { margin-left: 40px; }
.indent-4 { margin-left: 60px; }
.indent-5 { margin-left: 80px; }
.status { margin-top: 8px; font-size: 13px; color: var(--muted); }
.footer-note { margin-top: 12px; font-size: 12px; color: var(--muted); }
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .hero h1 { font-size: 28px; }
  .indent-2, .indent-3, .indent-4, .indent-5 { margin-left: 10px; }
}

/* App layout (minimal Notion/Feishu style) */
.app-shell {
  min-height: 100vh;
  background: #fff;
  color: #1f2329;
}

.app-topbar {
  height: 50px;
  border-bottom: 1px solid #eceff3;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-brand {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.app-summary {
  font-size: 11px;
  color: #7f8794;
}

.app-top-actions {
  display: flex;
  gap: 6px;
}

.app-body {
  display: grid;
  grid-template-columns: 270px 1fr 300px;
  min-height: calc(100vh - 50px);
}

.app-sidebar {
  border-right: 1px solid #eceff3;
  background: #fafbfc;
  padding: 10px;
  overflow: auto;
}

.sidebar-header {
  margin-bottom: 8px;
}

.sidebar-header input {
  border: 1px solid #e9edf2;
  border-radius: 8px;
  height: 34px;
}

.doc-tree {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tree-group {
  padding: 2px 0 6px;
  border-bottom: 1px dashed #eff2f6;
}

.tree-group:last-child {
  border-bottom: none;
}

.tree-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 4px 2px 6px;
}

.tree-group-meta {
  font-size: 11px;
  color: #8791a0;
}

.tree-group-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tree-group-actions .badge {
  font-size: 10px;
  padding: 2px 6px;
}

.tree-empty {
  font-size: 12px;
  color: #8a93a2;
  padding: 6px 6px;
}

.tree-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.doc-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  min-height: 38px;
  border-radius: 6px;
}

.doc-row.active {
  background: #e9f2ff;
}

.doc-row-main {
  min-width: 0;
  padding: 6px 0;
}

.doc-row-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-row-meta {
  font-size: 11px;
  color: #8a93a2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-row-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.doc-row-actions button {
  border: none;
  background: transparent;
  color: #6b7482;
  padding: 3px 6px;
}

.doc-row-actions button:hover {
  background: #eef2f7;
}

.app-editor {
  padding: 14px 28px 20px;
  overflow: auto;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.breadcrumb {
  font-size: 12px;
  color: #7f8794;
}

.editor-actions {
  display: flex;
  gap: 6px;
}

.doc-title-input {
  margin-top: 10px;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid #eef1f5;
  padding: 6px 0 8px;
  background: transparent;
  font-size: 34px;
  font-weight: 700;
  color: #1f2329;
  outline: none;
}

.doc-content-input {
  border: none;
  margin-top: 10px;
  padding: 4px 0;
  min-height: calc(100vh - 240px);
  font-size: 15px;
  line-height: 1.7;
  outline: none;
  resize: vertical;
}

.status-bar {
  margin-top: 8px;
  padding: 6px 0;
  font-size: 12px;
  color: #778190;
}

.status-bar[data-type="ok"] {
  color: #2b8a3e;
}

.status-bar[data-type="warn"] {
  color: #d9480f;
}

.app-meta {
  border-left: 1px solid #eceff3;
  background: #fcfcfd;
  padding: 12px;
  overflow: auto;
}

.app-meta h3 {
  margin: 4px 0;
  font-size: 14px;
  font-weight: 600;
}

.app-meta hr {
  border: none;
  border-top: 1px solid #eceff3;
  margin: 12px 0;
}

.app-meta .field {
  margin-top: 8px;
}

.app-meta label {
  font-size: 11px;
  color: #7f8794;
}

.app-meta input,
.app-meta select {
  height: 32px;
  border: 1px solid #e7ecf2;
  border-radius: 6px;
  font-size: 13px;
  padding: 6px 8px;
}

.app-meta .actions {
  margin-top: 8px;
  gap: 6px;
}

.app-meta .actions button {
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
}

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

@media (max-width: 1200px) {
  .app-body {
    grid-template-columns: 250px 1fr 280px;
  }
}

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

  .app-sidebar,
  .app-editor {
    border-right: none;
    border-bottom: 1px solid #eceff3;
  }

  .app-meta {
    border-left: none;
  }
}

/* Knowledge base dark UI */
body.kb-dark {
  margin: 0;
  background: #1f1f1f;
  color: #e9e9e9;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.kb-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.kb-sidebar {
  border-right: 1px solid #343434;
  background: #1d1d1d;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.kb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 30px;
  font-weight: 700;
  color: #f7f7f7;
}

.kb-logo {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: linear-gradient(135deg, #7c5cff 0%, #24d4ff 100%);
  box-shadow: 0 0 0 2px #1d1d1d, 0 0 0 3px #3a3a3a;
}

.kb-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kb-search-wrap input {
  flex: 1;
  background: #141414;
  border: 1px solid #353535;
  border-radius: 8px;
  color: #f2f2f2;
  padding: 8px 10px;
  font-size: 13px;
}

.kb-hotkey {
  font-size: 11px;
  color: #9d9d9d;
  border: 1px solid #3f3f3f;
  border-radius: 6px;
  padding: 3px 6px;
}

.kb-create-row {
  display: flex;
  gap: 8px;
}

.kb-create-row input {
  flex: 1;
  background: #252525;
  border: 1px solid #3b3b3b;
  border-radius: 8px;
  color: #f1f1f1;
  padding: 8px 10px;
}

.kb-btn {
  border: 1px solid #3b3b3b;
  background: #242424;
  color: #e9e9e9;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
}

.kb-btn:hover {
  background: #2d2d2d;
}

.kb-btn-accent {
  background: #de7b5f;
  border-color: #de7b5f;
  color: #fff;
}

.kb-btn-accent:hover {
  background: #d56f52;
}

.kb-btn-danger {
  border-color: #6a3030;
  color: #ffb7b7;
}

.kb-tree {
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px solid #343434;
  overflow: auto;
  flex: 1;
}

.kb-tree-group {
  margin-bottom: 10px;
}

.kb-tree-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 2px;
}

.kb-tree-head strong {
  font-size: 13px;
  color: #e8e8e8;
}

.kb-tree-meta {
  font-size: 11px;
  color: #949494;
}

.kb-tree-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #999;
}

.kb-tree-tools button {
  border: 1px solid #3d3d3d;
  background: #262626;
  color: #e5e5e5;
  border-radius: 6px;
  padding: 2px 6px;
}

.kb-row {
  min-height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin: 3px 0;
}

.kb-row:hover {
  background: #2a2a2a;
}

.kb-row.active {
  background: #2f3e56;
}

.kb-row-main {
  min-width: 0;
}

.kb-row-title {
  font-size: 13px;
  color: #ededed;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kb-row-meta {
  font-size: 10px;
  color: #8f8f8f;
}

.kb-row-actions {
  display: flex;
  gap: 2px;
  padding-right: 6px;
}

.kb-row-actions button {
  border: none;
  background: transparent;
  color: #adadad;
  font-size: 11px;
  padding: 3px 6px;
}

.kb-empty-row {
  color: #909090;
  font-size: 12px;
  padding: 6px 8px;
}

.kb-user {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #4a4a4a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #d8d8d8;
  background: #111;
}

.kb-main {
  background: #222;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.kb-main-top {
  height: 50px;
  border-bottom: 1px solid #343434;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
}

.kb-icon-btn {
  border: none;
  background: transparent;
  color: #ddd;
  font-size: 18px;
  padding: 4px 8px;
  cursor: pointer;
}

.kb-main-actions {
  display: flex;
  gap: 6px;
}

.kb-main-actions .kb-btn {
  background: #2a2a2a;
}

.kb-welcome {
  margin: auto;
  text-align: center;
  color: #ddd;
  max-width: 520px;
  padding: 20px;
}

.kb-welcome-icon {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: #121212;
  border: 1px solid #363636;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: #f0e1c7;
}

.kb-welcome h2 {
  margin: 0 0 8px;
  color: #efe6d1;
  font-size: 44px;
}

.kb-welcome p {
  margin: 0;
  color: #d5d5d5;
  line-height: 1.7;
  font-size: 26px;
}

.kb-editor {
  flex: 1;
  padding: 12px 26px 18px;
  display: flex;
  flex-direction: column;
}

.kb-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.kb-breadcrumb {
  font-size: 12px;
  color: #9f9f9f;
}

.kb-editor-actions {
  display: flex;
  gap: 6px;
}

.kb-title-input {
  margin-top: 10px;
  background: transparent;
  border: none;
  border-bottom: 1px solid #363636;
  color: #fafafa;
  font-size: 36px;
  font-weight: 700;
  padding: 8px 0;
  outline: none;
}

.kb-content-input {
  margin-top: 10px;
  background: transparent;
  border: none;
  color: #ececec;
  font-size: 23px;
  line-height: 1.75;
  min-height: calc(100vh - 250px);
  outline: none;
  resize: vertical;
}

.kb-status {
  margin-top: 6px;
  font-size: 12px;
  color: #9b9b9b;
}

.kb-status[data-type='ok'] {
  color: #91d7a1;
}

.kb-status[data-type='warn'] {
  color: #f2a183;
}

.kb-settings {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100vh;
  background: #181818;
  border-left: 1px solid #343434;
  transform: translateX(100%);
  transition: transform 0.2s ease;
  z-index: 60;
  padding: 12px;
  overflow: auto;
}

body.settings-open .kb-settings {
  transform: translateX(0);
}

.kb-settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.kb-settings h3 {
  margin: 0;
  font-size: 14px;
  color: #ececec;
}

.kb-settings .field {
  margin-top: 8px;
}

.kb-settings label {
  display: block;
  font-size: 11px;
  color: #9a9a9a;
  margin-bottom: 4px;
}

.kb-settings input,
.kb-settings select {
  width: 100%;
  height: 32px;
  border-radius: 6px;
  border: 1px solid #3a3a3a;
  background: #202020;
  color: #f2f2f2;
  padding: 6px 8px;
  font-size: 13px;
}

.kb-settings hr {
  border: none;
  border-top: 1px solid #343434;
  margin: 12px 0;
}

.kb-settings .actions {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.kb-side-summary {
  margin-top: 10px;
  font-size: 11px;
  color: #999;
}

@media (max-width: 900px) {
  .kb-shell {
    grid-template-columns: 1fr;
  }

  .kb-sidebar {
    min-height: 260px;
    border-right: none;
    border-bottom: 1px solid #343434;
  }

  .kb-main {
    min-height: auto;
  }

  .kb-welcome h2 {
    font-size: 34px;
  }

  .kb-title-input {
    font-size: 28px;
  }
}
