/* TaskVault — theme tokens. Dark by default (like the ClickUp setup this replaces), light on request. */
:root {
  --bg: #1b1c21; --bg2: #212228; --bg3: #2b2c33; --bg4: #34353d; --side: #16171b;
  --fg: #e9e9ee; --fg2: #b1b3bd; --fg3: #7d808c;
  --line: #2e2f37; --line2: #3a3b44;
  --accent: #7b68ee; --accent2: #9a8cff; --accent-bg: rgba(123,104,238,.16);
  --danger: #f2555a; --ok: #2fbf71; --warn: #f5a623;
  --shadow: 0 10px 30px rgba(0,0,0,.45); --radius: 8px;
  --row-h: 38px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #ffffff; --bg2: #f7f8fa; --bg3: #eef0f3; --bg4: #e4e6eb; --side: #f6f6f9;
  --fg: #202228; --fg2: #555a66; --fg3: #8a8f9c;
  --line: #e8e9ee; --line2: #dcdee4;
  --accent: #7b68ee; --accent2: #6a57e3; --accent-bg: rgba(123,104,238,.12);
  --shadow: 0 10px 30px rgba(20,20,40,.16);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg);
  font: 13.5px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent2); }
::selection { background: var(--accent-bg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
#app { display: grid; grid-template-columns: 264px 1fr; height: 100vh; height: 100dvh; }
#topbar { display: none; }

/* ------------------------------------------------------------ sidebar */
#sidebar { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; padding: 14px 14px 10px; font-size: 15px; }
.logo { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; color: #fff; font-size: 14px;
  background: linear-gradient(135deg, #7b68ee, #e54fa1 120%); box-shadow: 0 2px 8px rgba(123,104,238,.4); }
#search { margin: 2px 12px 10px; padding: 7px 10px 7px 30px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%237d808c' stroke-width='2'%3E%3Ccircle cx='6' cy='6' r='4.5'/%3E%3Cpath d='m9.5 9.5 3 3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 10px 50%; outline: none; }
#search:focus { border-color: var(--accent); }
#tree { flex: 1; overflow: auto; padding: 0 8px 12px; }
.side-foot { border-top: 1px solid var(--line); padding: 8px 10px; display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--fg2); flex-wrap: wrap; }
.side-foot .sp { flex: 1; }
.icon-btn { border: 0; background: none; color: var(--fg2); cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.icon-btn:hover { background: var(--bg3); color: var(--fg); }
.ws-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 8px 6px; font-size: 11px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; color: var(--fg3); }
.node { display: flex; align-items: center; gap: 6px; padding: 5px 6px; margin: 1px 0; border-radius: 6px; cursor: pointer; user-select: none; white-space: nowrap; color: var(--fg2); }
.node:hover { background: var(--bg3); color: var(--fg); }
.node.active { background: var(--accent-bg); color: var(--fg); font-weight: 600; }
.node.active .ico { color: var(--accent2); }
.node .caret { width: 12px; text-align: center; color: var(--fg3); font-size: 9px; flex: none; }
.node .ico { flex: none; width: 18px; text-align: center; color: var(--fg3); display: grid; place-items: center; }
.node .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.node .cnt { color: var(--fg3); font-size: 11px; }
.node .more { visibility: hidden; border: 0; background: none; padding: 0 4px; color: var(--fg2); cursor: pointer; border-radius: 4px; }
.node .more:hover { background: var(--bg4); }
.node:hover .more, .ws-head:hover .more { visibility: visible; }
.ws-head .more { visibility: hidden; border: 0; background: none; color: var(--fg2); cursor: pointer; }
.node.archived .nm { opacity: .55; font-style: italic; }
.node.space { color: var(--fg); font-weight: 500; }
.children { margin-left: 13px; padding-left: 4px; border-left: 1px solid var(--line); }
.sq { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; color: #fff; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* ------------------------------------------------------------- page head */
#main { overflow: auto; min-width: 0; background: var(--bg); }
.page-head { position: sticky; top: 0; left: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); padding: 10px 20px 0; }
.crumbs { font-size: 12px; color: var(--fg3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--fg2); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; } .crumbs a:hover { color: var(--fg); }
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.title-row h1 { font-size: 19px; margin: 0; flex: 1; min-width: 180px; display: flex; align-items: center; gap: 8px; font-weight: 650; }
.toolbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; align-items: flex-end; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: 0; background: none; padding: 7px 10px 9px; color: var(--fg2); cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent;
  display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.tab:hover { color: var(--fg); }
.tab.on { color: var(--fg); border-bottom-color: var(--accent); }
.tab .ti { color: var(--fg3); font-size: 12px; }
.tab.on .ti { color: var(--accent2); }
.tab.add { color: var(--fg3); }
.viewbar { position: sticky; left: 0; display: flex; align-items: center; gap: 6px; padding: 8px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: var(--bg); }
.viewbar .sp { flex: 1; }
.chipbtn { border: 1px solid var(--line2); background: var(--bg); color: var(--fg2); padding: 3px 10px; border-radius: 14px; cursor: pointer; font-size: 12.5px;
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.chipbtn:hover { background: var(--bg3); color: var(--fg); }
.chipbtn.on { background: var(--accent-bg); border-color: transparent; color: var(--accent2); }
.btn { border: 1px solid var(--line2); background: var(--bg); padding: 5px 12px; border-radius: var(--radius); cursor: pointer; color: var(--fg); }
.btn:hover { background: var(--bg3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent2); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 2px 9px; font-size: 12px; }
button.link { border: 0; background: none; color: var(--accent2); cursor: pointer; padding: 0; }
.muted { color: var(--fg3); }
.content { padding: 6px 20px 80px; }
.desc-box { margin: 0 20px; padding: 10px 0 0; color: var(--fg2); }

/* ------------------------------------------------------------ list view */
.group { margin: 16px 0 24px; }
.group-head { position: sticky; left: 0; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 12px; }
.group-head .caret { border: 0; background: none; color: var(--fg3); cursor: pointer; width: 18px; padding: 0; font-size: 10px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 5px; color: #fff; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pill.ghost { background: var(--bg3) !important; color: var(--fg2); }
.gcount { color: var(--fg3); font-weight: 600; }
.table-wrap { overflow-x: auto; }
table.tasks { border-collapse: separate; border-spacing: 0; min-width: 100%; table-layout: fixed; }
table.tasks th { text-align: left; font-weight: 500; font-size: 11.5px; color: var(--fg3); padding: 4px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap; cursor: pointer; overflow: hidden; text-overflow: ellipsis; user-select: none; }
table.tasks th:hover { color: var(--fg); }
table.tasks td { height: var(--row-h); padding: 0 10px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; color: var(--fg2); }
table.tasks td.name-cell { color: var(--fg); font-weight: 500; }
table.tasks tr.t:hover td { background: var(--bg2); cursor: pointer; }
table.tasks tr.sub td.name-cell { font-weight: 400; }
table.tasks th:first-child, table.tasks td:first-child { position: sticky; left: 0; background: var(--bg); z-index: 1; }
table.tasks tr.t:hover td:first-child { background: var(--bg2); }
.name-in { display: flex; align-items: center; gap: 6px; min-width: 0; }
.name-in .nm { overflow: hidden; text-overflow: ellipsis; }
.st-ring { width: 13px; height: 13px; border-radius: 50%; border: 2px solid; flex: none; display: inline-block; }
.st-ring.closed { border-width: 0; }
.sub-toggle { border: 0; background: none; color: var(--fg3); cursor: pointer; width: 16px; padding: 0; flex: none; font-size: 10px; }
.badge { font-size: 11px; color: var(--fg3); flex: none; display: inline-flex; align-items: center; gap: 2px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; margin-right: 3px; background: var(--bg3); color: var(--fg2); font-weight: 500; }
.opt { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11.5px; font-weight: 600; color: #fff; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.opt.plain { background: var(--bg3); color: var(--fg2); }
.av { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; font-size: 10px; font-weight: 700;
  color: #fff; background: #7b68ee; margin-right: -5px; border: 2px solid var(--bg); vertical-align: middle; }
.flag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.p1 { color: #f2555a; } .p2 { color: #f5a623; } .p3 { color: #6f8cff; } .p4 { color: var(--fg3); }
.overdue { color: var(--danger) !important; }
.cell-edit { cursor: pointer; border-radius: 4px; padding: 2px 0; }
.empty-cell { color: var(--fg3); opacity: .6; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 6px; background: var(--bg4); overflow: hidden; display: inline-block; width: 70px; vertical-align: middle; margin-right: 6px; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.cb { width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--fg3); display: inline-block; vertical-align: middle; }
.cb.on { background: var(--ok); border-color: var(--ok); }
tr.foot td { border-bottom: 0; color: var(--fg3); font-size: 11.5px; height: 28px; }
.add-row td { color: var(--fg3); border-bottom: 0; }
.add-row input { border: 0; background: transparent; width: 100%; outline: none; padding: 2px 0; color: var(--fg); }
.add-row input::placeholder { color: var(--fg3); }

/* ------------------------------------------------------------------ board */
.board { display: flex; gap: 10px; align-items: flex-start; overflow-x: auto; padding: 14px 0 20px; }
.col { flex: 0 0 272px; background: var(--bg2); border-radius: 10px; padding: 8px; max-height: calc(100dvh - 190px); display: flex; flex-direction: column; border-top: 3px solid var(--c, var(--line2)); }
.col-head { display: flex; align-items: center; gap: 6px; padding: 2px 4px 8px; font-size: 12px; }
.col-body { overflow-y: auto; min-height: 40px; display: flex; flex-direction: column; gap: 6px; padding: 1px; }
.col.drop { outline: 2px dashed var(--accent); }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.card:hover { border-color: var(--line2); background: var(--bg3); }
.card .ct { font-weight: 500; overflow-wrap: anywhere; }
.card .meta { display: flex; gap: 8px; align-items: center; margin-top: 7px; font-size: 11px; color: var(--fg3); flex-wrap: wrap; }
.card .kv { font-size: 11.5px; color: var(--fg2); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .kv b { color: var(--fg3); font-weight: 500; margin-right: 4px; }

/* ----------------------------------------------------------------- drawer */
#drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100vw); background: var(--bg); box-shadow: var(--shadow);
  border-left: 1px solid var(--line); z-index: 20; overflow-y: auto; }
.dr-head { position: sticky; top: 0; background: var(--bg); padding: 10px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; z-index: 2; }
.dr-head .crumbs { flex: 1; margin: 0; }
.dr-body { padding: 18px 24px 80px; }
.task-name { width: 100%; font-size: 23px; font-weight: 700; border: 1px solid transparent; border-radius: 6px; padding: 4px 6px; margin-left: -6px; background: transparent; }
.task-name:hover, .task-name:focus { border-color: var(--line2); outline: none; }
.props { display: grid; grid-template-columns: 150px 1fr; gap: 4px 14px; margin: 14px 0 18px; align-items: center; }
.props > label { color: var(--fg3); font-size: 12.5px; display: flex; align-items: center; min-height: 32px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.props select, .props input[type=date], .props input[type=text], .props input[type=number], .props input[type=url], .props input[type=email] {
  border: 1px solid transparent; border-radius: 6px; padding: 5px 8px; background: transparent; max-width: 100%; color: var(--fg); }
.props select:hover, .props input:hover, .props select:focus, .props input:focus { border-color: var(--line2); background: var(--bg2); outline: none; }
.props select option { background: var(--bg2); }
.chips { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 9px; border-radius: 12px; background: var(--bg3); font-size: 12px; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--fg3); padding: 0 3px; }
.section { margin-top: 24px; }
.section h3 { font-size: 13px; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; font-weight: 650; }
.section h3 .sp { flex: 1; }
textarea.md { width: 100%; min-height: 160px; border: 1px solid var(--line2); border-radius: 8px; padding: 10px; background: var(--bg2); font-family: ui-monospace, Consolas, monospace; font-size: 13px; resize: vertical; }
.md-view { border: 1px solid transparent; border-radius: 8px; padding: 4px 2px; min-height: 30px; cursor: text; overflow-wrap: anywhere; }
.md-view:hover { border-color: var(--line2); }
.md-view pre { background: var(--bg2); padding: 8px; border-radius: 6px; overflow: auto; }
.md-view code { background: var(--bg3); padding: 0 4px; border-radius: 4px; font-size: 12.5px; }
.md-view img { max-width: 100%; }
.md-view table { border-collapse: collapse; } .md-view td, .md-view th { border: 1px solid var(--line2); padding: 3px 8px; }
.md-view blockquote { border-left: 3px solid var(--line2); margin: 0; padding-left: 10px; color: var(--fg2); }
.row-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; }
.row-item:hover { background: var(--bg2); }
.row-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.row-item .x { visibility: hidden; border: 0; background: none; color: var(--fg3); cursor: pointer; }
.row-item:hover .x { visibility: visible; }
.inline-add { width: 100%; border: 1px dashed var(--line2); border-radius: 6px; padding: 6px 8px; background: transparent; margin-top: 4px; outline: none; }
.inline-add:focus { border-color: var(--accent); }
.done-text { text-decoration: line-through; color: var(--fg3); }
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.att { border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 12px; position: relative; overflow: hidden; background: var(--bg2); }
.att img { width: 100%; height: 90px; object-fit: cover; border-radius: 4px; display: block; margin-bottom: 4px; }
.att .ext { height: 90px; display: flex; align-items: center; justify-content: center; background: var(--bg3); border-radius: 4px; margin-bottom: 4px; font-weight: 700; color: var(--fg3); text-transform: uppercase; }
.att a { text-decoration: none; color: inherit; }
.att .nm { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .x { position: absolute; top: 4px; right: 4px; border: 0; border-radius: 4px; background: var(--bg); cursor: pointer; display: none; }
.att:hover .x { display: block; }
.dropzone.drag { outline: 2px dashed var(--accent); }
.comment { border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; margin-bottom: 8px; background: var(--bg2); }
.comment .who { font-weight: 600; font-size: 12px; } .comment .when { color: var(--fg3); font-size: 11px; margin-left: 6px; }
.comment .txt { white-space: pre-wrap; margin-top: 4px; overflow-wrap: anywhere; }
.comment .replies { margin: 8px 0 0 14px; }
.foot-meta { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--fg3); font-size: 12px; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }

/* -------------------------------------------------------- menus & modals */
.menu { position: fixed; z-index: 50; background: var(--bg2); border: 1px solid var(--line2); border-radius: 9px; box-shadow: var(--shadow); padding: 4px; min-width: 190px;
  max-height: 70vh; overflow-y: auto; }
.menu button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: none; padding: 6px 10px; border-radius: 6px; cursor: pointer; color: var(--fg); }
.menu button:hover { background: var(--bg3); }
.menu button.danger { color: var(--danger); }
.menu button.cur { color: var(--accent2); font-weight: 600; }
.menu hr { border: 0; border-top: 1px solid var(--line2); margin: 4px 0; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 40; display: flex; align-items: flex-start; justify-content: center; padding: 7vh 16px; }
.modal { background: var(--bg2); border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--shadow); width: min(640px, 100%); max-height: 86vh; display: flex; flex-direction: column; }
.modal header { padding: 14px 18px; font-weight: 700; border-bottom: 1px solid var(--line2); }
.modal .mb { padding: 14px 18px; overflow: auto; }
.modal footer { padding: 10px 18px; border-top: 1px solid var(--line2); display: flex; justify-content: flex-end; gap: 8px; }
.modal input[type=text], .modal select { border: 1px solid var(--line2); border-radius: 6px; padding: 5px 8px; background: var(--bg); }
.modal h4 { margin: 16px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--fg3); }
.modal h4:first-child { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; align-items: center; }
.col-pick { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; }
.col-pick:hover { background: var(--bg3); }
.col-pick .grow { flex: 1; }
.st-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.st-row input[type=text] { flex: 1; }
.st-row input[type=color] { width: 34px; height: 30px; border: 1px solid var(--line2); border-radius: 6px; padding: 1px; background: var(--bg); }
pre.raw { background: var(--bg); padding: 10px; border-radius: 8px; overflow: auto; font-size: 12px; max-height: 60vh; }

/* ------------------------------------------------------------------- docs */
.doc-layout { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100dvh - 80px); }
.doc-pages { border-right: 1px solid var(--line); padding: 10px 8px; }
.doc-main { padding: 18px 28px 60px; max-width: 900px; }
.doc-main .task-name { font-size: 27px; }
.empty { padding: 60px 20px; text-align: center; color: var(--fg3); }
.search-res .row-item { cursor: pointer; }
.info-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.info-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--bg2); }

/* ------------------------------------------------------------------ login */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(circle at 20% 10%, rgba(123,104,238,.25), transparent 50%), radial-gradient(circle at 90% 90%, rgba(229,79,161,.18), transparent 45%), var(--bg); }
.login { width: min(380px, 100%); background: var(--bg2); border: 1px solid var(--line2); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.login h1 { font-size: 20px; margin: 14px 0 4px; }
.login label { display: block; font-size: 12px; color: var(--fg3); margin: 14px 0 4px; }
.login input { width: 100%; padding: 9px 11px; border: 1px solid var(--line2); border-radius: 8px; background: var(--bg); outline: none; }
.login input:focus { border-color: var(--accent); }
.login .btn { width: 100%; margin-top: 20px; padding: 9px; }
.login .err { color: var(--danger); font-size: 12.5px; min-height: 18px; margin-top: 10px; }

/* ------------------------------------------------------------------ phone */
@media (max-width: 760px) {
  #app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  #topbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--side);
    padding-top: max(8px, env(safe-area-inset-top)); }
  #topbar .t { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #sidebar { position: fixed; inset: 0 auto 0 0; width: min(86vw, 320px); z-index: 30; transform: translateX(-102%); transition: transform .2s ease;
    box-shadow: var(--shadow); padding-top: env(safe-area-inset-top); }
  body.nav-open #sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 25; }
  .page-head { padding: 8px 12px 0; position: static; }
  .viewbar { padding: 8px 12px; }
  .content { padding: 4px 12px 80px; }
  .title-row h1 { font-size: 17px; }
  #drawer { width: 100vw; }
  .dr-body { padding: 14px 14px 80px; }
  .props { grid-template-columns: 110px 1fr; }
  .doc-layout { grid-template-columns: 1fr; }
  .doc-pages { border-right: 0; border-bottom: 1px solid var(--line); }
  .col { flex-basis: 82vw; }
  .node { padding: 8px 6px; }
  .tab { padding: 8px 10px 10px; }
}

/* ---- quick nav, home, trash, history ---- */
#quick { display: flex; gap: 4px; margin: 0 12px 8px; }
#quick a { flex: 1; padding: 5px 8px; border-radius: 6px; color: var(--fg2); text-decoration: none; font-size: 13px; }
#quick a:hover { background: var(--bg3); color: var(--fg); }
#quick a.active { background: var(--accent-bg); color: var(--fg); font-weight: 600; }
.home .stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.home .stat { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; min-width: 120px; }
.home .stat b { display: block; font-size: 22px; }
.home .stat span { color: var(--fg3); font-size: 12px; }
.home .stat.warn b { color: var(--danger); }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; margin-bottom: 22px; }
.home-card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; max-height: 420px; overflow: auto; }
.home-card h3 { margin: 2px 0 8px; font-size: 14px; }
.home-card .row-item { cursor: pointer; gap: 8px; }
.home-card .row-item .muted { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.due { font-size: 12px; color: var(--fg2); white-space: nowrap; }
.due.late, td.late { color: var(--danger); font-weight: 600; }
td.warnc { color: var(--warn); }
table.health { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 16px; }
table.health th { text-align: left; color: var(--fg3); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.health td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.health tbody tr { cursor: pointer; }
table.health tbody tr:hover { background: var(--bg3); }
.muted.small { font-size: 11px; }
details.dormant summary, details.history summary { cursor: pointer; font-weight: 600; margin: 6px 0; }
.hist { font-size: 12px; padding: 3px 0; color: var(--fg2); border-bottom: 1px dashed var(--line); }
.hist .when { color: var(--fg3); }
.hist .old { text-decoration: line-through; color: var(--fg3); }
@media (max-width: 700px) {
  .home-grid { grid-template-columns: 1fr; }
  table.health th:nth-child(4), table.health td:nth-child(4), table.health th:nth-child(5), table.health td:nth-child(5) { display: none; }
}

/* ---- reminders, quick add, settings ---- */
.remind { display: flex; flex-direction: column; gap: 6px; }
.remind input[type=datetime-local] { max-width: 230px; }
.snooze { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { border: 1px solid var(--line2); background: var(--bg3); color: var(--fg2); border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.chip-btn:hover { color: var(--fg); border-color: var(--accent); }
.quick-add { margin-bottom: 16px; }
.qa-row { display: flex; gap: 8px; }
.qa-input { flex: 1; min-width: 0; padding: 10px 12px; font-size: 16px; border: 1px solid var(--line2); border-radius: var(--radius); background: var(--bg2); color: var(--fg); }
.qa-input:focus { outline: none; border-color: var(--accent); }
.qa-list { max-width: 40%; border: 1px solid var(--line2); border-radius: var(--radius); background: var(--bg2); color: var(--fg); padding: 0 8px; }
.qa-hint { margin-top: 4px; min-height: 16px; }
#quick a[href="#/settings"] { flex: 0 0 auto; }
.settings .info-card { margin-bottom: 14px; max-width: 640px; }
.settings input[type=time], .settings input[list] { border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; background: var(--bg); color: var(--fg); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
@media (max-width: 700px) { .qa-row { flex-direction: column; } .qa-list { max-width: none; padding: 8px; } }
