:root {
  --navy: #0f1f31;
  --navy-2: #142a42;
  --blue: #315b7d;
  --blue-light: #e6eef6;
  --ink: #182536;
  --muted: #647282;
  --line: #d8e0e8;
  --bg: #f4f6f9;
  --paper: #fafaf7;
  --green: #397b60;
  --amber: #9a6b22;
  --red: #a94537;
  --shadow: 0 18px 50px rgba(15, 31, 49, .12);
}

html { font-family: "Noto Sans SC", system-ui, sans-serif; background: var(--paper); }
body { background: var(--paper); }
.sidebar { background: var(--navy); padding: 25px 16px 18px; }
.brand { margin: 0 7px 38px; gap: 11px; font-weight: 400; }
.brand-logo { width: 38px; height: 38px; display: block; object-fit: contain; flex: 0 0 38px; }
.brand b { display: block; font: 600 20px "Playfair Display", "Noto Sans SC", serif; letter-spacing: .2px; }
.brand small { display: block; margin-top: 3px; color: #9dafc1; font: 500 8px/1 "DM Mono", monospace; letter-spacing: 1.7px; }
.sidebar nav a { border-radius: 7px; color: #a9b8c6; font-size: 13px; }
.sidebar nav a.active, .sidebar nav a:hover { color: #fff; background: #294760; box-shadow: inset 2px 0 #79a6c9; }
.sidebar-bottom { border-top-color: #2a4058; }
.storage span { color: #8195a8; font-family: "DM Mono", monospace; }
.storage strong { color: #d5e0e9; }
.ghost-link { color: #91a7ba; }
main { background: var(--paper); }
.topbar { height: 72px; position: sticky; top: 0; z-index: 8; background: rgba(250, 250, 247, .94); backdrop-filter: blur(14px); }
.topbar h1, .intro h2, .detail-header h2, .modal-head h2, .login-card h1 { font-family: "Playfair Display", "Noto Sans SC", serif; }
.eyebrow, .detail-id { font-family: "DM Mono", monospace; }
.btn { border-radius: 6px; }
.btn.primary { background: var(--blue); box-shadow: 0 7px 16px rgba(49, 91, 125, .2); }
.btn.primary:hover { background: #294e6d; }
.topbar-actions { display: flex; gap: 9px; align-items: center; }
.stats { gap: 0; border: 1px solid var(--line); }
.stat { border: 0; border-right: 1px solid var(--line); border-radius: 0; background: #fff; }
.stat:last-child { border-right: 0; }
.table-card, .detail-card { border-radius: 3px; box-shadow: none; }
.table-head, th { background: #f0f3f6; }
.search, .filters select, .field select, .field input { border-radius: 6px; }
.pill { border-radius: 3px; font-family: "DM Mono", monospace; }
.tag { border-radius: 2px; background: #edf1f5; }
.sort-button { display: inline-flex; align-items: center; gap: 5px; padding: 0; color: inherit; background: transparent; border: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.sort-button span { color: #a0acb7; font-size: 11px; }
.sort-button:hover, .sort-button.active { color: #315b7d; }
.sort-button.active span { color: #315b7d; }
.note-preview { max-width: 220px; overflow: hidden; color: #5e6e7d; text-overflow: ellipsis; white-space: nowrap; }
.modal-card, .login-card { border-radius: 8px; }
.drop-zone { border-radius: 6px; }
.login-screen { background: radial-gradient(circle at 70% 20%, #294760 0, transparent 36%), var(--navy); }
.login-logo { width: 54px; height: 54px; margin-bottom: 18px; }
.markdown-body { color: var(--ink); font-size: 15px; line-height: 1.85; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { color: #10243a; font-family: "Playfair Display", "Noto Sans SC", serif; }
.markdown-body a { color: #315b7d; text-decoration-color: #9bb1c4; }
.markdown-body blockquote { margin-left: 0; padding: 4px 0 4px 16px; border-left: 3px solid #79a6c9; color: #526575; }
.markdown-body code { color: #27445e; background: #e8eef4; }
.markdown-body pre { color: #dce8f2; background: #0f1f31; border: 1px solid #223b54; }
.markdown-body pre code { display: inline; padding: 0; color: #dce8f2; background: transparent; border: 0; }
.markdown-body pre code * { color: inherit; background: transparent; }
.editor { color: #182536; background: #fff; }
.edit-preview { color: #182536; background: #fafaf7; }
.notes-box { margin: 22px 30px 0; padding: 18px; display: grid; grid-template-columns: 180px minmax(240px, 1fr) auto; gap: 14px; align-items: start; background: #f2f5f8; border: 1px solid var(--line); }
.notes-box label, .project-create label, .project-card label { display: block; color: #20364b; font-size: 12px; font-weight: 700; }
.notes-box small { display: block; margin-top: 5px; color: #7b8996; font-size: 10px; line-height: 1.5; }
.notes-box textarea, .project-card textarea { min-height: 76px; padding: 11px 12px; resize: vertical; color: var(--ink); background: #fff; border: 1px solid #cdd7e0; border-radius: 4px; font: 12px/1.65 "Noto Sans SC", sans-serif; }
.panel-box { background: #fff; border: 1px solid var(--line); }
.project-create { display: grid; grid-template-columns: minmax(180px, .7fr) minmax(260px, 1.3fr) auto; gap: 14px; align-items: end; padding: 18px; }
.project-create label { margin-bottom: 7px; }
.project-create input { width: 100%; height: 42px; padding: 0 12px; color: var(--ink); border: 1px solid #cdd7e0; border-radius: 4px; font: 13px "Noto Sans SC", sans-serif; }
.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 10px; }
.project-card { padding: 20px; background: #fff; border: 1px solid var(--line); border-top: 2px solid #315b7d; }
.project-card header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 18px; }
.project-card header div { display: flex; gap: 10px; align-items: center; }
.project-card header span { color: #8494a3; font: 500 9px "DM Mono", monospace; }
.project-name { width: min(190px, 18vw); padding: 4px 6px; color: #20364b; background: #fff; border: 1px solid transparent; border-radius: 3px; font: 600 17px "Playfair Display", "Noto Sans SC", serif; }
.project-name:hover, .project-name:focus { border-color: #b9c7d3; outline: none; }
.project-name[readonly] { color: #20364b; background: transparent; cursor: default; }
.project-name[readonly]:hover, .project-name[readonly]:focus { border-color: transparent; }
.project-card header strong { padding: 4px 7px; color: #315b7d; background: #e6eef6; border-radius: 2px; font: 500 9px "DM Mono", monospace; }
.project-card label { margin-bottom: 7px; color: #748494; font-size: 10px; }
.project-card textarea { width: 100%; min-height: 90px; }
.project-card footer { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.project-card footer > div { display: flex; gap: 7px; }
.project-card .save-project { padding: 9px 11px; font-size: 11px; }
.delete-project { padding: 8px; color: #a94537; background: transparent; border: 0; cursor: pointer; font: 11px "Noto Sans SC", sans-serif; }
.append-form { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.append-form .wide { grid-column: 1 / -1; }
.append-form label { display: block; margin-bottom: 7px; color: #20364b; font-size: 12px; font-weight: 700; }
.append-form input, .append-form select, .append-form textarea { width: 100%; color: var(--ink); background: #fff; border: 1px solid #cdd7e0; border-radius: 4px; font: 13px "Noto Sans SC", sans-serif; }
.append-form input, .append-form select { height: 43px; padding: 0 12px; }
.append-form textarea { min-height: 180px; padding: 12px; resize: vertical; line-height: 1.7; }
.append-form textarea.tasks-input { min-height: 96px; }
.append-form .field > small { display: block; margin-top: 6px; color: #7b8996; font-size: 10px; }
.requirement-actions { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.row-action { padding: 6px 8px; color: #315b7d; background: #edf3f7; border: 1px solid #cbd9e4; border-radius: 3px; cursor: pointer; font: 10px "Noto Sans SC", sans-serif; }
.row-action:hover { color: #fff; background: #315b7d; border-color: #315b7d; }
.todo-box { margin: 14px 30px 0; padding: 18px; background: #fff; border: 1px solid var(--line); }
.todo-box > header { display: flex; justify-content: space-between; align-items: start; }
.todo-box header strong { display: block; color: #20364b; font-size: 13px; }
.todo-box header small { display: block; margin-top: 4px; color: #7b8996; font-size: 10px; }
.todo-box header > span { color: #397b60; font: 500 11px "DM Mono", monospace; }
.todo-progress { height: 5px; margin: 13px 0; overflow: hidden; background: #e7ecf0; }
.todo-progress i { display: block; height: 100%; background: #397b60; transition: width .2s; }
.todo-list { display: grid; gap: 7px; }
.todo-item { display: flex; gap: 9px; align-items: start; padding: 8px 10px; background: #f5f7f9; cursor: pointer; font-size: 12px; }
.todo-item input { margin-top: 3px; accent-color: #397b60; }
.todo-item.done span { color: #8895a0; text-decoration: line-through; }
.todo-empty { margin: 0; color: #7b8996; font-size: 11px; }
.todo-empty code { color: #315b7d; background: #e8eef4; }
.history-list { max-width: 760px; }
.history-loading, .history-empty { padding: 24px 0; color: #748494; font-size: 12px; }
.history-item { display: grid; grid-template-columns: 24px 1fr 20px; gap: 10px; color: inherit; text-decoration: none; }
.history-line { position: relative; display: flex; justify-content: center; }
.history-line::after { content: ""; position: absolute; top: 18px; bottom: -12px; width: 1px; background: #d8e0e8; }
.history-item:last-child .history-line::after { display: none; }
.history-line i { position: relative; z-index: 1; width: 8px; height: 8px; margin-top: 7px; background: #447ca4; border: 2px solid #e6eef6; border-radius: 50%; box-sizing: content-box; }
.history-item > div { padding: 0 0 20px; }
.history-item small { display: block; color: #80909f; font: 9px "DM Mono", monospace; }
.history-item strong { display: block; margin: 5px 0 3px; color: #20364b; font-size: 13px; }
.history-item p { margin: 0; color: #718191; font: 10px "DM Mono", monospace; }
.history-item > b { color: #80909f; font-size: 12px; }
.history-item:hover strong { color: #315b7d; }

@media (max-width: 620px) {
  .stats { border: 0; gap: 9px; }
  .stat { border: 1px solid var(--line); }
  .notes-box { margin: 16px 18px 0; grid-template-columns: 1fr; }
  .todo-box { margin: 12px 18px 0; }
  .project-create { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
  .topbar-actions .secondary { display: none; }
  .append-form { grid-template-columns: 1fr; }
  .append-form .wide { grid-column: auto; }
  .project-card footer { align-items: flex-end; gap: 8px; }
  .project-card footer > div { flex-direction: column; align-items: stretch; }
}

@media (min-width: 621px) and (max-width: 1050px) {
  .project-grid { grid-template-columns: repeat(2, 1fr); }
}
