:root {
  --bg: #f4f3ef;
  --surface: #fbfaf7;
  --surface-strong: #ffffff;
  --text: #191918;
  --muted: #7b7973;
  --line: #deddd7;
  --line-dark: #c9c7bf;
  --accent: #e75b27;
  --accent-soft: #fbe8dd;
  --blue: #4267bb;
  --green: #498263;
  --sidebar: #edece7;
  --shadow: 0 18px 60px rgba(32, 30, 24, 0.10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; }
body.auth-pending .app-shell { visibility: hidden; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 232px; padding: 28px 20px 20px; background: var(--sidebar); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 20; }
.brand-row { display: flex; align-items: center; justify-content: space-between; margin: 0 8px 50px; }
.brand { font: 500 15px/1 ui-monospace, "SFMono-Regular", Consolas, monospace; letter-spacing: .12em; }
.brand-dot { color: var(--accent); }
.sidebar-label, .eyebrow { margin: 0; color: #99968f; font: 500 10px/1.4 ui-monospace, "SFMono-Regular", Consolas, monospace; letter-spacing: .15em; text-transform: uppercase; }
.sidebar-label { padding: 0 10px 12px; }
.main-nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item { min-height: 42px; padding: 0 10px; display: grid; grid-template-columns: 24px 1fr auto; align-items: center; border-radius: 5px; color: #686660; font-size: 13px; transition: .2s ease; }
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.55); }
.nav-item.active { color: #fff; background: #20201f; }
.nav-icon { font-family: "DM Mono", monospace; font-size: 15px; }
.nav-item small { color: #aaa8a1; font: 400 9px "DM Mono", monospace; }
.nav-item.active small { color: #888680; }
.sidebar-bottom { margin-top: auto; }
.utility-link { display: flex; align-items: center; gap: 11px; padding: 12px 10px; color: #686660; font-size: 13px; border-bottom: 1px solid var(--line); }
.profile-card { margin-top: 14px; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--accent); font: 500 11px "DM Mono", monospace; }
.profile-card strong, .profile-card small { display: block; }
.profile-card strong { font-size: 12px; }
.profile-card small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.profile-arrow { color: var(--muted); font-size: 12px; }
.sidebar-close, .menu-button { display: none !important; }

.main-content { grid-column: 2; min-width: 0; }
.topbar { height: 72px; padding: 0 34px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(244,243,239,.9); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 10; }
.breadcrumb { display: flex; gap: 10px; align-items: center; font: 400 11px "DM Mono", monospace; }
.breadcrumb span, .breadcrumb b { color: #a19e97; font-weight: 400; }
.breadcrumb strong { font-weight: 500; }
.topbar-actions { display: flex; gap: 9px; align-items: center; }
.icon-button, .more-button { border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.icon-button { width: 36px; height: 36px; border-radius: 4px; display: grid; place-items: center; }
.search-button { width: 218px; height: 36px; padding: 0 10px; display: flex; align-items: center; gap: 8px; color: #96938d; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; cursor: pointer; font-size: 11px; }
.search-button kbd { margin-left: auto; }
kbd { padding: 2px 5px; color: #99968f; border: 1px solid var(--line); border-radius: 3px; background: #f1f0eb; font: 400 9px "DM Mono", monospace; }
.primary-button { height: 36px; padding: 0 14px; border: 1px solid #1f1f1e; border-radius: 4px; color: white; background: #1f1f1e; font-size: 11px; cursor: pointer; transition: .2s; }
.primary-button:hover { background: var(--accent); border-color: var(--accent); }
.sync-status { color: var(--muted); font-size: 9px; white-space: nowrap; }
.sync-status.synced { color: var(--green); }
.sync-status.error { color: #b04427; }

.auth-screen { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; padding: 22px; background: var(--bg); }
.auth-screen[hidden] { display: none; }
.auth-screen::before { content: ""; position: absolute; inset: 0; opacity: .38; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 52px 52px; mask-image: radial-gradient(circle at center, black, transparent 72%); }
.auth-card { position: relative; width: min(440px, 100%); padding: 36px; background: var(--surface-strong); border: 1px solid var(--line); box-shadow: var(--shadow); }
.auth-brand { display: inline-block; margin-bottom: 48px; }
.auth-copy h1 { margin: 9px 0 10px; font-size: 27px; letter-spacing: -.04em; }
.auth-copy > p:not(.eyebrow) { margin: 0 0 27px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.auth-card form { display: flex; flex-direction: column; gap: 15px; }
.auth-card form label { display: flex; flex-direction: column; gap: 7px; }
.auth-card form label span { color: var(--muted); font-size: 9px; }
.auth-card form input { height: 43px; padding: 0 12px; color: var(--text); background: var(--bg); border: 1px solid var(--line); outline: 0; font-size: 12px; }
.auth-card form input:focus { border-color: var(--line-dark); }
.auth-submit { width: 100%; height: 43px; margin-top: 4px; }
.auth-switch { width: 100%; margin-top: 17px; padding: 0; color: var(--muted); background: transparent; border: 0; font-size: 10px; cursor: pointer; }
.auth-switch:hover { color: var(--accent); }
.local-mode-button { width: 100%; height: 41px; margin-top: 12px; color: var(--text); background: var(--surface); border: 1px solid var(--line-dark); font-size: 10px; cursor: pointer; }
.local-mode-button:hover { border-color: var(--accent); color: var(--accent); }
.auth-error { margin: 0; padding: 9px 10px; color: #b04427; background: #f8dfd5; font-size: 9px; }
.auth-footnote { margin: 27px 0 0; padding-top: 17px; color: #aaa7a0; border-top: 1px solid var(--line); font-size: 8px; text-align: center; }

.dashboard-wrap { max-width: 1400px; margin: 0 auto; padding: 48px 40px 64px; }
.hero-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; margin-bottom: 35px; }
.hero-row h1 { margin: 10px 0 9px; font-size: clamp(28px, 3vw, 40px); line-height: 1.25; letter-spacing: -.04em; }
.hero-copy { max-width: 620px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.week-progress { width: 225px; flex: 0 0 auto; }
.week-progress-top { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 11px; }
.week-progress-top strong { font: 500 12px "DM Mono", monospace; }
.progress-track, .mini-progress, .project-progress { height: 3px; overflow: hidden; background: #dddcd6; }
.progress-track i, .mini-progress i, .project-progress i { height: 100%; display: block; background: var(--accent); }
.week-progress small { display: block; margin-top: 8px; color: var(--muted); font-size: 9px; text-align: right; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); background: var(--surface); }
.stat-card { min-height: 120px; padding: 18px 19px; border-right: 1px solid var(--line); display: grid; grid-template-columns: auto 1fr; grid-template-rows: 1fr auto; column-gap: 14px; }
.stat-card:last-child { border-right: 0; }
.stat-index { color: #aaa7a0; font: 400 9px "DM Mono", monospace; }
.stat-card strong { display: block; font: 500 30px/1 "DM Mono", monospace; letter-spacing: -.04em; }
.stat-card strong small { font-size: 14px; color: var(--muted); }
.stat-card p { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.stat-card em { grid-column: 2; color: var(--green); font: normal 9px "DM Mono", monospace; }
.stat-card:nth-child(3) em { color: var(--accent); }

.content-grid { margin-top: 24px; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(330px, .8fr); gap: 24px; align-items: start; }
.primary-column, .secondary-column { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); }
.panel-heading { min-height: 82px; padding: 19px 22px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.panel-heading.compact { min-height: 74px; }
.panel-heading h2 { margin: 5px 0 0; font-size: 17px; line-height: 1.2; }
.text-button, .text-link { padding: 0; border: 0; color: var(--muted); background: transparent; font-size: 10px; cursor: pointer; }
.text-button:hover, .text-link:hover { color: var(--accent); }

.todo-item { min-height: 73px; padding: 13px 21px; display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.todo-item:hover { background: #f7f5f0; }
.todo-item input { display: none; }
.custom-check { width: 16px; height: 16px; border: 1px solid #aaa8a0; position: relative; }
.todo-item input:checked + .custom-check { background: #252524; border-color: #252524; }
.todo-item input:checked + .custom-check::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: white; font-size: 9px; }
.todo-item input:checked ~ .todo-main strong { color: #aaa7a0; text-decoration: line-through; }
.todo-main strong, .todo-main small { display: block; }
.todo-main strong { font-size: 12px; font-weight: 500; }
.todo-main small { margin-top: 7px; color: #99968f; font-size: 9px; }
.tag { margin-right: 6px; padding: 3px 6px; border-radius: 2px; font-style: normal; }
.tag-reading { color: #98552f; background: #f5e9df; }
.tag-ai { color: #415a99; background: #e4e9f5; }
.tag-health { color: #47735a; background: #e2eee7; }
.tag-knowledge { color: #6e5b8c; background: #ece7f3; }
.priority { padding: 3px 5px; border-radius: 2px; font: 400 8px "DM Mono", monospace; }
.priority.high { color: #b04427; background: #f8dfd5; }
.priority.medium { color: #907222; background: #f1ebd6; }
.priority.low { color: #5c7265; background: #e2ece6; }
.todo-footer { min-height: 42px; padding: 0 22px; display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 9px; }
.mini-progress { width: 110px; }

.project-item { padding: 18px 21px; display: grid; grid-template-columns: 41px 1fr; gap: 14px; border-bottom: 1px solid var(--line); }
.project-item:last-child { border-bottom: 0; }
.project-symbol { width: 41px; height: 41px; display: grid; place-items: center; color: white; font: 500 11px "DM Mono", monospace; }
.project-symbol.orange { background: var(--accent); }
.project-symbol.blue { background: var(--blue); }
.project-symbol.green { background: var(--green); }
.project-info > div:first-child { display: flex; align-items: center; gap: 9px; }
.project-info strong { font-size: 12px; }
.project-info > div > span { padding: 2px 5px; color: var(--muted); border: 1px solid var(--line); border-radius: 2px; font-size: 8px; }
.project-info p { margin: 7px 0 12px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.project-meta { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; color: #99968f; font-size: 8px; }
.project-progress i { background: #77746e; }

.more-button { width: 30px; height: 28px; border: 0; background: transparent; letter-spacing: 2px; }
.activity-item { min-height: 75px; padding: 13px 18px; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 11px; border-bottom: 1px solid var(--line); transition: .2s; }
.activity-item:hover { padding-left: 22px; background: #f7f5f0; }
.activity-item:last-child { border-bottom: 0; }
.activity-type { width: 34px; height: 34px; display: grid; place-items: center; color: #9c4e2f; background: #f3e5dc; font-size: 8px; }
.activity-type.project { color: #435d98; background: #e2e8f4; }
.activity-type.reading { color: #4b765d; background: #e3eee8; }
.activity-type.idea { color: #775e8d; background: #ede7f2; }
.activity-item strong, .activity-item small { display: block; }
.activity-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 500; }
.activity-item small { margin-top: 6px; color: #99968f; font-size: 8px; }
.activity-item > span:last-child { color: #aaa7a0; font-size: 10px; }
.count-badge { padding: 4px 7px; border-radius: 50%; color: white; background: #252524; font: 400 9px "DM Mono", monospace; }
.course-card { padding: 15px 18px; border-bottom: 1px solid var(--line); }
.course-card:last-child { border-bottom: 0; }
.course-top { display: grid; grid-template-columns: 31px 1fr auto; gap: 11px; align-items: center; margin-bottom: 11px; }
.course-icon { width: 31px; height: 31px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); font-size: 13px; }
.course-icon.dark { color: white; background: #252524; font: 500 10px "DM Mono", monospace; }
.course-icon.outline { color: var(--blue); border: 1px solid #c9d2e8; background: #eef1f8; }
.course-top strong, .course-top small { display: block; }
.course-top strong { font-size: 10px; }
.course-top small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.course-top b { font: 500 9px "DM Mono", monospace; }
.progress-track.thin { height: 2px; }
.learning-panel .progress-track i { background: #686660; }

.reflection-card { padding: 22px; color: white; background: #242423; position: relative; overflow: hidden; }
.reflection-card::after { content: "↻"; position: absolute; right: -8px; top: -28px; color: rgba(255,255,255,.055); font: 400 120px "DM Mono", monospace; }
.reflection-card span { color: #96938d; font: 400 8px "DM Mono", monospace; letter-spacing: .14em; }
.reflection-card strong { display: block; margin-top: 13px; font-size: 18px; }
.reflection-card p { max-width: 270px; margin: 8px 0 21px; color: #aaa7a0; font-size: 10px; line-height: 1.7; }
.reflection-card button { width: 100%; height: 37px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; color: #20201f; background: white; border: 0; font-size: 10px; cursor: pointer; position: relative; z-index: 1; }

/* Section pages */
.section-page { min-height: calc(100vh - 72px); }
.page-intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 28px; margin-bottom: 30px; }
.page-intro h1 { margin: 9px 0 8px; font-size: clamp(29px, 3vw, 42px); letter-spacing: -.04em; }
.page-intro p:not(.eyebrow) { max-width: 650px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.page-action { flex: 0 0 auto; }
.page-tabs { margin-bottom: 23px; display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; }
.page-tabs::-webkit-scrollbar { display: none; }
.page-tabs button { padding: 8px 12px; white-space: nowrap; color: var(--muted); background: transparent; border: 1px solid transparent; font-size: 10px; cursor: pointer; }
.page-tabs button.active { color: var(--text); background: var(--surface); border-color: var(--line); }
.section-stats { margin-bottom: 23px; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); background: var(--surface); }
.section-stat { min-height: 91px; padding: 16px 18px; border-right: 1px solid var(--line); }
.section-stat:last-child { border-right: 0; }
.section-stat span { display: block; color: var(--muted); font-size: 9px; }
.section-stat strong { display: block; margin-top: 10px; font: 500 23px/1 ui-monospace, "SFMono-Regular", Consolas, monospace; }
.section-stat small { display: block; margin-top: 7px; color: var(--green); font-size: 8px; }
.module-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.module-grid.two { grid-template-columns: repeat(2, 1fr); }
.module-card { min-height: 170px; padding: 20px; background: var(--surface); border: 1px solid var(--line); transition: transform .2s, border-color .2s; }
.module-card:hover { transform: translateY(-2px); border-color: var(--line-dark); }
.module-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; }
.module-card .module-icon { width: 34px; height: 34px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); font: 500 11px ui-monospace, monospace; }
.module-card .module-number { color: #aaa7a0; font: 400 9px ui-monospace, monospace; }
.module-card h3 { margin: 19px 0 7px; font-size: 14px; }
.module-card p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.7; }
.module-card footer { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 5px; }
.chip { padding: 4px 7px; color: var(--muted); background: var(--bg); border: 1px solid var(--line); font-size: 8px; }
.wide-card { background: var(--surface); border: 1px solid var(--line); }
.list-row { min-height: 66px; padding: 13px 18px; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 13px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: color-mix(in srgb, var(--surface) 60%, var(--bg)); }
.row-icon { width: 36px; height: 36px; display: grid; place-items: center; color: var(--text); background: var(--bg); font: 500 9px ui-monospace, monospace; }
.list-row strong, .list-row small { display: block; }
.list-row strong { font-size: 11px; }
.list-row small { margin-top: 6px; color: var(--muted); font-size: 8px; }
.row-end { min-width: 70px; color: var(--muted); font: 400 9px ui-monospace, monospace; text-align: right; }
.split-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.subhead { min-height: 66px; padding: 16px 18px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.subhead h2 { margin: 0; font-size: 14px; }
.subhead span { color: var(--muted); font-size: 9px; }
.metric-card { padding: 20px; color: white; background: #242423; }
.metric-card .eyebrow { color: #898780; }
.metric-card strong { display: block; margin: 14px 0 5px; font: 500 32px ui-monospace, monospace; }
.metric-card p { margin: 0; color: #aaa7a0; font-size: 9px; }
.metric-card .progress-track { margin-top: 18px; background: #44423f; }
.timeline { padding: 4px 18px; }
.timeline-item { padding: 15px 0 15px 24px; border-left: 1px solid var(--line-dark); position: relative; }
.timeline-item::before { content: ""; position: absolute; left: -4px; top: 22px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.timeline-item strong, .timeline-item small { display: block; }
.timeline-item strong { font-size: 11px; }
.timeline-item small { margin-top: 5px; color: var(--muted); font-size: 8px; }
.quote-card { padding: 23px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line)); }
.quote-card blockquote { margin: 0; font-size: 14px; line-height: 1.85; }
.quote-card cite { display: block; margin-top: 13px; color: var(--muted); font-size: 9px; font-style: normal; }
.habit-grid { display: grid; grid-template-columns: 1fr repeat(7, 25px); gap: 7px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.habit-grid:last-child { border-bottom: 0; }
.habit-grid strong { font-size: 10px; }
.habit-dot { width: 22px; height: 22px; display: grid; place-items: center; color: #aaa7a0; background: var(--bg); font-size: 8px; }
.habit-dot.done { color: white; background: #252524; }
.tool-search { width: 100%; height: 52px; padding: 0 18px; color: var(--text); background: var(--surface); border: 1px solid var(--line); outline: 0; font-size: 12px; }
.tool-search:focus { border-color: var(--line-dark); }
.profile-hero { padding: 30px; display: grid; grid-template-columns: 80px 1fr auto; align-items: center; gap: 22px; background: var(--surface); border: 1px solid var(--line); }
.profile-hero .big-avatar { width: 80px; height: 80px; display: grid; place-items: center; color: white; background: var(--accent); font: 500 22px ui-monospace, monospace; }
.profile-hero h2 { margin: 0 0 8px; font-size: 21px; }
.profile-hero p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.7; }
.profile-hero .status { align-self: start; padding: 5px 8px; color: var(--green); background: #e2eee7; font-size: 8px; }
.editable-item { cursor: pointer; position: relative; }
.editable-item::after { content: "编辑"; position: absolute; right: 9px; top: 8px; padding: 3px 5px; opacity: 0; color: var(--muted); background: var(--surface-strong); border: 1px solid var(--line); font-size: 7px; transition: opacity .2s; pointer-events: none; }
.editable-item:hover::after { opacity: 1; }
.section-stat.editable-item::after, .stat-card.editable-item::after { top: 6px; right: 6px; }
.editor-modal { width: min(620px, 100%); }
.editor-fields { margin-top: 23px; display: flex; flex-direction: column; gap: 15px; }
.editor-fields label { display: flex; flex-direction: column; gap: 7px; }
.editor-fields label > span { color: var(--muted); font-size: 9px; }
.editor-fields input, .editor-fields textarea { width: 100%; padding: 11px 12px; color: var(--text); background: var(--bg); border: 1px solid var(--line); outline: none; font-size: 12px; }
.editor-fields input:focus, .editor-fields textarea:focus { border-color: var(--line-dark); }
.editor-fields textarea { min-height: 105px; resize: vertical; line-height: 1.65; }
.editor-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.editor-actions > div { display: flex; gap: 8px; }
.danger-button, .secondary-button { height: 36px; padding: 0 13px; border-radius: 4px; font-size: 10px; cursor: pointer; }
.danger-button { color: #b04427; background: transparent; border: 1px solid #e2b9aa; }
.secondary-button { color: var(--text); background: var(--surface); border: 1px solid var(--line); }
.empty-state { padding: 45px 20px; color: var(--muted); text-align: center; font-size: 11px; border: 1px dashed var(--line-dark); }
.habit-dot { cursor: pointer; transition: transform .15s; }
.habit-dot:hover { transform: scale(1.1); }
.connected-workspace { margin: 22px 0; background: var(--surface); border: 1px solid var(--line); }
.connected-workspace .subhead { background: color-mix(in srgb, var(--surface) 78%, var(--bg)); }
.connected-grid { padding: 16px; }
.entity-card { min-height: 190px; }
.entity-card::after { content: "打开详情 ↗"; }
.entity-progress { height: 3px; margin-top: 17px; overflow: hidden; background: var(--line); }
.entity-progress i { display: block; height: 100%; background: var(--accent); }
.dashboard-connected { margin-top: 24px; }
.detail-head { margin-bottom: 25px; }
.detail-back { display: inline-block; margin-bottom: 22px; color: var(--muted); font-size: 10px; }
.detail-back:hover { color: var(--accent); }
.detail-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 25px; }
.detail-title-row h1 { margin: 8px 0; font-size: clamp(29px, 4vw, 44px); letter-spacing: -.04em; }
.detail-title-row p:not(.eyebrow) { max-width: 720px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.detail-icon { width: 64px; height: 64px; flex: 0 0 auto; display: grid; place-items: center; color: white; background: var(--accent); font: 500 15px ui-monospace, monospace; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 20px; align-items: start; }
.detail-fields { padding: 20px; display: flex; flex-direction: column; gap: 15px; }
.detail-fields label { display: flex; flex-direction: column; gap: 7px; }
.detail-fields label > span { color: var(--muted); font-size: 9px; }
.detail-fields input:not([type="range"]), .detail-fields textarea { width: 100%; padding: 11px 12px; color: var(--text); background: var(--bg); border: 1px solid var(--line); outline: 0; font-size: 12px; }
.detail-fields textarea { min-height: 100px; resize: vertical; line-height: 1.7; }
.detail-fields input:focus, .detail-fields textarea:focus { border-color: var(--line-dark); }
.detail-task { min-height: 56px; padding: 10px 18px; display: grid; grid-template-columns: 17px 1fr 25px; align-items: center; gap: 11px; border-bottom: 1px solid var(--line); font-size: 10px; cursor: pointer; }
.detail-task:last-child { border-bottom: 0; }
.detail-task input { display: none; }
.detail-task input:checked ~ span:not(.custom-check) { color: var(--muted); text-decoration: line-through; }
.detail-task button { width: 25px; height: 25px; color: var(--muted); background: transparent; border: 0; cursor: pointer; }
.detail-notes textarea { width: 100%; min-height: 180px; padding: 18px; color: var(--text); background: transparent; border: 0; outline: 0; resize: vertical; font-size: 11px; line-height: 1.8; }
.relation-list { display: flex; flex-direction: column; }
.relation-card { min-height: 62px; padding: 11px 14px; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.relation-card:last-child { border-bottom: 0; }
.relation-card:hover { background: var(--bg); }
.relation-card strong, .relation-card small { display: block; }
.relation-card strong { font-size: 10px; }
.relation-card small { margin-top: 5px; color: var(--muted); font-size: 8px; }
.relation-card b { color: var(--muted); font-size: 9px; }
.detail-tip { padding: 18px; color: var(--muted); font-size: 10px; line-height: 1.8; }

.modal-backdrop, .command-palette { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(25,25,24,.42); backdrop-filter: blur(8px); }
[hidden] { display: none !important; }
.quick-modal { width: min(580px, 100%); padding: 25px; background: var(--surface-strong); border: 1px solid var(--line-dark); box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; }
.modal-head h2 { margin: 6px 0 0; font-size: 20px; }
.quick-modal textarea { width: 100%; min-height: 150px; margin-top: 24px; padding: 16px; resize: vertical; color: var(--text); background: var(--bg); border: 1px solid var(--line); outline: 0; font-size: 13px; line-height: 1.7; }
.quick-modal textarea:focus { border-color: #99968f; }
.capture-types { display: flex; gap: 7px; margin-top: 12px; }
.capture-types button { padding: 6px 10px; color: var(--muted); background: transparent; border: 1px solid var(--line); font-size: 9px; cursor: pointer; }
.capture-types button.active { color: white; background: #252524; border-color: #252524; }
.modal-actions { margin-top: 24px; padding-top: 17px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-actions > span { color: var(--muted); font-size: 9px; }
.command-palette { place-items: start center; padding-top: 14vh; }
.command-box { width: min(600px, 100%); background: var(--surface-strong); border: 1px solid var(--line-dark); box-shadow: var(--shadow); }
.command-input { height: 61px; padding: 0 17px; display: flex; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); }
.command-input input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 13px; }
.command-results { padding: 10px; }
.command-results p { margin: 6px 9px 10px; color: var(--muted); font: 400 8px "DM Mono", monospace; letter-spacing: .12em; }
.command-results a { min-height: 42px; padding: 0 9px; display: grid; grid-template-columns: 25px 1fr auto; align-items: center; font-size: 11px; }
.command-results a:hover { background: var(--bg); }
.toast { position: fixed; left: 50%; bottom: 30px; z-index: 200; padding: 10px 18px; transform: translate(-50%, 20px); opacity: 0; color: white; background: #252524; font-size: 10px; pointer-events: none; transition: .25s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

body.dark { --bg:#1d1d1c; --surface:#242423; --surface-strong:#292928; --text:#efeee9; --muted:#98958f; --line:#383735; --line-dark:#4a4945; --sidebar:#20201f; --accent-soft:#4a3025; --shadow:0 18px 60px rgba(0,0,0,.35); }
body.dark .topbar { background: rgba(29,29,28,.9); }
body.dark .search-button, body.dark .icon-button { background: #242423; }
body.dark kbd { background: #30302f; }
body.dark .todo-item:hover, body.dark .activity-item:hover { background: #2b2b29; }
body.dark .quick-modal textarea { background: #20201f; }

@media (max-width: 1120px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-card:nth-child(2) { border-right: 0; }
  .stat-card:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .content-grid { grid-template-columns: 1fr; }
  .secondary-column { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .reflection-card { grid-column: 1 / -1; }
  .module-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { transform: translateX(-100%); transition: .25s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close, .menu-button { display: grid !important; }
  .main-content { width: 100%; }
  .topbar { height: 62px; padding: 0 16px; }
  .breadcrumb { display: none; }
  .search-button { width: 36px; justify-content: center; }
  .search-button span:nth-child(2), .search-button kbd, .topbar .primary-button { display: none; }
  .dashboard-wrap { padding: 30px 16px 45px; }
  .hero-row { align-items: flex-start; flex-direction: column; }
  .week-progress { width: 100%; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { min-height: 106px; padding: 14px; }
  .stat-card strong { font-size: 25px; }
  .secondary-column { display: flex; }
  .project-item { grid-template-columns: 34px 1fr; padding: 16px; }
  .project-symbol { width: 34px; height: 34px; }
  .panel-heading { padding: 17px; }
  .todo-item { padding: 13px 16px; }
  .page-intro { align-items: flex-start; flex-direction: column; }
  .section-stats { grid-template-columns: repeat(2, 1fr); }
  .section-stat:nth-child(2) { border-right: 0; }
  .section-stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .module-grid, .module-grid.two, .split-layout { grid-template-columns: 1fr; }
  .profile-hero { grid-template-columns: 58px 1fr; padding: 20px; }
  .profile-hero .big-avatar { width: 58px; height: 58px; }
  .profile-hero .status { grid-column: 1 / -1; justify-self: start; }
  .editor-row { grid-template-columns: 1fr; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-title-row { flex-direction: column-reverse; }
  .connected-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { border-right: 0; border-bottom: 1px solid var(--line); }
  .stat-card:last-child { border-bottom: 0; }
  .project-info > div:first-child { align-items: flex-start; flex-direction: column; gap: 5px; }
  .modal-actions { align-items: flex-start; flex-direction: column; gap: 12px; }
  .modal-actions .primary-button { width: 100%; }
  .habit-grid { grid-template-columns: 1fr repeat(7, 20px); gap: 3px; padding: 11px; }
  .habit-dot { width: 19px; height: 19px; }
}
