/* ============================================================
   Espaço de Estudos · identidade visual
   Paleta: papel quente, tinta grafite, indigo profundo (acento),
   ambar (datas/aulas), verde-musgo (tags). Tipografia: Fraunces
   (display, serifada com carater) + Inter (corpo/UI).
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --paper: #f6f4ee;
  --paper-2: #efebe1;
  --surface: #ffffff;
  --surface-2: #f4f1ea;
  --ink: #211f1b;
  --ink-soft: #6b6459;
  --line: #e6e0d2;
  --indigo: #4138c9;
  --indigo-soft: #ebeafa;
  --amber: #b06d12;
  --amber-soft: #f7eddc;
  --moss: #4a6b46;
  --danger: #b3402f;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(31,29,26,.05), 0 12px 28px -14px rgba(31,29,26,.14);
}
[data-theme="dark"] {
  color-scheme: dark;
  --paper: #15171c;
  --paper-2: #1b1e24;
  --surface: #21252d;
  --surface-2: #272c35;
  --ink: #eae7e0;
  --ink-soft: #9d9588;
  --line: #30353f;
  --indigo: #8e86f2;
  --indigo-soft: #2b2950;
  --amber: #d9a24e;
  --amber-soft: #3a2f1c;
  --moss: #7fae7a;
  --danger: #e58373;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 14px 34px -16px rgba(0,0,0,.7);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background .2s ease, color .2s ease;
}

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 14px; }

/* ---------- Botoes ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  transition: .15s;
}
.btn:hover { border-color: var(--ink-soft); }
.btn-primary {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #fff;
}
.btn-primary:hover { background: #2f2f78; }
.btn-ghost { border: none; background: transparent; color: var(--ink-soft); padding: 6px 8px; }
.btn-ghost:hover { color: var(--ink); background: var(--paper-2); }
.btn-danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn-danger:hover { background: #f7e7e4; }
.btn-sm { padding: 5px 10px; font-size: 13px; }

/* ---------- Inputs ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; font-weight: 500; color: var(--ink-soft); margin-bottom: 5px; }
.input, textarea.input, select.input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}
.input:focus, textarea.input:focus, select.input:focus {
  outline: none; border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--indigo-soft);
}
.hint { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 500px at 80% -10%, var(--indigo-soft), transparent),
    var(--paper);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; padding: 32px;
  box-shadow: var(--shadow);
}
.login-logo { width: 56px; height: 56px; border-radius: 14px; display: block; margin-bottom: 16px; }
.login-card h1 {
  font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 26px;
  letter-spacing: -.01em; margin-bottom: 4px;
}
.login-card .sub { color: var(--ink-soft); font-size: 14px; margin-bottom: 24px; }

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--paper-2);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand {
  font-family: 'Space Grotesk', sans-serif; font-size: 20px; font-weight: 600;
  letter-spacing: -.01em; padding: 4px 8px 18px; display: flex; align-items: center; gap: 8px;
}
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--indigo); }
.brand-logo { width: 28px; height: 28px; border-radius: 7px; display: block; }
/* Marca clicável: volta para a página inicial (hub de módulos). */
.brand-home {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0;
  border: none; background: transparent; padding: 0; text-align: left;
  font: inherit; letter-spacing: inherit; color: inherit; cursor: pointer;
}
.brand-home:hover .brand-name { color: var(--indigo); }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-soft); padding: 14px 8px 6px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  text-align: left; border: none; background: transparent;
  padding: 8px 8px; border-radius: 8px; color: var(--ink-soft);
  font-size: 14px; font-weight: 500;
}
.nav-item:hover { background: var(--surface); color: var(--ink); }
.nav-item.active { background: var(--surface); color: var(--indigo); box-shadow: var(--shadow); }
.nav-item .ico { width: 16px; text-align: center; opacity: .8; }

/* Botão de recolher e modo "rail" (somente ícones) */
.brand-name { flex: 1; min-width: 0; }
.sidebar-toggle {
  margin-left: auto; flex: none; width: 30px; height: 30px; border: none;
  border-radius: 8px; background: transparent; color: var(--ink-soft);
  display: grid; place-items: center; cursor: pointer; font-size: 13px;
  transition: background .12s, color .12s;
}
.sidebar-toggle:hover { background: var(--surface); color: var(--ink); }

@media (min-width: 761px) {
  .app.collapsed { grid-template-columns: 72px 1fr; }
  .app.collapsed .sidebar { padding: 20px 10px; align-items: stretch; }
  .app.collapsed .brand { justify-content: center; padding: 4px 0 14px; }
  .app.collapsed .brand-logo,
  .app.collapsed .brand-name,
  .app.collapsed .brand-home { display: none; }
  .app.collapsed .sidebar-toggle { margin: 0; }
  .app.collapsed .nav-group { display: none; }
  .app.collapsed .nav-item { justify-content: center; gap: 0; padding: 11px 0; }
  .app.collapsed .nav-label,
  .app.collapsed .nav-caret-static { display: none; }
  .app.collapsed .nav-item .ico { width: auto; font-size: 16px; opacity: .85; }
  .app.collapsed .nav-tree,
  .app.collapsed .settings-sub { display: none !important; }
}
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--ink-soft); display: flex; align-items: center; justify-content: space-between; }

.main { padding: 0; overflow-y: auto; height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 5; background: var(--paper);
  border-bottom: 1px solid var(--line); padding: 14px 0;
}
.bar-inner {
  max-width: 1100px; width: 100%; margin: 0 auto; padding: 0 40px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topbar h2 { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 22px; letter-spacing: -.01em; }
.breadcrumb { font-size: 13px; color: var(--ink-soft); }
.breadcrumb a { color: var(--indigo); cursor: pointer; text-decoration: none; }
.content { max-width: 1100px; margin: 0 auto; padding: 28px 40px 80px; }

/* ---------- Cards / listas ---------- */
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); transition: .15s;
}
.card.clickable:hover { border-color: var(--indigo); transform: translateY(-1px); }
.card h3 { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 18px; margin-bottom: 4px; }
.card .meta { font-size: 13px; color: var(--ink-soft); }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--ink-soft); }
.empty { text-align: center; padding: 60px 20px; color: var(--ink-soft); }
.empty .big { font-family: 'Space Grotesk', sans-serif; font-size: 20px; color: var(--ink); margin-bottom: 6px; }

/* ---------- Tags / pills ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--indigo-soft); color: var(--indigo);
}
.tag .x { cursor: pointer; opacity: .6; }
.tag .x:hover { opacity: 1; }
.pill-level {
  display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 11px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  background: var(--amber-soft); color: var(--amber);
}
.date-chip {
  display: inline-flex; flex-direction: column; line-height: 1.2;
  background: var(--amber-soft); color: var(--amber);
  padding: 6px 10px; border-radius: 8px; font-size: 13px; font-weight: 500;
}
.date-chip small { color: var(--ink-soft); font-weight: 400; font-size: 11px; }

/* ---------- Editor de notas (rich text) ---------- */
.editor-toolbar { display: flex; gap: 2px; flex-wrap: wrap; padding: 6px;
  border: 1px solid var(--line); border-bottom: none; border-radius: 8px 8px 0 0; background: var(--paper-2); }
.editor-toolbar button { border: none; background: transparent; padding: 5px 9px; border-radius: 6px;
  font-size: 13px; color: var(--ink-soft); min-width: 30px; }
.editor-toolbar button:hover { background: var(--surface); color: var(--ink); }
.editor {
  border: 1px solid var(--line); border-radius: 0 0 8px 8px; padding: 14px 16px;
  min-height: 180px; background: var(--surface); outline: none; font-size: 15px; line-height: 1.65;
}
.editor:focus { border-color: var(--indigo); }
.editor h1, .editor h2 { font-family: 'Space Grotesk', sans-serif; }
.editor pre { background: var(--paper-2); padding: 10px 12px; border-radius: 8px; overflow-x: auto;
  font-family: ui-monospace, 'Cascadia Code', monospace; font-size: 13px; }
.editor code { background: var(--paper-2); padding: 1px 5px; border-radius: 4px;
  font-family: ui-monospace, monospace; font-size: .9em; }
.editor blockquote { border-left: 3px solid var(--indigo); padding-left: 12px; color: var(--ink-soft); }
.editor ul, .editor ol { padding-left: 22px; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(31,29,26,.4); display: grid; place-items: center;
  z-index: 50; padding: 20px; }
.modal {
  background: var(--surface); border-radius: 14px; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { font-family: 'Space Grotesk', sans-serif; font-size: 19px; font-weight: 600; }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

/* repeater (telefones/emails/datas) */
.repeat-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.repeat-row.dates { grid-template-columns: 160px 1fr auto; }
.logo-prev { width: 56px; height: 56px; border-radius: 10px; object-fit: contain; background: var(--paper-2); border: 1px solid var(--line); }

/* ============================================================
   CHAT DE IA (canto inferior direito)
   ============================================================ */
.chat-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 40;
  width: 54px; height: 54px; border-radius: 50%; border: none;
  background: var(--indigo); color: #fff; font-size: 22px;
  box-shadow: 0 8px 24px rgba(58,58,140,.4);
}
.chat-panel {
  position: fixed; right: 22px; bottom: 22px; z-index: 41;
  width: 360px; max-width: calc(100vw - 32px); height: 520px; max-height: calc(100vh - 44px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); display: flex; flex-direction: column; overflow: hidden;
}
.chat-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.chat-head .title { font-family: 'Space Grotesk', sans-serif; font-weight: 600; }
.chat-head .status { font-size: 11px; color: var(--ink-soft); }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { padding: 9px 12px; border-radius: 12px; font-size: 14px; max-width: 85%; line-height: 1.5; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--indigo); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: var(--paper-2); color: var(--ink); border-bottom-left-radius: 4px; }
.msg.sys { align-self: center; background: var(--amber-soft); color: var(--amber); font-size: 12px; text-align: center; }
.chat-input { padding: 12px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.chat-input textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; max-height: 90px; }

/* ============================================================
   NAVEGAÇÃO EM ÁRVORE (sidebar)
   ============================================================ */
.nav-caret-static { width: 14px; display: inline-block; text-align: center; font-size: 10px; opacity: .7; margin-left: auto; }
/* Cursos indentados sob "Cursos", com o mesmo recuo/guia das disciplinas sob um curso. */
.nav-tree { display: flex; flex-direction: column; gap: 2px; margin-left: 12px; padding-left: 18px; border-left: 1px solid var(--line); }
.nav-course-wrap { display: flex; flex-direction: column; }
.nav-course { display: flex; align-items: center; gap: 2px; padding: 6px 6px; }
.nav-caret {
  border: none; background: transparent; color: var(--ink-soft);
  width: 18px; height: 22px; border-radius: 5px; font-size: 10px; flex-shrink: 0;
}
.nav-caret:hover { background: var(--surface); color: var(--ink); }
.nav-course-label {
  flex: 1; text-align: left; border: none; background: transparent;
  color: var(--ink); font-size: 13.5px; font-weight: 600; padding: 2px 4px;
  border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-course-label:hover { color: var(--indigo); }
.nav-course.active { background: var(--surface); box-shadow: var(--shadow); }
.nav-children { display: flex; flex-direction: column; gap: 1px; padding-left: 18px; margin: 2px 0 6px; border-left: 1px solid var(--line); margin-left: 12px; }
.nav-sub { padding: 5px 8px; font-size: 13px; font-weight: 400; }
.nav-sub .nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-sub .ico { opacity: .5; font-size: 11px; }
.nav-sub .sem { color: var(--amber); font-weight: 500; font-size: 11px; }
.nav-add { color: var(--indigo); font-size: 12.5px; font-weight: 500; padding: 5px 8px; }
.nav-add:hover { background: var(--surface); }
.nav-empty { font-size: 12px; color: var(--ink-soft); padding: 4px 8px; font-style: italic; }
.nav-root .ico { width: 16px; text-align: center; }

/* ============================================================
   PÁGINA DA DISCIPLINA (ocupa toda a área à direita)
   ============================================================ */
.content-wide { max-width: 1100px; }
.section-title { font-family: 'Space Grotesk', sans-serif; font-weight: 600; margin-bottom: 12px; font-size: 18px; }
.subject-page { padding-bottom: 40px; }
.subject-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 14px; margin-bottom: 2px; }
.subject-meta .dotsep { color: var(--line); }
.subject-section { margin-top: 28px; }
.sem-chip {
  display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 12px;
  font-weight: 600; background: var(--amber-soft); color: var(--amber); vertical-align: middle;
}
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .grid-form { grid-template-columns: 1fr; } }

/* Visualização das anotações (modo leitura) */
.notes-view { font-size: 15.5px; line-height: 1.7; }
.notes-view h1, .notes-view h2 { font-family: 'Space Grotesk', sans-serif; margin: 18px 0 8px; }
.notes-view h1 { font-size: 26px; }
.notes-view h2 { font-size: 21px; }
.notes-view p { margin: 8px 0; }
.notes-view ul, .notes-view ol { padding-left: 24px; margin: 8px 0; }
.notes-view blockquote { border-left: 3px solid var(--indigo); padding-left: 14px; color: var(--ink-soft); margin: 10px 0; }
.notes-view pre { background: var(--paper-2); padding: 12px 14px; border-radius: 8px; overflow-x: auto;
  font-family: ui-monospace, 'Cascadia Code', monospace; font-size: 13.5px; }
.notes-view code { background: var(--paper-2); padding: 1px 5px; border-radius: 4px; font-family: ui-monospace, monospace; font-size: .9em; }

/* ============================================================
   RECURSOS MATEMÁTICOS (fórmulas LaTeX + gráficos)
   ============================================================ */
.tb-sep { width: 1px; align-self: stretch; background: var(--line); margin: 2px 4px; }
.editor-toolbar button[data-math] { color: var(--indigo); font-weight: 600; }

/* Nó de fórmula dentro do editor / visualização */
.mathnode { display: inline-block; padding: 0 2px; cursor: pointer; border-radius: 4px; }
.mathnode:hover { background: var(--indigo-soft); }
.mathnode.block { display: block; text-align: center; margin: 12px 0; padding: 8px; }
.notes-view .mathnode { cursor: default; }
.notes-view .mathnode:hover { background: transparent; }

/* Gráfico de função */
.fn-graph {
  display: block; margin: 14px 0; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px; background: var(--surface); cursor: pointer; max-width: 620px;
}
.fn-graph:hover { border-color: var(--indigo); }
.notes-view .fn-graph { cursor: default; }
.notes-view .fn-graph:hover { border-color: var(--line); }
.fn-graph canvas { display: block; border-radius: 6px; }

/* Pré-visualização nos modais de matemática */
.formula-preview {
  margin-top: 6px; min-height: 48px; padding: 12px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--paper-2); display: flex; align-items: center;
  justify-content: center; overflow-x: auto;
}

/* ============================================================
   FILTROS (listas de Cursos e Disciplinas)
   ============================================================ */
.filter-row {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px;
  padding: 14px 16px; margin-bottom: 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.filter { display: flex; flex-direction: column; gap: 4px; flex: 1 1 180px; min-width: 150px; max-width: 240px; }
.filter > span { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }
.filter select.input { width: 100%; min-width: 0; padding: 8px 10px; min-height: 38px; }
.filter-tags { flex: 1; min-width: 200px; }
.fchips { gap: 6px; }
.fchip { cursor: pointer; background: var(--paper-2); color: var(--ink-soft); border: 1px solid var(--line); }
.fchip:hover { border-color: var(--ink-soft); }
.fchip.on { border-color: transparent; }
.filter-row [data-fclear] { margin-left: auto; align-self: center; }

/* ============================================================
   PÁGINA-DOCUMENTO DA DISCIPLINA (estilo Notion)
   ============================================================ */
.save-status { font-size: 12px; color: var(--ink-soft); min-width: 78px; text-align: right; }
.doc { padding-bottom: 80px; }
.doc-title {
  font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 34px; letter-spacing: -.01em;
  line-height: 1.2; outline: none; padding: 4px 0; margin-bottom: 4px; color: var(--ink);
}
.doc-title:empty:before { content: attr(data-ph); color: var(--line); }
.doc-details { margin-bottom: 18px; }
.doc-details-btn {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px;
  border: none; background: transparent; padding: 4px 6px; border-radius: 8px;
  cursor: pointer; text-align: left; max-width: 100%;
}
.doc-details-btn:hover { background: var(--paper-2); }
.doc-detail { font-size: 13px; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 4px; }
.doc-detail.add { color: var(--indigo); font-weight: 500; }
.doc-detail.edit { color: var(--ink-soft); opacity: 0; transition: .15s; font-size: 12px; }
.doc-details-btn:hover .doc-detail.edit { opacity: .7; }
.doc-detail-tags { display: inline-flex; flex-wrap: wrap; gap: 5px; }

/* Documento em largura total (só a barra lateral fica de fora). */
.doc-content { padding-left: 24px; padding-right: 24px; max-width: none; }
.doc-content.has-outline { padding-right: 224px; }
.doc-title, .doc-details { margin-left: 64px; }

/* Caixa branca do editor: engloba a barra de botões e a numeração. */
.doc-editor-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden;
}
.doc-editor-card .editor-toolbar {
  border: none; border-bottom: 1px solid var(--line); border-radius: 0;
  background: #fbfaf7;
}

/* Editor com numeração de linhas (gutter dentro da caixa) */
.editor-wrap { position: relative; }
.editor-gutter {
  position: absolute; top: 0; left: 0; width: 24px; height: 100%;
  border-right: 1px solid var(--line);
}
.editor-gutter .ln {
  position: absolute; right: 6px; color: #c4bdac; font-size: 12px;
  font-family: ui-monospace, monospace; user-select: none; line-height: 1.7;
}
.editor.doc-body {
  margin-left: 0; padding: 10px 16px 14px 64px; min-height: 420px;
  border: none; border-radius: 0; font-size: 16px; line-height: 1.7;
}
.input.mono, textarea.input.mono { font-family: ui-monospace, 'Cascadia Code', monospace; }
.editor.doc-body:focus { border: none; }
.doc-body h1, .doc-body h2 { font-family: 'Space Grotesk', sans-serif; }
.doc-body h1 { font-size: 26px; margin: 16px 0 6px; }
.doc-body h2 { font-size: 21px; margin: 14px 0 6px; }
.doc-body p { margin: 6px 0; }
.doc-body blockquote { border-left: 3px solid var(--indigo); padding-left: 14px; color: var(--ink-soft); margin: 8px 0; }

/* Imagens nas anotações */
.doc-img { max-width: 100%; height: auto; border-radius: 8px; margin: 10px 0; display: block; cursor: pointer; }

/* Pontos de redimensionamento da imagem selecionada */
.img-resizer { position: absolute; box-sizing: border-box; border: 1.5px solid var(--indigo); pointer-events: none; z-index: 7; border-radius: 4px; }
.img-handle { position: absolute; width: 12px; height: 12px; background: var(--surface); border: 2px solid var(--indigo); border-radius: 50%; pointer-events: auto; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.h-nw { left: -7px; top: -7px; cursor: nwse-resize; }
.h-ne { right: -7px; top: -7px; cursor: nesw-resize; }
.h-sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.h-se { right: -7px; bottom: -7px; cursor: nwse-resize; }

/* Tabelas editáveis */
.doc-table { border-collapse: collapse; margin: 12px 0; width: auto; min-width: 60%; }
.doc-table td, .doc-table th { border: 1px solid var(--line); padding: 7px 10px; min-width: 48px; vertical-align: top; }
.doc-table th { background: var(--paper-2); font-weight: 600; text-align: left; }
.doc-table td:focus, .doc-table th:focus { outline: 2px solid var(--indigo-soft); outline-offset: -2px; }

/* Bloco de código com seletor de linguagem */
.code-block { margin: 12px 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.code-head { display: flex; align-items: center; justify-content: flex-end; padding: 5px 8px; background: var(--paper-2); border-bottom: 1px solid var(--line); }
.code-lang { font-family: 'Inter', sans-serif; font-size: 12px; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; background: var(--surface); cursor: pointer; }
.code-block pre { margin: 0; }
.code-block code { display: block; padding: 12px 14px; font-family: ui-monospace, 'Cascadia Code', monospace; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; outline: none; background: transparent; }

/* ============================================================
   EDITOR DE BLOCOS (Notion-like): blocos, alça, menus, sumário
   ============================================================ */
/* Tipos de bloco */
.doc-body .has-bg { padding: 4px 8px; border-radius: 6px; }
.todo-item { display: flex; align-items: flex-start; gap: 8px; margin: 3px 0; }
.todo-check { margin-top: 5px; flex-shrink: 0; }
.todo-text { flex: 1; }
.todo-check:checked + .todo-text { text-decoration: line-through; color: var(--ink-soft); }
.toggle { margin: 4px 0; }
.toggle-caret { border: none; background: none; cursor: pointer; color: var(--ink-soft); width: 20px; padding: 0; font-size: 12px; display: inline-block; vertical-align: top; transition: transform .15s; }
.toggle[data-open="0"] .toggle-caret { transform: rotate(-90deg); }
.toggle-title { display: inline-block; vertical-align: top; min-width: 40px; }
.toggle-body { margin: 4px 0 4px 24px; }
.toggle[data-open="0"] .toggle-body { display: none; }
.callout { display: flex; gap: 10px; background: var(--paper-2); border-radius: 8px; padding: 12px 14px; margin: 8px 0; }
.callout-ico { font-size: 18px; line-height: 1.5; flex-shrink: 0; }
.callout-body { flex: 1; }
hr.divider { border: none; border-top: 1px solid var(--line); margin: 16px 0; }

/* Alça de bloco (aparece ao passar o mouse), entre a numeração e o texto */
.blk-handle { position: absolute; left: 26px; display: flex; gap: 1px; height: 26px; align-items: center; z-index: 6; }
.blk-btn { width: 22px; height: 24px; border: none; background: transparent; color: var(--ink-soft); border-radius: 5px; font-size: 14px; cursor: pointer; display: grid; place-items: center; }
.blk-btn:hover { background: var(--paper-2); color: var(--ink); }
.blk-grip { cursor: grab; font-size: 12px; }

/* Menus flutuantes (alça e comando "/") */
.editor-menu {
  position: fixed; z-index: 60; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.18); padding: 6px;
  width: 236px; max-height: 62vh; overflow-y: auto;
}
.menu-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); padding: 7px 8px 3px; font-weight: 600; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.menu-item:hover { background: var(--paper-2); }
.menu-ico { width: 22px; text-align: center; font-size: 13px; color: var(--ink-soft); }
.menu-label { flex: 1; }
.menu-divider { height: 1px; background: var(--line); margin: 5px 4px; }
.color-row { display: flex; gap: 6px; padding: 4px 8px 8px; flex-wrap: wrap; }
.swatch { width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 6px; font-weight: 700; cursor: pointer; display: grid; place-items: center; background: var(--surface); color: var(--ink); }
.swatch.bg { font-size: 0; }
.swatch:hover { border-color: var(--ink-soft); }

/* Sumário de seções (direita) */
.doc-outline { position: fixed; top: 116px; right: 24px; width: 184px; max-height: 64vh; overflow-y: auto; }
.outline-title { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); font-weight: 600; margin-bottom: 8px; }
.outline-item { color: var(--ink-soft); padding: 3px 6px; border-radius: 5px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.outline-item:hover { background: var(--paper-2); color: var(--ink); }
.outline-item.lvl2 { padding-left: 16px; font-size: 12.5px; }
.outline-item.lvl3 { padding-left: 28px; font-size: 12px; }
.outline-empty { font-size: 12px; color: var(--ink-soft); font-style: italic; line-height: 1.5; }
@media (max-width: 1180px) { .doc-outline { display: none; } }

/* ============================================================
   PALETA DE SÍMBOLOS (modal de fórmula)
   ============================================================ */
.sym-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.sym-tab {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 500;
}
.sym-tab:hover { border-color: var(--ink-soft); }
.sym-tab.active { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.sym-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px;
  max-height: 200px; overflow-y: auto; padding: 10px; margin-bottom: 14px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper-2);
}
.sym-btn {
  min-height: 42px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px;
  display: grid; place-items: center; padding: 4px; font-size: 15px; color: var(--ink);
  overflow: hidden;
}
.sym-btn:hover { border-color: var(--indigo); background: var(--indigo-soft); }
.sym-btn .katex { font-size: 1em; }

/* ============================================================
   PERFIL, AVATAR E CAMPO DE SENHA
   ============================================================ */
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 38px; }
.pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: none; background: none; cursor: pointer; font-size: 15px; opacity: .45;
  padding: 4px; border-radius: 6px; line-height: 1;
}
.pw-eye:hover { opacity: .85; }
.pw-eye.on { opacity: 1; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%; background: var(--indigo);
  color: #fff; font-weight: 600; font-size: 14px; overflow: hidden; flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 26px; height: 26px; font-size: 12px; }
.avatar-lg { width: 84px; height: 84px; font-size: 32px; }

.sidebar-user {
  display: flex; align-items: center; gap: 8px; border: none; background: transparent;
  padding: 5px 6px; border-radius: 8px; cursor: pointer; color: var(--ink);
  flex: 1; min-width: 0; text-align: left;
}
.sidebar-user:hover { background: var(--surface); }
.sidebar-user.active { background: var(--surface); box-shadow: var(--shadow); }
.sidebar-user .su-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.profile-card { max-width: 560px; }
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }

/* ---------- responsivo ---------- */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .sidebar-toggle { display: none; } /* recolher é recurso de telas largas */
  .sidebar-foot { width: 100%; }
  .content { padding: 20px 16px 80px; }
  .doc-content, .doc-content.has-outline { padding-left: 12px; padding-right: 12px; }
  .doc-title, .doc-details { margin-left: 48px; }
  .topbar { padding: 12px 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ============================================================
   ORGANIZAÇÃO ACADÊMICA (tarefas: abas, lista, calendário, kanban)
   ============================================================ */
.tab-bar { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab {
  border: none; background: transparent; color: var(--ink-soft);
  padding: 9px 16px; font-size: 14px; font-weight: 500; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--indigo); border-bottom-color: var(--indigo); }

.task-status {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}

/* Lista (tabela) */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.task-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.task-table th {
  text-align: left; padding: 10px 12px; background: var(--paper-2);
  color: var(--ink-soft); font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.task-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.task-table tr:last-child td { border-bottom: none; }
.task-table tr.clickable:hover td { background: var(--paper-2); }
.task-table .logo-prev { width: 26px; height: 26px; border-radius: 6px; }

/* Calendário */
.cal-head { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 14px; }
.cal-head h3 { font-family: 'Space Grotesk', sans-serif; font-size: 19px; min-width: 220px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-wd { text-align: center; font-size: 12px; font-weight: 600; color: var(--ink-soft); padding-bottom: 4px; }
.cal-cell {
  position: relative;
  min-height: 96px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); padding: 5px 6px; display: flex; flex-direction: column; gap: 4px;
  overflow: hidden; /* cresce só na vertical; conteúdo não vaza para o lado */
  transition: border-color .12s, background .12s;
}
.cal-cell.empty { background: transparent; border: none; }
.cal-cell:not(.empty):hover { border-color: var(--indigo); }
.cal-cell.today { border-color: var(--indigo); box-shadow: 0 0 0 2px var(--indigo-soft); }
.cal-day { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.cal-add {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px;
  border: none; border-radius: 6px; background: var(--indigo); color: #fff;
  font-size: 16px; line-height: 1; display: grid; place-items: center;
  opacity: 0; transform: scale(.85); transition: opacity .12s, transform .12s; cursor: pointer; z-index: 1;
}
.cal-cell:not(.empty):hover .cal-add { opacity: 1; transform: scale(1); }
.cal-add:hover { filter: brightness(1.08); }
.cal-chip {
  display: flex; align-items: center; gap: 5px; padding: 3px 6px;
  background: var(--paper-2); border-radius: 5px; font-size: 12px; cursor: pointer;
  overflow: hidden; min-width: 0; max-width: 100%; /* nunca expande na horizontal */
}
.cal-chip:hover { background: var(--indigo-soft); }
.cal-chip .logo-prev { width: 16px; height: 16px; border-radius: 3px; flex: none; }
.cal-chip-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1 1 auto; }

/* Tooltip do calendário (flutua sobre tudo, fora do clip das células) */
.cal-tip {
  position: fixed; z-index: 9999; pointer-events: none;
  background: #1f2430; color: #fff; border-radius: 8px;
  padding: 8px 10px; font-size: 12px; line-height: 1.5;
  box-shadow: 0 10px 28px rgba(0,0,0,.28); max-width: 300px;
}
.cal-tip-row { display: flex; gap: 10px; }
.cal-tip-k { color: rgba(255,255,255,.55); min-width: 78px; flex: none; }
.cal-tip-v { font-weight: 500; word-break: break-word; }

/* ---------- Início (home) ---------- */
.home-block { margin-bottom: 26px; }
.home-block:last-child { margin-bottom: 0; }
.home-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px; font-weight: 600; margin: 0 0 12px;
}
.home-recents {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px;
}
.home-recent {
  text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 6px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.home-recent:hover { border-color: var(--indigo); box-shadow: var(--shadow); transform: translateY(-1px); }
.home-recent-top { display: flex; align-items: center; gap: 8px; }
.home-recent-top .logo-prev { border-radius: 6px; }
.home-recent-top .sem {
  margin-left: auto; font-size: 11px; color: var(--ink-soft);
  background: var(--paper-2); padding: 1px 8px; border-radius: 999px;
}
.home-recent-name { font-weight: 600; font-size: 14px; line-height: 1.3; }

/* ---------- Login: erro + estado de carregando ---------- */
.login-err { display: none; }
.login-err:not(:empty) {
  display: block;
  background: #fbeae8; color: var(--danger);
  border: 1px solid #f0c8c2; border-radius: 8px;
  padding: 9px 12px; font-size: 13px; margin: 6px 0 2px; line-height: 1.4;
}
.btn:disabled { opacity: .6; cursor: progress; }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: start; }
.kanban-col { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.kanban-col-head {
  padding: 10px 12px; font-weight: 600; font-size: 13.5px; background: var(--surface);
  display: flex; align-items: center; gap: 8px;
}
.kanban-count { color: var(--ink-soft); font-weight: 500; font-size: 12px; }
.kanban-list { padding: 10px; display: flex; flex-direction: column; gap: 10px; min-height: 80px; }
.kanban-list.drag-over { background: var(--indigo-soft); }
.kanban-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px; box-shadow: var(--shadow); cursor: grab;
}
.kanban-card:hover { border-color: var(--ink-soft); }
.kanban-card.dragging { opacity: .45; }
.kanban-card-title { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; }
.kanban-card .logo-prev { width: 22px; height: 22px; border-radius: 5px; }

@media (max-width: 900px) {
  .kanban { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .kanban { grid-template-columns: 1fr; }
  .cal-cell { min-height: 70px; }
}

/* Urgência por prazo (cards e itens do painel) */
.due-red { border-left: 4px solid #d44c47 !important; background: rgba(212,76,71,.08); }
.due-orange { border-left: 4px solid #d9730d !important; background: rgba(217,115,13,.08); }
.due-yellow { border-left: 4px solid #cb912f !important; background: rgba(203,145,47,.10); }

/* Select com busca */
select.ss-native { display: none !important; }
.ss-wrap { position: relative; }
.ss-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left; cursor: pointer; background: var(--surface);
}
.ss-btn::after { content: '▾'; color: var(--ink-soft); font-size: 11px; }
.ss-btn.ss-placeholder { color: var(--ink-soft); }
.filter .ss-btn { width: 100%; min-width: 0; padding: 8px 10px; min-height: 38px; }
.ss-panel {
  position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; right: 0; min-width: 180px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow); padding: 8px;
}
.ss-search { width: 100%; margin-bottom: 6px; padding: 7px 9px; }
.ss-list { max-height: 220px; overflow-y: auto; }
.ss-item { padding: 7px 9px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.ss-item:hover { background: var(--paper-2); }
.ss-item.active { background: var(--indigo-soft); color: var(--indigo); font-weight: 500; }
.ss-empty { padding: 8px 9px; color: var(--ink-soft); font-size: 13px; }

/* Dashboard (Painel) */
.dash-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.dash-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.dash-num { font-family: 'Space Grotesk', sans-serif; font-size: 28px; font-weight: 600; line-height: 1; }
.dash-label { color: var(--ink-soft); font-size: 12px; margin-top: 6px; }
.dash-bar { height: 10px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.dash-bar-fill { height: 100%; background: var(--moss); border-radius: 999px; transition: width .3s; }
.dash-up, .dash-inst {
  display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line);
}
.dash-up:last-child, .dash-inst:last-child { border-bottom: none; }
.dash-up { padding-left: 8px; border-left: 4px solid transparent; border-radius: 4px; }
.dash-up-title { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-up-when { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
/* Listas do painel: mostram ~3 itens; o resto rola. */
.dash-scroll { max-height: 162px; overflow-y: auto; padding-right: 2px; }
.dash-scroll-sm { max-height: 110px; overflow-y: auto; padding-right: 2px; }

/* Popup SOMENTE LEITURA de tarefa */
.view-list { display: flex; flex-direction: column; }
.view-row { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.view-row:last-child { border-bottom: none; }
.view-k { min-width: 104px; flex: none; color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.view-v { flex: 1; min-width: 0; font-size: 14px; }
.view-desc { margin-top: 14px; }
.view-desc .view-k { display: block; margin-bottom: 4px; }
.view-desc .view-rich { border: none; padding: 0; min-height: 0; font-size: 14px; line-height: 1.5; }
.view-desc .view-rich p:last-child { margin-bottom: 0; }

/* ---------- Conta (canto superior direito) ---------- */
.account { position: relative; display: flex; align-items: center; gap: 10px; flex: none; }
.bar-right { display: flex; align-items: center; gap: 14px; flex: none; }
.bar-inner > div:first-child { min-width: 0; }
.topbar h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-hi { font-size: 14px; font-weight: 500; color: var(--ink); }
.account-btn, .account-theme {
  display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  box-shadow: var(--shadow); color: var(--ink); cursor: pointer; transition: border-color .15s, transform .12s;
}
.account-btn { padding: 4px; }
.account-theme { width: 38px; height: 38px; font-size: 15px; }
.account-btn:hover, .account-theme:hover { border-color: var(--ink-soft); transform: translateY(-1px); }
@media (max-width: 760px) { .account-hi { display: none; } }
.account-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; }
.account-head-info { min-width: 0; }
.account-head-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-head-email { font-size: 12px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.account-menu button {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  border: none; background: transparent; padding: 10px 11px; border-radius: 9px;
  color: var(--ink); font-size: 14px;
}
.account-menu button:hover { background: var(--surface-2); }
.account-menu button .right { margin-left: auto; font-size: 12px; color: var(--ink-soft); }
.account-menu .sep { height: 1px; background: var(--line); margin: 5px 4px; }

/* ---------- Configurações (rodapé da barra) ---------- */
.settings-wrap { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.settings-sub { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }

@media (max-width: 900px) { .dash-stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .dash-stats { grid-template-columns: repeat(2, 1fr); } }

/* Urgência por prazo nas linhas da Lista (acento à esquerda + leve fundo) */
.task-table tr.due-red td { background: rgba(212,76,71,.07); }
.task-table tr.due-orange td { background: rgba(217,115,13,.07); }
.task-table tr.due-yellow td { background: rgba(203,145,47,.10); }
.task-table tr.due-red td:first-child { box-shadow: inset 4px 0 0 #d44c47; }
.task-table tr.due-orange td:first-child { box-shadow: inset 4px 0 0 #d9730d; }
.task-table tr.due-yellow td:first-child { box-shadow: inset 4px 0 0 #cb912f; }
.task-table tr.clickable:hover td { background: var(--paper-2); }

/* Dropdown de tags (multi-seleção) */
.tagdd-btn { min-height: 38px; height: auto; flex-wrap: wrap; }
.tagdd-btn .tag { font-size: 12px; }
.ss-check { display: inline-block; width: 14px; color: var(--indigo); font-weight: 700; }
.ss-item.ss-create { color: var(--indigo); font-weight: 500; border-top: 1px solid var(--line); margin-top: 4px; }

/* Select de status editável na Lista */
.task-status-sel {
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px;
  font-size: 12px; font-weight: 600; background: var(--surface); cursor: pointer; max-width: 170px;
}
.task-status-sel:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-soft); }

/* Textarea monoespaçada (importação JSON) */
textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.5; }

/* ============================================================
   MÓDULOS (Caderno / Audiobook) — seletor no topo da sidebar
   ============================================================ */
.mod-switch {
  display: flex; gap: 4px; padding: 4px; margin: 0 0 12px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
}
.mod-tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  border: none; background: transparent; color: var(--ink-soft);
  padding: 7px 6px; border-radius: 7px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .12s, color .12s;
}
.mod-tab:hover { color: var(--ink); }
.mod-tab.active { background: var(--surface); color: var(--indigo); box-shadow: var(--shadow); }
/* Aba de módulo EXTERNO (app próprio, ex.: financeiro) renderiza como <a>. */
a.mod-tab { text-decoration: none; }

@media (min-width: 761px) {
  .app.collapsed .mod-switch { flex-direction: column; }
  .app.collapsed .mod-tab { padding: 10px 0; gap: 0; font-size: 15px; }
}

/* ============================================================
   AUDIOBOOK — biblioteca e player
   ============================================================ */
.ab-ico {
  width: 44px; height: 44px; flex: none; border-radius: 12px;
  background: var(--indigo-soft); color: var(--indigo);
  display: grid; place-items: center; font-size: 18px;
}
.player-card { padding: 22px; }
.player-canvas { width: 100%; height: 120px; display: block; border-radius: 8px; background: var(--surface-2); }
.player-progress { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.player-progress input[type="range"] { flex: 1; accent-color: var(--indigo); }
.player-time { font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; min-width: 42px; text-align: center; }
.player-controls { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.player-play {
  width: 52px; height: 52px; border: none; border-radius: 50%;
  background: var(--indigo); color: #fff; font-size: 18px; cursor: pointer;
  display: grid; place-items: center; box-shadow: var(--shadow); transition: transform .12s, filter .12s;
}
.player-play:hover { transform: scale(1.05); filter: brightness(1.08); }
.player-skip {
  position: relative; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--ink-soft); cursor: pointer; font-size: 15px;
  display: grid; place-items: center; transition: color .12s, border-color .12s;
}
.player-skip:hover { color: var(--ink); border-color: var(--ink-soft); }
.player-skip span { position: absolute; font-size: 8px; font-weight: 700; top: 55%; left: 50%; transform: translate(-50%, -50%); }
.player-side { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.player-opt { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-soft); }
.player-opt select { width: auto; padding: 5px 8px; font-size: 13px; }
.player-side input[type="range"] { width: 90px; accent-color: var(--indigo); }
.player-meta { margin-top: 14px; font-size: 13px; color: var(--ink-soft); }

/* Toggle público/privado */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  width: 40px; height: 22px; border-radius: 999px; background: var(--line);
  position: relative; transition: background .15s; flex: none;
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); transition: left .15s;
}
.switch input:checked + .switch-track { background: var(--indigo); }
.switch input:checked + .switch-track::after { left: 21px; }
.switch-label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }

/* Velocidade fina do player (−/+ 0.05, valor clicável para digitar) */
.player-spd-btn {
  width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 700;
  display: grid; place-items: center; cursor: pointer;
}
.player-spd-btn:hover { border-color: var(--indigo); color: var(--indigo); }
.player-spd-val {
  min-width: 56px; text-align: center; border: none; background: transparent;
  color: var(--ink); font-size: 13px; font-weight: 700; cursor: text; padding: 4px 6px; border-radius: 8px;
}
.player-spd-val:hover { background: var(--surface-2); }
.player-spd-input {
  width: 56px; text-align: center; font-size: 13px; font-weight: 700;
  border: 1px solid var(--indigo); border-radius: 8px; padding: 4px 6px;
  background: var(--surface); color: var(--ink); outline: none;
}

/* Minutagem digitável: o tempo atual vira campo ao clicar */
.player-time-btn { border: none; background: transparent; cursor: text; padding: 2px 4px; border-radius: 6px; }
.player-time-btn:hover { background: var(--surface-2); color: var(--ink); }
.player-time-input {
  width: 76px; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums;
  border: 1px solid var(--indigo); border-radius: 6px; padding: 2px 4px;
  background: var(--surface); color: var(--ink); outline: none;
}

/* Progresso de escuta nos cards da biblioteca */
.ab-progress {
  height: 4px; border-radius: 999px; background: var(--line);
  margin-top: 12px; overflow: hidden;
}
.ab-progress span { display: block; height: 100%; background: var(--indigo); border-radius: 999px; }
/* Registro cujo áudio já foi excluído */
.ab-ico-muted { background: var(--surface-2); color: var(--ink-soft); }

/* YouTube em paralelo + mixer de volumes */
.yt-embed {
  margin-top: 14px; aspect-ratio: 16 / 9; border-radius: 10px;
  overflow: hidden; background: #000;
}
.yt-embed iframe { width: 100%; height: 100%; display: block; border: 0; }
.mix-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.mix-row > i { width: 20px; text-align: center; color: var(--ink-soft); }
.mix-name { width: 84px; font-size: 13px; color: var(--ink-soft); flex: none; }
.mix-row input[type="range"] { flex: 1; accent-color: var(--indigo); }
.mix-val {
  width: 44px; text-align: right; font-size: 12px; color: var(--ink-soft);
  font-variant-numeric: tabular-nums; flex: none;
}

/* ============================================================
   ÍCONES (padrão Font Awesome em toda a UI)
   Emojis/glifos unicode só permanecem DENTRO do conteúdo dos
   documentos (callout, toggle) para não quebrar notas salvas.
   ============================================================ */
/* ============================================================
   PÁGINA INICIAL (hub de módulos)
   ============================================================ */
.hub-wrap { min-height: 100vh; display: flex; flex-direction: column; }
.hub-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 26px; border-bottom: 1px solid var(--line);
}
.hub-brand {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Space Grotesk', sans-serif; font-size: 19px; font-weight: 600;
  letter-spacing: -.01em;
}
/* A saudação grande já está no corpo do hub; evita o "Olá" duplicado no topo. */
.hub-top .account-hi { display: none; }
.hub-main { width: 100%; max-width: 960px; margin: 0 auto; padding: 48px 20px 64px; }
.hub-hi { font-family: 'Space Grotesk', sans-serif; font-size: 30px; font-weight: 600; letter-spacing: -.02em; }
.hub-sub { color: var(--ink-soft); margin-top: 4px; }
.hub-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px; margin-top: 28px;
}
.hub-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  text-align: left; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 22px 20px; box-shadow: var(--shadow); cursor: pointer;
  transition: transform .15s ease, border-color .15s ease;
}
.hub-card:hover { transform: translateY(-3px); border-color: var(--indigo); }
.hub-card:hover .hub-card-go { color: var(--indigo); }
.hub-ico {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  background: var(--indigo-soft); color: var(--indigo); font-size: 19px;
}
.hub-card-title { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.hub-card-desc { font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; }
.hub-card-go { margin-top: auto; font-size: 13px; font-weight: 500; color: var(--ink-soft); transition: color .15s; }
.hub-card-go i { font-size: 11px; }
.hub-card.soon { cursor: default; opacity: .72; }
.hub-card.soon:hover { transform: none; border-color: var(--line); }
.hub-card.soon .hub-ico { background: var(--paper-2); color: var(--ink-soft); }
.hub-badge {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  background: var(--amber-soft); color: var(--amber);
  padding: 2px 8px; border-radius: 999px; flex: none;
}
.hub-badge.local { background: var(--indigo-soft); color: var(--indigo); }
/* Card de módulo externo renderiza como <a> — mesmo visual do botão. */
a.hub-card { text-decoration: none; color: var(--ink); }
@media (max-width: 520px) {
  .hub-main { padding-top: 28px; }
  .hub-hi { font-size: 24px; }
}

.menu-ico i { font-size: 12px; }
.menu-ico sub { font-size: 8px; margin-left: 1px; }
.meta i, .muted i, .hint i, .doc-detail i { font-size: 11px; opacity: .85; }
.ss-check i { font-size: 10px; }
.breadcrumb i, a[data-back] i { font-size: 11px; }
.nav-caret i, .nav-caret-static i { font-size: 9px; }
.tag i { font-size: 9px; }
