/* ============ Temas ============ */
:root {
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-notes: 'Literata', Georgia, serif;
  --font-code: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --notes-size: 18px;
  --page-w: 780px;
  --sidebar-w: 312px;
  --radius: 10px;
}

[data-theme="papel"] {
  --bg: #fbfaf7; --sidebar: #f3f1ec; --surface: #ffffff; --surface-2: #efede7;
  --text: #1f1d1a; --muted: #6f6a61; --faint: #9a958c; --border: #e3dfd6;
  --accent: #2f5bd3; --accent-ink: #ffffff; --accent-soft: #e5ebfb;
  --ink: #1f1d1a; --mark: #fff0a0; --code-bg: #f4f2ec; --paper: #ffffff; --paper-line: #e4e0d6;
  --st-reading: #d99a00; --st-done: #2e9d5b; --st-review: #d1491a;
  --c-definition: #2f5bd3; --c-key: #d99a00; --c-question: #d1491a; --c-summary: #2e9d5b;
  --shadow: 0 1px 2px rgba(30, 25, 15, .05), 0 6px 24px rgba(30, 25, 15, .07);
  color-scheme: light;
}
[data-theme="sepia"] {
  --bg: #f4ecd8; --sidebar: #ebe0c4; --surface: #fbf5e6; --surface-2: #e8dcbd;
  --text: #3b2f20; --muted: #7a6a52; --faint: #a08f72; --border: #dccdab;
  --accent: #9a5b1e; --accent-ink: #fffaf0; --accent-soft: #efdcb9;
  --ink: #3b2f20; --mark: #f3d36f; --code-bg: #efe4c9; --paper: #fbf5e6; --paper-line: #e2d3ae;
  --st-reading: #c08400; --st-done: #4d8a3c; --st-review: #b8431b;
  --c-definition: #3f6aa6; --c-key: #c08400; --c-question: #b8431b; --c-summary: #4d8a3c;
  --shadow: 0 1px 2px rgba(60, 40, 10, .07), 0 6px 24px rgba(60, 40, 10, .08);
  color-scheme: light;
}
[data-theme="lavanda"] {
  --bg: #f7f5fc; --sidebar: #eeeaf8; --surface: #ffffff; --surface-2: #ebe7f6;
  --text: #221d33; --muted: #6d6688; --faint: #9a94b2; --border: #e0daf0;
  --accent: #6d4fd8; --accent-ink: #ffffff; --accent-soft: #ebe5fc;
  --ink: #2a2340; --mark: #f9e3ff; --code-bg: #f3f0fa; --paper: #ffffff; --paper-line: #e3def2;
  --st-reading: #d48c00; --st-done: #2f9a68; --st-review: #d2457a;
  --c-definition: #6d4fd8; --c-key: #d48c00; --c-question: #d2457a; --c-summary: #2f9a68;
  --shadow: 0 1px 2px rgba(40, 20, 90, .05), 0 6px 24px rgba(40, 20, 90, .08);
  color-scheme: light;
}
[data-theme="ardosia"] {
  --bg: #1d2127; --sidebar: #171a1f; --surface: #242930; --surface-2: #2d333b;
  --text: #e6e9ee; --muted: #9aa3ae; --faint: #6f7884; --border: #353c46;
  --accent: #7aa2ff; --accent-ink: #0f1420; --accent-soft: #2a3550;
  --ink: #e6e9ee; --mark: #5c5222; --code-bg: #1a1e23; --paper: #242930; --paper-line: #343b45;
  --st-reading: #f2c14e; --st-done: #5fd08b; --st-review: #ff8a5c;
  --c-definition: #7aa2ff; --c-key: #f2c14e; --c-question: #ff8a5c; --c-summary: #5fd08b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .3);
  color-scheme: dark;
}
[data-theme="meianoite"] {
  --bg: #0d0f14; --sidebar: #0a0b0f; --surface: #14171e; --surface-2: #1b1f29;
  --text: #d8dbe3; --muted: #8389a0; --faint: #5d6278; --border: #242937;
  --accent: #c49bff; --accent-ink: #160e24; --accent-soft: #2b2240;
  --ink: #e8e8f0; --mark: #4a3d16; --code-bg: #0f1218; --paper: #14171e; --paper-line: #232836;
  --st-reading: #f5c451; --st-done: #67d69a; --st-review: #ff8f70;
  --c-definition: #8fb3ff; --c-key: #f5c451; --c-question: #ff8f70; --c-summary: #67d69a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 28px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
[data-theme="floresta"] {
  --bg: #17201b; --sidebar: #121a15; --surface: #1d2822; --surface-2: #25322b;
  --text: #e3eadf; --muted: #9db0a2; --faint: #6e8275; --border: #2f3d35;
  --accent: #8fd19e; --accent-ink: #0f1a13; --accent-soft: #26402f;
  --ink: #e3eadf; --mark: #4d4a1c; --code-bg: #141c17; --paper: #1d2822; --paper-line: #2e3c34;
  --st-reading: #e8c766; --st-done: #8fd19e; --st-review: #f2936b;
  --c-definition: #86b8e8; --c-key: #e8c766; --c-question: #f2936b; --c-summary: #8fd19e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 28px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
[data-theme="quadro"] {
  --bg: #22322b; --sidebar: #1b2823; --surface: #2a3c34; --surface-2: #33473e;
  --text: #f1efe6; --muted: #b5bfb5; --faint: #8a978d; --border: #3e544a;
  --accent: #f4d35e; --accent-ink: #22322b; --accent-soft: #4a4a2e;
  --ink: #f5f3ea; --mark: #6b5f22; --code-bg: #22312a; --paper: #2a3c34; --paper-line: #3b5146;
  --st-reading: #f4d35e; --st-done: #9be39a; --st-review: #ff9e80;
  --c-definition: #9ec9ff; --c-key: #f4d35e; --c-question: #ff9e80; --c-summary: #9be39a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

[data-theme="oceano"] {
  --bg: #f2f7fa; --sidebar: #e6eff5; --surface: #ffffff; --surface-2: #e1ebf2;
  --text: #13293d; --muted: #546a7b; --faint: #8aa0b0; --border: #d3e1ea;
  --accent: #0b7285; --accent-ink: #ffffff; --accent-soft: #d6edf1;
  --ink: #13293d; --mark: #fff1a8; --code-bg: #edf3f7; --paper: #ffffff; --paper-line: #d7e4ec;
  --st-reading: #d48a00; --st-done: #2b9348; --st-review: #d1495b;
  --c-definition: #1971c2; --c-key: #d48a00; --c-question: #d1495b; --c-summary: #2b9348;
  --shadow: 0 1px 2px rgba(10, 40, 60, .06), 0 6px 24px rgba(10, 40, 60, .08);
  color-scheme: light;
}
[data-theme="menta"] {
  --bg: #f3f8f4; --sidebar: #e7f1ea; --surface: #ffffff; --surface-2: #e1ede4;
  --text: #1b2e22; --muted: #587061; --faint: #8ea595; --border: #d4e5d8;
  --accent: #2b8a3e; --accent-ink: #ffffff; --accent-soft: #d8efdd;
  --ink: #1b2e22; --mark: #fff3a3; --code-bg: #edf5ef; --paper: #ffffff; --paper-line: #d8e7dc;
  --st-reading: #d08700; --st-done: #2b8a3e; --st-review: #c92a2a;
  --c-definition: #1c7ed6; --c-key: #d08700; --c-question: #c92a2a; --c-summary: #2b8a3e;
  --shadow: 0 1px 2px rgba(20, 50, 30, .06), 0 6px 24px rgba(20, 50, 30, .07);
  color-scheme: light;
}
[data-theme="rose"] {
  --bg: #fcf5f6; --sidebar: #f6e8ec; --surface: #ffffff; --surface-2: #f2e2e7;
  --text: #3a1f27; --muted: #7d5a64; --faint: #ad8d96; --border: #ebd6dc;
  --accent: #c2255c; --accent-ink: #ffffff; --accent-soft: #fbe0ea;
  --ink: #3a1f27; --mark: #ffe8a3; --code-bg: #f8edf0; --paper: #ffffff; --paper-line: #eedbe0;
  --st-reading: #d48a00; --st-done: #2f9e44; --st-review: #e8590c;
  --c-definition: #7048e8; --c-key: #d48a00; --c-question: #e8590c; --c-summary: #2f9e44;
  --shadow: 0 1px 2px rgba(70, 20, 35, .05), 0 6px 24px rgba(70, 20, 35, .07);
  color-scheme: light;
}
[data-theme="solar"] {
  --bg: #fdf6e3; --sidebar: #eee8d5; --surface: #fffbee; --surface-2: #ece5cf;
  --text: #073642; --muted: #586e75; --faint: #93a1a1; --border: #e2dac1;
  --accent: #268bd2; --accent-ink: #ffffff; --accent-soft: #dfeaf0;
  --ink: #073642; --mark: #f6e3a1; --code-bg: #f5efdc; --paper: #fffbee; --paper-line: #e6dec6;
  --st-reading: #b58900; --st-done: #859900; --st-review: #cb4b16;
  --c-definition: #268bd2; --c-key: #b58900; --c-question: #dc322f; --c-summary: #2aa198;
  --shadow: 0 1px 2px rgba(60, 50, 20, .06), 0 6px 24px rgba(60, 50, 20, .07);
  color-scheme: light;
}
[data-theme="contraste"] {
  --bg: #ffffff; --sidebar: #f2f2f2; --surface: #ffffff; --surface-2: #e6e6e6;
  --text: #000000; --muted: #2b2b2b; --faint: #555555; --border: #767676;
  --accent: #0040a8; --accent-ink: #ffffff; --accent-soft: #dce6ff;
  --ink: #000000; --mark: #ffe600; --code-bg: #f2f2f2; --paper: #ffffff; --paper-line: #bdbdbd;
  --st-reading: #8a5a00; --st-done: #006b2e; --st-review: #b00020;
  --c-definition: #0040a8; --c-key: #8a5a00; --c-question: #b00020; --c-summary: #006b2e;
  --shadow: 0 0 0 1px #000;
  color-scheme: light;
}
[data-theme="cafe"] {
  --bg: #1f1814; --sidebar: #19130f; --surface: #2a201a; --surface-2: #34291f;
  --text: #efe4d6; --muted: #b8a593; --faint: #87766a; --border: #3f3128;
  --accent: #e0a96d; --accent-ink: #1f1814; --accent-soft: #4a3524;
  --ink: #efe4d6; --mark: #5e4a1f; --code-bg: #1a1410; --paper: #2a201a; --paper-line: #3f3128;
  --st-reading: #f0c060; --st-done: #9bd18f; --st-review: #f28b6c;
  --c-definition: #9ec2f0; --c-key: #f0c060; --c-question: #f28b6c; --c-summary: #9bd18f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 28px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
[data-theme="grafite"] {
  --bg: #18181b; --sidebar: #121214; --surface: #202024; --surface-2: #2a2a2f;
  --text: #e7e7ea; --muted: #a1a1aa; --faint: #71717a; --border: #34343a;
  --accent: #d4d4d8; --accent-ink: #18181b; --accent-soft: #3a3a41;
  --ink: #f4f4f5; --mark: #52482a; --code-bg: #141416; --paper: #202024; --paper-line: #33333a;
  --st-reading: #facc15; --st-done: #4ade80; --st-review: #fb923c;
  --c-definition: #93c5fd; --c-key: #facc15; --c-question: #fb923c; --c-summary: #4ade80;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 28px rgba(0, 0, 0, .4);
  color-scheme: dark;
}
[data-theme="artico"] {
  --bg: #2e3440; --sidebar: #272c36; --surface: #3b4252; --surface-2: #434c5e;
  --text: #eceff4; --muted: #b8c0cf; --faint: #8590a3; --border: #4c566a;
  --accent: #88c0d0; --accent-ink: #2e3440; --accent-soft: #3e5664;
  --ink: #eceff4; --mark: #5b5636; --code-bg: #2a2f3a; --paper: #3b4252; --paper-line: #4c566a;
  --st-reading: #ebcb8b; --st-done: #a3be8c; --st-review: #d08770;
  --c-definition: #81a1c1; --c-key: #ebcb8b; --c-question: #bf616a; --c-summary: #a3be8c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 28px rgba(0, 0, 0, .25);
  color-scheme: dark;
}
[data-theme="noiteroxa"] {
  --bg: #1e1b2e; --sidebar: #18162a; --surface: #282541; --surface-2: #312d4e;
  --text: #f2efff; --muted: #b4aed6; --faint: #7f78a6; --border: #3b3660;
  --accent: #ff79c6; --accent-ink: #1e1b2e; --accent-soft: #4a2c4d;
  --ink: #f8f8f2; --mark: #5a4a26; --code-bg: #1a1729; --paper: #282541; --paper-line: #3b3660;
  --st-reading: #f1fa8c; --st-done: #50fa7b; --st-review: #ffb86c;
  --c-definition: #8be9fd; --c-key: #f1fa8c; --c-question: #ff5555; --c-summary: #50fa7b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 28px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

/* Uniformes: temas de duas cores no estilo de camisa de time */
[data-theme="flamengo"] {
  --bg: #121010; --sidebar: #0b0a0a; --surface: #1b1717; --surface-2: #261f1f;
  --text: #f4efef; --muted: #bba9a9; --faint: #877777; --border: #382c2c;
  --accent: #e3262f; --accent-ink: #ffffff; --accent-soft: #4a1517;
  --ink: #f6f1f1; --mark: #6b2226; --code-bg: #0f0d0d; --paper: #1b1717; --paper-line: #382c2c;
  --st-reading: #f5b82e; --st-done: #4fc97a; --st-review: #ff7a59;
  --c-definition: #7fb2ff; --c-key: #f5b82e; --c-question: #ff6b6b; --c-summary: #4fc97a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 8px 28px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
[data-theme="uniforme2"] {
  --bg: #ffffff; --sidebar: #f7f4f4; --surface: #ffffff; --surface-2: #f1ecec;
  --text: #141111; --muted: #5f5656; --faint: #938888; --border: #e5dcdc;
  --accent: #c8102e; --accent-ink: #ffffff; --accent-soft: #fde2e5;
  --ink: #141111; --mark: #ffe08a; --code-bg: #f7f3f3; --paper: #ffffff; --paper-line: #ece3e3;
  --st-reading: #c98a00; --st-done: #23874a; --st-review: #e0661b;
  --c-definition: #1f5fbf; --c-key: #c98a00; --c-question: #c8102e; --c-summary: #23874a;
  --shadow: 0 1px 2px rgba(40, 0, 0, .06), 0 6px 24px rgba(40, 0, 0, .07);
  color-scheme: light;
}
[data-theme="gramado"] {
  --bg: #fbfdfb; --sidebar: #eff6f1; --surface: #ffffff; --surface-2: #e5f0e8;
  --text: #102016; --muted: #4f6656; --faint: #87998c; --border: #d5e5d9;
  --accent: #00843d; --accent-ink: #ffffff; --accent-soft: #d4efdd;
  --ink: #102016; --mark: #fff2a0; --code-bg: #f0f7f2; --paper: #ffffff; --paper-line: #dae8de;
  --st-reading: #d18b00; --st-done: #00843d; --st-review: #d9480f;
  --c-definition: #1971c2; --c-key: #d18b00; --c-question: #d9480f; --c-summary: #00843d;
  --shadow: 0 1px 2px rgba(0, 40, 15, .06), 0 6px 24px rgba(0, 40, 15, .07);
  color-scheme: light;
}
[data-theme="estadio"] {
  --bg: #0d110e; --sidebar: #090c0a; --surface: #141a16; --surface-2: #1c241f;
  --text: #e9f2ec; --muted: #a3b5a9; --faint: #6d7f73; --border: #27332b;
  --accent: #2fd27a; --accent-ink: #07120b; --accent-soft: #163a26;
  --ink: #eef6f0; --mark: #3f4c1f; --code-bg: #0f1511; --paper: #141a16; --paper-line: #27332b;
  --st-reading: #f2c94c; --st-done: #2fd27a; --st-review: #ff8a5b;
  --c-definition: #7cb6ff; --c-key: #f2c94c; --c-question: #ff8a5b; --c-summary: #2fd27a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 8px 28px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
/* ============ Base ============ */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .35; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ic { display: block; flex-shrink: 0; }
[hidden] { display: none !important; }
kbd {
  font: 500 10px var(--font-ui); color: var(--faint);
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 500; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.06); border-color: var(--accent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 10px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: 8px;
  border: 0; background: transparent; color: var(--muted);
  font-size: 22px; line-height: 1;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.xs { width: 24px; height: 24px; border-radius: 6px; }
.icon-btn.flash { color: var(--st-done); }

/* ============ Layout ============ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100vh; height: 100dvh;
  transition: grid-template-columns .2s ease;
}
.app.sidebar-hidden { grid-template-columns: 0 minmax(0, 1fr); }
.app.sidebar-hidden .sidebar { visibility: hidden; }

.sidebar {
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 6px; padding: 12px 12px 8px 10px; }
.brand-btn {
  flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 4px 6px; border: 0; border-radius: 9px; background: none; color: var(--text); text-align: left;
}
.brand-btn:hover { background: var(--surface-2); }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  background: var(--accent); color: var(--accent-ink);
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.only-mobile { display: none; }

.lib-btn {
  display: flex; align-items: center; gap: 8px; margin: 2px 12px 6px; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  color: var(--muted); font-weight: 500; text-align: left;
}
.lib-btn:hover { color: var(--text); border-color: var(--muted); }
.book-head { display: flex; align-items: flex-start; gap: 4px; padding: 6px 8px 0 16px; }
.book-title {
  flex: 1; min-width: 0; margin: 6px 0 0; font: 600 15px/1.3 var(--font-notes); color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.book-meta { padding: 8px 16px 4px; }
.meta-line { color: var(--muted); font-size: 12.5px; }
.meta-line.small { font-size: 11.5px; color: var(--faint); margin-top: 4px; }
.progress { height: 4px; border-radius: 4px; background: var(--surface-2); margin-top: 8px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--st-done); border-radius: 4px; transition: width .3s; }

.search { position: relative; margin: 10px 12px 6px; }
.search-ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input {
  width: 100%; height: 34px; padding: 0 52px 0 32px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
}
.search input::placeholder { color: var(--faint); }
.search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }

.toc { flex: 1; overflow-y: auto; padding: 4px 8px 12px; min-height: 0; }
.toc-empty { color: var(--faint); padding: 12px 10px; font-size: 13px; }
.toc-row {
  display: flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 5px 8px 5px calc(4px + (var(--lvl) - 1) * 16px);
  border-radius: 7px; cursor: pointer; color: var(--muted);
  font-size: 13.5px; line-height: 1.35;
}
.toc-row:hover { background: var(--surface-2); color: var(--text); }
.toc-row.active { background: var(--accent-soft); color: var(--text); }
.toc-row.lvl-1 { color: var(--text); font-weight: 600; margin-top: 2px; }
.toc-caret, .toc-caret-sp { width: 18px; height: 18px; flex-shrink: 0; }
.toc-caret {
  display: grid; place-items: center; border: 0; background: none; padding: 0;
  color: var(--faint); border-radius: 4px;
}
.toc-caret:hover { background: var(--border); color: var(--text); }
.toc-caret .ic { transition: transform .15s; }
.toc-caret.open .ic { transform: rotate(90deg); }
.toc-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid var(--faint);
}
.st-reading.toc-dot, .seg.st-reading .dot { background: var(--st-reading); border-color: var(--st-reading); }
.st-done.toc-dot, .seg.st-done .dot { background: var(--st-done); border-color: var(--st-done); }
.st-review.toc-dot, .seg.st-review .dot { background: var(--st-review); border-color: var(--st-review); }
.toc-dot-btn {
  display: grid; place-items: center; width: 22px; height: 22px; margin: -2px -4px -2px -5px; padding: 0;
  flex-shrink: 0; border: 0; border-radius: 50%; background: none;
}
.toc-dot-btn:hover { background: var(--border); }
.toc-dot-btn:hover .toc-dot { transform: scale(1.25); }
.toc-dot { transition: transform .12s; }
.toc-more {
  display: grid; place-items: center; width: 24px; height: 24px; margin: -3px -4px -3px 0; padding: 0;
  flex-shrink: 0; border: 0; border-radius: 6px; background: none; color: var(--faint);
  visibility: hidden;
}
.toc-row:hover .toc-more, .toc-row:focus-within .toc-more, .toc-row.active .toc-more { visibility: visible; }
.toc-more:hover { background: var(--border); color: var(--text); }
.toc-row.editing { background: var(--surface); box-shadow: inset 0 0 0 1px var(--accent); }
.toc-input {
  flex: 1; min-width: 0; height: 24px; padding: 0 6px; margin: -2px 0;
  border: 0; border-radius: 5px; background: transparent; color: var(--text); font-size: 13.5px; outline: none;
}
.toc-label { flex: 1; min-width: 0; }
.toc-num { color: var(--faint); font-weight: 500; margin-right: 6px; font-variant-numeric: tabular-nums; }
.toc-row.active .toc-num { color: var(--accent); }
.toc-has { color: var(--accent); opacity: .8; }
.toc-page { color: var(--faint); font-size: 11.5px; font-variant-numeric: tabular-nums; font-weight: 400; }

.sidebar-foot {
  display: flex; justify-content: space-between; gap: 4px;
  padding: 8px; border-top: 1px solid var(--border);
}

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  display: flex; align-items: center; gap: 8px;
  height: 52px; padding: 0 10px; flex-shrink: 0;
  border-bottom: 1px solid var(--border); background: var(--bg);
}
.crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px; overflow: hidden; }
.crumb {
  border: 0; background: none; color: var(--muted); padding: 4px 6px; border-radius: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; font-size: 13px;
}
.crumb:hover { background: var(--surface-2); color: var(--text); }
.crumb.book { font-weight: 600; color: var(--text); }
.crumb-sep { color: var(--faint); }
.save-state { color: var(--faint); font-size: 12px; white-space: nowrap; transition: opacity .3s; }
.save-state[data-state="saved"] { color: var(--st-done); }
.save-state[data-state="error"] { color: var(--st-review); font-weight: 600; }

.sync-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 8px; border: 0; border-radius: 8px;
  background: transparent; color: var(--faint); font-size: 12.5px; font-weight: 600;
}
.sync-btn:hover { background: var(--surface-2); color: var(--text); }
.sync-btn[data-state="idle"] { color: var(--st-done); }
.sync-btn[data-state="needs-auth"] { background: var(--accent-soft); color: var(--accent); padding: 0 10px; }
.sync-btn[data-state="error"] { color: var(--st-review); }
.sync-btn[data-state="syncing"] .ic { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sync-btn[data-state="syncing"] .ic { animation: none; } }

.scroller { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.page { max-width: var(--page-w); margin: 0 auto; padding: 36px 28px 140px; }

/* ============ Página do bloco ============ */
.page-head { margin-bottom: 28px; }
.kicker {
  color: var(--accent); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px;
}
.page-title {
  font-family: var(--font-notes); font-weight: 600;
  font-size: clamp(26px, 4vw, 36px); line-height: 1.15; letter-spacing: -.01em;
  margin: 0 0 18px; text-wrap: balance;
}

.head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.segmented {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px;
  background: var(--surface-2); flex-wrap: wrap;
}
.seg {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 12px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); font-weight: 500; font-size: 13px;
}
.seg:hover { color: var(--text); }
.seg.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.seg .dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--faint); }
.segmented.small .seg { height: 28px; }

.items { display: flex; flex-direction: column; gap: 18px; }
.item { position: relative; }
.item-tools {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  min-height: 32px; margin-bottom: 4px;
  opacity: 0; transition: opacity .15s;
}
.item:hover .item-tools, .item:focus-within .item-tools { opacity: 1; }
.item-tools .spacer { flex: 1; }
.item-kind { display: inline-flex; align-items: center; gap: 6px; color: var(--faint); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: 0 4px; }
.callout-select {
  height: 28px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface); color: var(--muted); font-size: 12.5px; padding: 0 6px; margin-right: 4px;
}
.fmt-bar { display: flex; gap: 1px; flex-wrap: wrap; }
.fmt {
  display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px;
  border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 15px;
}
.fmt:hover { background: var(--surface-2); color: var(--text); }
.fmt .tx { font-size: 14px; }
.fmt sub { font-size: 9px; }

/* Texto */
.rte {
  font-family: var(--font-notes); font-size: var(--notes-size); line-height: 1.7;
  min-height: 2.2em; padding: 2px 2px; outline: none; word-wrap: break-word;
}
.rte.is-empty::before { content: attr(data-placeholder); color: var(--faint); pointer-events: none; position: absolute; }
.rte > :first-child { margin-top: 0; }
.rte > :last-child { margin-bottom: 0; }
.rte p { margin: 0 0 .65em; }
.rte h3 { font-size: 1.2em; margin: 1em 0 .4em; line-height: 1.3; }
.rte ul, .rte ol { margin: 0 0 .65em; padding-left: 1.4em; }
.rte li { margin: .15em 0; }
.rte blockquote {
  margin: .4em 0 .8em; padding: .1em 0 .1em 1em;
  border-left: 3px solid var(--border); color: var(--muted); font-style: italic;
}
.rte mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 .1em; }
.rte code {
  font-family: var(--font-code); font-size: .82em;
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 5px; padding: .05em .35em;
}
.rte img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: .6em 0; }
.rte a { color: var(--accent); }

.callout {
  --c: var(--muted);
  padding: 4px 16px 14px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--c) 9%, var(--bg));
  border-left: 3px solid var(--c);
}
.callout::before {
  content: attr(data-label); display: block; padding-top: 10px;
  color: var(--c); font: 700 11px var(--font-ui); text-transform: uppercase; letter-spacing: .08em;
}
.callout .item-tools { position: absolute; top: 2px; right: 8px; left: 100px; justify-content: flex-end; margin: 0; }
.callout .rte { margin-top: 6px; }
.callout-definition { --c: var(--c-definition); }
.callout-key { --c: var(--c-key); }
.callout-question { --c: var(--c-question); }
.callout-summary { --c: var(--c-summary); }

/* Código */
textarea.code {
  display: block; width: 100%; resize: none; overflow: hidden;
  font: 14px/1.6 var(--font-code); tab-size: 4;
  padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--code-bg); color: var(--text);
  outline: none;
}
textarea.code:focus { border-color: var(--accent); }
textarea.code::placeholder { color: var(--faint); }

/* Quadro */
.board { border: 1px solid var(--border); border-radius: var(--radius); background: var(--paper); overflow: clip; }
.board-bar {
  position: sticky; top: 0; z-index: 2;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
  padding: 6px 8px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.bar-group { display: flex; align-items: center; gap: 1px; }
.bar-group.dim { opacity: .35; }
.tool {
  display: grid; place-items: center; width: 30px; height: 32px;
  border: 0; border-radius: 7px; background: none; color: var(--muted);
}
.tool:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.tool.on { background: var(--accent-soft); color: var(--accent); }
.tool.danger:hover:not(:disabled) { color: var(--st-review); }
.swatch {
  position: relative; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid transparent; background: none; padding: 0; display: grid; place-items: center;
}
.swatch::after { content: ''; width: 15px; height: 15px; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(128, 128, 128, .35); }
.swatch.on { border-color: var(--accent); }
.swatch.custom { cursor: pointer; }
.swatch.custom:not([style])::after { background: conic-gradient(#e03131, #f08c00, #ffd43b, #2f9e44, #1c7ed6, #9c36b5, #e03131); }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.size { display: grid; place-items: center; width: 26px; height: 32px; border: 0; border-radius: 7px; background: none; }
.size span { width: var(--d); height: var(--d); border-radius: 50%; background: var(--muted); }
.size:hover { background: var(--surface-2); }
.size.on { background: var(--accent-soft); }
.size.on span { background: var(--accent); }
.bg-select {
  height: 30px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface);
  color: var(--muted); font-size: 12.5px; padding: 0 4px; margin: 0 2px;
}
.board-wrap { position: relative; }
.board-canvas { display: block; width: 100%; touch-action: none; cursor: crosshair; }
.board-handle {
  display: grid; place-items: center; height: 16px; cursor: ns-resize; touch-action: none;
  border-top: 1px dashed var(--border); background: var(--surface);
}
.board-handle span { width: 40px; height: 4px; border-radius: 4px; background: var(--border); }
.board-handle:hover span { background: var(--muted); }

/* Adicionar / navegar */
.add-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--border);
}
.add-label { color: var(--faint); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; margin-right: 4px; }
.btn.add { background: transparent; border-style: dashed; color: var(--muted); }
.btn.add:hover { color: var(--accent); border-color: var(--accent); border-style: solid; }
.btn.finish { margin-top: 40px; width: 100%; height: 44px; color: var(--st-done); border-color: color-mix(in srgb, var(--st-done) 40%, var(--border)); background: color-mix(in srgb, var(--st-done) 8%, var(--surface)); }
.btn.finish:hover { border-color: var(--st-done); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.pager-btn {
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start; text-align: left;
  padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
  min-width: 0;
}
.pager-btn.next { align-items: flex-end; text-align: right; grid-column: 2; }
.pager-btn:hover { border-color: var(--accent); }
.pager-dir { display: inline-flex; align-items: center; gap: 5px; color: var(--faint); font-size: 12px; }
.pager-title { font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty-state { text-align: center; padding: 80px 20px; color: var(--muted); }
.empty-state h2 { color: var(--text); font-family: var(--font-notes); }

/* ============ Diálogos ============ */
.dlg {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 40px);
  padding: 0; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.dlg.wide { width: min(1040px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(10, 10, 15, .45); backdrop-filter: blur(2px); }
.dlg form { display: flex; flex-direction: column; max-height: calc(100dvh - 42px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 6px; }
.dlg-head h2 { margin: 0; font-size: 18px; }
.dlg-body { padding: 12px 22px 22px; overflow-y: auto; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); }

.import-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 22px; min-height: 0; flex: 1; }
.import-grid .col { display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.field.narrow { flex: 0 0 130px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field input, .field textarea, .set-row select {
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg); padding: 8px 10px;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); outline: none; }
.field input.invalid { border-color: var(--st-review); }
.field textarea { min-height: 260px; flex: 1; resize: vertical; font: 13px/1.55 var(--font-code); }
.field-row { display: flex; gap: 10px; align-items: flex-end; }
.field-row.between { justify-content: space-between; align-items: center; flex-wrap: wrap; }
.hint { margin: 0; font-size: 12.5px; color: var(--muted); }
.hint code { font-family: var(--font-code); background: var(--surface-2); padding: 0 4px; border-radius: 4px; }
.tpl-note { padding: 8px 10px; border-radius: 8px; background: var(--accent-soft); color: var(--text); }
.check { display: inline-flex; gap: 7px; align-items: center; font-size: 13px; color: var(--muted); }

.preview-head { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.preview {
  flex: 1; min-height: 300px; max-height: 58vh; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 10px; padding: 6px; background: var(--bg);
}
.preview-empty { color: var(--faint); padding: 20px; text-align: center; font-size: 13px; }
.pv-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 4px 4px calc(8px + (var(--lvl) - 1) * 18px); border-radius: 6px; font-size: 13px;
}
.pv-row:hover { background: var(--surface-2); }
.pv-row[style*="--lvl:1"] { font-weight: 600; }
.pv-text { flex: 1; min-width: 0; display: flex; gap: 6px; align-items: baseline; }
.pv-text .toc-page { margin-left: auto; }
.pv-ctl { display: flex; opacity: .25; }
.pv-row:hover .pv-ctl { opacity: 1; }

/* Configurações */
.set-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 0 10px; }
#settingsBody > .set-title:first-child { margin-top: 4px; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.theme-card {
  display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 10px;
  border: 2px solid transparent; background: none; text-align: left;
}
.theme-card.on { border-color: var(--accent); }
.tc-preview {
  display: flex; height: 64px; border-radius: 7px; overflow: hidden;
  background: var(--bg); border: 1px solid var(--border);
}
.tc-side { width: 30%; background: var(--sidebar); padding: 8px 5px; display: flex; flex-direction: column; gap: 4px; }
.tc-side i { height: 3px; border-radius: 2px; background: var(--faint); opacity: .6; }
.tc-side i:first-child { background: var(--accent); opacity: 1; }
.tc-page { flex: 1; padding: 9px 8px; display: flex; flex-direction: column; gap: 4px; }
.tc-page b { height: 6px; width: 70%; border-radius: 2px; background: var(--text); }
.tc-page i { height: 3px; border-radius: 2px; background: var(--muted); opacity: .6; }
.tc-page em { height: 10px; width: 50%; border-radius: 3px; background: var(--mark); margin-top: 2px; }
.tc-name { font-size: 12.5px; font-weight: 500; color: var(--text); padding-left: 2px; }

.font-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.font-opt {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--bg); text-align: left;
}
.font-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.fo-sample { font-size: 22px; line-height: 1; width: 34px; }
.fo-name { font-size: 13px; line-height: 1.2; }

.set-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.set-row > label, .set-label { flex: 0 0 150px; font-weight: 500; }
.set-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.set-row output { width: 40px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.set-note { color: var(--muted); margin: 0 0 6px; font-size: 13px; }
.set-note.small { font-size: 12px; color: var(--faint); }
.set-note.error { color: var(--st-review); margin-top: 8px; }
.set-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* Menu */
.menu {
  position: fixed; z-index: 100; min-width: 230px; padding: 5px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
}
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 7px; background: none; text-align: left;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.menu-item .ic { color: var(--muted); }
.menu-item.danger { color: var(--st-review); }
.menu-item.danger .ic { color: currentColor; }
.menu-item > span:not(.menu-dot) { flex: 1; }
.menu-item.checked { font-weight: 600; }
.menu-item.checked > .ic:last-child { color: var(--accent); }
.menu.compact { min-width: 170px; }
.menu-dot { display: grid; place-items: center; width: 16px; height: 16px; }
.menu-dot .toc-dot { width: 10px; height: 10px; }

/* ============ Biblioteca ============ */
.app.library-mode { grid-template-columns: 0 minmax(0, 1fr); }
.app.library-mode .sidebar { visibility: hidden; }
.app.library-mode #btnToggleSidebar { display: none; }
.app.library-mode .topbar { padding-left: 20px; }
.library-page { max-width: 1100px; }
.lib-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 32px; }
.lib-head h1 { font: 600 clamp(26px, 4vw, 34px)/1.15 var(--font-notes); margin: 0; letter-spacing: -.01em; }
.lib-count { color: var(--faint); font-size: 13px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 36px 28px; }
.lib-card { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.folder {
  position: relative; display: block; width: 100%; aspect-ratio: 5 / 4; padding: 0;
  border: 0; background: none; margin-top: 12px; cursor: pointer;
}
.folder-tab {
  position: absolute; left: 0; top: -12px; width: 42%; height: 24px;
  border-radius: 10px 10px 0 0; background: var(--cover);
  filter: brightness(.82);
}
.folder-sheet {
  position: absolute; left: 7%; right: 7%; top: -9px; height: 40%;
  border-radius: 6px; background: var(--paper); box-shadow: 0 0 0 1px var(--border);
  transition: transform .2s ease;
}
.folder-front {
  position: absolute; inset: 0; display: grid; place-items: center;
  border-radius: 4px 14px 14px 14px; background: var(--cover); color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 8px 22px -8px rgba(0, 0, 0, .35);
  transition: transform .2s ease, box-shadow .2s ease;
  background-image: linear-gradient(160deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0) 45%);
}
.folder:hover .folder-sheet, .folder:focus-visible .folder-sheet { transform: translateY(-8px); }
.folder:hover .folder-front, .folder:focus-visible .folder-front { transform: translateY(2px); }
.folder-initials { font: 600 clamp(34px, 5vw, 46px)/1 var(--font-notes); letter-spacing: .02em; text-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.folder-badge {
  position: absolute; left: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 99px; background: rgba(255, 255, 255, .92); color: #1d6b3e; font: 600 11px var(--font-ui);
}
.lib-card.new .folder-tab { background: none; border: 2px dashed var(--border); border-bottom: 0; filter: none; }
.lib-card.new .folder-front {
  background: transparent; color: var(--faint); border: 2px dashed var(--border); box-shadow: none;
}
.lib-card.new .folder:hover .folder-front { color: var(--accent); border-color: var(--accent); }

.lib-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lib-title-row { display: flex; align-items: flex-start; gap: 4px; }
.lib-title { flex: 1; min-width: 0; margin: 0; font: 600 15px/1.3 var(--font-ui); }
.lib-title button {
  border: 0; background: none; padding: 0; text-align: left; color: var(--text); font: inherit;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lib-title button:hover { color: var(--accent); }
.lib-title-row .icon-btn { margin: -4px -6px 0 0; }
.lib-meta { color: var(--muted); font-size: 12.5px; }
.lib-meta.small { color: var(--faint); font-size: 12px; }
.lib-info .progress { margin-top: 4px; }
.lib-continue {
  border: 0; background: none; padding: 0; text-align: left; color: var(--accent); font-size: 12.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lib-continue span { color: var(--faint); }
.lib-continue:hover { text-decoration: underline; }
.lib-head { justify-content: space-between; align-items: center; flex-wrap: wrap; }
.lib-head-text { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.lib-card.tpl .folder-front { color: var(--muted); }
.lib-card.tpl .folder-initials { text-shadow: none; opacity: .7; }

/* Conta */
.avatar {
  display: inline-grid; place-items: center; flex-shrink: 0; border-radius: 50%; object-fit: cover;
  background: var(--accent-soft); color: var(--accent); font: 600 12px var(--font-ui);
}
.account-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px 0 6px;
  border: 1px solid var(--border); border-radius: 99px; background: var(--surface); color: var(--text);
  font-weight: 500; max-width: 260px;
}
.account-chip:hover { border-color: var(--muted); }
.account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-chip > span:last-child { color: var(--faint); }

/* ============ Tela inicial ============ */
.app.start-mode .topbar { display: none; }
.start-page { max-width: 1160px; min-height: 100%; display: flex; align-items: center; padding-top: 48px; }
.start-wrap { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 56px; align-items: start; width: 100%; }
.start-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 20px; letter-spacing: -.01em; margin-bottom: 36px; }
.brand-mark.lg { width: 40px; height: 40px; border-radius: 11px; font-size: 21px; }
.start-hero h1 { font: 600 clamp(30px, 4.4vw, 46px)/1.1 var(--font-notes); letter-spacing: -.02em; margin: 0 0 18px; text-wrap: balance; }
.start-hero .lead { font-size: 17px; color: var(--muted); margin: 0 0 32px; max-width: 52ch; line-height: 1.6; }
.start-features { list-style: none; padding: 0; margin: 0; display: grid; gap: 18px; }
.start-features li { display: flex; gap: 14px; align-items: flex-start; }
.sf-icon {
  display: grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 10px; background: var(--accent-soft); color: var(--accent);
}
.start-features b { display: block; font-weight: 600; margin-bottom: 2px; }
.start-features li span:not(.sf-icon) { color: var(--muted); font-size: 13.5px; }
.start-side { display: flex; flex-direction: column; gap: 18px; }
.start-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px;
}
.start-card h2 { margin: 0; font-size: 17px; }
.start-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.start-card .theme-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.start-card .tc-preview { height: 46px; }
.start-card .tc-name { font-size: 11.5px; }
.start-account { display: flex; align-items: center; gap: 12px; padding: 4px 0 6px; }
.start-account b { display: block; }
.start-account span { color: var(--muted); font-size: 13px; }
.start-note { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.start-note.small { color: var(--faint); font-size: 12px; text-align: center; }
.start-error { margin: 0; padding: 8px 12px; border-radius: 8px; color: var(--st-review); background: color-mix(in srgb, var(--st-review) 10%, transparent); font-size: 13px; }
.start-or { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; }
.start-or::before, .start-or::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.btn.block { width: 100%; }
.btn.google { background: #fff; color: #1f1f1f; border-color: #dadce0; }
.btn.google:hover:not(:disabled) { background: #f8f9fa; border-color: #c4c7c5; }
.btn.busy .ic { animation: spin 1s linear infinite; }
.link-btn { border: 0; background: none; padding: 2px 0; color: var(--accent); font-size: 13px; cursor: pointer; align-self: center; }
.link-btn:hover { text-decoration: underline; }

.theme-group-label { font-size: 11.5px; font-weight: 600; color: var(--faint); margin: 6px 0 6px 2px; }
.theme-groups .theme-group-label:first-child { margin-top: 0; }

.backdrop { display: none; }

/* ============ Responsivo ============ */
@media (hover: none) {
  .item-tools { opacity: 1; }
  .item:not(:focus-within) .fmt-bar { display: none; }
  .pv-ctl { opacity: 1; }
}

@media (max-width: 900px) {
  .app, .app.sidebar-hidden, .app.library-mode { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(340px, 88vw);
    transform: translateX(-100%); transition: transform .22s ease; visibility: visible !important;
    box-shadow: var(--shadow);
  }
  .app.drawer-open .sidebar { transform: none; }
  .backdrop { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .4); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .app.drawer-open .backdrop { opacity: 1; pointer-events: auto; }
  .only-mobile { display: inline-grid; }
  .search kbd { display: none; }
  .search input { padding-right: 10px; }
  .page { padding: 24px 16px 120px; }
  .import-grid { grid-template-columns: 1fr; }
  .field textarea { min-height: 180px; }
  .preview { max-height: 40vh; min-height: 160px; }
  .crumb:not(:last-child), .crumb-sep { display: none; }
  .crumb:last-child { display: block; }
}

@media (max-width: 900px) {
  /* no celular/tablet em pé: título, login, recursos e temas, nessa ordem */
  .start-wrap { display: flex; flex-direction: column; gap: 0; }
  .start-hero, .start-side { display: contents; }
  .start-brand { order: 1; }
  .start-hero h1 { order: 2; }
  .start-hero .lead { order: 3; margin-bottom: 24px; }
  .start-login { order: 4; margin-bottom: 32px; }
  .start-features { order: 5; margin-bottom: 32px; }
  .start-prefs { order: 6; }
  .start-page { padding-top: 28px; }
  .start-brand { margin-bottom: 22px; }
}

@media (max-width: 560px) {
  .start-card { padding: 18px 16px; }
  .account-name { max-width: 110px; }
  .lib-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 16px; }
  .folder-initials { font-size: 30px; }
  .pager { grid-template-columns: 1fr; }
  .pager-btn.next { grid-column: 1; }
  .set-row > label, .set-label { flex-basis: 100%; }
  .field-row:not(.between) { flex-direction: column; align-items: stretch; }
  .field.narrow { flex: 1; }
  .dlg-body { padding: 10px 16px 16px; }
  .dlg-head, .dlg-foot { padding-left: 16px; padding-right: 16px; }
}

@media print {
  .sidebar, .topbar, .item-tools, .add-bar, .pager, .btn.finish, .board-bar, .board-handle { display: none !important; }
  .app { display: block; height: auto; }
  .scroller { overflow: visible; }
}
