/* Acervo Jurídico — estilos (reproduz o protótipo Acervo.dc.html) */
:root {
  --bg: #ece8df;
  --header: #14332e;
  --header2: #1c403a;
  --header-border: #2c5049;
  --gold: #d9a441;
  --green: #0f5c52;
  --green-dark: #0c4b43;
  --panel-left: #f6f4ee;
  --panel-right: #e4e0d6;
  --ink: #1c2733;
  --ink-soft: #2b3540;
  --muted: #8c96a0;
  --muted2: #7a8590;
  --border: #ddd8cc;
  --border2: #e6e1d5;
  --code: #a9925a;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --serif: 'Lora', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: #1a2233;
  overflow: hidden;
}
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-dark); }
button { font-family: var(--sans); }
input, select { font-family: var(--sans); }
input::placeholder { color: #8c96a3; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: #cfc9bc; border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b9b2a2; background-clip: content-box; }

@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

.app { height: 100vh; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }

/* ---------------- Header ---------------- */
.header {
  display: flex; align-items: center; gap: 28px; padding: 0 28px; height: 68px;
  background: var(--header); color: #f3f1ea; flex-shrink: 0; box-shadow: 0 1px 0 rgba(0,0,0,0.15);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 8px; background: var(--gold);
  display: flex; align-items: center; justify-content: center;
  color: var(--header); font-weight: 700; font-size: 18px; font-family: var(--serif);
}
.brand .title { font-family: var(--serif); font-size: 19px; font-weight: 600; letter-spacing: .2px; line-height: 1.1; }
.brand .sub { font-size: 11px; color: #9fb3ad; letter-spacing: .3px; line-height: 1.1; }

.tabs { display: flex; gap: 4px; background: var(--header2); border: 1px solid var(--header-border); border-radius: 9px; padding: 3px; }
.tab { height: 30px; padding: 0 16px; border: none; border-radius: 7px; background: transparent; color: #cfe0db; font-size: 13px; font-weight: 500; cursor: pointer; }
.tab.active { background: var(--green); color: #fff; }

.searchbar { flex: 1; max-width: 560px; position: relative; }
.searchbar svg.ico { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); }
.searchbar input {
  width: 100%; height: 42px; padding: 0 44px; border-radius: 10px;
  border: 1px solid var(--header-border); background: var(--header2); color: #f3f1ea; font-size: 15px; outline: none;
}
.searchbar .clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border: none; border-radius: 7px; background: transparent; color: #8ba39c;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.header .spacer { flex: 1; }
.header-btn { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 9px; border: 1px solid #3a5e57; background: transparent; color: #cfe0db; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.header-btn:hover { background: #1c403a; }

/* ------------- Barra de status de indexação ------------- */
.statusbar {
  display: flex; align-items: center; gap: 12px; padding: 7px 28px; font-size: 12.5px;
  background: #fff8e8; color: #8a6d1f; border-bottom: 1px solid #f0e2b8; flex-shrink: 0;
}
.statusbar.ok { background: #eaf3ef; color: #2e7d5b; border-bottom-color: #cfe6da; }
.statusbar.hidden { display: none; }
.statusbar .spin { width: 14px; height: 14px; border: 2px solid rgba(0,0,0,.15); border-top-color: currentColor; border-radius: 50%; animation: spin .8s linear infinite; }
.statusbar .bar { flex: 1; max-width: 320px; height: 6px; background: rgba(0,0,0,.08); border-radius: 4px; overflow: hidden; }
.statusbar .bar > i { display: block; height: 100%; background: currentColor; opacity: .55; transition: width .3s; }
.statusbar .warn { margin-left: auto; font-weight: 600; }

/* ---------------- Layout principal ---------------- */
.main { flex: 1; min-height: 0; display: flex; }
.view { flex: 1; display: flex; min-height: 0; }
.view.hidden { display: none; }
/* botões escondidos no modo só-busca (servidor não indexa) */
.header-btn.hidden, .btn.hidden { display: none; }

.left {
  width: 470px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--panel-left); border-right: 1px solid var(--border); min-height: 0;
}
.right { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--panel-right); }

/* filtros */
.filters { padding: 16px 22px 14px; border-bottom: 1px solid var(--border2); flex-shrink: 0; }
.filters .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filters .lbl { font-size: 12px; color: var(--muted2); font-weight: 500; }
.filters .sep { width: 1px; height: 18px; background: var(--border); margin: 0 2px; }
.pill { height: 28px; padding: 0 13px; border-radius: 8px; border: 1px solid #e0dbcf; background: #fff; color: #4a5560; font-size: 12.5px; font-weight: 500; cursor: pointer; }
.pill.active { border-color: var(--green); background: var(--green); color: #fff; }

.recent { margin-top: 13px; display: flex; align-items: center; gap: 8px; min-height: 24px; flex-wrap: wrap; }
.recent .lbl { font-size: 11.5px; color: #9aa3ac; }
.recent .chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; border: 1px solid #e0dbcf; background: #fff; color: #4a5560; font-size: 12px; cursor: pointer; }

.results-head { padding: 12px 22px 6px; display: flex; align-items: baseline; justify-content: space-between; flex-shrink: 0; }
.results-head .count { font-size: 13px; color: #55606b; }
.fav-toggle { display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; border-radius: 8px; border: 1px solid #e0dbcf; background: #fff; color: #6b7580; font-size: 12px; font-weight: 500; cursor: pointer; }
.fav-toggle.active { border-color: var(--gold); background: #fdf4e1; color: #8a6d1f; }

/* lista de resultados */
.list { flex: 1; overflow-y: auto; padding: 6px 14px 20px; }
.result { padding: 13px 12px; border-radius: 11px; cursor: pointer; margin-bottom: 4px; border: 1px solid transparent; }
.result:hover { background: rgba(255,255,255,.5); }
.result.active { background: #fff; box-shadow: 0 2px 12px rgba(20,30,40,.09); border-color: #e6dfd0; }
.result .top { display: flex; align-items: flex-start; gap: 11px; }
.badge-type { flex-shrink: 0; width: 42px; height: 42px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; letter-spacing: .3px; }
.t-pdf { background: #fdeceb; color: #c0392b; }
.t-png { background: #eaf3ef; color: #2e7d5b; }
.t-jpg, .t-jpeg { background: #eef1f8; color: #3d5a99; }
.result .body { flex: 1; min-width: 0; }
.result .meta-top { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.result .code { font-size: 11px; font-weight: 600; color: var(--code); letter-spacing: .4px; }
.result .dot { font-size: 11px; color: #aeb6bd; }
.result .cat { font-size: 11px; color: var(--muted); }
.result .matchbadge { margin-left: auto; font-size: 10.5px; font-weight: 600; color: var(--green); background: #dcebe6; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.result .rtitle { font-family: var(--serif); font-size: 15.5px; font-weight: 600; color: var(--ink); line-height: 1.25; margin-bottom: 4px; }
.result .rmeta { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.result .snippet { font-size: 12.5px; line-height: 1.55; color: #57626d; font-family: var(--serif); }
/* artigo arquivado em mais de uma pasta: as demais categorias */
.result .tambem { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; line-height: 1.5; }
.result .tambem .tambem-lbl { text-transform: uppercase; letter-spacing: .04em; font-size: 10px; margin-right: 5px; opacity: .8; }
.fav-star { flex-shrink: 0; width: 28px; height: 28px; border: none; background: transparent; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; }

mark { background: #ffe58a; color: #3a2f10; border-radius: 3px; padding: 0 1px; }
mark.current { background: #f6b93b; box-shadow: 0 0 0 2px #f6b93b; }

.empty { text-align: center; padding: 60px 24px; color: #9aa3ac; }
.empty .big { font-size: 15px; color: #6b7580; font-weight: 500; }
.empty .small { font-size: 13px; margin-top: 6px; }

/* ---------------- Preview ---------------- */
.preview-head { display: flex; align-items: center; gap: 14px; padding: 12px 24px; background: var(--panel-left); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.preview-head .info { flex: 1; min-width: 0; }
.preview-head .badges { display: flex; align-items: center; gap: 9px; }
.type-badge { font-size: 10.5px; font-weight: 700; letter-spacing: .4px; padding: 3px 9px; border-radius: 6px; }
.preview-head .ptitle { font-family: var(--serif); font-size: 16px; font-weight: 600; color: var(--ink); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.matchnav { display: flex; align-items: center; gap: 4px; background: #efe9db; border: 1px solid #e2dccc; border-radius: 9px; padding: 3px; }
.matchnav span { font-size: 12px; color: #6b7580; padding: 0 8px; white-space: nowrap; }
.matchnav button { width: 28px; height: 28px; border: none; border-radius: 7px; background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.btn { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 9px; border: 1px solid #e0dbcf; background: #fff; color: #4a5560; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.btn.icon-only { width: 38px; padding: 0; justify-content: center; }
.btn.primary { border: none; background: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); }
.btn.ativo { background: #dcebe6; border-color: var(--green); color: var(--green); }

.preview-body { flex: 1; overflow-y: auto; padding: 34px 24px 60px; }

/* preview PDF (pdf.js) */
.pdf-pages { max-width: 820px; margin: 0 auto; }
.pdf-page { position: relative; margin: 0 auto 20px; background: #fff; box-shadow: 0 8px 30px rgba(20,30,40,.13); border-radius: 3px; }
.pdf-page canvas { display: block; border-radius: 3px; }
.textLayer { position: absolute; inset: 0; overflow: hidden; opacity: 1; line-height: 1; }
.textLayer > span, .textLayer > br { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.textLayer mark { color: transparent; }
.textLayer mark.current { box-shadow: 0 0 0 2px #f6b93b; }
.pdf-loading { text-align: center; color: #9aa3ac; padding: 40px; font-size: 14px; }

/* preview de texto (fallback / OCR) */
.doc-article { max-width: 760px; margin: 0 auto; background: #fff; box-shadow: 0 8px 30px rgba(20,30,40,.13); border-radius: 3px; padding: 66px 74px 90px; }
.doc-article .kicker { font-size: 11.5px; font-weight: 600; color: var(--code); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 10px; }
.doc-article h1 { font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1.2; margin: 0 0 14px; color: #17212c; }
.doc-article .dmeta { font-size: 13px; color: var(--muted); padding-bottom: 22px; margin-bottom: 26px; border-bottom: 1px solid #ece8dd; }
.doc-article .content { font-family: var(--serif); font-size: 16px; line-height: 1.85; color: var(--ink-soft); white-space: pre-wrap; }

/* preview de imagem */
.img-wrap { max-width: 820px; margin: 0 auto; }
.img-wrap img { width: 100%; height: auto; display: block; background: #fff; border-radius: 4px; box-shadow: 0 8px 30px rgba(20,30,40,.14); }
.ocr-note { margin-top: 16px; background: #fff8e8; border: 1px solid #f0e2b8; border-radius: 10px; padding: 14px 16px; display: flex; gap: 11px; color: #8a6d1f; font-size: 13px; line-height: 1.5; }
.ocr-text { margin-top: 16px; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 20px 22px; font-family: var(--serif); font-size: 14.5px; line-height: 1.7; color: var(--ink-soft); white-space: pre-wrap; }
.ocr-text h4 { font-family: var(--sans); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted2); margin: 0 0 10px; }

.placeholder { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #9aa3ac; gap: 16px; }
.placeholder .msg { font-size: 15px; color: #6b7580; }

/* ---------------- Coleções ---------------- */
.col-head { padding: 16px 22px; border-bottom: 1px solid var(--border2); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.col-head .h { font-family: var(--serif); font-size: 17px; font-weight: 600; color: var(--ink); }
.col-head .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.col-list { flex: 1; overflow-y: auto; padding: 12px 14px 20px; }
.col-row { padding: 13px 14px; border-radius: 12px; cursor: pointer; margin-bottom: 6px; border: 1px solid transparent; }
.col-row:hover { background: rgba(255,255,255,.5); }
.col-row.active { background: #fff; border-color: #e6dfd0; box-shadow: 0 2px 12px rgba(20,30,40,.09); }
.col-row .cn { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.col-row .cname { font-family: var(--serif); font-size: 15px; font-weight: 600; color: var(--ink); }
.col-row .ccase { font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.col-row .cinfo { display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: #96a0a8; }
.col-row .cbadge { background: #e9ede9; color: #5b6b60; padding: 2px 9px; border-radius: 20px; font-weight: 600; }

.col-detail { max-width: 820px; margin: 0 auto; padding: 34px 34px 60px; }
.col-detail .kicker { font-size: 11.5px; font-weight: 600; color: var(--code); letter-spacing: 1px; text-transform: uppercase; }
.col-detail h1 { font-family: var(--serif); font-size: 26px; font-weight: 600; margin: 4px 0; color: #17212c; }
.col-detail .ccase { font-size: 13px; color: var(--muted); }
.audit { display: flex; gap: 22px; margin: 18px 0 24px; padding: 14px 18px; background: var(--panel-left); border: 1px solid var(--border2); border-radius: 11px; font-size: 12.5px; color: #57626d; }
.audit .vsep { width: 1px; background: #e0dbcf; }
.audit strong { color: var(--ink-soft); }
.audit .k { color: #96a0a8; }
.arts-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.arts-head .h { font-size: 14px; font-weight: 600; color: var(--ink); }
.add-art { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px dashed #b9b09a; border-radius: 8px; background: transparent; color: var(--green); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.art-row { display: flex; align-items: center; gap: 12px; padding: 13px 15px; background: #fff; border: 1px solid #e6dfd0; border-radius: 11px; margin-bottom: 8px; }
.art-row .abody { flex: 1; min-width: 0; }
.art-row .acode { font-size: 11px; font-weight: 600; color: var(--code); letter-spacing: .4px; }
.art-row .atitle { font-family: var(--serif); font-size: 15px; font-weight: 600; color: var(--ink); }
.art-row .badge-type { width: 40px; height: 40px; }
.mini { height: 30px; padding: 0 12px; border: 1px solid #e0dbcf; border-radius: 8px; background: #fff; color: #4a5560; font-size: 12px; cursor: pointer; }
.mini.danger { width: 30px; padding: 0; color: #c0392b; border-color: #f0d8d5; display: flex; align-items: center; justify-content: center; }
.hist { margin-top: 28px; }
.hist .h { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 10px; }
.hist-row { display: flex; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.hist-row .dot { width: 8px; height: 8px; border-radius: 50%; background: #c3b47f; margin-top: 5px; flex-shrink: 0; }
.hist-row .txt { font-size: 12.5px; color: #57626d; }
.hist-row strong { color: var(--ink-soft); }
.col-empty { padding: 30px; text-align: center; color: #9aa3ac; font-size: 13px; background: var(--panel-left); border: 1px dashed var(--border); border-radius: 11px; }

/* ---------------- Navegação por pastas ---------------- */
.breadcrumb { padding: 11px 22px; border-bottom: 1px solid var(--border2); font-size: 13px; color: #55606b; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }
.breadcrumb a { cursor: pointer; color: var(--green); font-weight: 500; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: #bcc3ca; }
.breadcrumb .atual { color: var(--ink); font-weight: 600; }
.pastas-label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted2); font-weight: 600; margin: 14px 12px 8px; }
.folder-row, .file-row { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; cursor: pointer; margin-bottom: 3px; border: 1px solid transparent; }
.folder-row:hover, .file-row:hover { background: #fff; border-color: #ece7db; box-shadow: 0 1px 8px rgba(20,30,40,.06); }
.folder-ic { width: 38px; height: 38px; border-radius: 9px; background: #efe7d0; color: #a9925a; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.folder-row .nome { font-weight: 600; color: var(--ink); font-size: 14.5px; }
.folder-row .qtd { margin-left: auto; font-size: 12px; color: #6b7580; background: #eef1ee; padding: 3px 11px; border-radius: 20px; white-space: nowrap; }
.file-row .fbody { flex: 1; min-width: 0; }
.file-row .fcode { font-size: 11px; font-weight: 600; color: var(--code); letter-spacing: .3px; }
.file-row .ftitle { font-family: var(--serif); font-size: 14.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- Modal ---------------- */
.overlay { position: fixed; inset: 0; background: rgba(20,30,30,.5); z-index: 90; display: flex; align-items: center; justify-content: center; animation: fadein .16s ease; }
.overlay.hidden { display: none; }
.modal { width: 520px; max-width: 92vw; background: var(--panel-left); border-radius: 16px; overflow: hidden; box-shadow: 0 24px 70px rgba(0,0,0,.34); }
.modal .mhead { padding: 20px 26px; background: var(--header); color: #f3f1ea; }
.modal .mhead .mt { font-family: var(--serif); font-size: 18px; font-weight: 600; }
.modal .mhead .ms { font-size: 12px; color: #9fb3ad; margin-top: 2px; }
.modal .mbody { padding: 24px 26px; }
.modal label { display: block; font-size: 12.5px; font-weight: 600; color: #4a5560; margin-bottom: 6px; }
.modal label.mt-space { margin-top: 16px; }
.field { width: 100%; height: 42px; padding: 0 14px; border-radius: 10px; border: 1px solid #d8d2c4; background: #fff; color: var(--ink); font-size: 14px; outline: none; }
.field:focus { border-color: var(--green); }
.audit-box { margin-top: 18px; padding: 14px 16px; background: #fff8e8; border: 1px solid #f0e2b8; border-radius: 11px; }
.audit-box label { display: flex; align-items: center; gap: 6px; color: #8a6d1f; margin-bottom: 7px; }
.audit-box .req { color: #c0392b; }
.audit-box .hint { font-size: 11.5px; color: #a58a3f; margin-top: 6px; }
.form-error { margin-top: 12px; font-size: 12.5px; color: #c0392b; }
.remove-msg { font-size: 14px; color: #4a5560; line-height: 1.5; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.modal .btn-cancel { height: 40px; padding: 0 18px; border: 1px solid #d8d2c4; border-radius: 9px; background: #fff; color: #4a5560; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.modal .btn-save { height: 40px; padding: 0 20px; border: none; border-radius: 9px; background: var(--green); color: #fff; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.modal .btn-save.danger { background: #c0392b; }

/* ---------------- Toast ---------------- */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: #17212c; color: #f3f1ea; padding: 12px 20px; border-radius: 10px; font-size: 13.5px; box-shadow: 0 10px 34px rgba(0,0,0,.28); animation: fadein .2s ease; z-index: 120; display: flex; align-items: center; gap: 10px; }
.toast.hidden { display: none; }

/* responsivo básico (uso principal é desktop) */
@media (max-width: 1000px) {
  .left { width: 42%; min-width: 320px; }
  .header { gap: 16px; padding: 0 16px; }
  .searchbar { max-width: none; }
}
