/* Hestia · shell de la aplicación y componentes compartidos de la maqueta.
   Se carga después de design/tokens.css y design/components.css. Prefijo h- para piezas de la app. */
:root {
  --chart-1: var(--brand-blue);
  --chart-2: var(--brand-hearth);
  --chart-muted: #c9d2d7;
}
body { min-height: 100vh; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.h-small { font-size: var(--text-xs); }
.h-text-danger { color: var(--color-danger); }
.h-text-warning { color: var(--color-warning); }
.h-text-success { color: var(--color-success); }
.h-muted, .ds-muted { color: var(--color-text-muted); }
.noscript { padding: 32px; }

/* ---------- Estructura ---------- */
.h-app { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.h-bare .h-app { display: none; }
.h-bare-root { display: none; }
.h-bare .h-bare-root { display: block; min-height: 100vh; }
.h-sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--color-surface); border-right: 1px solid var(--color-border); padding: 0 0 24px; z-index: var(--z-menu); }
.h-brand { height: var(--topbar-height); display: flex; flex-direction: column; justify-content: center; padding: 0 18px; border-bottom: 1px solid var(--color-border); position: sticky; top: 0; background: var(--color-surface); z-index: 1; }
.h-brand-link { display: grid; gap: 5px; text-decoration: none; color: var(--color-text); border-radius: var(--radius-control); }
.h-brand-logo { width: 148px; height: auto; display: block; }
.h-wordmark { font-size: 12px; font-weight: 600; letter-spacing: .01em; color: var(--color-text); line-height: 1.2; white-space: nowrap; }
.h-brand-note { font-weight: 400; color: var(--color-text-muted); }
#h-nav { padding: 8px 10px; }
.h-nav-group { margin-top: 6px; }
.h-nav-group-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; border: 0; background: none; color: var(--color-text-muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: 8px 10px 6px; border-radius: var(--radius-control); }
.h-nav-group-btn .icon { width: 14px; height: 14px; transition: transform var(--duration-fast); }
.h-nav-group-btn[aria-expanded='false'] .icon { transform: rotate(-90deg); }
.h-nav-group-btn:hover { color: var(--color-text); }
#h-nav ul { list-style: none; margin: 0; padding: 0; }
#h-nav a { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 6px 10px; border-radius: var(--radius-control); color: var(--color-text); text-decoration: none; font-size: var(--text-sm); }
#h-nav a .icon { color: var(--color-text-muted); }
#h-nav a:hover { background: var(--color-surface-subtle); }
#h-nav a[aria-current='page'] { background: var(--color-primary-soft); color: var(--color-primary-text); font-weight: 500; }
#h-nav a[aria-current='page'] .icon { color: var(--color-primary); }
.h-workspace { min-width: 0; display: flex; flex-direction: column; }
.h-topbar { position: sticky; top: 0; z-index: var(--z-sticky); height: var(--topbar-height); display: flex; align-items: center; gap: 12px; padding: 0 24px; background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.h-menu-btn { display: inline-flex; margin-left: -8px; }
@media (min-width: 1024px) {
  .h-app { transition: grid-template-columns 220ms var(--ease-ui); }
  .nav-collapsed .h-app { grid-template-columns: 0 minmax(0, 1fr); }
  .nav-collapsed .h-sidebar { visibility: hidden; border-right: 0; }
}
.h-context { display: flex; align-items: center; min-width: 0; }
.h-context-logo { width: 150px; height: auto; display: block; }
.h-context-name { font-weight: 600; font-size: 15px; white-space: nowrap; }
.h-company select { min-height: 34px; padding-block: 5px; width: auto; max-width: 220px; font-weight: 500; }
.h-search { position: relative; flex: 1 1 260px; max-width: 440px; margin-left: 8px; }
.h-search > .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--color-text-muted); pointer-events: none; }
.h-search input { padding-left: 34px; min-height: 34px; background: var(--color-surface-subtle); border-color: var(--color-border); }
.h-search input:focus { background: var(--color-surface); border-color: var(--color-control-border); }
.h-search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; min-width: 360px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-panel); box-shadow: var(--shadow-overlay); padding: 6px; z-index: var(--z-menu); max-height: 70vh; overflow: auto; }
.h-search-scope, .h-search-empty { font-size: var(--text-xs); color: var(--color-text-muted); padding: 6px 10px; margin: 0; }
.h-search-item { display: grid; grid-template-columns: 92px 1fr auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--radius-control); color: var(--color-text); text-decoration: none; }
.h-search-item:hover, .h-search-item.is-active { background: var(--color-primary-soft); }
.h-search-type { grid-row: span 2; font-size: var(--text-xs); color: var(--color-text-muted); }
.h-search-title { font-weight: 500; font-size: var(--text-sm); }
.h-search-meta { grid-column: 2; font-size: var(--text-xs); color: var(--color-text-muted); }
.h-search-item .ds-badge { grid-column: 3; grid-row: 1 / span 2; }
.h-topbar-end { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.h-role { display: flex; align-items: center; gap: 8px; font-size: var(--text-xs); color: var(--color-text-muted); }
.h-role select { min-height: 32px; padding-block: 4px; width: auto; font-size: var(--text-xs); border-style: dashed; }
.h-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; background: transparent; color: var(--color-text); border-radius: var(--radius-control); position: relative; flex: none; }
.h-icon-btn:hover { background: var(--color-surface-subtle); }
.h-bell-count { position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--color-danger); color: white; font-size: 10px; font-weight: 600; line-height: 16px; text-align: center; }
.h-bell-count:empty { display: none; }
.h-user { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--color-text); padding: 4px 6px; border-radius: var(--radius-control); }
.h-user:hover { background: var(--color-surface-subtle); }
.h-user-name { display: grid; line-height: 1.2; font-size: var(--text-xs); font-weight: 500; }
.h-user-name small { color: var(--color-text-muted); font-weight: 400; }
.h-avatar { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--color-primary-soft); color: var(--color-primary-text); font-size: 11px; font-weight: 600; flex: none; }
.h-who { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.h-who .h-avatar { width: 24px; height: 24px; font-size: 10px; }
.h-main { flex: 1; padding: 24px var(--page-gutter) 48px; max-width: 1480px; width: 100%; outline: none; }
.h-footer { padding: 16px var(--page-gutter); font-size: var(--text-xs); color: var(--color-text-muted); border-top: 1px solid var(--color-border); }
.h-backdrop { display: none; }

/* ---------- Cabecera de página ---------- */
.h-page-head { position: relative; margin-bottom: 20px; }
.h-crumbs { display: flex; gap: 8px; font-size: var(--text-xs); color: var(--color-text-muted); margin-bottom: 8px; flex-wrap: wrap; }
.h-crumbs a { color: var(--color-text-muted); }
.h-page-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.h-page-title-text { min-width: 0; flex: 1 1 360px; }
.h-page-title h1 { margin: 0 0 4px; outline: none; }
.h-page-title p { max-width: 80ch; }
.h-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 10px; font-size: var(--text-sm); color: var(--color-text-muted); }
.h-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.h-head-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.h-head-top .h-crumbs { margin-bottom: 0; }
.h-code { font-size: 11px; white-space: nowrap; color: var(--color-text-muted); border: 1px dashed var(--color-border); border-radius: var(--radius-badge); padding: 1px 6px; background: var(--color-surface); }
.h-crumbs + .h-page-title { }
.h-page-head:has(.h-code) .h-page-title { padding-top: 0; }
.h-co { display: inline-block; font-size: var(--text-xs); font-weight: 500; color: var(--color-text-muted); border: 1px solid var(--color-border); border-radius: var(--radius-badge); padding: 1px 6px; white-space: nowrap; background: var(--color-surface); }
.h-req { color: var(--color-danger); }
.h-link-btn { border: 0; background: none; color: var(--color-primary-text); text-decoration: underline; text-underline-offset: 3px; padding: 4px; font-size: var(--text-xs); }

/* ---------- Paneles y rejillas ---------- */
.h-panel { margin-bottom: 20px; min-width: 0; }
.h-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--color-border); }
.h-panel-head h2 { font-size: 15px; }
.h-panel-body { padding: 16px; }
.h-panel-flush { padding: 0; }
.h-panel .ds-toolbar { border-bottom: 1px solid var(--color-border); }
.h-grid { display: grid; gap: 20px; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); align-items: start; }
.h-grid > .h-panel { margin-bottom: 0; }
.h-grid + .h-grid, .h-grid + .h-panel, .h-panel + .h-grid, .h-kpis + .h-grid, .h-kpis + .h-panel { margin-top: 20px; }
.h-grid--main-side { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.h-stack-v { display: grid; gap: 20px; align-content: start; }
.h-stack-v > .h-panel { margin-bottom: 0; }

/* ---------- KPI ---------- */
.h-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.h-kpi { display: grid; gap: 2px; align-content: start; padding: 14px 16px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-panel); color: var(--color-text); text-decoration: none; min-width: 0; }
a.h-kpi:hover { border-color: var(--color-primary); }
.h-kpi-label { font-size: var(--text-xs); color: var(--color-text-muted); font-weight: 500; }
.h-kpi-value { font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.3; }
.h-kpi-note { font-size: var(--text-xs); color: var(--color-text-muted); }

/* ---------- Datos ---------- */
.h-dl { display: grid; gap: 12px 24px; margin: 0; }
.h-dl--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.h-dl--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.h-dl--1 { grid-template-columns: 1fr; }
.h-dl dt { font-size: var(--text-xs); color: var(--color-text-muted); margin-bottom: 2px; }
.h-dl dd { margin: 0; font-size: var(--text-sm); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.h-table .ds-toolbar { padding: 12px 16px; }
.h-toolbar .ds-field select { min-width: 140px; }
.h-toolbar-extra { margin-left: auto; display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.h-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 16px; font-size: var(--text-xs); border-bottom: 1px solid var(--color-border); }
.h-chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--color-border); background: var(--color-primary-soft); color: var(--color-primary-text); border-radius: 999px; padding: 2px 6px 2px 10px; font-size: var(--text-xs); }
.h-chip .icon { width: 14px; height: 14px; }
.h-dtable { min-width: 720px; }
.h-dtable a { color: var(--color-text); font-weight: 500; text-decoration: none; }
.h-dtable a:hover { color: var(--color-primary-text); text-decoration: underline; }
.h-sub { display: block; font-size: var(--text-xs); color: var(--color-text-muted); font-weight: 400; }
.h-mini-table { min-width: 0; }
.h-mini-table td, .h-mini-table th { height: auto; padding: 6px 10px; }
.h-row-warning td:first-child { box-shadow: inset 3px 0 0 var(--color-warning); }
.h-row-danger td:first-child { box-shadow: inset 3px 0 0 var(--color-danger); }
.h-empty { padding: 32px 16px; text-align: center; }
.h-empty h3 { margin-bottom: 6px; }
.h-empty .ds-btn { margin-top: 14px; }
.h-restricted { display: flex; gap: 14px; align-items: flex-start; padding: 20px; background: var(--color-surface); border: 1px dashed var(--color-control-border); border-radius: var(--radius-panel); max-width: 720px; }
.h-restricted .icon { width: 24px; height: 24px; color: var(--color-text-muted); margin-top: 2px; }
.h-restricted h3 { margin-bottom: 4px; }
.h-notice { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-radius: var(--radius-control); font-size: var(--text-sm); line-height: 1.5; margin-bottom: 16px; background: var(--color-primary-soft); color: var(--color-primary-text); }
.h-notice .icon { margin-top: 2px; }
.h-notice > div:first-of-type { flex: 1; }
.h-notice--warning { background: var(--color-warning-soft); color: var(--color-warning); }
.h-notice--danger { background: var(--color-danger-soft); color: var(--color-danger); }
.h-notice--success { background: var(--color-success-soft); color: var(--color-success); }
.h-notice-action { flex: none; }
.h-progress { display: grid; gap: 4px; min-width: 100px; }
.h-progress-label { font-size: var(--text-xs); color: var(--color-text-muted); }
.h-progress-track { display: block; height: 6px; border-radius: 3px; background: var(--color-neutral-soft); overflow: hidden; }
.h-progress-track > span { display: block; height: 100%; background: var(--chart-1); border-radius: 3px; }

/* ---------- Pestañas ---------- */
.h-tablist { display: flex; gap: 2px; border-bottom: 1px solid var(--color-border); margin-bottom: 20px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.h-tablist [role='tab'] { border: 0; background: none; padding: 10px 12px; font-size: var(--text-sm); font-weight: 500; color: var(--color-text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.h-tablist [role='tab']:hover { color: var(--color-text); }
.h-tablist [role='tab'][aria-selected='true'] { color: var(--color-primary-text); border-bottom-color: var(--color-primary); }
.h-tab-count { font-size: 11px; background: var(--color-neutral-soft); border-radius: 999px; padding: 0 6px; color: var(--color-text-muted); }
.h-tabpanel { outline: none; }

/* ---------- Kanban ---------- */
.h-board { display: grid; grid-template-columns: repeat(var(--cols), minmax(240px, 1fr)); gap: 12px; align-items: start; overflow-x: auto; padding-bottom: 8px; }
.h-col { background: var(--color-neutral-soft); border-radius: var(--radius-panel); padding: 10px; min-width: 240px; }
.h-col.is-over { outline: 2px dashed var(--color-primary); outline-offset: -2px; }
.h-col .ds-column-heading { margin: 2px 4px 10px; }
.h-col .ds-column-heading h3 { font-size: var(--text-sm); }
.h-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 10px; padding: 12px; margin-top: 8px; font-size: var(--text-sm); cursor: grab; }
.h-card.is-dragging { opacity: .5; }
.h-card:focus { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.h-card h4 { margin: 0 0 4px; font-size: var(--text-sm); font-weight: 600; line-height: 1.35; }
.h-card h4 a { color: var(--color-text); text-decoration: none; }
.h-card h4 a:hover { text-decoration: underline; }
.h-card-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 6px; align-items: center; }
.h-move { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 11px; color: var(--color-text-muted); }
.h-move select { min-height: 28px; padding: 2px 6px; font-size: var(--text-xs); flex: 1; }

/* ---------- Línea temporal y pasos ---------- */
.h-timeline { list-style: none; margin: 0; padding: 0; }
.h-timeline-item { display: grid; grid-template-columns: 16px 1fr; gap: 10px; position: relative; padding-bottom: 16px; font-size: var(--text-sm); }
.h-timeline-item::before { content: ''; position: absolute; left: 7px; top: 14px; bottom: 0; width: 1px; background: var(--color-border); }
.h-timeline-item:last-child::before { display: none; }
.h-timeline-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--color-control-border); margin: 5px 0 0 3px; }
.h-timeline-item--email .h-timeline-dot { background: var(--chart-1); }
.h-timeline-item--note .h-timeline-dot { background: var(--chart-2); }
.h-timeline-item--alert .h-timeline-dot { background: var(--color-danger); }
.h-timeline-meta { font-size: var(--text-xs); color: var(--color-text-muted); margin-bottom: 2px; }
.h-timeline-type { font-weight: 600; color: var(--color-text); }
.h-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 0; overflow-x: auto; }
.h-step { display: flex; align-items: flex-start; gap: 8px; flex: 1 1 0; min-width: 120px; padding: 0 12px 0 0; position: relative; font-size: var(--text-sm); }
.h-step::after { content: ''; position: absolute; left: 30px; right: 4px; top: 12px; height: 2px; background: var(--color-border); }
.h-step:last-child::after { display: none; }
.h-step-mark { flex: none; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; background: var(--color-surface); border: 1.5px solid var(--color-control-border); color: var(--color-text-muted); position: relative; z-index: 1; }
.h-step-text { display: grid; padding-top: 28px; margin-left: -32px; line-height: 1.3; font-weight: 500; }
.h-step-text small { font-weight: 400; color: var(--color-text-muted); font-size: 11px; margin-top: 2px; }
.h-step--done .h-step-mark { background: var(--color-primary); border-color: var(--color-primary); color: white; }
.h-step--done::after { background: var(--color-primary); }
.h-step--current .h-step-mark { border-color: var(--color-primary); color: var(--color-primary-text); box-shadow: 0 0 0 3px var(--color-primary-soft); }
.h-step--blocked .h-step-mark { border-color: var(--color-danger); color: var(--color-danger); background: var(--color-danger-soft); }
.h-step--blocked small { color: var(--color-danger); }

/* ---------- Gráficos ---------- */
.h-chart { margin: 0; }
.h-series-1 { fill: var(--chart-1); background: var(--chart-1); }
.h-series-2 { fill: var(--chart-2); background: var(--chart-2); }
.h-series-muted { fill: var(--chart-muted); background: var(--chart-muted); }
.h-svg { width: 100%; height: auto; display: block; overflow: visible; }
.h-svg .h-grid { stroke: var(--color-border); stroke-width: 1; }
.h-svg .h-axis-label { font-size: 11px; fill: var(--color-text-muted); }
.h-svg .h-col-g:hover path { opacity: .8; }
.h-axis-note { font-size: 11px; color: var(--color-text-muted); margin-top: 4px; }
.h-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--text-xs); color: var(--color-text-muted); margin-bottom: 8px; }
.h-legend span { display: inline-flex; align-items: center; gap: 6px; }
.h-legend strong { color: var(--color-text); font-weight: 600; font-variant-numeric: tabular-nums; }
.h-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.h-hbars, .h-cmp { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.h-hbar, .h-cmp li { display: grid; grid-template-columns: minmax(90px, 34%) 1fr minmax(88px, auto); align-items: center; gap: 10px; font-size: var(--text-sm); color: var(--color-text); text-decoration: none; padding: 3px 4px; border-radius: 6px; }
a.h-hbar:hover { background: var(--color-surface-subtle); }
.h-hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-hbar-track { height: 12px; background: var(--color-neutral-soft); border-radius: 0 4px 4px 0; overflow: hidden; }
.h-hbar-fill { display: block; height: 100%; background: var(--chart-1); border-radius: 0 4px 4px 0; }
.h-hbar-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
.h-hbar-value small { color: var(--color-text-muted); font-weight: 400; }
.h-cmp-bars { display: grid; gap: 2px; }
.h-cmp-bar { display: block; height: 8px; border-radius: 0 4px 4px 0; min-width: 2px; }
.h-stack { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; background: var(--color-neutral-soft); margin-bottom: 8px; }
.h-stack-seg { display: block; height: 100%; }
.h-chart-data { margin-top: 8px; font-size: var(--text-xs); }
.h-chart-data summary { cursor: pointer; color: var(--color-primary-text); width: max-content; padding: 2px 0; }
.h-chart-data table { margin-top: 8px; }

/* ---------- Diálogos, panel lateral y avisos ---------- */
.h-dialog, .h-drawer { border: 0; padding: 0; border-radius: var(--radius-panel); box-shadow: var(--shadow-overlay); color: var(--color-text); background: var(--color-surface); max-width: calc(100vw - 32px); }
.h-dialog { width: 560px; max-height: calc(100vh - 48px); }
.h-dialog--wide { width: 880px; }
.h-dialog::backdrop, .h-drawer::backdrop { background: rgb(32 40 45 / 36%); }
.h-dialog-inner, .h-drawer-inner { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.h-dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--color-border); }
.h-dialog-head h2 { font-size: 17px; }
.h-dialog-body, .h-drawer-body { padding: 20px; overflow-y: auto; }
.h-dialog-body > * + *, .h-drawer-body > * + * { margin-top: 16px; }
.h-dialog-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--color-border); background: var(--color-surface-subtle); border-radius: 0 0 var(--radius-panel) var(--radius-panel); }
.h-demo-note { font-size: 11px; color: var(--color-text-muted); }
.h-drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: 460px; border-radius: 0; }
.h-drawer .h-drawer-inner { height: 100%; max-height: 100vh; }
.h-drawer .h-drawer-body { flex: 1; }
.h-drawer .h-dialog-foot { border-radius: 0; }
.h-form-grid { margin-top: 0; }
.h-form-note { margin-top: 12px; }
.h-drop { border: 1.5px dashed var(--color-control-border); border-radius: var(--radius-panel); padding: 20px; text-align: center; background: var(--color-surface-subtle); display: grid; gap: 8px; justify-items: center; }
.h-drop p { display: flex; align-items: center; gap: 6px; }
.h-toasts { position: fixed; bottom: 20px; right: 20px; z-index: var(--z-toast); display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.h-toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; background: var(--color-text); color: white; border-radius: 10px; box-shadow: var(--shadow-overlay); font-size: var(--text-sm); }
.h-toast .icon { color: #9fd3b4; margin-top: 1px; }
.h-toast--danger .icon { color: #f3a5a9; }
.h-notif-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.h-notif { padding: 12px; border-radius: 10px; border: 1px solid var(--color-border); }
.h-notif.is-unread { border-color: var(--color-control-border); background: var(--color-primary-soft); }
.h-notif-meta { font-size: var(--text-xs); color: var(--color-text-muted); }
.h-notif-title { font-weight: 500; margin: 4px 0 10px; }

/* ---------- Documento (presupuesto, factura, contrato) ---------- */
.h-doc { background: white; border: 1px solid var(--color-border); border-radius: 4px; box-shadow: 0 1px 2px rgb(32 40 45 / 6%); padding: 48px 52px; max-width: 820px; margin: 0 auto; font-size: 13px; color: #111; aspect-ratio: auto; }
.h-doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding-bottom: 20px; border-bottom: 1px solid #111; margin-bottom: 24px; }
.h-doc-logo { width: 190px; height: auto; }
.h-doc-issuer { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.h-doc h2 { font-size: 20px; margin-bottom: 4px; }
.h-doc table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; margin: 16px 0; }
.h-doc th { text-align: left; font-weight: 500; font-size: 11px; color: #555; border-bottom: 1px solid #111; padding: 6px 4px; }
.h-doc td { padding: 7px 4px; border-bottom: 1px solid #e5e5e5; vertical-align: top; }
.h-doc .h-doc-chapter td { font-weight: 600; background: #f7f4f0; }
.h-doc-totals { margin-left: auto; width: 280px; display: grid; gap: 4px; font-variant-numeric: tabular-nums; }
.h-doc-totals div { display: flex; justify-content: space-between; }
.h-doc-totals .is-total { border-top: 1px solid #111; padding-top: 6px; font-weight: 600; font-size: 15px; }
.h-doc-foot { margin-top: 32px; padding-top: 12px; border-top: 1px solid #ddd; font-size: 10.5px; color: #666; display: flex; justify-content: space-between; gap: 16px; }
.h-watermark { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--color-warning); border: 1px solid currentColor; padding: 2px 8px; border-radius: 4px; }

/* ---------- Mapa de la maqueta ---------- */
.h-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.h-map-mod { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-panel); padding: 14px 16px; }
.h-map-mod h3 { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.h-map-mod h3 span { font-size: var(--text-xs); color: var(--color-text-muted); font-weight: 500; }
.h-map-mod ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 2px; }
.h-map-mod li a, .h-map-mod li > span { display: grid; grid-template-columns: 64px 1fr; gap: 8px; font-size: var(--text-sm); padding: 4px 6px; border-radius: 6px; text-decoration: none; color: var(--color-text); }
.h-map-mod li a:hover { background: var(--color-primary-soft); }
.h-map-mod li code { font-family: inherit; font-size: 11px; color: var(--color-text-muted); font-variant-numeric: tabular-nums; padding-top: 1px; }

/* ---------- Responsive ---------- */
@media (max-width: 1279px) {
  :root { --page-gutter: 24px; }
  .h-role span { display: none; }
  .h-user-name { display: none; }
  .h-grid--main-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1023px) {
  .h-app { grid-template-columns: 1fr; }
  .h-sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform var(--duration-fast) var(--ease-ui); box-shadow: var(--shadow-overlay); z-index: var(--z-dialog); }
  .nav-open .h-sidebar { transform: none; }
  .nav-open .h-backdrop { display: block; position: fixed; inset: 0; background: rgb(32 40 45 / 36%); z-index: calc(var(--z-dialog) - 1); }
  .h-grid { grid-template-columns: minmax(0, 1fr); }
  .h-dl--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .h-context-logo { width: 120px; }
}
@media (max-width: 767px) {
  :root { --page-gutter: 16px; }
  .h-topbar { padding: 0 12px; gap: 8px; flex-wrap: wrap; height: auto; min-height: var(--topbar-height); padding-block: 8px; }
  .h-context { display: none; }
  .h-company { flex: 1; }
  .h-company select { max-width: none; width: 100%; font-size: 16px; min-height: 40px; }
  .h-search { order: 10; flex: 1 1 100%; max-width: none; margin: 0; }
  .h-search input { font-size: 16px; min-height: 40px; }
  .h-search-results { min-width: 0; }
  .h-topbar-end { gap: 4px; }
  .h-role select { max-width: 116px; min-height: 40px; }
  .h-main { padding-top: 16px; }
  .h-page-title h1 { font-size: 22px; }
  .h-dl--2, .h-dl--3 { grid-template-columns: 1fr; }
  .h-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .h-kpi-value { font-size: 19px; }
  .h-hide-sm { display: none; }
  .h-hbar, .h-cmp li { grid-template-columns: minmax(80px, 38%) 1fr auto; }
  .h-doc { padding: 24px 18px; }
  .h-doc-head { flex-direction: column; }
  .h-drawer { width: 100vw; max-width: 100vw; }
  .h-dialog { max-width: calc(100vw - 16px); }
  .h-toolbar-extra { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .h-sidebar, .h-topbar, .h-footer, .h-actions, .ds-toolbar, .ds-pagination, .h-tablist { display: none !important; }
  .h-app { display: block; }
  body { background: white; }
  .h-doc { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .h-doc table thead { display: table-header-group; }
  .h-doc-totals, .h-doc tr { break-inside: avoid; }
}

/* ---------- Inicio (modules/inicio.js) ---------- */
.ini-exceptions, .ini-list, .ini-agenda, .ini-projects, .ini-journeys, .ini-config { list-style: none; margin: 0; padding: 0; }
.ini-exceptions li + li, .ini-list li + li, .ini-agenda li + li, .ini-projects li + li { border-top: 1px solid var(--color-border); }
.ini-exceptions a { display: grid; grid-template-columns: 190px 1fr auto; gap: 12px; align-items: center; padding: 10px 16px; color: var(--color-text); text-decoration: none; font-size: var(--text-sm); }
.ini-exceptions a:hover, .ini-projects a:hover { background: var(--color-surface-subtle); }
.ini-exc-type { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: var(--text-xs); }
.ini-exc-type .icon { width: 16px; height: 16px; }
.ini-exc-type--danger { color: var(--color-danger); }
.ini-exc-type--warning { color: var(--color-warning); }
.ini-exc-text { font-variant-numeric: tabular-nums; min-width: 0; }
.ini-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; font-size: var(--text-sm); }
.ini-list strong { font-variant-numeric: tabular-nums; }
.ini-agenda li { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 10px 16px; font-size: var(--text-sm); }
.ini-agenda time { display: grid; font-size: var(--text-xs); color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.ini-agenda time strong { color: var(--color-text); font-weight: 600; }
.ini-agenda a { color: var(--color-text); font-weight: 500; text-decoration: none; }
.ini-agenda a:hover { text-decoration: underline; }
.ini-projects a { display: grid; grid-template-columns: 1fr auto 140px 96px; gap: 12px; align-items: center; padding: 10px 16px; color: var(--color-text); text-decoration: none; font-size: var(--text-sm); }
.ini-p-name { font-weight: 500; min-width: 0; }
.ini-projects .ds-badge { justify-self: end; }
.ini-co-table th[scope='row'] { font-weight: 500; color: var(--color-text); }
.ini-note { margin-top: 10px; }
.ini-journeys { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.ini-journeys a { display: grid; grid-template-columns: 40px 1fr 18px; gap: 8px; align-items: center; padding: 10px 16px; color: var(--color-text); text-decoration: none; font-size: var(--text-sm); border-bottom: 1px solid var(--color-border); }
.ini-journeys a:hover { background: var(--color-primary-soft); }
.ini-journeys code { font-family: inherit; font-size: var(--text-xs); color: var(--color-text-muted); }
.ini-journeys .icon { color: var(--color-text-muted); width: 16px; height: 16px; }
.ini-map-title { margin: 28px 0 12px; }
.ini-config li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--color-border); font-size: var(--text-sm); }
.ini-config label { display: flex; align-items: center; gap: 8px; }
.ini-reports { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; }
.ini-report-list ul { list-style: none; margin: 0; padding: 6px; }
.ini-report-list a { display: block; padding: 10px; border-radius: var(--radius-control); color: var(--color-text); text-decoration: none; font-size: var(--text-sm); }
.ini-report-list a:hover { background: var(--color-surface-subtle); }
.ini-report-list a[aria-current='page'] { background: var(--color-primary-soft); color: var(--color-primary-text); }
.ini-report-list strong { font-weight: 500; }
.ini-report-total { display: flex; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--color-border); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
@media (max-width: 1023px) { .ini-reports { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 767px) {
  .ini-exceptions a { grid-template-columns: 1fr auto; }
  .ini-exc-text { grid-column: 1 / -1; grid-row: 2; }
  .ini-projects a { grid-template-columns: 1fr auto; }
  .ini-p-prog { grid-column: 1; }
}

.ds-table tbody th { position: static; background: transparent; color: var(--color-text); font-weight: 500; white-space: normal; }
.ds-badge--neutral { background: var(--color-neutral-soft); color: var(--color-text-muted); }
/* En móvil, las tablas sin contenedor propio se desplazan dentro de su panel, no en la página. */
@media (max-width: 767px) { .h-panel-body, .h-panel-flush { overflow-x: auto; } }

/* ---------- Pantalla de carga ---------- */
.h-splash { position: fixed; inset: 0; z-index: 100; background: #2b2420; overflow: hidden; cursor: pointer; clip-path: inset(0 0 0 0); }
.splash-seen .h-splash { display: none; }
.h-splash-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 48% 50%; opacity: 0; transform: scale(1.12); filter: blur(6px) saturate(.9); }
.h-splash::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgb(43 36 32 / 34%) 0%, rgb(43 36 32 / 0%) 55%); pointer-events: none; }
.h-splash-panel { position: absolute; z-index: 1; left: clamp(20px, 6vw, 88px); bottom: clamp(20px, 9vh, 96px); width: min(400px, calc(100vw - 40px)); padding: 40px 36px 32px; background: var(--brand-cream); border-radius: 4px; box-shadow: 0 18px 48px rgb(20 14 10 / 28%); opacity: 0; transform: translateY(18px); }
.h-splash-sub { font-size: var(--text-sm); color: var(--color-text-muted); max-width: 32ch; }
.h-splash.is-ready .h-splash-photo { opacity: 1; transform: scale(1); filter: blur(0) saturate(1); transition: opacity 700ms ease-out, filter 900ms cubic-bezier(.16, 1, .3, 1), transform 3200ms cubic-bezier(.16, 1, .3, 1); }
.h-splash.is-ready .h-splash-panel { opacity: 1; transform: none; transition: opacity 500ms 350ms ease-out, transform 900ms 350ms cubic-bezier(.16, 1, .3, 1); }
.h-splash.is-leaving { clip-path: inset(0 0 100% 0); transition: clip-path 800ms cubic-bezier(.76, 0, .24, 1); }
.h-splash.is-leaving .h-splash-panel { transform: translateY(-24px); opacity: 0; transition: transform 600ms cubic-bezier(.76, 0, .24, 1), opacity 400ms ease-in; }
@media (prefers-reduced-motion: reduce) {
  .h-splash-photo, .h-splash-panel { transform: none; filter: none; }
  .h-splash.is-ready .h-splash-photo, .h-splash.is-ready .h-splash-panel { transition: opacity 200ms linear; }
  .h-splash.is-leaving { clip-path: none; opacity: 0; transition: opacity 200ms linear; }
}

/* Superficies del navegador */
html { scrollbar-color: #c3ccd1 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c3ccd1; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--color-control-border); }
.h-context { display: none; }
.ini-more { padding: 10px 16px; border-top: 1px solid var(--color-border); font-size: var(--text-xs); color: var(--color-text-muted); }

/* ---------- Logotipo Hestia (assets/brand/hestia-logo.svg) y firma Transforma ---------- */
.h-brand-link { display: inline-flex; align-items: center; padding: 4px 2px; }
.h-brand-hx { width: 128px; height: auto; display: block; }
.h-sidebar { display: flex; flex-direction: column; }
#h-nav { flex: 1; }
.h-sidebar-foot { margin: 16px 18px 0; padding-top: 18px; border-top: 1px solid var(--color-border); }
.h-foot-logo { width: 100%; max-width: 196px; height: auto; display: block; }
.h-sidebar-foot p { margin-top: 10px; font-size: 11px; color: var(--color-text-muted); }
.h-splash-product { width: min(300px, 100%); }
.h-splash-product svg { width: 100%; height: auto; display: block; overflow: visible; }
.h-splash-sub { margin-top: 18px; }
.h-splash-sign { margin-top: 30px; padding-top: 24px; border-top: 1px solid rgb(32 40 45 / 14%); }
.h-splash-logo { width: 210px; max-width: 100%; height: auto; display: block; }
/* El hogar se enciende: la línea ocre crece desde el centro mientras carga. */
.h-splash .hx-fire { transform-box: fill-box; transform-origin: 50% 50%; transform: scaleX(0); fill: #8f6a4a; }
.h-splash.is-ready .hx-fire { transform: scaleX(1); fill: #b5713a; transition: transform 1100ms 650ms cubic-bezier(.16, 1, .3, 1), fill 900ms 900ms ease-out; }
@media (prefers-reduced-motion: reduce) { .h-splash .hx-fire { transform: none; fill: #b5713a; } }
.h-sidebar { overflow: hidden; padding-bottom: 16px; }
#h-nav { overflow-y: auto; min-height: 0; scrollbar-width: thin; }
.h-sidebar-foot { flex: none; }
