/* =====================================================================
   RDMP · Módulo Documentación
   ===================================================================== */
.doc-search { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 16px; display: grid; gap: 10px; }
.doc-search__box { position: relative; display: flex; align-items: center; }
.doc-search__box svg { position: absolute; left: 14px; width: 20px; height: 20px; fill: var(--muted); pointer-events: none; }
.doc-search__box input { height: 48px; font-size: 16px; padding-left: 44px; padding-right: 44px; border-width: 2px; border-color: var(--line); }
.doc-search__box input:focus { border-color: var(--blue); }
.doc-search__box kbd { position: absolute; right: 12px; font: 600 12px var(--font); color: var(--muted); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 7px; background: #FAFAFB; }
.doc-search__filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.doc-search__filters select { width: auto; min-width: 170px; height: 34px; min-height: 34px; padding: 4px 10px; }
.doc-search__filters .seg small { opacity: .6; font-weight: 700; margin-left: 3px; }
.doc-tip { margin-left: auto; }

.doc-layout { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 16px; align-items: start; }
.doc-list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); max-height: calc(100vh - 250px); overflow-y: auto; position: sticky; top: 12px; }
.doc-list__head { padding: 10px 14px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--line-2); position: sticky; top: 0; background: #fff; z-index: 1; }
.doc-list__head b { color: var(--ink); }
.doc-partial { margin-top: 4px; color: #946800; }
.doc-item { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line-2); background: #fff; padding: 11px 14px; cursor: pointer; font: inherit; color: inherit; border-left: 3px solid transparent; }
.doc-item:hover { background: #FAFAFB; }
.doc-item.is-active { background: #FFF8D6; border-left-color: var(--yellow); }
.doc-item__title { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; line-height: 1.3; }
.doc-item--compact .doc-item__title { font-weight: 600; font-size: 13.5px; }
.doc-item__meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 12px; flex-wrap: wrap; }
.doc-hits { margin-left: auto; background: var(--line-2); border-radius: 999px; padding: 0 8px; font-weight: 700; font-size: 11px; color: var(--ink-2); }
.doc-snip { font-size: 12.5px; color: var(--ink-2); margin-top: 6px; line-height: 1.45; overflow-wrap: anywhere; }
.doc-snip mark, .doc-item__title mark, .doc-file mark, .doc-comment__body mark { background: #FFE58A; color: inherit; border-radius: 2px; padding: 0 1px; }
.doc-group__head { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: #F7F8FA; padding: 8px 14px; cursor: pointer; font: 600 12.5px var(--font); border-bottom: 1px solid var(--line-2); }
.doc-group__head .muted { margin-left: auto; }
.doc-caret { display: inline-block; transition: transform .15s; color: var(--muted); }
.doc-group.is-closed .doc-caret { transform: rotate(-90deg); }
.doc-group.is-closed .doc-group__body { display: none; }
.doc-type { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 4px; background: color-mix(in srgb, var(--c) 12%, #fff); color: color-mix(in srgb, var(--c) 85%, #000); white-space: nowrap; }
.doc-lock { width: 14px; height: 14px; fill: #946800; flex: none; }

.doc-reader { min-height: 400px; padding: 22px 26px; }
.doc-welcome h2 { font-size: 20px; margin-bottom: 6px; }
.doc-welcome h4 { margin: 22px 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.doc-head__top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.doc-head__top .code { font-size: 12px; font-weight: 700; color: var(--muted); }
.doc-head h2 { font-size: 24px; font-weight: 800; margin: 8px 0; display: flex; align-items: center; gap: 8px; letter-spacing: -.2px; }
.doc-head h2 .doc-lock { width: 20px; height: 20px; }
.doc-head__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.doc-hitnav { display: inline-flex; align-items: center; gap: 2px; background: #FFF8D6; border-radius: 8px; padding: 0 4px; font-size: 12px; font-weight: 700; }
.doc-hitnav .icon-btn { font-size: 18px; }
.doc-sens { margin: 14px 0 0; }

/* Contenido del documento */
.doc-body { margin-top: 18px; font-size: 14.5px; line-height: 1.65; color: var(--ink); overflow-wrap: anywhere; }
.doc-body > :first-child { margin-top: 0; }
.doc-body p { margin: 0 0 8px; min-height: 1em; }
.doc-body h1, .doc-body h2 { font-size: 20px; margin: 24px 0 8px; }
.doc-body h3 { font-size: 17px; margin: 20px 0 6px; }
.doc-body h4 { font-size: 15px; margin: 16px 0 6px; }
.doc-body h5 { font-size: 14px; margin: 14px 0 4px; text-transform: uppercase; letter-spacing: .3px; color: var(--ink-2); }
.doc-body ul, .doc-body ol { margin: 0 0 10px; padding-left: 24px; }
.doc-body li { margin: 2px 0; }
.doc-body ul.todo-list { list-style: none; padding-left: 4px; }
.doc-body li.todo input { width: 15px; height: 15px; min-height: 0; padding: 0; vertical-align: -2px; margin-right: 6px; accent-color: var(--green); }
.doc-body li.todo.done { color: var(--muted); text-decoration: line-through; }
.doc-body blockquote { margin: 10px 0; padding: 6px 14px; border-left: 3px solid var(--ink); color: var(--ink-2); background: #FAFAFB; }
.doc-body hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.doc-body code { background: #F1F2F4; padding: 1px 5px; border-radius: 4px; font-size: .9em; color: #B00D0F; }
.doc-body pre { background: #16181D; color: #E6E8EC; padding: 12px 14px; border-radius: 8px; overflow-x: auto; font-size: 13px; }
.doc-body pre code { background: none; color: inherit; padding: 0; }
.doc-body table { border-collapse: collapse; width: 100%; margin: 10px 0 14px; font-size: 13.5px; display: block; overflow-x: auto; }
.doc-body th, .doc-body td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; min-width: 80px; }
.doc-body th, .doc-body tr:first-child td:empty { background: #F7F8FA; font-weight: 700; }
.doc-body figure { margin: 12px 0; }
.doc-body img { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; }
.doc-body figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
.doc-body .callout { background: #FFF8D6; border-radius: 8px; padding: 10px 14px; margin: 10px 0; }
.doc-body details { border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; margin: 8px 0; }
.doc-body summary { cursor: pointer; font-weight: 600; }
.doc-body mark[data-color] { background: #FFF3B0; }
.doc-body .attachment a { display: inline-flex; gap: 6px; align-items: center; background: #F7F8FA; border: 1px solid var(--line); padding: 6px 12px; border-radius: 8px; font-weight: 600; }
.doc-body mark.hit { background: #FFE58A; color: inherit; border-radius: 2px; padding: 0 1px; }
.doc-body mark.hit.is-current { background: #FFB020; box-shadow: 0 0 0 2px #FFB020; }

.doc-files, .doc-comments { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); }
.doc-files h4, .doc-comments h4 { font-size: 13px; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.doc-file { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.doc-file img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.doc-file__ico { font-size: 22px; width: 48px; text-align: center; }
.doc-comment { background: #FAFAFB; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; position: relative; }
.doc-comment__body { white-space: pre-wrap; margin-top: 4px; font-size: 13.5px; overflow-wrap: anywhere; }
.doc-comment__del { position: absolute; top: 6px; right: 6px; opacity: 0; }
.doc-comment:hover .doc-comment__del { opacity: 1; }
.doc-comment-form { display: flex; gap: 8px; align-items: flex-end; }
.doc-comment-form textarea { flex: 1; }
.doc-history { margin-top: 20px; font-size: 13px; }
.doc-history summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.doc-foot { margin-top: 18px; display: flex; justify-content: flex-end; }

/* Editor */
.doc-editor { display: grid; gap: 12px; }
.doc-editor__head { display: flex; align-items: center; gap: 8px; }
.doc-editor__head .code { font-size: 12px; font-weight: 700; color: var(--muted); }
.doc-title-input { font-size: 22px; font-weight: 800; border: 0; border-bottom: 2px solid var(--line); border-radius: 0; padding: 6px 2px; }
.doc-title-input:focus { box-shadow: none; border-bottom-color: var(--blue); }
.doc-editor__meta { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 12px; align-items: end; }
.form label.doc-sens-check { flex-direction: row; align-items: center; gap: 8px; cursor: pointer; padding-bottom: 8px; }
.doc-sens-check input { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--red); }
.doc-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; background: #F7F8FA; border: 1px solid var(--line); border-radius: 8px; position: sticky; top: 0; z-index: 3; }
.doc-toolbar button { border: 0; background: transparent; height: 30px; min-width: 30px; padding: 0 8px; border-radius: 6px; cursor: pointer; font: 600 13px var(--font); color: var(--ink-2); }
.doc-toolbar button:hover { background: #fff; box-shadow: var(--shadow); }
.doc-toolbar .sep { width: 1px; background: var(--line); margin: 4px 4px; }
.doc-editable { min-height: 380px; border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; margin-top: 0; outline: none; }
.doc-editable:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 109, 183, .12); }
.doc-editable img { cursor: default; }

@media (max-width: 1000px) {
  .doc-layout { grid-template-columns: 1fr; }
  .doc-list { position: static; max-height: 45vh; }
  .doc-editor__meta { grid-template-columns: 1fr 1fr; }
  .doc-tip { display: none; }
}
@media print {
  .sidebar, .topbar, .doc-search, .doc-list, .doc-head__top, .doc-comment-form, .doc-foot, .doc-history, #toast { display: none !important; }
  .shell, .main, .view, .doc-layout { display: block !important; padding: 0 !important; }
  .doc-reader { box-shadow: none !important; padding: 0 !important; }
  .doc-body mark.hit { background: none !important; box-shadow: none !important; }
}