/* ---------- v5: bancos de dados, páginas, editor e busca ---------- */
:root {
  --c-cinza-bg: #ececec; --c-cinza-fg: #474747; --c-cinza-dot: #8b8a92;
  --c-marrom-bg: #f2e7df; --c-marrom-fg: #6b4a35; --c-marrom-dot: #a27450;
  --c-laranja-bg: #fde3cf; --c-laranja-fg: #8a4510; --c-laranja-dot: #e8822e;
  --c-amarelo-bg: #fbf0c4; --c-amarelo-fg: #6f5400; --c-amarelo-dot: #d9a90a;
  --c-verde-bg: #dcefe2; --c-verde-fg: #1d6a3e; --c-verde-dot: #2f9e5f;
  --c-azul-bg: #dbe9fb; --c-azul-fg: #1f5aa6; --c-azul-dot: #3b82f6;
  --c-roxo-bg: #ebe3fb; --c-roxo-fg: #5b3aa6; --c-roxo-dot: #8b5cf6;
  --c-rosa-bg: #f9e1ef; --c-rosa-fg: #a1306e; --c-rosa-dot: #e0559d;
  --c-vermelho-bg: #fde0df; --c-vermelho-fg: #a8302c; --c-vermelho-dot: #e5484d;
  --code-bg: #f3f2f8; --mark: #fff1a8;
}
@media (prefers-color-scheme: dark) {
  :root {
    --c-cinza-bg: #3a3a42; --c-cinza-fg: #d6d6dc; --c-cinza-dot: #9b9aa6;
    --c-marrom-bg: #4a3a30; --c-marrom-fg: #ecd2bd; --c-marrom-dot: #b98a64;
    --c-laranja-bg: #5a3a1e; --c-laranja-fg: #fcc08f; --c-laranja-dot: #f0913f;
    --c-amarelo-bg: #54481c; --c-amarelo-fg: #f3d97a; --c-amarelo-dot: #e2b52a;
    --c-verde-bg: #1f4630; --c-verde-fg: #96e0b0; --c-verde-dot: #3fbf75;
    --c-azul-bg: #1e3a5f; --c-azul-fg: #a6cbfb; --c-azul-dot: #5b9cf8;
    --c-roxo-bg: #3b2d63; --c-roxo-fg: #cdbbfb; --c-roxo-dot: #a280fa;
    --c-rosa-bg: #55233f; --c-rosa-fg: #f6b3d6; --c-rosa-dot: #ea72b0;
    --c-vermelho-bg: #5c2424; --c-vermelho-fg: #f8b0ad; --c-vermelho-dot: #f0686c;
    --code-bg: #24222f; --mark: #6b5a12;
  }
}
.c-cinza { --cbg: var(--c-cinza-bg); --cfg: var(--c-cinza-fg); --cdot: var(--c-cinza-dot); }
.c-marrom { --cbg: var(--c-marrom-bg); --cfg: var(--c-marrom-fg); --cdot: var(--c-marrom-dot); }
.c-laranja { --cbg: var(--c-laranja-bg); --cfg: var(--c-laranja-fg); --cdot: var(--c-laranja-dot); }
.c-amarelo { --cbg: var(--c-amarelo-bg); --cfg: var(--c-amarelo-fg); --cdot: var(--c-amarelo-dot); }
.c-verde { --cbg: var(--c-verde-bg); --cfg: var(--c-verde-fg); --cdot: var(--c-verde-dot); }
.c-azul { --cbg: var(--c-azul-bg); --cfg: var(--c-azul-fg); --cdot: var(--c-azul-dot); }
.c-roxo { --cbg: var(--c-roxo-bg); --cfg: var(--c-roxo-fg); --cdot: var(--c-roxo-dot); }
.c-rosa { --cbg: var(--c-rosa-bg); --cfg: var(--c-rosa-fg); --cdot: var(--c-rosa-dot); }
.c-vermelho { --cbg: var(--c-vermelho-bg); --cfg: var(--c-vermelho-fg); --cdot: var(--c-vermelho-dot); }

.opt-pill { display: inline-flex; align-items: center; gap: 5px; background: var(--cbg); color: var(--cfg); border-radius: 5px; padding: 1px 7px; font-size: 12.5px; line-height: 1.5; margin: 1px 4px 1px 0; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.opt-pill.status { border-radius: 999px; padding: 1px 9px 1px 7px; }
.opt-pill.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--cdot); flex: none; }
.content.doc { padding-top: 0; }
kbd { font: 11px/1 system-ui, sans-serif; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 2px 5px; color: var(--muted); background: var(--panel); }
mark { background: var(--mark); color: inherit; border-radius: 2px; }

/* barra lateral */
.side-search { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; border: 1px solid var(--border); background: var(--panel); color: var(--muted); border-radius: 8px; padding: 6px 10px; margin: 0 0 8px; cursor: pointer; text-align: left; }
.side-search:hover { border-color: var(--accent); color: var(--text); }
.doc-item .di, .pg-item .di { width: 18px; text-align: center; flex: none; font-size: 14px; }
.list-item.doc-item { padding-left: 30px; }
.pg-row { display: flex; align-items: center; border-radius: 8px; padding-left: calc(14px + var(--d) * 14px); position: relative; }
.pg-row:hover { background: var(--hover); }
.pg-row.active { background: var(--accent-soft); }
.pg-row.active .pg-item { color: var(--accent); font-weight: 600; }
.pg-tog { width: 18px; height: 22px; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; font-size: 11px; flex: none; border-radius: 4px; }
.pg-tog:hover:not(.leaf) { background: var(--border); color: var(--text); }
.pg-tog.leaf { cursor: default; }
.pg-item { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; border: 0; background: none; padding: 6px 4px; text-align: left; cursor: pointer; color: var(--muted); }
.pg-item .ln { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-add { opacity: 0; flex: none; }
.pg-row:hover .pg-add, .pg-add:focus { opacity: 1; }
@media (hover: none) { .pg-add { opacity: .7; } }

/* popover */
.pop { position: fixed; z-index: 45; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; min-width: 220px; max-width: min(420px, calc(100vw - 16px)); max-height: min(460px, calc(100vh - 16px)); overflow-y: auto; }
.pop.pop-wide { min-width: min(520px, calc(100vw - 16px)); max-width: min(620px, calc(100vw - 16px)); }
.pop-title { font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 8px 4px; }
.pop-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: 7px; cursor: pointer; color: var(--text); text-decoration: none; font-size: 14px; }
.pop-item:hover { background: var(--hover); }
.pop-item.danger { color: var(--danger); }
.pop-item.create { color: var(--accent); }
.pop-item .ck { width: 14px; color: var(--accent); font-weight: 700; flex: none; }
.pop-item .avatar { flex: none; }
.pop-group { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 8px 2px; }
.pop-search { width: 100%; margin-bottom: 4px; }
.pop-foot { display: flex; gap: 6px; justify-content: space-between; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; flex-wrap: wrap; }
.pop .fl { padding: 4px 6px; margin-bottom: 4px; }
.pop .check { padding: 4px 6px; }
.pad { padding: 6px 8px; margin: 0; }
.pop-input { padding: 4px; }
.cell-input { width: 100%; min-width: 0; resize: vertical; font-size: 14px; }
.date-pop { width: 270px; max-width: 100%; }
.dp-row { display: flex; gap: 6px; }
.dp-row input { flex: 1; min-width: 0; }
input[type=time] { border: 1px solid var(--border); background: var(--panel); border-radius: 8px; padding: 8px 6px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 34px); gap: 2px; padding: 4px; }
.emoji-grid button { width: 34px; height: 34px; border: 0; background: none; border-radius: 6px; font-size: 19px; cursor: pointer; }
.emoji-grid button:hover { background: var(--hover); }
.pop-emoji .inline { padding: 4px; }
.frow { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(110px, 1fr) minmax(140px, 1.4fr) 30px; gap: 6px; align-items: center; padding: 4px 6px; }
.frow.srow { grid-template-columns: 1fr 1.2fr 30px; }
.frow select, .frow input { width: 100%; padding: 6px 8px; font-size: 13px; }
.fvals { display: flex; gap: 4px; min-width: 0; }
.fvals > * { flex: 1; min-width: 0; }
.pp-row { display: flex; align-items: center; gap: 4px; padding: 2px 4px; border-radius: 7px; }
.pp-row:hover { background: var(--hover); }
.pp-row.off .pp-name { opacity: .5; }
.pp-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; border: 0; background: none; text-align: left; padding: 6px 4px; cursor: pointer; }
.pp-row .icon-btn:disabled { opacity: .25; cursor: default; }
.tpl-item { display: flex; align-items: center; }
.pt-ico { display: inline-block; min-width: 18px; text-align: center; color: var(--muted); font-size: 12px; font-weight: 600; flex: none; }

/* cabeçalho do banco de dados */
.dbv { padding-top: 18px; }
.db-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.db-icon { font-size: 30px; border: 0; background: none; cursor: pointer; border-radius: 8px; padding: 0 4px; line-height: 1.2; }
.db-icon:hover { background: var(--hover); }
.db-title { flex: 1; min-width: 0; font-size: 26px; font-weight: 750; border: 0 !important; background: none !important; padding: 2px 0 !important; color: var(--text); }
.db-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border); margin-bottom: 10px; flex-wrap: wrap; }
.vtabs { display: flex; gap: 2px; overflow-x: auto; min-width: 0; scrollbar-width: none; }
.vtab { border: 0; background: none; padding: 8px 10px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; border-radius: 6px 6px 0 0; }
.vtab:hover { background: var(--hover); color: var(--text); }
.vtab.active { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }
.vt-ico { font-size: 13px; opacity: .8; }
.vt-caret { font-size: 10px; color: var(--muted); }
.db-actions { display: flex; align-items: center; gap: 6px; padding: 4px 0; flex-wrap: wrap; }
.db-actions .btn.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.db-more { font-size: 20px; line-height: 1; padding: 2px 8px; }
.split { display: inline-flex; }
.split .btn:first-child { border-radius: 8px 0 0 8px; }
.split .btn:last-child { border-radius: 0 8px 8px 0; border-left: 1px solid rgba(255,255,255,.35); padding-left: 8px; padding-right: 8px; }
.fchips { display: flex; gap: 6px; flex-wrap: wrap; margin: -2px 0 10px; }
.fchip { border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 2px 10px; font-size: 12.5px; cursor: pointer; }

/* tabela */
.dbt-wrap { overflow-x: auto; max-width: 100%; border-top: 1px solid var(--border); -webkit-overflow-scrolling: touch; }
.dbt { border-collapse: collapse; table-layout: fixed; min-width: 100%; }
.dbt th { text-align: left; font-weight: 500; font-size: 13px; color: var(--muted); padding: 0; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); position: relative; cursor: pointer; user-select: none; height: 34px; }
.dbt th:hover { background: var(--hover); }
.th-in { display: flex; align-items: center; gap: 6px; padding: 0 8px; min-width: 0; }
.th-add { border-right: 0 !important; }
.th-add .icon-btn { width: 100%; height: 34px; }
.col-resize { position: absolute; right: -3px; top: 0; bottom: 0; width: 6px; cursor: col-resize; z-index: 2; }
.col-resize:hover { background: var(--accent); opacity: .5; }
.dbt td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 0 8px; height: 36px; font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.dbt td:last-child { border-right: 0; }
.dbt tbody tr:hover td { background: var(--hover); }
.dbt td.cell:hover { box-shadow: inset 0 0 0 1px var(--border); }
.dbt td.t-titulo { position: relative; font-weight: 500; }
.row-title { display: flex; align-items: center; gap: 6px; min-width: 0; cursor: pointer; }
.row-title .ellip { text-decoration: underline; text-decoration-color: transparent; }
.row-title:hover .ellip { text-decoration-color: var(--muted); }
.rt-ico { font-size: 13px; opacity: .7; flex: none; }
.row-open { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 1px solid var(--border); background: var(--panel); border-radius: 6px; font-size: 11px; padding: 2px 7px; color: var(--muted); cursor: pointer; opacity: 0; font-weight: 600; letter-spacing: .02em; }
.dbt tr:hover .row-open, .row-open:focus { opacity: 1; }
@media (hover: none) { .row-open { opacity: 1; } }
.dbt td.t-numero, .dbt td.t-moeda { text-align: right; font-variant-numeric: tabular-nums; }
.dbt td.t-caixa { text-align: center; }
.dbt td.t-criado_em, .dbt td.t-editado_em { cursor: default; font-size: 13px; }
.cb { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }
.lnk { color: var(--accent); text-decoration: none; }
.lnk:hover { text-decoration: underline; }
.person { display: inline-flex; align-items: center; gap: 5px; margin-right: 6px; max-width: 100%; }
.person .avatar { width: 20px; height: 20px; font-size: 10px; flex: none; }
.file-thumb { width: 26px; height: 26px; object-fit: cover; border-radius: 4px; vertical-align: middle; margin-right: 4px; border: 1px solid var(--border); }
.file-chip { font-size: 12px; color: var(--muted); margin-right: 6px; }
.pw-mask { letter-spacing: .12em; color: var(--muted); }
.dbt-new { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--muted); padding: 9px 10px; cursor: pointer; position: sticky; left: 0; }
.dbt-new:hover { background: var(--hover); color: var(--text); }
.db-count { padding: 8px 2px; }

/* quadro */
.dboard { grid-auto-columns: minmax(250px, 280px); }
.dboard .col-head { flex-wrap: wrap; }
.dboard .col-head .grp { margin-left: auto; font-size: 11px; }
.dcard .title { margin-bottom: 4px; font-weight: 600; }
.card-props { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.card-props .cp { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-props .cp.t-moeda, .card-props .cp.t-numero { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.card-props .file-thumb { width: 40px; height: 40px; }

/* calendário */
.dcal .day { position: relative; min-height: 104px; overflow: visible; }
.day-add { position: absolute; top: 3px; right: 4px; border: 0; background: none; color: var(--muted); cursor: pointer; opacity: 0; border-radius: 5px; width: 22px; height: 22px; }
.day:hover .day-add { opacity: 1; }
.day-add:hover { background: var(--hover); color: var(--text); }
@media (hover: none) { .day-add { display: none; } }
.dev { background: var(--cbg) !important; color: var(--cfg); border-left: 3px solid var(--cdot) !important; font-weight: 500; }
.dev.cont-l { border-left: 0 !important; border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -5px; padding-left: 8px; }
.dev.cont-r { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: -5px; }
.cal-nav .muted { margin-left: 6px; }

/* galeria */
.gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; padding: 4px 0 20px; }
.gcard { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; text-align: left; transition: box-shadow .15s; }
.gcard:hover, .gcard:focus-visible { box-shadow: var(--shadow); outline: none; }
.gcover { aspect-ratio: 16 / 9; background: var(--hover); display: grid; place-items: center; font-size: 28px; border-bottom: 1px solid var(--border); overflow: hidden; }
.gcover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gbody { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.gtitle { font-weight: 650; }
.gnew { align-items: center; justify-content: center; min-height: 120px; color: var(--muted); border-style: dashed; font-size: 15px; }

/* gaveta larga (linha como página) */
.drawer.wide { width: min(860px, 100vw); padding: 18px 34px 50px; }
.save-ind { font-size: 12px; color: var(--muted); margin-right: 4px; }
.save-ind.ok { color: var(--s-concluido); }
.save-ind.err { color: var(--danger); font-weight: 600; }
.drawer textarea.row-title-in { resize: none; overflow: hidden; font-size: 26px; line-height: 1.25; outline: none; min-height: 0; border: 0; background: none; padding: 4px 0; }
.rprops { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; gap: 2px 10px; margin: 10px 0 6px; align-items: start; }
.rp-label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; padding: 7px 4px; min-width: 0; }
.rp-val { padding: 5px 8px; border-radius: 6px; min-height: 34px; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.rp-val:hover { background: var(--hover); }
.rp-val.t-criado_em, .rp-val.t-editado_em, .rp-val.t-senha, .rp-val.t-arquivos { cursor: default; }
.rp-val.t-senha:hover, .rp-val.t-arquivos:hover, .rp-val.t-criado_em:hover, .rp-val.t-editado_em:hover { background: none; }
.rp-add { grid-column: 1 / -1; justify-self: start; margin-top: 2px; color: var(--muted); }
.row-meta { margin: 4px 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.pw { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pw-val { min-width: 90px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.pw-val.pw-shown { color: var(--text); background: var(--accent-soft); border-radius: 6px; padding: 2px 8px; letter-spacing: 0; user-select: all; }
.pfiles { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pfile { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 8px; padding: 3px 4px 3px 6px; font-size: 13px; max-width: 100%; }
.pfile img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; }
.pfile a { color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.tpl-banner { background: var(--accent-soft); color: var(--text); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 10px; }
.tpl-banner input { padding: 3px 8px; font-weight: 600; width: 180px; max-width: 100%; }
.conflict { background: var(--c-amarelo-bg); color: var(--c-amarelo-fg); border: 1px solid var(--c-amarelo-dot); border-radius: 10px; padding: 10px 12px; margin: 8px 0 12px; font-size: 13.5px; line-height: 1.5; }
.cf-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.comment .who { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.comment .who .avatar { width: 20px; height: 20px; font-size: 10px; }

/* wiki */
.wiki { max-width: 860px; margin: 0 auto; padding: 22px 0 60px; }
.wiki-path a { color: var(--muted); text-decoration: none; }
.wiki-path a:hover { color: var(--text); text-decoration: underline; }
.wiki-head { display: flex; align-items: flex-start; gap: 8px; margin-top: 18px; }
.wiki-icon { font-size: 40px; line-height: 1.1; border: 0; background: none; cursor: pointer; border-radius: 10px; padding: 2px 4px; flex: none; }
.wiki-icon:hover { background: var(--hover); }
.wiki-title { flex: 1; min-width: 0; font-size: 34px; font-weight: 750; line-height: 1.2; border: 0 !important; background: none !important; padding: 6px 0 !important; resize: none; overflow: hidden; outline: none; color: var(--text); }
.wiki-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding: 4px 0 10px; margin-bottom: 8px; }
.wiki-actions { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.wiki-h { margin: 28px 0 8px; font-size: 14px; }
.subpages { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.subpage { display: flex; gap: 8px; align-items: center; border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; color: var(--text); text-decoration: none; background: var(--panel); }
.subpage:hover { border-color: var(--accent); }
.sec-title { margin: 28px 0 4px; font-size: 15px; }

/* editor (TOAST UI) adaptado às cores do app */
.ed-loading { padding: 30px 0; }
.md-editor .toastui-editor-defaultUI { border: 0; font-family: inherit; }
.md-editor .toastui-editor-defaultUI-toolbar { background: var(--panel); border-bottom: 1px solid var(--border); padding: 0; position: sticky; top: 0; z-index: 5; flex-wrap: wrap; height: auto; min-height: 42px; }
.drawer .md-editor .toastui-editor-defaultUI-toolbar { top: -18px; }
.md-editor .toastui-editor-toolbar { height: auto; }
.md-editor .toastui-editor-toolbar-group { flex-wrap: wrap; }
.md-editor .toastui-editor-toolbar-divider { background: var(--border); }
.md-editor .toastui-editor-toolbar-icons { border-color: transparent; background-color: transparent; border-radius: 6px; }
.md-editor .toastui-editor-toolbar-icons:not(:disabled):hover { background-color: var(--hover); border-color: var(--border); }
.md-editor .toastui-editor-toolbar-icons.tb-callout, .md-editor .toastui-editor-toolbar-icons.tb-slash { background-image: none; font-size: 15px; line-height: 1; color: var(--text); display: inline-grid; place-items: center; padding: 0; vertical-align: top; }
.md-editor .toastui-editor-toolbar-icons.tb-slash { font-size: 20px; font-weight: 700; color: var(--accent); }
.md-editor .toastui-editor-main, .md-editor .toastui-editor-ww-container, .md-editor .toastui-editor-ww-container > .toastui-editor { background: transparent; }
.md-editor .toastui-editor-mode-switch { display: none !important; }
.md-editor .toastui-editor-contents { font-family: inherit; font-size: 15.5px; line-height: 1.65; color: var(--text); padding: 14px 2px 30px; }
.md-editor .ProseMirror { min-height: inherit; }
.md-editor .toastui-editor-contents p { color: var(--text); margin: 6px 0; }
.md-editor .toastui-editor-contents h1, .md-editor .toastui-editor-contents h2 { border-bottom: 0; color: var(--text); }
.md-editor .toastui-editor-contents h1 { font-size: 28px; margin: 22px 0 8px; line-height: 1.3; padding-bottom: 0; }
.md-editor .toastui-editor-contents h2 { font-size: 22px; margin: 20px 0 6px; padding-bottom: 0; }
.md-editor .toastui-editor-contents h3 { font-size: 18px; margin: 16px 0 4px; color: var(--text); }
.md-editor .toastui-editor-contents h4, .md-editor .toastui-editor-contents h5, .md-editor .toastui-editor-contents h6 { color: var(--text); }
.md-editor .toastui-editor-contents ul, .md-editor .toastui-editor-contents ol { color: var(--text); }
.md-editor .toastui-editor-contents ul > li::before { background-color: var(--muted); }
.md-editor .toastui-editor-contents ol > li::before { color: var(--muted); }
.md-editor .toastui-editor-contents .task-list-item::before { border-color: var(--muted); background-color: var(--panel); }
.md-editor .toastui-editor-contents .task-list-item.checked::before { background-color: var(--accent); border-color: var(--accent); }
.md-editor .toastui-editor-contents .task-list-item.checked { color: var(--muted); text-decoration: line-through; }
.md-editor .toastui-editor-contents blockquote { border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 10px 10px 0; padding: 8px 14px; margin: 12px 0; }
.md-editor .toastui-editor-contents blockquote p { color: var(--text); }
.md-editor .toastui-editor-contents pre { background: var(--code-bg); border-radius: 10px; }
.md-editor .toastui-editor-contents pre code, .md-editor .toastui-editor-contents code { color: var(--text); background: var(--code-bg); }
.md-editor .toastui-editor-contents hr { border-top-color: var(--border); }
.md-editor .toastui-editor-contents a { color: var(--accent); }
.md-editor .toastui-editor-contents img { border-radius: 8px; max-width: 100%; }
.md-editor .toastui-editor-contents table { border-color: var(--border); }
.md-editor .toastui-editor-contents table th { background-color: var(--hover); color: var(--text); font-weight: 650; border-color: var(--border); }
.md-editor .toastui-editor-contents table td { border-color: var(--border); color: var(--text); }
.md-editor .toastui-editor-contents .placeholder, .md-editor .toastui-editor-contents .placeholder::before { color: var(--muted); }
.md-editor .toastui-editor-ww-code-block-language { background: var(--panel); border-color: var(--border); }
.toastui-editor-popup, .toastui-editor-context-menu, .toastui-editor-tooltip { font-family: inherit; }
.toastui-editor-tooltip { background-color: var(--text); color: var(--bg); }
.toastui-editor-tooltip .arrow { background-color: var(--text); }

/* menu "/" */
.slash-menu { position: fixed; z-index: 60; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; width: 250px; max-height: 330px; overflow-y: auto; }
.slash-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 4px 8px 6px; }
.slash-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 6px 8px; border-radius: 7px; cursor: pointer; text-align: left; color: var(--text); font-size: 14px; }
.slash-item.on, .slash-item:hover { background: var(--hover); }
.slash-ico { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); font-weight: 700; font-size: 13px; flex: none; }

/* busca global */
.search-bg { position: fixed; inset: 0; background: rgba(10, 8, 25, .45); z-index: 55; display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; }
.search-box { width: 100%; max-width: 640px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; max-height: 75vh; }
.search-box input { border: 0 !important; border-bottom: 1px solid var(--border) !important; border-radius: 0 !important; font-size: 17px; padding: 14px 16px !important; width: 100%; }
.search-results { overflow-y: auto; padding: 6px; }
.sr-group { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 10px 4px; font-weight: 600; }
.sr-group span { font-weight: 400; }
.sr-item { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--text); }
.sr-item.on, .sr-item:hover { background: var(--hover); }
.sr-ico { width: 22px; text-align: center; flex: none; font-size: 16px; }
.sr-txt { display: flex; flex-direction: column; min-width: 0; }
.sr-txt b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-txt small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* opções (editar) */
.opt-edit { display: grid; gap: 6px; margin-bottom: 10px; }
.opt-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 6px; align-items: center; }
.opt-row.st { grid-template-columns: 110px 1fr 140px auto; }
.opt-color { background: var(--cbg) !important; color: var(--cfg) !important; font-weight: 600; }
.opt-btns { display: flex; }

@media (max-width: 760px) {
  .drawer.wide { padding: 14px 16px 40px; }
  .rprops { grid-template-columns: 112px 1fr; }
  .db-title { font-size: 22px; }
  .db-bar { gap: 4px; }
  .db-actions { width: 100%; }
  .db-actions .split { margin-left: auto; }
  .wiki { padding-top: 12px; }
  .wiki-title { font-size: 26px; }
  .wiki-icon { font-size: 32px; }
  .frow { grid-template-columns: 1fr 1fr 30px; }
  .frow .fvals, .frow > span:empty { grid-column: 1 / 3; }
  .frow.srow { grid-template-columns: 1fr 1fr 30px; }
  .opt-row, .opt-row.st { grid-template-columns: 96px 1fr auto; }
  .opt-row.st select[data-ogroup] { grid-column: 1 / 3; }
  .gal { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .dcal .day { min-height: 70px; }
  .dev { font-size: 10px; }
  .search-bg { padding-top: 12px; }
  .md-editor .toastui-editor-contents { font-size: 15px; }
}

.ev.ev-gap { visibility: hidden; border-left: 3px solid transparent; }
.cal-nav h3.no-cap { text-transform: none; }
.md-editor .toastui-editor-toolbar-item-wrapper { vertical-align: top; }
.md-editor .toastui-editor-toolbar-item-wrapper > .toastui-editor-toolbar-icons { margin-top: 0; }
.md-editor .ProseMirror > :first-child { margin-top: 4px !important; }
