
/* ProjectHubb. System fonts only, nothing loaded from outside your server.
   Layout: FileHubb desk shell. Top bar, category sidebar, workspace, Ollama panel on the right, status bar. */
:root {
  --bg: #f4f6f9; --surface: #ffffff; --surface2: #eef1f5; --raise: #ffffff; --line: #dde3ea; --line2: #cfd7e1;
  --text: #111827; --text2: #374151; --muted: #5b6675;
  --accent: #0b8a60; --accent-ink: #ffffff; --accent-soft: rgba(11,138,96,.10);
  --danger: #c62828; --ok: #0b8a60; --off: #9aa4b2;
  --shadow: 0 10px 30px rgba(17,24,39,.14); --scrim: rgba(15,20,30,.45);
  --c-blue: #2f5fd0; --c-purple: #7b3fc4; --c-amber: #a35f00; --c-rose: #b8325a; --c-teal: #0b8a60; --c-green: #2f7d32; --c-red: #c62828; --c-slate: #4b5768; --c-cyan: #0a7a99; --c-pink: #b0307e;
  --g1: #9d4edd; --g2: #2ec4b6;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117; --surface: #151b24; --surface2: #1b2330; --raise: #1b2330; --line: #263040; --line2: #2f3a4c;
    --text: #e6edf3; --text2: #c9d1db; --muted: #8b97a6;
    --accent: #5ee3b0; --accent-ink: #0d1117; --accent-soft: rgba(94,227,176,.09);
    --danger: #ff8a80; --ok: #5ee3b0; --off: #4a5566;
    --shadow: 0 12px 30px rgba(0,0,0,.5); --scrim: rgba(0,0,0,.6);
    --c-blue: #7aa2ff; --c-purple: #c39bff; --c-amber: #f5b866; --c-rose: #ff9fb6; --c-teal: #5ee3b0; --c-green: #8fdc8a; --c-red: #ff8a80; --c-slate: #a9b4c4; --c-cyan: #6fd6f2; --c-pink: #ff8fd2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1117; --surface: #151b24; --surface2: #1b2330; --raise: #1b2330; --line: #263040; --line2: #2f3a4c;
  --text: #e6edf3; --text2: #c9d1db; --muted: #8b97a6;
  --accent: #5ee3b0; --accent-ink: #0d1117; --accent-soft: rgba(94,227,176,.09);
  --danger: #ff8a80; --ok: #5ee3b0; --off: #4a5566;
  --shadow: 0 12px 30px rgba(0,0,0,.5); --scrim: rgba(0,0,0,.6);
  --c-blue: #7aa2ff; --c-purple: #c39bff; --c-amber: #f5b866; --c-rose: #ff9fb6; --c-teal: #5ee3b0; --c-green: #8fdc8a; --c-red: #ff8a80; --c-slate: #a9b4c4; --c-cyan: #6fd6f2; --c-pink: #ff8fd2;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 13.5px/1.45 var(--sans); overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
svg.i { width: 18px; height: 18px; flex-shrink: 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

/* shell */
.app { height: 100%; display: grid; grid-template-rows: auto 1fr auto auto; }
.top { display: flex; align-items: center; gap: 8px; padding-block: 8px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); border-bottom: 1px solid var(--line); background: var(--bg); }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); border: 0; background: none; padding: 0; }
.brand svg { width: 28px; height: 28px; }
.wordmark { font-size: 17px; font-weight: 400; letter-spacing: -.4px; }
.wordmark span { font-weight: 800; background: linear-gradient(90deg, var(--g1), var(--g2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.search { flex: 1; max-width: 420px; margin-left: 18px; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; color: var(--muted); }
.search input { border: 0; background: none; outline: none; flex: 1; min-width: 0; color: var(--text); }
.kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line2); border-radius: 5px; padding: 0 5px; }
.spacer { flex: 1; }
.tbtn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 9px; border: 1px solid transparent; background: none; color: var(--text); white-space: nowrap; }
.tbtn:hover { background: var(--surface2); }
.tbtn.on { background: var(--accent-soft); color: var(--accent); }
.tbtn.primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tbtn.ghost { border-color: var(--line); background: var(--surface); }
.ibtn { width: 34px; height: 34px; display: grid; place-items: center; border: 0; background: none; border-radius: 9px; color: var(--text); }
.ibtn:hover { background: var(--surface2); }
.menu-btn { display: none; }

.body { display: grid; grid-template-columns: 236px 1fr auto; min-height: 0; }
.side { border-right: 1px solid var(--line); overflow-y: auto; padding: 10px 10px 14px; display: flex; flex-direction: column; gap: 2px; background: var(--bg); }
.slabel { display: flex; justify-content: space-between; align-items: center; padding: 14px 8px 6px; font-size: 11.5px; font-weight: 650; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.slabel button { border: 0; background: none; color: var(--muted); padding: 2px; border-radius: 6px; display: grid; }
.slabel button:hover { color: var(--accent); }
.nav { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; border: 0; background: none; width: 100%; text-align: left; color: var(--text); }
.nav:hover { background: var(--surface2); }
.nav.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav .ct { margin-left: auto; font-size: 11px; font-family: var(--mono); color: var(--muted); }
.nav .pill-n { margin-left: auto; font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.chip-ic { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex-shrink: 0; color: var(--cc); background: color-mix(in srgb, var(--cc) 15%, transparent); }
.chip-ic svg.i { width: 15px; height: 15px; }
.side-foot { margin-top: auto; padding: 16px 8px 0; font-size: 11.5px; color: var(--muted); }

.main { overflow-y: auto; min-width: 0; padding-block: 22px 40px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 12px; display: flex; flex-direction: column; gap: 22px; }
.mock-note { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); border: 1px dashed var(--line2); border-radius: 9px; padding: 7px 11px; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.4px; margin: 0; text-wrap: balance; }
h2 { font-size: 13px; font-weight: 650; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin: 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12.5px; }

/* filter chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.fchip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 15px; border: 1px solid var(--line); background: var(--surface); color: var(--text2); }
.fchip svg.i { width: 14px; height: 14px; color: var(--cc, currentColor); }
.fchip.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* project cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; text-align: left; padding: 0; color: inherit; }
.pcard:hover { border-color: var(--line2); box-shadow: var(--shadow); }
.pcard .cover { aspect-ratio: 16/7; width: 100%; max-width: 100%; display: block; object-fit: cover; background: var(--surface2); }
.pcard .pb { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pcard .pt { display: flex; align-items: center; gap: 9px; }
.pcard .pt b { font-size: 15px; font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .sum { color: var(--text2); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 36px; }
.pcard .meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-top: auto; }
.next { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; min-width: 0; }
.next span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 6px; border-radius: 3px; background: var(--surface2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--g1), var(--g2)); }
.status { font-size: 11px; font-weight: 650; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.s-Active { background: var(--accent-soft); color: var(--accent); }
.s-Planning { background: color-mix(in srgb, var(--c-blue) 15%, transparent); color: var(--c-blue); }
.s-On-hold { background: color-mix(in srgb, var(--c-amber) 15%, transparent); color: var(--c-amber); }
.s-Done { background: var(--surface2); color: var(--muted); }
.newcard { border: 1px dashed var(--line2); border-radius: 14px; display: grid; place-items: center; min-height: 220px; color: var(--muted); background: none; gap: 6px; }
.newcard:hover { color: var(--accent); border-color: var(--accent); }

/* two column home lower */
.cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.panel-h { display: flex; justify-content: space-between; align-items: center; }
.link-btn { border: 0; background: none; color: var(--accent); font-weight: 550; padding: 2px 0; display: inline-flex; gap: 5px; align-items: center; }
.list { display: flex; flex-direction: column; }
.li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); }
.li:first-child { border-top: 0; }
.li .lt { flex: 1; min-width: 0; }
.li .lt small { display: block; color: var(--muted); font-size: 11.5px; }
.check { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line2); background: none; flex-shrink: 0; display: grid; place-items: center; padding: 0; margin-top: 1px; color: var(--accent-ink); }
.check.on { background: var(--accent); border-color: var(--accent); }
.check svg.i { width: 13px; height: 13px; }
.done-t { text-decoration: line-through; color: var(--muted); }

/* project page */
.phead { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.phead .big-ic { width: 56px; height: 56px; border-radius: 14px; }
.phead .big-ic svg.i { width: 28px; height: 28px; }
.phead .ptitle { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 4px; }
.crumb { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.crumb button { border: 0; background: none; color: var(--muted); padding: 0; }
.crumb button:hover { color: var(--accent); }
.ring { width: 58px; height: 58px; position: relative; display: grid; place-items: center; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tab { border: 0; background: none; padding: 9px 12px; display: inline-flex; gap: 7px; align-items: center; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab .n { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.ov { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 14px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; }
.tag { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 10px; background: var(--surface2); color: var(--text2); margin: 0 4px 4px 0; }
.path { font-family: var(--mono); font-size: 12px; color: var(--muted); word-break: break-all; }

/* kanban */
.board { display: grid; grid-template-columns: repeat(4, minmax(200px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.col { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 260px; }
.col.over { border-color: var(--accent); background: var(--accent-soft); }
.col-h { display: flex; align-items: center; gap: 8px; padding: 2px 4px 4px; font-weight: 650; }
.col-h .dotc { width: 8px; height: 8px; border-radius: 4px; background: var(--cc); }
.col-h .ct { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.kcard { background: var(--raise); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; display: flex; flex-direction: column; gap: 6px; cursor: grab; }
.kcard.dragging { opacity: .4; }
.kcard .kt { font-size: 13px; }
.kcard .km { display: flex; gap: 8px; font-size: 11px; color: var(--muted); align-items: center; }
.kcard .km svg.i { width: 12px; height: 12px; }
.prio { width: 6px; height: 6px; border-radius: 3px; display: inline-block; }
.p-high { background: var(--c-red); } .p-med { background: var(--c-amber); } .p-low { background: var(--off); }
.addk { display: flex; gap: 6px; }
.inp { height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); color: var(--text); min-width: 0; flex: 1; outline: none; }
.inp:focus { border-color: var(--accent); }
textarea.inp { height: auto; padding: 9px 10px; resize: vertical; line-height: 1.5; }

/* notes */
.notes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.note { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.note b { font-size: 14px; }
.note p { margin: 0; color: var(--text2); font-size: 13px; white-space: pre-wrap; }
.note .nm { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--muted); margin-top: auto; gap: 8px; }
.note select { font-size: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); padding: 2px 4px; max-width: 150px; }
.compose { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }

/* links */
.links { display: flex; flex-direction: column; }
.linkrow { display: flex; gap: 12px; align-items: center; padding: 11px 4px; border-top: 1px solid var(--line); text-decoration: none; color: var(--text); }
.linkrow:first-child { border-top: 0; }
.linkrow .fav { width: 34px; height: 34px; border-radius: 9px; background: var(--surface2); display: grid; place-items: center; color: var(--muted); flex-shrink: 0; }
.linkrow .lt { flex: 1; min-width: 0; }
.linkrow .lt small { display: block; color: var(--muted); font-family: var(--mono); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* gallery */
.gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.gimg { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); padding: 0; text-align: left; color: inherit; }
.gimg img { width: 100%; max-width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.gimg span { display: block; padding: 7px 10px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; padding: 2px; background: var(--surface); }
.seg button { border: 0; background: none; padding: 4px 10px; border-radius: 7px; display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.seg button.on { background: var(--surface2); color: var(--text); font-weight: 600; }
.cboard { position: relative; height: 560px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background-color: var(--surface); background-image: radial-gradient(var(--line2) 1px, transparent 1px); background-size: 22px 22px; touch-action: none; }
.bitem { position: absolute; border-radius: 10px; box-shadow: var(--shadow); cursor: grab; user-select: none; }
.bitem img { display: block; width: 100%; border-radius: 10px 10px 0 0; pointer-events: none; }
.bitem.img { background: var(--raise); border: 1px solid var(--line); }
.bitem.img span { display: block; padding: 5px 8px; font-size: 11.5px; }
.bitem.sticky { background: color-mix(in srgb, var(--c-amber) 22%, var(--raise)); border: 1px solid color-mix(in srgb, var(--c-amber) 40%, transparent); padding: 10px 12px; width: 170px; font-size: 12.5px; }

/* files / records */
.ftable { width: 100%; border-collapse: collapse; font-size: 13px; }
.ftable th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ftable td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ftable tr:hover td { background: var(--surface2); }
.fname { display: flex; gap: 9px; align-items: center; }
.fname img { width: 34px; height: 26px; object-fit: cover; border-radius: 4px; }
.scroll-x { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.drop { border: 1.5px dashed var(--line2); border-radius: 14px; padding: 18px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); text-align: center; flex-wrap: wrap; }

/* writing */
.writer { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 14px; min-height: 560px; }
.chapters { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.chap { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 8px; border-radius: 8px; text-align: left; color: var(--text); }
.chap:hover { background: var(--surface2); }
.chap.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.chap small { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.paper { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; min-width: 0; }
.paper-bar { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.paper-bar .ibtn { width: 30px; height: 30px; }
.paper textarea { flex: 1; border: 0; outline: none; background: none; resize: none; padding: 28px clamp(16px, 6vw, 72px); font: 17px/1.75 var(--serif); color: var(--text); min-height: 440px; }
.paper-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; flex-wrap: wrap; align-items: center; }
.goal { width: 120px; }

/* ideas */
.ideas { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.idea { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.idea b { font-size: 15px; }
.idea p { margin: 0; color: var(--text2); font-size: 13px; }
.idea .ia { display: flex; gap: 6px; margin-top: auto; flex-wrap: wrap; align-items: center; }
.heat { display: inline-flex; gap: 2px; }
.heat i { width: 7px; height: 7px; border-radius: 2px; background: var(--surface2); }
.heat i.on { background: var(--c-amber); }

/* Ollama panel */
.ai { width: 340px; border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.ai[hidden] { display: none; }
.ai-h { display: flex; align-items: center; gap: 9px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ai-h .av { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, var(--g1), var(--g2)); color: #fff; }
.ai-h b { display: block; font-size: 14px; }
.ai-h small { display: block; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.ai-ctx { padding: 8px 14px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); display: flex; gap: 6px; align-items: center; }
.ai-ctx b { color: var(--text); font-weight: 600; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.qa { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; padding: 5px 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text2); }
.qa:hover { border-color: var(--accent); color: var(--accent); }
.qa svg.i { width: 13px; height: 13px; }
.chat { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 92%; padding: 9px 12px; border-radius: 12px; font-size: 13px; white-space: pre-wrap; }
.msg.me { align-self: flex-end; background: var(--accent-soft); color: var(--text); border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg .acts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.typing { display: inline-flex; gap: 3px; }
.typing i { width: 6px; height: 6px; border-radius: 3px; background: var(--muted); animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .2; } }
.ai-in { display: flex; gap: 6px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }

/* status bar */
.sbar { display: flex; gap: 18px; align-items: center; padding-block: 6px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.sbar span { display: inline-flex; gap: 6px; align-items: center; }
.sbar svg.i { width: 14px; height: 14px; }
.dot { width: 7px; height: 7px; border-radius: 4px; background: var(--ok); }

/* sheet / dialog */
.scrim { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; z-index: 50; padding: 16px; }
.dialog { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); width: min(560px, 100%); max-height: calc(100% - 20px); overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.dialog h3 { margin: 0; font-size: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field .inp, .compose .inp { flex: none; }
.field > label { font-size: 12px; font-weight: 600; color: var(--muted); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.sw { width: 28px; height: 28px; border-radius: 8px; border: 2px solid transparent; background: var(--cc); padding: 0; }
.sw.on { border-color: var(--text); }
.icongrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 4px; max-height: 236px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: var(--bg); }
.icongrid button { aspect-ratio: 1; border: 1px solid transparent; border-radius: 8px; background: none; display: grid; place-items: center; color: var(--text2); padding: 0; }
.icongrid button:hover { background: var(--surface2); }
.icongrid button.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; }
.preview-ic { display: flex; align-items: center; gap: 10px; }
.lightbox img { width: 100%; max-width: 100%; border-radius: 10px; display: block; }
.toast { position: fixed; left: 50%; bottom: calc(46px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 10px; font-size: 13px; z-index: 60; box-shadow: var(--shadow); max-width: calc(100% - 32px); }

/* responsive */
@media (max-width: 1240px) {
  .ai { position: fixed; right: 0; top: 51px; bottom: 0; z-index: 30; box-shadow: var(--shadow); width: min(360px, 100%); }
}
@media (max-width: 900px) {
  .body { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 51px; bottom: 0; width: 260px; z-index: 40; box-shadow: var(--shadow); transform: translateX(-105%); transition: transform .2s; }
  .side.open { transform: none; }
  .menu-btn { display: grid; }
  .search { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols, .ov { grid-template-columns: 1fr; }
  .writer { grid-template-columns: 1fr; }
  .chapters { flex-direction: row; overflow-x: auto; }
  .chap { white-space: nowrap; }
  .hide-sm { display: none; }
  .wrap { padding: 0; }
  .sbar .hide-sm { display: none; }
}

/* phone tab bar */
.tabbar { display: none; }
.tabbar button { border: 0; background: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; padding: 6px 0; }
.tabbar button.on { color: var(--accent); font-weight: 600; }
.tabbar svg.i { width: 22px; height: 22px; }
.tabbar .fab { width: 46px; height: 46px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; margin: -6px auto 0; }
@media (max-width: 900px) {
  .sbar { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; border-top: 1px solid var(--line); background: var(--bg); padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
  #aiBtn { display: none; }
  .main { padding-block: 14px 24px; }
  .wrap { gap: 16px; }
  h1 { font-size: 21px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
  .fchip { flex-shrink: 0; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 10px; border-radius: 12px; }
  .stat b { font-size: 20px; }
  .stat span { font-size: 11px; line-height: 1.25; }
  .pcard .cover { aspect-ratio: 16/6; }
  .phead { gap: 12px; }
  .phead .big-ic { width: 44px; height: 44px; }
  .ring { width: 46px; height: 46px; font-size: 11px; }
  .board { grid-template-columns: repeat(4, 84%); scroll-snap-type: x mandatory; margin-inline: -16px; padding-inline: 16px; scroll-padding-inline: 16px; }
  .col { scroll-snap-align: start; min-height: 0; }
  .ai { top: 0; width: 100%; z-index: 45; }
  .scrim { align-items: end; padding: 0; }
  .dialog { width: 100%; border-radius: 18px 18px 0 0; max-height: 92%; padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
  .paper textarea { font-size: 16px; padding: 18px; min-height: 360px; }
  .cboard { height: 460px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- real app additions ---------- */
.mock-note { display: none; }
.login { height: 100%; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-left, 0px)); }
.login-card { width: min(360px, 100%); display: flex; flex-direction: column; gap: 14px; align-items: stretch; text-align: center; }
.login-card svg.mark { width: 72px; height: 72px; margin: 0 auto; }
.login-card .wordmark { font-size: 26px; }
.login-card .err { color: var(--danger); font-size: 13px; min-height: 18px; }
.login-card .inp { height: 44px; font-size: 16px; text-align: center; flex: none; }
.login-card .tbtn { height: 44px; justify-content: center; }
.side-foot button { border: 0; background: none; color: var(--muted); padding: 4px 0; display: inline-flex; gap: 6px; align-items: center; font-size: 12px; }
.side-foot button:hover { color: var(--accent); }
.pcard { cursor: pointer; }
.pcard.archived { opacity: .6; }
.kcard { cursor: pointer; }
.kcard .kt { word-break: break-word; }
.due-late { color: var(--danger); }
.icon-action { border: 0; background: none; color: var(--muted); padding: 4px; border-radius: 6px; display: inline-grid; place-items: center; }
.icon-action:hover { color: var(--danger); background: var(--surface2); }
.icon-action.plain:hover { color: var(--accent); }
.icon-action svg.i { width: 15px; height: 15px; }
.note .acts, .linkrow .acts { display: flex; gap: 2px; }
.linkrow { gap: 10px; }
.linkrow a { display: flex; gap: 12px; align-items: center; flex: 1; min-width: 0; text-decoration: none; color: var(--text); }
.empty { padding: 26px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line2); border-radius: 14px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.empty svg.i { width: 28px; height: 28px; opacity: .7; }
.dlg-foot.split { justify-content: space-between; }
.danger-btn { color: var(--danger) !important; border-color: var(--danger-line, var(--line)) !important; }
.checkrow { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.checkrow input { width: 16px; height: 16px; accent-color: var(--accent); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.uploads { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(44px + env(safe-area-inset-bottom, 0px)); z-index: 55; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px; width: min(300px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.uploads .bar { height: 4px; }
.results { display: flex; flex-direction: column; gap: 8px; }
.result { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-align: left; color: var(--text); width: 100%; }
.result small { display: block; color: var(--muted); font-size: 12px; }
.result mark { background: var(--accent-soft); color: var(--accent); border-radius: 3px; }
.msg .md-list { margin: 4px 0 0; padding-left: 18px; }
.ai-warn { margin: 10px 14px 0; padding: 8px 10px; border-radius: 9px; font-size: 12px; background: color-mix(in srgb, var(--c-amber) 14%, transparent); color: var(--c-amber); }
.bitem .x { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); display: none; place-items: center; padding: 0; }
.bitem:hover .x { display: grid; }
.bitem.sticky textarea { width: 100%; border: 0; background: none; resize: none; outline: none; font: inherit; color: var(--text); min-height: 60px; cursor: text; }
.rec-inp { height: 28px; padding: 0 6px; border: 1px solid transparent; background: none; border-radius: 6px; width: 100%; min-width: 80px; }
.rec-inp:hover, .rec-inp:focus { border-color: var(--line); background: var(--bg); outline: none; }
.lightbox .lb-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.paper.focus { position: fixed; inset: 0; z-index: 70; border-radius: 0; }
.paper.focus textarea { max-width: 780px; margin: 0 auto; width: 100%; }
.cat-edit { opacity: 0; }
.nav:hover .cat-edit { opacity: 1; }
.tbtn:disabled { opacity: .5; cursor: default; }
@media (max-width: 900px) {
  .uploads { bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
  .two { grid-template-columns: 1fr; }
  .cat-edit { opacity: 1; }
}
