/* app.css — Opus Notes.

   A quiet academic tool: warm paper in light, ink and slate in dark, one
   restrained teal for selection and primary actions. The sidebar and lists
   are a compact sans; the reading surface is a serif; raw Markdown is mono.
   Distinctness lives in colour and content, never in where things sit —
   the suite's chrome grammar. */

:root {
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Source Serif 4", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --bg: #f4f1e9;            /* warm paper */
  --panel: #faf8f2;
  --panel-2: #fffdf8;
  --ink: #23292f;
  --dim: #71767c;
  --faint: #a3a49e;
  --line: #e2ddcf;
  --line-soft: #ebe7da;
  /* The accent family is the logo's own: deep slate #4e6481 (the gradient's
     blue, 5.9:1 under near-white button text), rose #905563 for danger.
     Sampled from branding/Opus Note Logo.png, not approximated. */
  --accent: #4e6481;
  --accent-ink: #fffdf8;
  --accent-soft: #e5eaf2;
  --danger: #905563;
  --warn-bg: #f3ead6;
  --ok-bg: #e5eaf2;
  --card: #fffdf8;
  --shadow: 0 10px 30px rgba(40, 36, 25, 0.14);
  --sel: #ece7d8;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161b;          /* ink / slate */
    --panel: #171c22;
    --panel-2: #1b2129;
    --ink: #e6e4dc;
    --dim: #98a0a8;
    --faint: #6c737b;
    --line: #262d36;
    --line-soft: #212831;
    /* Dark accent is the nib's pale slate, straight off the artwork. */
    --accent: #8d9db4;
    --accent-ink: #0e1418;
    --accent-soft: #222b38;
    --danger: #c98d9b;
    --warn-bg: #2b2a1e;
    --ok-bg: #222b38;
    --card: #1b2129;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --sel: #232b35;
  }
}
:root[data-theme="dark"] {
  --bg: #12161b;
  --panel: #171c22;
  --panel-2: #1b2129;
  --ink: #e6e4dc;
  --dim: #98a0a8;
  --faint: #6c737b;
  --line: #262d36;
  --line-soft: #212831;
  --accent: #8d9db4;
  --accent-ink: #0e1418;
  --accent-soft: #222b38;
  --danger: #c98d9b;
  --warn-bg: #2b2a1e;
  --ok-bg: #222b38;
  --card: #1b2129;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  --sel: #232b35;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a.ext { text-decoration: underline; text-underline-offset: 2px; }

.ic { display: inline-flex; }
.ic svg { width: 16px; height: 16px; display: block; }

/* ------------------------------- layout ---------------------------------- */

#app {
  display: grid;
  grid-template-columns: 240px 300px 1fr;
  height: 100dvh;
}
body[data-view="capture"] #app,
body[data-view="scratchpad"] #app,
body[data-view="settings"] #app,
body[data-view="login"] #app {
  grid-template-columns: 240px 1fr;
}
body[data-view="capture"] #mid,
body[data-view="scratchpad"] #mid,
body[data-view="settings"] #mid,
body[data-view="login"] #mid { display: none; }

#side {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px 10px 10px;
  gap: 4px;
}
#mid {
  background: var(--panel-2);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }

#fab { display: none; }
#drawerVeil { display: none; }

/* ------------------------------- sidebar ---------------------------------- */

.crumb-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 6px 10px;
}
.crumb-bench img { width: 18px; height: 18px; border-radius: 4px; display: block; }
.crumb-sep { color: var(--faint); font-size: 13px; }
.crumb-app { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.crumb-app img { width: 18px; height: 18px; border-radius: 4px; display: block; }
.wordmark { font-weight: 650; letter-spacing: 0.1px; white-space: nowrap; }

.btn-new {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 4px 10px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.btn-new:hover { filter: brightness(1.06); }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: 7px;
  color: var(--ink);
  position: relative;
}
.nav-item .ic { color: var(--dim); }
.nav-item:hover { background: var(--sel); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item.active .ic { color: var(--accent); }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count { color: var(--faint); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.nav-item.dropping { outline: 2px solid var(--accent); outline-offset: -2px; }

.cats-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding: 2px 8px 2px 4px;
}
.cats-toggle {
  display: flex; align-items: center; gap: 5px;
  color: var(--dim);
  font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.6px;
}
.chev { display: inline-block; transition: transform 0.12s; }
.chev.open { transform: rotate(90deg); }
.cats { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; }
.cats-empty { color: var(--faint); font-size: 12.5px; padding: 4px 8px; }
.nav-item .row-menu { opacity: 0; }
.nav-item:hover .row-menu { opacity: 1; }

.side-foot {
  margin-top: auto;
  border-top: 1px solid var(--line-soft);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.foot-row { display: flex; align-items: center; gap: 6px; }
.foot-mail {
  color: var(--dim);
  font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-left: 2px;
  flex: 1;
}
.foot-mail.signin { color: var(--accent); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 6px;
  color: var(--dim);
}
.icon-btn:hover { background: var(--sel); color: var(--ink); }
.icon-btn.on { color: var(--accent); background: var(--accent-soft); }

.chip {
  align-self: flex-start;
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid var(--line);
  color: var(--dim);
  background: var(--panel-2);
}
.chip-ok { background: var(--ok-bg); color: var(--accent); border-color: transparent; }
.chip-warn { background: var(--warn-bg); border-color: transparent; }
.chip-busy { border-style: dashed; }

.mini-btn {
  font-size: 12.5px;
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}
.mini-btn:hover { background: var(--sel); }
.mini-btn.danger { color: var(--danger); }
.btn-save {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
}
.btn-save:hover { filter: brightness(1.06); }

/* ------------------------------ list (mid) -------------------------------- */

.mid-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 6px;
}
.mid-head h2 { font-size: 15px; margin: 0; font-weight: 650; }
.mid-count { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.mid-head .mini-btn { margin-left: auto; }
.mid-tools { padding: 0 12px 8px; }
.mid-search {
  width: 100%;
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--panel);
  outline: none;
}
.mid-search:focus { border-color: var(--accent); }

.bulk {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background: var(--accent-soft);
  font-size: 12.5px;
}

.mid-list { overflow-y: auto; flex: 1; padding: 2px 6px 12px; }
.empty-line { color: var(--faint); padding: 18px 10px; font-size: 13px; }

.row {
  padding: 8px 9px;
  border-radius: 8px;
  cursor: default;
  border: 1px solid transparent;
}
.row:hover { background: var(--sel); }
.row.open { background: var(--accent-soft); }
.row.selected { border-color: var(--accent); }
.row-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.row-title {
  font-weight: 600;
  font-size: 13.5px;
  flex: 1;
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-pin svg, .row-fav svg { width: 12px; height: 12px; }
.row-pin { color: var(--accent); }
.row-fav { color: #b98b2e; }
.row-time { color: var(--faint); font-size: 11px; white-space: nowrap; }
.row-snippet {
  color: var(--dim);
  font-size: 12.5px;
  margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-tags { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
.tagchip {
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 7px;
  border-radius: 99px;
}
.tagchip:hover { filter: brightness(0.96); }

/* -------------------------------- editor ---------------------------------- */

.editor { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.editor-empty {
  margin: auto;
  color: var(--faint);
  font-size: 14px;
}
.ed-head { display: flex; align-items: center; gap: 6px; padding: 12px 18px 0; }
.back-btn { display: none; }
.ed-title {
  flex: 1;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 650;
  border: 0;
  background: none;
  outline: none;
  padding: 4px 0;
  color: var(--ink);
}
.ed-title::placeholder { color: var(--faint); font-style: italic; }

.trash-note {
  margin: 8px 18px 0;
  padding: 8px 12px;
  background: var(--warn-bg);
  border-radius: 8px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
}

.ed-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.bar-gap { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg-btn { padding: 4px 11px; font-size: 12.5px; color: var(--dim); }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.ed-body { flex: 1; min-height: 0; display: flex; }
.ed-ta {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  resize: none;
  background: none;
  padding: 16px 18px 24px;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink);
}
.ed-rich {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 16px 22px 24px;
  outline: none;
  caret-color: var(--accent);
}
.ed-rich:empty::before { content: 'Write — the toolbar and right-click carry the formatting.'; color: var(--faint); font-style: italic; }
.ed-rich a { cursor: pointer; }
.ed-rich li.task input { accent-color: var(--accent); }
.ed-body.mode-write .ed-ta { display: none; }
.ed-body.mode-markdown .ed-rich { display: none; }
.ed-body.mode-both .ed-rich { border-left: 1px solid var(--line-soft); }
.att-input { display: none; }

/* The format row — the main Markdown moves as buttons. */
.fmt-row {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  padding: 4px 18px 6px;
  border-bottom: 1px solid var(--line-soft);
}
.fmt-btn {
  min-width: 26px;
  height: 24px;
  padding: 0 7px;
  border-radius: 6px;
  color: var(--dim);
  font-size: 12px;
  font-family: var(--sans);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.fmt-btn:hover { background: var(--sel); color: var(--ink); }
.fmt-bold { font-weight: 750; }
.fmt-italic { font-style: italic; font-family: var(--serif); }
.fmt-strike { text-decoration: line-through; }
.fmt-code, .fmt-fence { font-family: var(--mono); font-size: 11px; }
.fmt-sep { width: 1px; height: 16px; background: var(--line); margin: 0 6px; }

/* Section dividers for pinned groups (lists and the capture feed). */
.list-sep {
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  padding: 10px 10px 3px;
}
.glyph { font-size: 14px; line-height: 1; }
.sort-btn { margin-left: auto; color: var(--dim); }
.mid-head .sort-btn + .mini-btn { margin-left: 8px; }
.cap-feed-tools { display: flex; justify-content: flex-end; margin: -4px 0 2px; }
.cap-feed-tools .sort-btn { margin-left: 0; }

/* The rest of the vault, folded under the Capture feed. */
.cap-others {
  margin-top: 22px;
  border-top: 1px solid var(--line-soft);
  padding-top: 8px;
}
.cap-others-head {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  color: var(--dim);
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 4px 2px;
}
.cap-others-head:hover { color: var(--ink); }
.cap-others-list { display: flex; flex-direction: column; margin-top: 4px; }
.cap-other-row {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 5px 8px;
  border-radius: 7px;
}
.cap-other-row:hover { background: var(--sel); }
.cap-other-row .row-title { flex: 1; font-weight: 500; }

.howto { padding: 18px 22px; max-height: 70dvh; }

.att-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 0 18px 6px;
}
.att-strip:empty { display: none; }
.att-head { color: var(--faint); font-size: 11.5px; margin-right: 2px; }
.att-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 99px;
  padding: 2px 8px;
}
.att-x { color: var(--faint); padding: 0 2px; }
.att-x:hover { color: var(--danger); }

.backlinks { padding: 0 18px; }
.backlinks:empty { display: none; }
.back-head {
  color: var(--faint);
  font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.6px;
  padding: 8px 0 4px;
  border-top: 1px solid var(--line-soft);
}
.back-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  text-align: left;
  padding: 4px 6px;
  border-radius: 6px;
}
.back-row:hover { background: var(--sel); }

.ed-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px 10px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--dim);
  flex-wrap: wrap;
}
.foot-dim { color: var(--faint); }
.foot-dim.right { margin-left: auto; }
.foot-tags { display: inline-flex; gap: 4px; flex-wrap: wrap; }

/* ------------------------- markdown reading surface ------------------------ */

.md { font-family: var(--serif); font-size: 15.5px; line-height: 1.68; }
.md > :first-child { margin-top: 0; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 {
  font-family: var(--serif);
  line-height: 1.25;
  margin: 1.1em 0 0.4em;
}
.md h1 { font-size: 1.5em; }
.md h2 { font-size: 1.28em; }
.md h3 { font-size: 1.12em; }
.md p { margin: 0.55em 0; }
.md ul, .md ol { margin: 0.55em 0; padding-left: 1.5em; }
.md li.task { list-style: none; margin-left: -1.2em; }
.md blockquote {
  margin: 0.7em 0;
  padding: 2px 0 2px 14px;
  border-left: 3px solid var(--line);
  color: var(--dim);
}
.md code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--sel);
  border-radius: 4px;
  padding: 1px 5px;
}
.md pre {
  background: var(--sel);
  border-radius: 8px;
  padding: 10px 13px;
  overflow-x: auto;
}
.md pre code { background: none; padding: 0; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }
.md img { max-width: 100%; border-radius: 6px; }
.md a.wikilink {
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 0 4px;
}
.md a.wikilink.missing {
  background: none;
  border-bottom: 1px dashed var(--danger);
  color: var(--danger);
  border-radius: 0;
}
.md a.tag { color: var(--accent); font-family: var(--sans); font-size: 0.85em; }
.att-missing { color: var(--faint); font-style: italic; }

/* -------------------------------- capture ---------------------------------- */

.capture {
  width: 100%;
  max-width: 680px;
  transition: max-width 0.15s ease;
  margin: 0 auto;
  padding: 18px 20px 60px;
  overflow-y: auto;
}
.cap-headrow { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cap-headrow h2 { margin: 0; font-size: 17px; }
.composer {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px 10px;
  box-shadow: 0 1px 2px rgba(30, 28, 20, 0.05);
}
.cap-ta {
  width: 100%;
  min-height: 88px;
  border: 0;
  outline: none;
  resize: vertical;      /* grab the corner; the size sticks */
  background: none;
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.6;
}
.cap-ta::placeholder { color: var(--faint); font-style: italic; }
.cap-actions { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.cap-hint { color: var(--faint); font-size: 11.5px; flex: 1; }
.capture.wide { max-width: 980px; }
.cap-empty { color: var(--faint); text-align: center; padding: 42px 0 10px; font-family: var(--serif); font-style: italic; font-size: 15px; }

.feed { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.cap-card {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 10px 14px 12px;
  cursor: default;
}
.cap-card:hover { border-color: var(--line); }
.cap-card.pinned { border-color: var(--accent); }
.card-meta { display: flex; align-items: center; gap: 6px; color: var(--faint); font-size: 11.5px; }
.card-body { margin-top: 4px; max-height: 300px; overflow: hidden; font-size: 14.5px; }

/* ----------------------------- settings / login ---------------------------- */

.settings, .login {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 22px 20px 60px;
  overflow-y: auto;
}
.set-card {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.set-card h3 { margin: 0 0 8px; font-size: 14px; }
.set-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.dim { color: var(--dim); }

.login { text-align: left; padding-top: 8dvh; }
.login-mark { display: flex; align-items: center; gap: 12px; }
.login-mark img { width: 44px; height: 44px; border-radius: 10px; }
.login-mark h1 { font-family: var(--serif); font-size: 30px; margin: 0; }
.login-line { font-family: var(--serif); font-size: 16.5px; color: var(--dim); margin: 12px 0 6px; }
.login-points { color: var(--dim); padding-left: 1.2em; }
.login-points li { margin: 4px 0; }
.login-form { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 4px; }
.login-mail {
  flex: 1;
  min-width: 220px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  outline: none;
}
.login-mail:focus { border-color: var(--accent); }
.login-msg { width: 100%; color: var(--dim); font-size: 13px; }
.login-err { color: var(--danger); }

/* ------------------------------ overlay & menu ----------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 14, 10, 0.35);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12dvh;
  z-index: 40;
}
.ov-box {
  width: min(620px, calc(100vw - 32px));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.ov-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); color: var(--dim); }
.ov-input { flex: 1; border: 0; outline: none; background: none; font-size: 15px; }
.ov-list { max-height: 46dvh; overflow-y: auto; padding: 6px; }
.ov-row {
  display: flex; align-items: baseline; gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: default;
}
.ov-row:hover, .ov-row.on { background: var(--accent-soft); }
.ov-row .row-snippet { flex: 1; margin: 0; }
.ov-row .row-title { flex: 0 1 auto; }
.ov-kbd {
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--faint);
}
.ov-hint { color: var(--faint); padding: 10px 12px; font-size: 12.5px; }

.menu-veil { position: fixed; inset: 0; z-index: 50; }
.menu {
  position: fixed;
  min-width: 180px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 5px;
  z-index: 51;
}
.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
}
.menu-item:hover { background: var(--sel); }
.menu-item.danger { color: var(--danger); }
.menu-sep { height: 1px; background: var(--line-soft); margin: 4px 6px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 9px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  z-index: 60;
  max-width: calc(100vw - 40px);
}
.toast-act { color: var(--accent); font-weight: 650; }
:root[data-theme="dark"] .toast, .dark-toast { color: var(--bg); }

/* -------------------------------- mobile ----------------------------------- */

@media (max-width: 900px) {
  #app { grid-template-columns: 1fr !important; }

  #side {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 84vw);
    z-index: 30;
    transform: translateX(-102%);
    transition: transform 0.18s ease;
    box-shadow: none;
  }
  body.drawer-open #side { transform: none; box-shadow: var(--shadow); }
  #drawerVeil {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15, 14, 10, 0.35);
    z-index: 29;
  }
  body.drawer-open #drawerVeil { display: block; }

  /* twin views stack: the list OR the editor, chosen by data-pane */
  body[data-view="twin"] #mid { display: flex; border-right: 0; }
  body[data-view="twin"] #main { display: none; }
  body[data-view="twin"][data-pane="editor"] #mid { display: none; }
  body[data-view="twin"][data-pane="editor"] #main { display: flex; }
  .back-btn { display: inline-flex; }

  #fab {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    right: 18px;
    bottom: 22px;
    width: 48px; height: 48px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 700;
    font-size: 18px;
    box-shadow: var(--shadow);
    z-index: 20;
  }
  body[data-view="settings"] #fab, body[data-view="login"] #fab { display: none; }

  .ed-body.mode-both .ed-ta { display: none; }   /* narrow screens show the page */
  .drawer-btn { display: inline-flex; }
}
@media (min-width: 901px) {
  .drawer-btn { display: none; }
}
