:root {
    --hw-bg: #e8e9ec;
    --hw-glass: rgba(255, 255, 255, 0.72);
    --hw-glass-strong: rgba(255, 255, 255, 0.88);
    --hw-ink: #1d1d1f;
    --hw-muted: #6e6e73;
    --hw-accent: #0071e3;
    --hw-border: rgba(0, 0, 0, 0.08);
    --hw-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    --hw-radius: 16px;
    --hw-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: var(--hw-font);
    color: var(--hw-ink);
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(120, 160, 255, 0.25), transparent 60%),
        radial-gradient(900px 500px at 100% 0%, rgba(180, 200, 255, 0.2), transparent 55%),
        var(--hw-bg);
}

a { color: var(--hw-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.hw-shell { min-height: 100vh; display: flex; flex-direction: column; }

.hw-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    background: rgba(246, 246, 248, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--hw-border);
    position: sticky;
    top: 0;
    z-index: 40;
}

.hw-titlebar-left, .hw-titlebar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.hw-brand {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--hw-ink);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.hw-user { color: var(--hw-muted); font-size: 0.85rem; }

.hw-burger {
    width: 36px;
    height: 32px;
    border: none;
    background: transparent;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    padding: 4px;
}

.hw-burger span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--hw-ink);
    border-radius: 2px;
}

.hw-link-btn {
    border: none;
    background: transparent;
    color: var(--hw-accent);
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
}

.hw-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.28);
    z-index: 50;
}

.hw-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 86vw);
    z-index: 60;
    background: var(--hw-glass-strong);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: var(--hw-shadow);
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.hw-drawer-title {
    margin: 0 0 0.75rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--hw-muted);
}

.hw-drawer a {
    display: block;
    padding: 0.7rem 0.85rem;
    border-radius: 10px;
    color: var(--hw-ink);
    text-decoration: none;
}

.hw-drawer a:hover { background: rgba(0, 0, 0, 0.05); }

.hw-main {
    flex: 1;
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 0.85rem 0.85rem 2rem;
    box-sizing: border-box;
}

/* —— Visor tipo WinHelp (contenido / índice / buscar) —— */
.hw-help {
    display: grid;
    grid-template-columns: minmax(220px, 300px) 1fr;
    gap: 0;
    min-height: calc(100vh - 4.5rem);
    background: var(--hw-glass);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--hw-border);
    border-radius: var(--hw-radius);
    box-shadow: var(--hw-shadow);
    overflow: hidden;
}

.hw-help-nav {
    border-right: 1px solid var(--hw-border);
    background: rgba(255, 255, 255, 0.45);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.hw-help-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border-bottom: 1px solid var(--hw-border);
    background: rgba(246, 246, 248, 0.92);
    padding: 0.35rem 0.35rem 0;
}

.hw-help-tab {
    border: 1px solid transparent;
    border-bottom: none;
    background: transparent;
    padding: 0.55rem 0.25rem;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--hw-muted);
    cursor: pointer;
    border-radius: 10px 10px 0 0;
}

.hw-help-tab.is-active {
    color: var(--hw-ink);
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--hw-border);
    box-shadow: 0 -1px 0 #fff inset;
}

.hw-lookfor-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.hw-btn-sm {
    padding: 0.4rem 0.65rem;
    font-size: 0.8rem;
    border-radius: 8px;
}

.hw-help-nav-body {
    flex: 1;
    overflow: auto;
    padding: 0.55rem 0.5rem 1rem;
}

.hw-toc-group {
    margin: 0 0 0.15rem;
}

.hw-toc-group > summary {
    cursor: pointer;
    font-weight: 700;
    font-size: 0.84rem;
    padding: 0.4rem 0.35rem;
    border-radius: 8px;
    list-style: none;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.hw-toc-group > summary:hover {
    background: rgba(0, 0, 0, 0.04);
}

.hw-toc-group > summary::-webkit-details-marker { display: none; }

.hw-toc-group ul,
.hw-toc-flat {
    list-style: none;
    margin: 0;
    padding: 0 0 0 0.35rem;
}

.hw-toc-group a,
.hw-toc-flat a {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    padding: 0.38rem 0.45rem;
    border-radius: 8px;
    color: var(--hw-ink);
    text-decoration: none;
    font-size: 0.86rem;
    line-height: 1.35;
}

.hw-toc-group a:hover,
.hw-toc-flat a:hover { background: rgba(0, 113, 227, 0.08); }

.hw-toc-group a.is-active,
.hw-toc-flat a.is-active {
    background: rgba(0, 113, 227, 0.16);
    font-weight: 600;
}

.hw-toc-icon {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    margin-top: 2px;
    border-radius: 3px;
    background: #7c6ad8;
    box-shadow: inset 0 -1px 0 rgba(0,0,0,.15);
}

.hw-toc-icon--book {
    background: linear-gradient(135deg, #8b7cf0, #5c4fcf);
}

.hw-toc-icon--folder {
    background: linear-gradient(135deg, #f0c36a, #d4913a);
}

.hw-toc-group--nested > summary {
    font-weight: 500;
    font-size: 0.9rem;
}

.hw-toc-icon--page {
    background: linear-gradient(135deg, #6cb4ff, #2f7de0);
    border-radius: 2px;
}

.hw-index-list {
    list-style: none;
    margin: 0.55rem 0 0;
    padding: 0;
    max-height: 40vh;
    overflow: auto;
    border: 1px solid var(--hw-border);
    border-radius: 10px;
    background: rgba(255,255,255,.7);
}

.hw-index-kw {
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 0.4rem 0.55rem;
    font: inherit;
    font-size: 0.84rem;
    cursor: pointer;
    color: var(--hw-ink);
}

.hw-index-kw:hover { background: rgba(0, 113, 227, 0.08); }
.hw-index-kw.is-active {
    background: rgba(0, 113, 227, 0.16);
    font-weight: 600;
}

.hw-help-topic {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.hw-help-toolbar {
    display: flex;
    gap: 0.35rem;
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid var(--hw-border);
    background: rgba(246, 246, 248, 0.75);
}

.hw-tool-btn {
    border: 1px solid var(--hw-border);
    background: rgba(255,255,255,.85);
    border-radius: 8px;
    padding: 0.35rem 0.7rem;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--hw-ink);
}

.hw-tool-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.hw-help-topic-body {
    flex: 1;
    overflow: auto;
    padding: 1.15rem 1.35rem 2rem;
}

.hw-topic h1,
.hw-topic-welcome h1 {
    margin: 0 0 0.5rem;
    font-size: 1.55rem;
    letter-spacing: -0.03em;
}

.hw-topic-para {
    margin: 0 0 0.85rem;
    line-height: 1.55;
    font-size: 0.95rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.hw-topic-h2 {
    margin: 1.35rem 0 0.5rem;
    font-size: 1rem;
}

.hw-version-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hw-version-list li {
    padding: 0.55rem 0;
    border-top: 1px solid var(--hw-border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: baseline;
}

.hw-welcome-tips {
    margin: 1rem 0 0;
    padding-left: 1.15rem;
    color: var(--hw-muted);
    line-height: 1.6;
}

@media (max-width: 800px) {
    .hw-help {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .hw-help-nav {
        border-right: none;
        border-bottom: 1px solid var(--hw-border);
        max-height: 42vh;
    }
}

.hw-panel {
    background: var(--hw-glass);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--hw-border);
    border-radius: var(--hw-radius);
    box-shadow: var(--hw-shadow);
    padding: 1.25rem 1.35rem;
}

.hw-panel h1 {
    margin: 0 0 0.35rem;
    font-size: 1.55rem;
    letter-spacing: -0.03em;
}

.hw-lede {
    margin: 0 0 1.25rem;
    color: var(--hw-muted);
    font-size: 0.95rem;
}

.hw-search-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
    margin-bottom: 1rem;
}

@media (min-width: 720px) {
    .hw-search-row {
        grid-template-columns: 1.6fr 1fr 1fr auto;
        align-items: end;
    }
}

.hw-field label {
    display: block;
    font-size: 0.75rem;
    color: var(--hw-muted);
    margin-bottom: 0.25rem;
}

.hw-field input,
.hw-field select,
.hw-field textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--hw-border);
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
    font: inherit;
    background: rgba(255, 255, 255, 0.9);
}

.hw-field input[type="checkbox"],
.hw-field input[type="radio"] {
    width: auto;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
}

.hw-btn {
    border: none;
    border-radius: 10px;
    padding: 0.55rem 1rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    background: var(--hw-accent);
    color: #fff;
}

.hw-btn:disabled { opacity: 0.55; cursor: default; }
.hw-btn-ghost {
    background: rgba(0, 0, 0, 0.06);
    color: var(--hw-ink);
}

.hw-topic-list { list-style: none; margin: 0; padding: 0; }
.hw-topic-list li {
    border-top: 1px solid var(--hw-border);
    padding: 0.9rem 0;
}
.hw-topic-list li:first-child { border-top: none; }
.hw-topic-list a {
    color: var(--hw-ink);
    font-weight: 600;
    text-decoration: none;
    font-size: 1.05rem;
}
.hw-topic-meta {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--hw-muted);
}
.hw-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.45rem; }
.hw-chip {
    font-size: 0.72rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: rgba(0, 113, 227, 0.1);
    color: #0058b0;
}

.hw-login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.hw-login-card {
    width: min(400px, 100%);
    background: var(--hw-glass-strong);
    backdrop-filter: blur(24px);
    border-radius: 18px;
    border: 1px solid var(--hw-border);
    box-shadow: var(--hw-shadow);
    padding: 1.75rem 1.5rem;
    text-align: center;
}

.hw-login-card h1 {
    margin: 0 0 0.25rem;
    font-size: 1.6rem;
    letter-spacing: -0.03em;
}

.hw-login-card .hw-lede { margin-bottom: 1.5rem; }
.hw-login-card .hw-field { text-align: left; margin-bottom: 0.85rem; }
.hw-login-card .hw-btn { width: 100%; margin-top: 0.5rem; }

.hw-version {
    border-top: 1px solid var(--hw-border);
    padding: 0.85rem 0;
}
.hw-version:first-child { border-top: none; }

.hw-checkgrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.55rem;
    margin: 0.5rem 0 1rem;
}

.hw-checkgrid label {
    display: flex;
    gap: 0.45rem;
    align-items: flex-start;
    font-size: 0.9rem;
    line-height: 1.35;
    min-width: 0;
    word-break: break-word;
}

.hw-checkgrid label input {
    flex: 0 0 auto;
    margin-top: 0.15rem;
}

/* Dropdown multi-select (sistemas / módulos) */
.hw-dd {
    position: relative;
    width: 100%;
}

.hw-dd-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--hw-border);
    border-radius: 10px;
    background: #fff;
    font: inherit;
    font-size: 0.95rem;
    color: var(--hw-ink);
    cursor: pointer;
    text-align: left;
}

.hw-dd-trigger:hover {
    border-color: #b0b0b8;
}

.hw-dd-trigger-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hw-dd-caret {
    opacity: 0.55;
    font-size: 0.75rem;
}

.hw-dd-panel {
    position: absolute;
    z-index: 40;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: 260px;
    overflow: auto;
    padding: 0.4rem;
    border: 1px solid var(--hw-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
}

.hw-dd-panel--tree {
    max-height: 320px;
}

.hw-dd-empty {
    margin: 0;
    padding: 0.65rem 0.5rem;
    font-size: 0.85rem;
    color: var(--hw-muted, #6e6e73);
}

.hw-dd-option {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0 !important;
    padding: 0.5rem 0.55rem;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.25;
    color: var(--hw-ink);
    cursor: pointer;
}

.hw-dd-option:hover {
    background: rgba(0, 0, 0, 0.04);
}

.hw-dd-option input[type="checkbox"] {
    flex: 0 0 auto;
    width: 1rem !important;
    height: 1rem;
    margin: 0;
    padding: 0;
    align-self: center;
}

.hw-dd-option span {
    flex: 1;
    min-width: 0;
    word-break: break-word;
    line-height: 1.25;
}

.hw-dd-group + .hw-dd-group {
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.hw-dd-group-title {
    padding: 0.35rem 0.5rem 0.25rem;
    font-size: 0.75rem;
    font-weight: 650;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--hw-muted, #6e6e73);
    user-select: none;
    pointer-events: none;
}

.hw-dd-option--child {
    padding-left: 1.15rem;
}

.hw-table-wrap { overflow-x: auto; }
.hw-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.hw-table th, .hw-table td {
    text-align: left;
    padding: 0.55rem 0.4rem;
    border-bottom: 1px solid var(--hw-border);
}
.hw-denied { padding: 2rem; text-align: center; color: var(--hw-muted); }

.hw-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; }

/* Modal visor de documento */
.hw-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(6px);
}

.hw-modal {
    width: min(920px, 100%);
    max-height: min(88vh, 900px);
    display: flex;
    flex-direction: column;
    background: var(--hw-glass-strong);
    border: 1px solid var(--hw-border);
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
    overflow: hidden;
}

.hw-modal-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--hw-border);
}

.hw-modal-header h2 {
    margin: 0;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}

.hw-modal-close {
    border: none;
    background: rgba(0, 0, 0, 0.06);
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    color: var(--hw-ink);
}

.hw-modal-body {
    flex: 1;
    overflow: auto;
    padding: 1.1rem 1.25rem;
    background: #fff;
}

.hw-modal--pdf {
    width: min(980px, 100%);
    height: min(90vh, 920px);
    max-height: min(90vh, 920px);
}

.hw-modal-body--pdf {
    padding: 0;
    background: #525659;
    display: flex;
    min-height: 0;
}

.hw-pdf-frame {
    width: 100%;
    height: 100%;
    min-height: 60vh;
    border: none;
    background: #525659;
}

.hw-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.85rem 1.15rem;
    border-top: 1px solid var(--hw-border);
    background: rgba(246, 246, 248, 0.9);
}
