:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --panel: #ffffff;
  --panel-soft: #f3f4f4;
  --panel-hover: #eef1f3;
  --ink: #202124;
  --ink-strong: #111214;
  --muted: #65696f;
  --faint: #92979e;
  --line: #e2e3e5;
  --line-strong: #cfd2d6;
  --sidebar: #212326;
  --sidebar-hover: #2d3034;
  --sidebar-active: #373b40;
  --accent: #2864dc;
  --accent-hover: #1f53bd;
  --accent-soft: #eaf1ff;
  --green: #208567;
  --green-soft: #e5f4ee;
  --amber: #a46515;
  --amber-soft: #fbefd9;
  --violet: #7456b8;
  --violet-soft: #eee9fb;
  --pink: #a8496b;
  --pink-soft: #f8e8ef;
  --red: #bd3f42;
  --red-soft: #fcebec;
  --cyan: #287890;
  --cyan-soft: #e4f1f4;
  --shadow-lg: 0 20px 60px rgba(25, 29, 35, 0.16);
  --sidebar-width: 224px;
  --topbar-height: 58px;
  --mobile-nav-height: 64px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; overflow: hidden; color: var(--ink); background: var(--bg); font: 14px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif; }
button, input, select, textarea { color: inherit; font: inherit; }
button, a, label, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
svg { display: block; width: 18px; height: 18px; stroke-width: 1.8; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid rgba(40, 100, 220, 0.35); outline-offset: 2px; }
::selection { color: var(--ink-strong); background: #ccdcff; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 14px; border: 1px solid transparent; border-radius: 6px; font-size: 13px; font-weight: 650; white-space: nowrap; transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease; }
.button svg { width: 16px; height: 16px; }
.button-primary { color: #fff; background: var(--accent); box-shadow: 0 1px 2px rgba(22, 41, 77, 0.12); }
.button-primary:hover { background: var(--accent-hover); }
.button-secondary { border-color: var(--line-strong); color: var(--ink); background: var(--panel); }
.button-secondary:hover { border-color: #b9bdc2; background: var(--panel-soft); }
.button-ghost { color: var(--muted); background: transparent; }
.button-ghost:hover { color: var(--ink); background: var(--panel-soft); }
.button-wide { width: 100%; }
.button-small { min-height: 32px; padding: 0 10px; font-size: 12px; }
.icon-button { display: inline-grid; flex: 0 0 auto; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 6px; place-items: center; color: var(--muted); background: transparent; }
.icon-button:hover { color: var(--ink); background: var(--panel-hover); }
.danger-hover:hover { color: var(--red); background: var(--red-soft); }
kbd { border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; color: var(--faint); background: var(--panel); font: 10px/1.5 inherit; }

/* Login */
.login-view { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(380px, 0.65fr); min-height: 100vh; background: #131417; }
.login-visual { position: relative; min-width: 0; overflow: hidden; color: #fff; background: #140b18; }
.login-visual::after { position: absolute; inset: 0; content: ""; background: rgba(9, 10, 14, 0.22); }
.login-visual > img { width: 100%; height: 100%; object-fit: cover; object-position: center; opacity: 0.78; }
.login-brand { position: absolute; z-index: 1; top: 38px; left: 42px; display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; flex: 0 0 auto; width: 34px; height: 34px; border: 1px solid currentColor; border-radius: 7px; place-items: center; color: inherit; font-size: 15px; font-weight: 800; }
.login-brand strong, .login-brand small { display: block; }
.login-brand strong { font-size: 14px; }
.login-brand small { margin-top: 2px; color: rgba(255, 255, 255, 0.62); font-size: 9px; }
.login-statement { position: absolute; z-index: 1; right: 48px; bottom: 58px; left: 48px; max-width: 680px; }
.login-statement p { margin: 0 0 14px; color: rgba(255, 255, 255, 0.66); font-size: 11px; font-weight: 700; }
.login-statement h1 { margin: 0; color: #fff; font-size: 38px; line-height: 1.28; font-weight: 720; }
.login-panel { display: grid; place-items: center; min-width: 0; padding: 42px; background: var(--panel); }
.login-form { width: min(100%, 390px); }
.login-kicker, .section-kicker { color: var(--accent); font-size: 10px; font-weight: 750; }
.login-form h2 { margin: 10px 0 6px; color: var(--ink-strong); font-size: 30px; line-height: 1.25; }
.login-form > p { margin: 0 0 30px; color: var(--muted); }
.login-form > label { display: block; margin-bottom: 8px; color: var(--ink); font-size: 12px; font-weight: 650; }
.field-with-icon { position: relative; }
.field-with-icon svg { position: absolute; top: 14px; left: 13px; width: 17px; height: 17px; color: var(--faint); pointer-events: none; }
.field-with-icon input { width: 100%; height: 46px; padding: 0 14px 0 40px; border: 1px solid var(--line-strong); border-radius: 6px; outline: 0; background: var(--panel); }
.field-with-icon input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(40, 100, 220, 0.1); }
.login-form .button-wide { height: 44px; margin-top: 14px; }
.form-message { min-height: 20px; margin: 9px 0 0 !important; color: var(--green) !important; font-size: 12px; }
.form-message.error { color: var(--red) !important; }
.back-link { display: inline-flex; align-items: center; gap: 7px; margin-top: 26px; color: var(--muted); font-size: 12px; text-decoration: none; }
.back-link:hover { color: var(--accent); }
.back-link svg { width: 14px; height: 14px; }

/* Shell and navigation */
.app-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); height: 100vh; background: var(--bg); }
.sidebar { position: relative; z-index: 40; display: flex; flex-direction: column; min-width: 0; height: 100vh; padding: 18px 12px 14px; color: #d6d9de; background: var(--sidebar); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; height: 42px; margin: 0 5px 17px; }
.app-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.app-brand .brand-mark { width: 32px; height: 32px; border-color: #66717f; color: #eef2f7; }
.app-brand strong, .app-brand small { display: block; }
.app-brand strong { color: #fff; font-size: 14px; font-weight: 700; }
.app-brand small { color: #8e949d; font-size: 10px; }
.sidebar-close { display: none; color: #aeb3bb; }
.sidebar-close:hover { color: #fff; background: var(--sidebar-hover); }
.capture-button { display: flex; align-items: center; width: 100%; height: 40px; padding: 0 11px; border: 1px solid #4b5058; border-radius: 6px; color: #fff; background: #2c2f33; font-size: 12px; font-weight: 650; text-align: left; }
.capture-button:hover { border-color: #646b75; background: #34383d; }
.capture-button svg { width: 16px; height: 16px; margin-right: 9px; }
.capture-button kbd { margin-left: auto; padding: 1px 6px; border-color: #50555c; color: #90959d; background: #242629; }
.app-nav { display: grid; gap: 2px; margin-top: 17px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 10px; border: 0; border-radius: 5px; color: #b7bbc2; background: transparent; font-size: 12px; text-align: left; text-decoration: none; }
.nav-item > svg { width: 16px; height: 16px; color: #9298a1; }
.nav-item:hover { color: #f4f5f7; background: var(--sidebar-hover); }
.nav-item.active { color: #fff; background: var(--sidebar-active); box-shadow: inset 2px 0 var(--accent); }
.nav-item.active > svg { color: #8eb4ff; }
.nav-item b { min-width: 18px; margin-left: auto; color: #9ebcf7; font-size: 10px; font-weight: 650; text-align: right; }
.nav-section { margin-top: 22px; }
.nav-label { padding: 0 10px 7px; color: #717780; font-size: 9px; font-weight: 750; }
.nav-item-small { min-height: 31px; font-size: 11px; }
.nav-dot { width: 7px; height: 7px; border-radius: 50%; background: #9aa0a8; }
.nav-dot.prompt { background: #9a7fe1; }
.nav-dot.skill { background: #db7398; }
.nav-dot.command { background: #df9b4d; }
.nav-dot.link { background: #58a2bb; }
.ecosystem-section { margin-top: 20px; }
.external-link > svg:last-child { width: 12px; height: 12px; margin-left: auto; opacity: 0; }
.external-link:hover > svg:last-child { opacity: 1; }
.sidebar-foot { display: grid; gap: 10px; margin-top: auto; padding-top: 12px; border-top: 1px solid #36393e; }
.user-chip { display: grid; grid-template-columns: 30px minmax(0, 1fr) 30px; align-items: center; gap: 9px; min-width: 0; padding: 7px 5px; }
.avatar { display: grid; width: 30px; height: 30px; border-radius: 50%; place-items: center; color: #daf3eb; background: #315348; font-size: 10px; font-weight: 750; }
.user-chip strong, .user-chip small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip strong { color: #e5e7ea; font-size: 11px; }
.user-chip small { color: #858b94; font-size: 9px; }
.user-chip small i { display: inline-block; width: 5px; height: 5px; margin-right: 5px; border-radius: 50%; background: #54b88e; }
.user-chip .icon-button { width: 30px; height: 30px; color: #858b94; }
.user-chip .icon-button:hover { color: #fff; background: var(--sidebar-hover); }
.user-chip .icon-button svg { width: 15px; height: 15px; }
.sidebar-scrim { display: none; }

/* Main workspace */
.main-panel { min-width: 0; height: 100vh; overflow: hidden; }
.topbar { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(280px, 500px) minmax(180px, 1fr); align-items: center; gap: 18px; height: var(--topbar-height); padding: 0 18px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.94); }
.topbar-left { display: flex; align-items: center; min-width: 0; }
.menu-button { display: none; margin-right: 7px; }
.breadcrumb { display: flex; align-items: center; min-width: 0; gap: 7px; color: var(--faint); font-size: 11px; white-space: nowrap; }
.breadcrumb svg { width: 12px; height: 12px; }
.breadcrumb strong { overflow: hidden; color: var(--ink); font-weight: 650; text-overflow: ellipsis; }
.search-trigger { display: flex; align-items: center; min-width: 0; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--faint); background: var(--panel-soft); font-size: 11px; text-align: left; }
.search-trigger:hover { border-color: var(--line-strong); background: #fff; }
.search-trigger svg { flex: 0 0 auto; width: 15px; height: 15px; margin-right: 8px; }
.search-trigger span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-trigger kbd { margin-left: auto; padding: 1px 6px; }
.topbar-actions { display: flex; justify-content: flex-end; gap: 7px; }
.top-capture { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 11px; border: 1px solid var(--accent); border-radius: 6px; color: #fff; background: var(--accent); font-size: 11px; font-weight: 650; }
.top-capture:hover { background: var(--accent-hover); }
.top-capture svg { width: 15px; height: 15px; }
.workspace { display: grid; grid-template-columns: minmax(320px, 390px) minmax(0, 1fr); height: calc(100vh - var(--topbar-height)); }
.collection-panel { min-width: 0; overflow-y: auto; border-right: 1px solid var(--line); background: var(--bg); scrollbar-color: #c8cbd0 transparent; scrollbar-width: thin; }
.collection-head { display: flex; align-items: flex-start; justify-content: space-between; min-height: 124px; padding: 28px 24px 18px; }
.collection-head h1 { margin: 4px 0 2px; color: var(--ink-strong); font-size: 23px; line-height: 1.25; }
.collection-head p:last-child { margin: 0; color: var(--muted); font-size: 11px; }
.collection-action { margin-top: 11px; border: 1px solid var(--line); background: var(--panel); }
.collection-summary { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 16px 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.summary-cell { min-width: 0; padding: 10px 11px; border-right: 1px solid var(--line); }
.summary-cell:last-child { border-right: 0; }
.summary-cell strong, .summary-cell span { display: block; }
.summary-cell strong { color: var(--ink-strong); font-size: 15px; line-height: 1.2; }
.summary-cell span { overflow: hidden; margin-top: 2px; color: var(--faint); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.filter-row { display: flex; gap: 6px; padding: 0 16px 12px; }
.filter-select-wrap { position: relative; flex: 1; }
.filter-select-wrap svg { position: absolute; top: 9px; left: 10px; z-index: 1; width: 14px; height: 14px; color: var(--faint); pointer-events: none; }
.filter-select-wrap select { width: 100%; height: 33px; padding: 0 28px 0 31px; border: 1px solid var(--line); border-radius: 6px; outline: 0; color: var(--muted); background: var(--panel); font-size: 11px; appearance: auto; }
.filter-row > .icon-button { width: 33px; height: 33px; border: 1px solid var(--line); background: var(--panel); }
.filter-row > .icon-button svg { width: 14px; height: 14px; }
.item-list { display: grid; padding: 0 8px 20px; }
.asset-row { position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; min-height: 84px; padding: 12px 10px; border: 1px solid transparent; border-radius: 6px; }
.asset-row:hover { background: var(--panel-hover); }
.asset-row.selected { border-color: #cbd8f2; background: var(--accent-soft); }
.asset-row.just-created { animation: created-pulse 1.8s ease both; }
@keyframes created-pulse { 0%, 100% { background: transparent; } 20%, 65% { background: var(--green-soft); } }
.asset-row + .asset-row::before { position: absolute; top: -1px; right: 10px; left: 50px; height: 1px; content: ""; background: var(--line); }
.asset-row.selected + .asset-row::before, .asset-row:has(+ .asset-row.selected)::before { display: none; }
.asset-leading { padding-top: 2px; }
.asset-icon, .type-icon { display: grid; width: 30px; height: 30px; border-radius: 6px; place-items: center; color: var(--green); background: var(--green-soft); }
.asset-icon svg, .type-icon svg { width: 15px; height: 15px; }
.asset-icon.prompt, .type-icon.prompt { color: var(--violet); background: var(--violet-soft); }
.asset-icon.skill, .type-icon.skill { color: var(--pink); background: var(--pink-soft); }
.asset-icon.command, .type-icon.command { color: var(--amber); background: var(--amber-soft); }
.asset-icon.link, .type-icon.link { color: var(--cyan); background: var(--cyan-soft); }
.asset-icon.task, .type-icon.task { color: var(--accent); background: var(--accent-soft); }
.asset-icon.decision, .type-icon.decision { color: #925a28; background: #f7eadc; }
.asset-icon.workflow, .type-icon.workflow { color: #5267a6; background: #e9edfa; }
.asset-icon.journal, .type-icon.journal { color: #7a6262; background: #f0eaea; }
.type-icon.project { color: var(--amber); background: var(--amber-soft); }
.task-toggle { display: grid; width: 20px; height: 20px; margin: 4px 0 0 5px; padding: 0; border: 1px solid #aeb9c8; border-radius: 50%; place-items: center; color: #fff; background: transparent; }
.task-toggle:hover { border-color: var(--accent); background: var(--accent-soft); }
.task-toggle.done { border-color: var(--green); background: var(--green); }
.task-toggle svg { width: 12px; height: 12px; }
.asset-main { min-width: 0; padding: 0; border: 0; color: inherit; background: transparent; text-align: left; }
.asset-main > strong { display: block; overflow: hidden; color: var(--ink-strong); font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.asset-main > p { display: -webkit-box; overflow: hidden; margin: 3px 0 5px; color: var(--muted); font-size: 10px; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 1; }
.asset-meta { display: flex; align-items: center; min-width: 0; gap: 5px; color: var(--faint); font-size: 9px; }
.asset-kind { color: var(--faint); white-space: nowrap; }
.asset-meta .project-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-meta time { margin-left: auto; white-space: nowrap; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 2px; min-width: 52px; }
.asset-row > .row-actions .icon-button { width: 25px; height: 25px; opacity: 0; }
.asset-row:hover > .row-actions .icon-button, .asset-row > .row-actions .icon-button.selected, .asset-row > .row-actions .row-more:focus-visible { opacity: 1; }
.row-more svg { width: 15px; height: 15px; }
.row-actions time { color: var(--faint); font-size: 9px; white-space: nowrap; }
.row-favorite svg { width: 14px; height: 14px; }
.row-favorite.selected { color: #c18418; }
.row-favorite.selected svg { fill: #f1bd4d; }
.empty-state { display: grid; min-height: 280px; padding: 36px 28px; place-items: center; align-content: center; text-align: center; }
.empty-icon { display: grid; width: 42px; height: 42px; margin-bottom: 14px; border-radius: 8px; place-items: center; color: var(--faint); background: var(--panel-hover); }
.empty-state strong { color: var(--ink); font-size: 13px; }
.empty-state p { max-width: 230px; margin: 4px 0 15px; color: var(--muted); font-size: 10px; }

/* Detail and overview */
.detail-panel { position: relative; min-width: 0; overflow: hidden; background: var(--panel); }
.mobile-back { display: none; }
.detail-home, .editor, .project-editor { height: 100%; }
.detail-home { overflow-y: auto; }
.detail-home-inner { width: min(100%, 920px); min-height: 100%; margin: 0 auto; padding: 50px 56px 70px; }
.home-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.home-heading .home-date { margin: 0 0 7px; color: var(--accent); font-size: 10px; font-weight: 750; }
.home-heading h2 { margin: 0; color: var(--ink-strong); font-size: 27px; line-height: 1.3; }
.home-heading p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.home-quick-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.home-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.home-metric { display: flex; align-items: center; gap: 11px; min-width: 0; padding: 22px 16px; border-right: 1px solid var(--line); }
.home-metric:first-child { padding-left: 0; }
.home-metric:last-child { border-right: 0; }
.home-metric > span { display: grid; width: 30px; height: 30px; border-radius: 6px; place-items: center; color: var(--accent); background: var(--accent-soft); }
.home-metric:nth-child(2) > span { color: var(--amber); background: var(--amber-soft); }
.home-metric:nth-child(3) > span { color: var(--green); background: var(--green-soft); }
.home-metric:nth-child(4) > span { color: var(--violet); background: var(--violet-soft); }
.home-metric svg { width: 15px; height: 15px; }
.home-metric strong, .home-metric small { display: block; }
.home-metric strong { color: var(--ink-strong); font-size: 17px; line-height: 1.2; }
.home-metric small { overflow: hidden; margin-top: 2px; color: var(--faint); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.home-sections { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(230px, 0.7fr); gap: 38px; padding-top: 34px; }
.home-section + .home-section { margin-top: 32px; }
.subsection-head { display: flex; align-items: center; justify-content: space-between; min-height: 32px; margin-bottom: 8px; }
.subsection-head > div { display: flex; align-items: baseline; gap: 8px; }
.subsection-head span { color: var(--ink-strong); font-size: 12px; font-weight: 700; }
.subsection-head small { color: var(--faint); font-size: 9px; }
.text-action { display: inline-flex; align-items: center; gap: 5px; padding: 3px; border: 0; color: var(--accent); background: transparent; font-size: 10px; }
.text-action svg { width: 12px; height: 12px; }
.focus-list, .linked-list { display: grid; }
.focus-item, .linked-item { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 9px; min-height: 48px; border-bottom: 1px solid var(--line); }
.focus-item:first-child, .linked-item:first-child { border-top: 1px solid var(--line); }
.focus-item > span, .linked-item > span { display: grid; width: 24px; height: 24px; border-radius: 5px; place-items: center; color: var(--muted); background: var(--panel-soft); }
.focus-item > span svg, .linked-item > span svg { width: 13px; height: 13px; }
.focus-item button, .linked-item button { overflow: hidden; padding: 0; border: 0; background: transparent; text-align: left; }
.focus-item button strong, .focus-item button small, .linked-item button strong, .linked-item button small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.focus-item button strong, .linked-item button strong { color: var(--ink); font-size: 11px; font-weight: 600; }
.focus-item button small, .linked-item button small { margin-top: 1px; color: var(--faint); font-size: 9px; }
.focus-item time, .linked-item time { color: var(--faint); font-size: 9px; }
.focus-item .row-actions, .linked-item .row-actions { min-width: 52px; }
.focus-item .row-more, .linked-item .row-more { opacity: 0; }
.focus-item:hover .row-more, .linked-item:hover .row-more, .focus-item .row-more:focus-visible, .linked-item .row-more:focus-visible { opacity: 1; }
.plain-empty { padding: 22px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--faint); font-size: 10px; text-align: center; }
.launcher-list { display: grid; border-top: 1px solid var(--line); }
.launcher { display: grid; grid-template-columns: 30px minmax(0, 1fr) 18px; align-items: center; gap: 9px; min-height: 57px; border-bottom: 1px solid var(--line); text-decoration: none; }
button.launcher { width: 100%; padding: 0; border-top: 0; border-right: 0; border-left: 0; color: inherit; background: transparent; text-align: left; }
.launcher > span:first-child { display: grid; width: 30px; height: 30px; border-radius: 6px; place-items: center; color: var(--pink); background: var(--pink-soft); }
.launcher:nth-child(2) > span:first-child { color: var(--amber); background: var(--amber-soft); }
.launcher:nth-child(3) > span:first-child { color: var(--green); background: var(--green-soft); }
.launcher svg { width: 14px; height: 14px; }
.launcher strong, .launcher small { display: block; }
.launcher strong { color: var(--ink); font-size: 11px; }
.launcher small { color: var(--faint); font-size: 9px; }
.launcher > svg { color: var(--faint); }
.launcher:hover > svg { color: var(--accent); }
.context-intro { max-width: 670px; padding-top: 60px; }
.context-icon { display: grid; width: 46px; height: 46px; margin-bottom: 20px; border-radius: 8px; place-items: center; color: var(--accent); background: var(--accent-soft); }
.context-icon svg { width: 21px; height: 21px; }
.context-intro h2 { margin: 0; color: var(--ink-strong); font-size: 26px; }
.context-intro > p { max-width: 520px; margin: 8px 0 26px; color: var(--muted); font-size: 12px; }
.context-features { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.context-feature { padding: 18px 18px 18px 0; }
.context-feature + .context-feature { padding-left: 18px; border-left: 1px solid var(--line); }
.context-feature strong, .context-feature span { display: block; }
.context-feature strong { color: var(--ink); font-size: 11px; }
.context-feature span { margin-top: 4px; color: var(--faint); font-size: 9px; }

/* Editor */
.editor, .project-editor { display: grid; grid-template-rows: 58px minmax(0, 1fr) 62px; }
.editor-head { display: flex; align-items: center; justify-content: space-between; min-width: 0; padding: 0 22px; border-bottom: 1px solid var(--line); }
.editor-context { display: flex; align-items: center; min-width: 0; gap: 10px; }
.editor-context > span:last-child { min-width: 0; }
.editor-context small, .editor-context strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-context small { color: var(--faint); font-size: 9px; }
.editor-context strong { color: var(--ink); font-size: 11px; font-weight: 650; }
.editor-actions { display: flex; gap: 3px; }
.editor-divider { width: 1px; height: 18px; margin: 0 4px; background: var(--line); }
.detail-close { color: #7b8087; }
.detail-close:hover { color: var(--ink); background: var(--panel-hover); }
.editor-actions .icon-button.selected { color: #bc7e10; background: var(--amber-soft); }
.editor-actions .icon-button.selected svg { fill: #e8b13e; }
.editor-scroll { min-width: 0; overflow-y: auto; padding: 38px clamp(28px, 5vw, 72px) 70px; scrollbar-color: #c8cbd0 transparent; scrollbar-width: thin; }
.title-input { width: 100%; height: auto; padding: 0 0 14px; border: 0; border-bottom: 1px solid transparent; outline: 0; color: var(--ink-strong); background: transparent; font-size: 26px; line-height: 1.35; font-weight: 680; }
.title-input::placeholder { color: #b4b7bc; }
.title-input:focus { border-bottom-color: var(--line); }
.content-editor { width: 100%; min-height: 300px; margin-top: 14px; padding: 0; border: 0; outline: 0; color: #303237; background: transparent; font: 13px/1.8 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", "Microsoft YaHei", monospace; resize: none; }
.content-editor::placeholder, .project-description::placeholder { color: #a8acb2; }
.metadata-section { margin-top: 32px; border-top: 1px solid var(--line); }
.metadata-heading { display: flex; align-items: center; height: 44px; color: var(--muted); font-size: 10px; font-weight: 700; }
.metadata-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.metadata-grid label { display: grid; grid-template-columns: 106px minmax(0, 1fr); align-items: center; min-width: 0; min-height: 45px; border-bottom: 1px solid var(--line); }
.metadata-grid label:nth-child(odd):not(.full-row) { padding-right: 16px; }
.metadata-grid label:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--line); }
.metadata-grid label.full-row { grid-column: 1 / -1; }
.metadata-grid label > span { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; }
.metadata-grid label > span svg { width: 14px; height: 14px; color: var(--faint); }
.metadata-grid input, .metadata-grid select { width: 100%; min-width: 0; height: 34px; padding: 0 8px; border: 1px solid transparent; border-radius: 5px; outline: 0; background: transparent; font-size: 11px; }
.metadata-grid input:hover, .metadata-grid select:hover { background: var(--panel-soft); }
.metadata-grid input:focus, .metadata-grid select:focus { border-color: var(--line-strong); background: var(--panel); }
.editor-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; min-width: 0; padding: 0 22px; border-top: 1px solid var(--line); background: rgba(255, 255, 255, 0.96); }
.editor-footer > div { display: flex; gap: 5px; }
.save-state { display: flex; align-items: center; min-width: 0; gap: 7px; margin: 0; color: var(--faint); font-size: 10px; }
.save-state svg { flex: 0 0 auto; width: 14px; height: 14px; }
.save-state span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-state.error { color: var(--red); }
.save-state.saved { color: var(--green); }

/* Projects */
.project-list-row { position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 68px; padding: 10px; border: 1px solid transparent; border-radius: 6px; }
.project-list-row + .project-list-row::before { position: absolute; top: -1px; right: 10px; left: 52px; height: 1px; content: ""; background: var(--line); }
.project-list-row:hover { background: var(--panel-hover); }
.project-list-row.selected { border-color: #ead8b7; background: #fff8e9; }
.project-list-mark { display: grid; width: 32px; height: 32px; border-radius: 6px; place-items: center; color: var(--amber); background: var(--amber-soft); font-size: 12px; font-weight: 750; }
.project-list-row > button { min-width: 0; padding: 0; border: 0; background: transparent; text-align: left; }
.project-list-row strong, .project-list-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-list-row strong { color: var(--ink); font-size: 12px; }
.project-list-row small { margin-top: 3px; color: var(--faint); font-size: 9px; }
.project-list-row > time { color: var(--faint); font-size: 9px; }
.project-list-row > .row-actions { min-width: 55px; }
.project-list-row > .row-actions .row-more { opacity: 0; }
.project-list-row:hover > .row-actions .row-more, .project-list-row > .row-actions .row-more:focus-visible { opacity: 1; }
.project-scroll { padding-top: 40px; }
.project-description { width: 100%; min-height: 130px; margin-top: 12px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); outline: 0; color: var(--ink); background: transparent; font-size: 12px; line-height: 1.7; resize: vertical; }
.project-status-row { display: grid; grid-template-columns: repeat(2, 1fr); margin-top: 22px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.project-status-row label { display: grid; grid-template-columns: 90px 1fr; align-items: center; min-height: 46px; color: var(--muted); font-size: 10px; }
.project-status-row label + label { padding-left: 18px; border-left: 1px solid var(--line); }
.project-status-row input, .project-status-row select { min-width: 0; height: 34px; padding: 0 8px; border: 1px solid transparent; border-radius: 5px; outline: 0; background: transparent; font-size: 11px; }
.project-status-row input:focus, .project-status-row select:focus { border-color: var(--line-strong); }
.project-assets { margin-top: 36px; }
.project-assets .linked-list { margin-top: 10px; }

/* Settings */
.settings-page { max-width: 720px; padding-top: 6px; }
.settings-page h2 { margin: 0; color: var(--ink-strong); font-size: 25px; }
.settings-page > p { margin: 7px 0 31px; color: var(--muted); font-size: 12px; }
.settings-section { padding: 23px 0; border-top: 1px solid var(--line); }
.settings-section:last-child { border-bottom: 1px solid var(--line); }
.settings-section-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.settings-section-head > div { min-width: 0; }
.settings-section h3 { margin: 0; color: var(--ink); font-size: 12px; }
.settings-section p { margin: 4px 0 0; color: var(--faint); font-size: 10px; }
.settings-actions { display: flex; flex: 0 0 auto; gap: 6px; }
.system-facts { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.system-fact { padding: 13px 12px; border-right: 1px solid var(--line); }
.system-fact:first-child { padding-left: 0; }
.system-fact:last-child { border-right: 0; }
.system-fact strong, .system-fact span { display: block; }
.system-fact strong { color: var(--ink); font-size: 10px; }
.system-fact span { margin-top: 2px; color: var(--faint); font-size: 9px; }

/* Command palette */
.command-dialog { width: min(650px, calc(100vw - 32px)); max-width: none; margin: 12vh auto 0; padding: 0; border: 1px solid #c9ccd1; border-radius: 8px; color: var(--ink); background: var(--panel); box-shadow: var(--shadow-lg); }
.command-dialog::backdrop { background: rgba(22, 25, 30, 0.36); backdrop-filter: blur(2px); }
.command-box { overflow: hidden; border-radius: 8px; }
.command-search { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 8px; height: 54px; padding: 0 13px; border-bottom: 1px solid var(--line); }
.command-search svg { width: 18px; height: 18px; color: var(--faint); }
.command-search input { width: 100%; height: 48px; padding: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 13px; }
.key-button { height: 25px; padding: 0 7px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--faint); background: var(--panel-soft); font-size: 9px; }
.command-results { min-height: 170px; max-height: 410px; overflow-y: auto; padding: 7px; }
.command-group-label { padding: 8px 9px 5px; color: var(--faint); font-size: 9px; font-weight: 700; }
.command-result { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 5px 8px; border: 0; border-radius: 6px; color: var(--ink); background: transparent; text-align: left; }
.command-result:hover, .command-result.active { background: var(--panel-hover); }
.command-result > span:first-child { display: grid; width: 30px; height: 30px; border-radius: 6px; place-items: center; color: var(--accent); background: var(--accent-soft); }
.command-result > span:first-child svg { width: 15px; height: 15px; }
.command-result strong, .command-result small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.command-result strong { font-size: 11px; }
.command-result small { margin-top: 2px; color: var(--faint); font-size: 9px; }
.command-result > kbd { padding: 1px 5px; }
.command-empty { display: grid; min-height: 165px; place-items: center; align-content: center; color: var(--faint); font-size: 11px; }
.command-empty svg { width: 24px; height: 24px; margin-bottom: 10px; }
.command-box > footer { display: flex; align-items: center; gap: 18px; height: 34px; padding: 0 13px; border-top: 1px solid var(--line); color: var(--faint); background: var(--panel-soft); font-size: 9px; }
.command-box > footer kbd { display: inline-block; min-width: 18px; margin-right: 3px; padding: 0 4px; text-align: center; }

.context-menu { position: fixed; z-index: 90; width: 218px; padding: 6px; border: 1px solid var(--line-strong); border-radius: 7px; background: rgba(255, 255, 255, 0.98); box-shadow: 0 16px 40px rgba(28, 32, 38, 0.18); }
.context-menu-title { overflow: hidden; padding: 7px 9px 6px; color: var(--faint); font-size: 10px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.context-menu-group { display: grid; gap: 2px; }
.context-menu-divider { height: 1px; margin: 5px 2px; background: var(--line); }
.context-menu-item { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 34px; padding: 0 9px; border: 0; border-radius: 5px; color: var(--ink); background: transparent; font-size: 11px; text-align: left; }
.context-menu-item:hover, .context-menu-item:focus-visible { color: var(--ink-strong); background: var(--panel-hover); outline: 0; }
.context-menu-item svg { width: 15px; height: 15px; color: var(--muted); }
.context-menu-item.danger { color: var(--red); }
.context-menu-item.danger svg { color: var(--red); }
.context-menu-item.danger:hover, .context-menu-item.danger:focus-visible { background: var(--red-soft); }

.toast { position: fixed; z-index: 100; right: 22px; bottom: 76px; display: flex; align-items: center; max-width: min(360px, calc(100vw - 32px)); min-height: 42px; padding: 0 14px; border: 1px solid #bad8cc; border-radius: 6px; color: #17684f; background: #f4fbf8; box-shadow: 0 10px 30px rgba(31, 45, 41, 0.13); opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity 160ms ease, transform 160ms ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { border-color: #ecc2c3; color: var(--red); background: #fff6f6; }
.toast svg { flex: 0 0 auto; width: 16px; height: 16px; margin-right: 8px; }
.toast span { font-size: 11px; }
.icon-button.loading svg { animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.mobile-nav { display: none; }

@media (max-width: 1100px) {
  :root { --sidebar-width: 210px; }
  .workspace { grid-template-columns: minmax(300px, 350px) minmax(0, 1fr); }
  .detail-home-inner { padding-right: 38px; padding-left: 38px; }
  .home-sections { gap: 28px; }
  .home-metric { padding-right: 10px; padding-left: 10px; }
  .home-metric:first-child { padding-left: 0; }
  .editor-scroll { padding-right: 40px; padding-left: 40px; }
}

@media (max-width: 900px) {
  :root { --sidebar-width: 224px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: var(--sidebar-width); transform: translateX(-100%); transition: transform 180ms ease; }
  .sidebar.open { transform: translateX(0); box-shadow: 18px 0 45px rgba(15, 19, 24, 0.18); }
  .sidebar-close { display: inline-grid; }
  .sidebar-scrim { position: fixed; z-index: 35; inset: 0; display: block; background: rgba(22, 25, 30, 0.38); opacity: 0; pointer-events: none; transition: opacity 180ms ease; }
  .sidebar.open + .main-panel { pointer-events: none; }
  .sidebar-scrim.visible { opacity: 1; pointer-events: auto; }
  .menu-button { display: inline-grid; }
  .topbar { grid-template-columns: 1fr minmax(260px, 420px) 1fr; }
  .home-sections { grid-template-columns: 1fr; }
  .home-secondary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
  .home-secondary .home-section + .home-section { margin-top: 0; }
}

@media (max-width: 720px) {
  body { overflow: hidden; }
  .login-view { display: block; min-height: 100vh; background: var(--panel); }
  .login-visual { height: 34vh; min-height: 230px; }
  .login-brand { top: 22px; left: 22px; }
  .login-statement { right: 22px; bottom: 26px; left: 22px; }
  .login-statement p { margin-bottom: 8px; }
  .login-statement h1 { font-size: 22px; }
  .login-panel { min-height: 66vh; padding: 35px 24px 50px; place-items: start center; }
  .login-form h2 { font-size: 26px; }
  .login-form > p { margin-bottom: 24px; }
  .topbar { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 0 12px; }
  .breadcrumb > span, .breadcrumb > svg { display: none; }
  .search-trigger { width: 34px; padding: 0; border: 0; place-items: center; background: transparent; }
  .search-trigger svg { margin: 0; }
  .search-trigger span, .search-trigger kbd, .top-capture span { display: none; }
  .top-capture { width: 34px; padding: 0; justify-content: center; }
  .topbar > .search-trigger { justify-self: end; }
  .topbar-actions { display: none; }
  .workspace { display: block; height: calc(100vh - var(--topbar-height) - var(--mobile-nav-height)); }
  .collection-panel { height: 100%; border-right: 0; }
  .collection-head { min-height: 111px; padding: 22px 18px 13px; }
  .collection-head h1 { font-size: 22px; }
  .collection-summary { margin-right: 12px; margin-left: 12px; }
  .filter-row { padding-right: 12px; padding-left: 12px; }
  .item-list { padding-right: 6px; padding-left: 6px; }
  .asset-row { min-height: 82px; }
  .asset-row > .row-actions .icon-button, .project-list-row > .row-actions .row-more { opacity: 1; }
  .detail-panel { position: fixed; z-index: 30; inset: var(--topbar-height) 0 var(--mobile-nav-height); display: none; }
  .app-shell.detail-open .detail-panel { display: block; }
  .app-shell.detail-open .collection-panel { display: none; }
  .mobile-back { position: absolute; z-index: 3; top: 11px; left: 11px; display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 8px; border: 0; border-radius: 6px; color: var(--muted); background: var(--panel-soft); font-size: 10px; }
  .mobile-back svg { width: 14px; height: 14px; }
  .detail-home-inner { padding: 62px 20px 50px; }
  .home-heading { display: block; padding-bottom: 22px; }
  .home-heading h2 { font-size: 23px; }
  .home-quick-actions { justify-content: flex-start; margin-top: 18px; }
  .home-metrics { grid-template-columns: repeat(2, 1fr); }
  .home-metric { border-bottom: 1px solid var(--line); }
  .home-metric:nth-child(2) { border-right: 0; }
  .home-metric:nth-child(3), .home-metric:nth-child(4) { border-bottom: 0; }
  .home-metric:nth-child(3) { padding-left: 0; }
  .home-secondary { grid-template-columns: 1fr; }
  .home-secondary .home-section + .home-section { margin-top: 28px; }
  .context-intro { padding-top: 20px; }
  .context-features { grid-template-columns: 1fr; }
  .context-feature { padding: 15px 0; }
  .context-feature + .context-feature { padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }
  .editor, .project-editor { grid-template-rows: 58px minmax(0, 1fr) 60px; }
  .editor-head { padding: 0 12px 0 105px; }
  .editor-context .type-icon { display: none; }
  .editor-scroll { padding: 27px 19px 55px; }
  .title-input { font-size: 22px; }
  .content-editor { min-height: 270px; }
  .metadata-grid { grid-template-columns: 1fr; }
  .metadata-grid label, .metadata-grid label:nth-child(odd):not(.full-row), .metadata-grid label:nth-child(even) { padding: 0; border-left: 0; }
  .metadata-grid label.full-row { grid-column: 1; }
  .editor-footer { padding: 0 12px; }
  .editor-footer .save-state { max-width: 100px; }
  .editor-footer .button { min-height: 36px; padding: 0 11px; }
  .project-status-row { grid-template-columns: 1fr; }
  .project-status-row label + label { padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }
  .settings-section-head { align-items: flex-start; }
  .settings-actions { flex-direction: column; }
  .system-facts { grid-template-columns: 1fr; }
  .system-fact, .system-fact:first-child { padding: 11px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .system-fact:last-child { border-bottom: 0; }
  .mobile-nav { position: fixed; z-index: 45; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--mobile-nav-height); padding: 5px 6px max(5px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255, 255, 255, 0.97); }
  .mobile-nav button { display: grid; min-width: 0; padding: 4px 0; border: 0; border-radius: 5px; place-items: center; align-content: center; gap: 2px; color: var(--faint); background: transparent; font-size: 9px; }
  .mobile-nav button svg { width: 18px; height: 18px; }
  .mobile-nav button.active { color: var(--accent); }
  .mobile-nav .mobile-capture { width: 42px; height: 42px; margin: 3px auto 0; border-radius: 50%; color: #fff; background: var(--accent); }
  .mobile-nav .mobile-capture svg { width: 20px; height: 20px; }
  .command-dialog { margin-top: 7vh; }
  .command-results { max-height: 58vh; }
  .toast { right: 12px; bottom: 138px; }
  .focus-item .row-more, .linked-item .row-more { opacity: 1; }
}

@media (max-width: 390px) {
  .summary-cell { padding-right: 7px; padding-left: 7px; }
  .asset-row { grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px; }
  .asset-row > .row-actions { min-width: 50px; }
  .editor-actions { gap: 0; }
  .editor-actions .icon-button { width: 31px; }
  .editor-head { padding-right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
