:root {
  color: #1b1e24;
  background: #f6f5f0;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

main { max-width: 1120px; padding: 42px 24px 96px; margin: 0 auto; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 34px; line-height: 1.2; margin-bottom: 12px; }
h2 { font-size: 21px; line-height: 1.3; }
.eyebrow, .muted, time { color: #6b7076; font-size: 14px; }
.hero { min-height: 260px; display: flex; align-items: end; padding: 30px; color: #fff; background: linear-gradient(90deg, rgba(15,22,20,.78), rgba(15,22,20,.12)), url('/assets/desk-notes.png') center/cover; border-radius: 6px; }
.hero h1 { max-width: 440px; margin: 5px 0; }
.hero p { margin: 0; }
.archive-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); align-items: start; gap: 42px; margin-top: 28px; }
.library-sidebar { position: sticky; top: 16px; align-self: start; height: calc(100vh - 32px); border-right: 1px solid #d8d7d1; padding: 4px 22px 0 0; }
.sidebar-title { color: #6b7076; font-size: 13px; font-weight: 700; margin: 0 0 9px; }
.folder-menu { height: calc(100% - 30px); overflow-y: auto; padding-right: 5px; }
.tree-node { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: center; padding-left: calc(var(--level) * 13px); }
.tree-children { grid-column: 1 / -1; }
.tree-node.collapsed > .tree-children { display: none; }
.folder-toggle, .folder-spacer { width: 18px; height: 28px; border: 0; border-radius: 0; padding: 0; background: transparent; color: #737771; font-size: 18px; line-height: 1; }
.folder-toggle:hover { color: #1b1e24; }
.folder-item { width: 100%; overflow: hidden; border: 0; border-left: 2px solid transparent; border-radius: 0; padding: 7px 8px; background: transparent; color: #565a60; font-size: 14px; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.root-folder { margin-bottom: 3px; }
.folder-item:hover { background: #ecebe6; color: #1b1e24; }
.folder-item.active { border-left-color: #24513b; background: #e7eee7; color: #1b1e24; font-weight: 650; }
.archive-content { min-width: 0; }
.search-row { display: flex; align-items: center; gap: 12px; }
.search-trigger {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; border: 1px solid #c8c8c2; border-radius: 10px;
  background: #fff; color: #565a60; box-shadow: 0 1px 0 rgba(27, 30, 36, .04);
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.search-trigger:hover { border-color: #24513b; color: #24513b; background: #f3f7f3; }
.search-trigger svg { width: 18px; height: 18px; }
.search-overlay {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: start center;
  padding: min(12vh, 96px) 16px 24px; background: rgba(12, 14, 16, .48);
  backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity .16s ease;
}
.search-overlay.open { opacity: 1; pointer-events: auto; }
.search-palette {
  width: min(820px, 100%); max-height: min(72vh, 640px); display: flex; flex-direction: column;
  border: 1px solid #2c2c2c; border-radius: 18px; background: #141414; color: #f2f2f2;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .45); overflow: hidden;
  transform: translateY(10px) scale(.985); transition: transform .16s ease;
}
.search-overlay.open .search-palette { transform: none; }
.search-palette-head {
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
  padding: 16px 18px; border-bottom: 1px solid #262626;
}
.search-palette-head svg { flex: none; width: 18px; height: 18px; color: #8a8a8a; }
.search-palette-head input {
  flex: 1; min-width: 0; border: 0; outline: 0; padding: 0; border-radius: 0;
  background: transparent; color: #f5f5f5; font-size: 17px; box-shadow: none;
}
.search-palette-head input::placeholder { color: #6f6f6f; }
.search-palette-body {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 12px; min-height: 0; flex: 1; padding: 10px; overflow: hidden;
}
.search-results { list-style: none; margin: 0; padding: 4px 2px; overflow-y: auto; min-height: 0; }
.search-group { margin: 0; padding: 10px 10px 6px; color: #777; font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.search-hit {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; border-radius: 10px; padding: 10px 12px; background: transparent;
  color: #ececec; text-align: left; cursor: pointer;
}
.search-hit:hover, .search-hit.active { background: #2a2a2a; }
.search-hit-icon {
  display: grid; place-items: center; flex: none; width: 28px; height: 28px;
  overflow: hidden; border-radius: 8px; background: #242424; color: #b8b8b8; font-size: 13px; font-weight: 700;
}
.search-hit-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.search-hit-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.search-hit-meta { flex: none; color: #7a7a7a; font-size: 13px; white-space: nowrap; }
.search-preview {
  min-height: 0; overflow: auto; border-radius: 14px; padding: 18px 18px 20px; background: #1c1c1c;
}
.search-preview-empty { display: grid; place-items: center; height: 100%; min-height: 180px; color: #777; font-size: 14px; }
.search-preview-tag {
  display: inline-block; margin-bottom: 10px; border: 1px solid #3a3a3a; border-radius: 999px;
  padding: 4px 9px; color: #a0a0a0; font-size: 12px;
}
.search-preview h2 { margin: 0 0 10px; color: #fff; font-size: 22px; line-height: 1.25; }
.search-preview-date { margin: 0 0 14px; color: #7d7d7d; font-size: 13px; }
.search-preview-body { margin: 0; color: #bdbdbd; font-size: 14px; line-height: 1.65; white-space: pre-wrap; }
.search-palette-foot {
  display: flex; align-items: center; gap: 16px; flex-shrink: 0; flex-wrap: wrap;
  padding: 10px 16px; border-top: 1px solid #262626; color: #777; font-size: 12px;
}
.search-palette-foot kbd {
  display: inline-block; margin-right: 4px; border: 1px solid #3a3a3a; border-radius: 5px;
  padding: 1px 5px; background: #222; color: #b5b5b5; font: 11px ui-monospace, SFMono-Regular, Menlo, monospace;
}
.search-empty { padding: 28px 12px; color: #777; font-size: 14px; text-align: center; }
.source-filter { display: flex; flex-wrap: wrap; gap: 7px; margin: 16px 0 0; }
.source-chip { border: 1px solid #c8c8c2; border-radius: 999px; padding: 6px 12px; background: transparent; color: #565a60; font-size: 13px; }
.source-chip:hover { border-color: #8e918d; color: #1b1e24; }
.source-chip.active { border-color: #24513b; background: #24513b; color: #fff; }
.article-list { list-style: none; margin: 18px 0; padding: 0; border-top: 1px solid #d8d7d1; }
.article-list li { border-bottom: 1px solid #d8d7d1; padding: 25px 0; }
.article-list a { text-decoration: none; display: block; }
.article-row { display: grid; grid-template-columns: minmax(0, 1fr) 92px; align-items: center; gap: 22px; }
.article-row:has(.article-copy:only-child) { grid-template-columns: minmax(0, 1fr); }
.article-copy { min-width: 0; }
.article-thumbnail { width: 92px; height: 72px; object-fit: cover; border: 1px solid #d8d7d1; border-radius: 4px; }
.article-list h2 { margin-bottom: 5px; }
.article-list p { margin: 0; color: #565a60; }
.empty-state { padding: 32px 0 !important; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; padding-top: 18px; }
.pagination button { min-width: 76px; }
.article-list time { display: block; margin-top: 12px; }
.meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.meta time { margin: 0; }
.source-badge, .folder-badge { font-size: 12px; line-height: 1; padding: 5px 7px; border-radius: 3px; font-family: ui-sans-serif, sans-serif; }
.source-badge { background: #dbe8dc; color: #24513b; }
.source-badge.notion { background: #e8dfd4; color: #6d4524; }
.source-badge.blog { background: #dce5ec; color: #24475e; }
.folder-badge { border: 1px solid #c6c5be; color: #565a60; }
.article { max-width: 720px; }
.back-button { margin-bottom: 22px; }
.article header { border-bottom: 1px solid #d8d7d1; margin-bottom: 28px; padding-bottom: 24px; }
.markdown { font-family: ui-serif, Georgia, serif; font-size: 18px; }
.markdown h1, .markdown h2, .markdown h3 { font-family: ui-sans-serif, sans-serif; margin: 32px 0 12px; }
.markdown p, .markdown ul, .markdown ol { margin: 0 0 18px; }
.markdown img { display: block; width: auto; max-width: 100%; height: auto; margin: 22px 0; border: 1px solid #d8d7d1; }
.markdown a { color: #24513b; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.markdown code, .copy-code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.code-block { position: relative; margin: 22px 0; border: 1px solid #d5d7d3; background: #202522; }
.markdown .code-block pre { overflow-x: auto; margin: 0; padding: 18px 64px 18px 18px; color: #e5ebe4; background: transparent; }
.markdown .code-block code { font-size: 14px; line-height: 1.65; }
.copy-code { position: absolute; top: 9px; right: 9px; border: 1px solid #5c675f; border-radius: 3px; padding: 4px 8px; background: #2e3731; color: #dbe4dc; font-size: 12px; }
.copy-code:hover { border-color: #a2b3a3; background: #39463d; }
.markdown :not(pre) > code { border: 1px solid #d5d7d3; background: #e9ece7; padding: 1px 4px; color: #27372c; }
.markdown blockquote { border-left: 3px solid #9a9da0; color: #565a60; margin: 0 0 18px; padding-left: 16px; }

.panel { max-width: 600px; border: 1px solid #d8d7d1; padding: 24px; background: #fbfaf7; }
.field { display: grid; gap: 7px; margin-bottom: 17px; font-size: 14px; font-weight: 650; }
input, textarea { width: 100%; border: 1px solid #babbb5; border-radius: 3px; padding: 10px; color: #1b1e24; background: #fff; }
textarea { min-height: 360px; resize: vertical; line-height: 1.55; }
.toolbar, .admin-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin: 20px 0; }
.spacer { flex: 1; }
button { border: 1px solid #1b1e24; border-radius: 3px; padding: 8px 12px; background: #1b1e24; color: #fff; }
button.secondary { background: transparent; color: #1b1e24; border-color: #8c8e89; }
button.danger { color: #962f27; border-color: #962f27; background: transparent; }
button:disabled { opacity: .5; cursor: not-allowed; }
.admin-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 30px; }
.admin-list { border-right: 1px solid #d8d7d1; padding-right: 20px; }
.admin-list button { width: 100%; text-align: left; color: #1b1e24; background: transparent; border-color: transparent; padding: 8px 6px; }
.admin-list button.active { background: #e7e6df; }
.status { font-size: 12px; color: #6b7076; }
.notice { color: #9b3026; margin-top: 12px; }
.preview { border-top: 1px solid #d8d7d1; margin-top: 24px; padding-top: 22px; }
@media (max-width: 680px) {
  main { padding-top: 36px; }
  .admin-layout { display: block; }
  .admin-list { border-right: 0; border-bottom: 1px solid #d8d7d1; padding: 0 0 16px; margin-bottom: 22px; }
  h1 { font-size: 29px; }
  .hero { min-height: 230px; padding: 22px; }
  .archive-layout { display: block; margin-top: 22px; }
  .library-sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid #d8d7d1; padding: 0 0 15px; margin-bottom: 18px; }
  .folder-menu { display: flex; max-height: none; overflow-x: auto; padding: 0 0 2px; }
  .tree-node { display: contents; }
  .tree-children { display: contents !important; }
  .folder-toggle, .folder-spacer { display: none; }
  .folder-item { width: auto; flex: 0 0 auto; border-left: 0; border-bottom: 2px solid transparent; }
  .folder-item.active { border-left-color: transparent; border-bottom-color: #24513b; }
  .article-row { grid-template-columns: minmax(0, 1fr) 76px; gap: 14px; }
  .article-thumbnail { width: 76px; height: 60px; }
  .search-overlay { padding: 10vh 10px 16px; align-items: start; }
  .search-palette { max-height: 80vh; border-radius: 14px; }
  .search-palette-body { grid-template-columns: 1fr; }
  .search-preview { display: none; }
  .search-palette-foot { gap: 10px; }
}
