:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-hover: #243044;
  --border: #2d3a4f;
  --text: #e7edf4;
  --text-muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* Auth page */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(59, 130, 246, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: var(--shadow);
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-header .logo {
  font-size: 48px;
  margin-bottom: 12px;
}

.auth-header h1 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
}

.auth-header p {
  color: var(--text-muted);
  font-size: 14px;
}

.auth-form label {
  display: block;
  margin-bottom: 16px;
}

.auth-form label span {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.auth-form input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

.auth-form input:focus {
  border-color: var(--accent);
}

.auth-form button[type="submit"] {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.auth-form button[type="submit"]:hover:not(:disabled) {
  background: var(--accent-hover);
}

.auth-form button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 8px;
}

/* Dashboard */
.topbar {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.brand .logo {
  font-size: 32px;
}

.brand h1 {
  font-size: 18px;
  font-weight: 600;
}

.brand p {
  font-size: 13px;
  color: var(--text-muted);
}

.user-area {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-muted);
}

.btn-ghost {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-ghost:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.service-grid {
  display: grid;
  gap: 16px;
}

.service-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

.service-card:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.service-icon {
  font-size: 32px;
  flex-shrink: 0;
  width: 48px;
  text-align: center;
}

.service-body {
  flex: 1;
  min-width: 0;
}

.service-body h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.service-body p {
  font-size: 13px;
  color: var(--text-muted);
}

.service-arrow {
  color: var(--text-muted);
  font-size: 18px;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.service-card:hover .service-arrow {
  color: var(--accent);
  transform: translateX(4px);
}
.empty-msg {
  text-align: center;
  color: #6b6b6b;
  padding: 48px 0;
}

/* ========== VS Code style guide page ========== */
.guide-page {
  --bg-editor: #1e1e1e;
  --bg-sidebar: #252526;
  --bg-title: #3c3c3c;
  --bg-tab: #2d2d2d;
  --bg-active-tab: #1e1e1e;
  --bg-hover: #2a2d2e;
  --bg-select: #37373d;
  --fg: #cccccc;
  --fg-dim: #bbbbbb;
  --border: #474747;
  --accent-line: #0078d4;
  --md-blue: #519aba;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-editor);
  color: var(--fg);
}

.vscode-titlebar {
  height: 30px;
  background: var(--bg-title);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 12px;
  color: var(--fg-dim);
  border-bottom: 1px solid #2b2b2b;
  user-select: none;
}

.titlebar-left {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.titlebar-app { color: #fff; font-weight: 600; }
.titlebar-file {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 50vw;
}

.titlebar-right {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}

.titlebar-link {
  background: none;
  border: none;
  color: var(--fg-dim);
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  padding: 0;
}

.titlebar-link:hover { color: #fff; }
.titlebar-user { color: #9d9d9d; }

.guide-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  height: calc(100vh - 30px);
  overflow: hidden;
}

.guide-sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid #2b2b2b;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.explorer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px 4px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--fg);
}

.explorer-header-actions { display: flex; gap: 1px; }

.explorer-icon-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--fg);
  border-radius: 3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  padding: 0;
}

.explorer-icon-btn:hover {
  background: var(--bg-hover);
  opacity: 1;
}

.explorer-root-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--fg);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 8px 4px 4px;
  cursor: pointer;
  text-align: left;
}

.explorer-root-toggle:hover { background: var(--bg-hover); }

.guide-tree {
  flex: 1;
  overflow: auto;
  padding-bottom: 12px;
  font-size: 13px;
  user-select: none;
}

.tree-row {
  display: flex;
  align-items: center;
  height: 22px;
  padding-left: calc(4px + var(--depth, 0) * 8px);
  padding-right: 4px;
}

.tree-row:hover { background: var(--bg-hover); }
.tree-row.file.active { background: var(--bg-select); color: #fff; }

.tree-toggle, .tree-spacer {
  width: 16px;
  height: 22px;
  border: none;
  background: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.chevron {
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid #c5c5c5;
  display: inline-block;
}

.chevron.open { transform: rotate(90deg); }

.tree-label {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 13px;
  height: 22px;
  padding: 0 2px;
  cursor: pointer;
  text-align: left;
}

.tree-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.codicon { width: 16px; height: 16px; display: block; }

.md-file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  font-size: 9px;
  font-weight: 800;
  color: #fff;
  background: var(--md-blue);
  border-radius: 2px;
  line-height: 1;
}

.tree-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-plus {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: #89d185;
  cursor: pointer;
  opacity: 0;
  flex-shrink: 0;
}

.tree-row:hover .tree-plus { opacity: 1; background: rgba(255,255,255,0.06); }
.tree-children.collapsed { display: none; }

.tree-empty {
  height: 22px;
  line-height: 22px;
  color: #6a6a6a;
  font-size: 12px;
  padding-left: calc(24px + var(--depth, 0) * 8px);
}

.guide-plus-menu {
  position: fixed;
  z-index: 60;
  min-width: 140px;
  background: #252526;
  border: 1px solid #454545;
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
  padding: 4px;
  display: flex;
  flex-direction: column;
}

.guide-plus-menu[hidden] { display: none; }

.guide-plus-menu button {
  border: none;
  background: transparent;
  color: #ccc;
  text-align: left;
  padding: 5px 10px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 3px;
}

.guide-plus-menu button:hover { background: #094771; color: #fff; }

.guide-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  background: var(--bg-editor);
  overflow: hidden;
}

.guide-tabbar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  min-height: 35px;
  background: var(--bg-tab);
  border-bottom: 1px solid #252526;
}

.guide-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 35px;
  padding: 0 14px;
  background: var(--bg-active-tab);
  border-right: 1px solid #252526;
  border-top: 1px solid var(--accent-line);
  color: #fff;
  font-size: 13px;
}

.md-badge {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  background: var(--md-blue);
  color: #fff;
  border-radius: 2px;
}

.tab-ro {
  font-size: 10px;
  color: #cca700;
  border: 1px solid rgba(204,167,0,.4);
  border-radius: 8px;
  padding: 0 5px;
}

.guide-tabbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 10px;
}

.mode-btn {
  border: 1px solid #3c3c3c;
  background: transparent;
  color: #9d9d9d;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
}

.mode-btn.active {
  color: #fff;
  border-color: #0078d4;
  background: rgba(0,120,212,.2);
}

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

.btn-tiny {
  padding: 3px 10px;
  font-size: 12px;
}

.btn-primary {
  background: #0e639c;
  border: 1px solid #0e639c;
  color: #fff;
  border-radius: 3px;
  cursor: pointer;
  padding: 4px 12px;
  font-size: 12px;
}

.btn-primary:hover:not(:disabled) { background: #1177bb; }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  border: 1px solid #3c3c3c;
  color: #ccc;
  border-radius: 3px;
  cursor: pointer;
  padding: 4px 12px;
  font-size: 12px;
}

.btn-ghost:hover { border-color: #6b6b6b; color: #fff; }

.vscode-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 4px 12px;
  font-size: 12px;
  color: #a0a0a0;
  background: var(--bg-editor);
  border-bottom: 1px solid #2b2b2b;
  min-height: 24px;
}

.crumb { padding: 0 2px; }
.crumb.current { color: #e0e0e0; }
.crumb-sep { color: #6b6b6b; margin: 0 2px; }

.guide-viewer {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.source-view {
  display: flex;
  height: 100%;
  overflow: auto;
  font-family: 'Cascadia Code', 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 19px;
  background: var(--bg-editor);
}

.source-gutter {
  flex-shrink: 0;
  min-width: 48px;
  padding: 8px 8px 8px 0;
  text-align: right;
  color: #858585;
  user-select: none;
  background: var(--bg-editor);
  border-right: 1px solid transparent;
}

.source-gutter span {
  display: block;
  height: 19px;
  padding-right: 12px;
}

.source-code {
  margin: 0;
  padding: 8px 16px;
  flex: 1;
  color: #d4d4d4;
  white-space: pre;
  overflow: visible;
  background: transparent;
}

.source-code code {
  font-family: inherit;
  font-size: inherit;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}

.preview-view {
  height: 100%;
  overflow: auto;
  padding: 20px 28px 40px;
}

.guide-doc-body {
  max-width: 920px;
  margin: 0 auto;
}

.empty-view {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b6b6b;
  font-size: 14px;
}

.empty-view[hidden],
.source-view[hidden],
.preview-view[hidden],
.guide-editor-wrap[hidden] {
  display: none !important;
}

.guide-editor-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100%;
  gap: 0;
}

.edit-pane {
  display: flex;
  height: 100%;
  overflow: auto;
  border-right: 1px solid #2b2b2b;
}

.guide-editor {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  background: var(--bg-editor);
  color: #d4d4d4;
  font-family: 'Cascadia Code', 'JetBrains Mono', Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 19px;
  padding: 8px 16px;
  min-height: 100%;
}

.guide-preview {
  overflow: auto;
  padding: 12px 16px;
  background: #1e1e1e;
}

.guide-preview-label {
  font-size: 11px;
  color: #6b6b6b;
  margin-bottom: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.markdown-preview { min-height: 200px; }

.guide-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
}

.guide-modal[hidden] { display: none; }

.guide-modal-card {
  width: 100%;
  max-width: 400px;
  background: #252526;
  border: 1px solid #3c3c3c;
  border-radius: 6px;
  padding: 20px;
  color: #e0e0e0;
}

.guide-modal-card h3 { margin-bottom: 14px; font-size: 16px; }

.guide-modal-form label { display: block; margin-bottom: 12px; }
.guide-modal-form label span {
  display: block;
  font-size: 12px;
  color: #9d9d9d;
  margin-bottom: 4px;
}

.guide-modal-form input,
.guide-modal-form select {
  width: 100%;
  padding: 8px 10px;
  background: #1e1e1e;
  border: 1px solid #3c3c3c;
  border-radius: 3px;
  color: #e0e0e0;
  font-size: 13px;
  outline: none;
}

.guide-modal-form input:focus,
.guide-modal-form select:focus { border-color: #0078d4; }

.guide-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.guide-muted {
  color: #6b6b6b;
  font-size: 12px;
  padding: 8px 16px;
}

.guide-lock {
  margin-left: 4px;
  font-size: 10px;
  color: #cca700;
  border: 1px solid rgba(204,167,0,.35);
  border-radius: 8px;
  padding: 0 5px;
}

.markdown-body {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  line-height: 1.7;
  color: #d4d4d4;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  color: #e8e8e8;
  font-weight: 600;
  margin: 1.4em 0 .5em;
  line-height: 1.3;
}

.markdown-body h1 {
  font-size: 1.7rem;
  border-bottom: 1px solid #3c3c3c;
  padding-bottom: .35em;
}

.markdown-body h2 {
  font-size: 1.3rem;
  border-bottom: 1px solid #3c3c3c;
  padding-bottom: .3em;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body pre,
.markdown-body blockquote { margin: 0 0 1em; }

.markdown-body ul,
.markdown-body ol { padding-left: 1.4em; }

.markdown-body a { color: #3794ff; text-decoration: none; }
.markdown-body a:hover { text-decoration: underline; }

.markdown-body code {
  font-family: Menlo, Consolas, monospace;
  font-size: .9em;
  background: #2d2d2d;
  border-radius: 3px;
  padding: .1em .35em;
}

.markdown-body pre {
  background: #2d2d2d;
  border-radius: 4px;
  padding: 12px 14px;
  overflow-x: auto;
}

.markdown-body pre code {
  background: none;
  padding: 0;
  color: #d4d4d4;
}

.markdown-body blockquote {
  border-left: 3px solid #0078d4;
  padding-left: 12px;
  color: #9d9d9d;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid #3c3c3c;
  margin: 1.4em 0;
}

@media (max-width: 900px) {
  .guide-layout {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .guide-editor-wrap {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .service-card { padding: 16px; }
}
