/* ==========================================================================
   Design Hub — CSS funcional con variables para theming posterior.
   Todo bajo el prefijo .dh- para no colisionar con el tema activo.
   ========================================================================== */

.dh-app {
    /* Tokens visuales — se sobreescribirán cuando definamos el tema definitivo */
    --dh-bg:           #f4f4f4;
    --dh-surface:      #ffffff;
    --dh-surface-2:    #f9f9f9;
    --dh-border:       #e2e2e2;
    --dh-text:         #1a1a1a;
    --dh-text-muted:   #6b6b6b;
    --dh-accent:       #2563eb;
    --dh-accent-hover: #1d4ed8;
    --dh-danger:       #dc2626;
    --dh-success:      #16a34a;
    --dh-radius:       8px;
    --dh-radius-sm:    4px;
    --dh-shadow:       0 1px 4px rgba(0,0,0,.1);
    --dh-shadow-md:    0 4px 16px rgba(0,0,0,.12);
    --dh-header-h:     52px;
    --dh-sidebar-w:    272px;
    --dh-panel-w:      440px;

    /* Colores por estado del tablón */
    --dh-col-in-progress: #eff6ff;
    --dh-col-review:      #fefce8;
    --dh-col-approved:    #f0fdf4;
    --dh-col-discarded:   #f3f4f6;

    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size:   15px;
    color:       var(--dh-text);
    background:  var(--dh-bg);
    min-height:  100vh;
    box-sizing:  border-box;
}

.dh-app *, .dh-app *::before, .dh-app *::after {
    box-sizing: inherit;
}

/* -----------------------------------------------------------------------
   Utilidades
   ----------------------------------------------------------------------- */
.dh-hidden   { display: none !important; }
.dh-loading  { color: var(--dh-text-muted); padding: 24px; text-align: center; }
.dh-empty    { color: var(--dh-text-muted); padding: 16px 0; }
.dh-error    { color: var(--dh-danger); }

/* -----------------------------------------------------------------------
   Botones
   ----------------------------------------------------------------------- */
.dh-btn {
    display:         inline-flex;
    align-items:     center;
    gap:             6px;
    padding:         8px 16px;
    border:          1px solid transparent;
    border-radius:   var(--dh-radius-sm);
    font-size:       14px;
    font-weight:     500;
    cursor:          pointer;
    transition:      background .15s, box-shadow .15s;
    white-space:     nowrap;
    text-decoration: none;
    background:      transparent;
    color:           var(--dh-text);
}
.dh-btn:focus-visible { outline: 2px solid var(--dh-accent); outline-offset: 2px; }

.dh-btn-primary {
    background: var(--dh-accent);
    color:      #fff;
    border-color: var(--dh-accent);
}
.dh-btn-primary:hover { background: var(--dh-accent-hover); border-color: var(--dh-accent-hover); }

.dh-btn-ghost { border-color: var(--dh-border); }
.dh-btn-ghost:hover { background: var(--dh-surface-2); }

.dh-btn-danger { color: var(--dh-danger); border-color: var(--dh-danger); }
.dh-btn-danger:hover { background: #fef2f2; }

.dh-btn-sm    { padding: 4px 10px; font-size: 13px; }
.dh-btn-full  { width: 100%; justify-content: center; }
.dh-btn:disabled { opacity: .5; cursor: not-allowed; }

/* -----------------------------------------------------------------------
   Formularios
   ----------------------------------------------------------------------- */
.dh-form-group {
    display:        flex;
    flex-direction: column;
    gap:            6px;
    margin-bottom:  16px;
}
.dh-form-group label { font-size: 13px; font-weight: 500; color: var(--dh-text-muted); }

.dh-app input[type="text"],
.dh-app input[type="email"],
.dh-app input[type="password"],
.dh-app input[type="date"],
.dh-app input[type="file"],
.dh-app textarea,
.dh-app select {
    width:        100%;
    padding:      8px 12px;
    border:       1px solid var(--dh-border);
    border-radius: var(--dh-radius-sm);
    font-size:    14px;
    font-family:  inherit;
    background:   var(--dh-surface);
    color:        var(--dh-text);
    transition:   border-color .15s;
}
.dh-app input:focus,
.dh-app textarea:focus,
.dh-app select:focus {
    outline:      none;
    border-color: var(--dh-accent);
}

.dh-form-actions {
    display:         flex;
    justify-content: flex-end;
    gap:             8px;
    margin-top:      8px;
}
.dh-form-row {
    display:     flex;
    gap:         8px;
    margin-top:  8px;
    align-items: center;
}

.dh-form-error {
    padding:       8px 12px;
    background:    #fef2f2;
    border-radius: var(--dh-radius-sm);
    color:         var(--dh-danger);
    font-size:     13px;
}

/* -----------------------------------------------------------------------
   Header global
   ----------------------------------------------------------------------- */
.dh-header {
    height:          var(--dh-header-h);
    background:      var(--dh-surface);
    border-bottom:   1px solid var(--dh-border);
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    padding:         0 20px;
    position:        sticky;
    top:             0;
    z-index:         50;
}
.dh-logo { font-weight: 700; font-size: 17px; letter-spacing: -.3px; }
.dh-header-right {
    display:     flex;
    align-items: center;
    gap:         12px;
}
.dh-current-user {
    display:     flex;
    align-items: center;
    gap:         8px;
    font-size:   13px;
    color:       var(--dh-text-muted);
}
.dh-header-username { font-weight: 500; color: var(--dh-text); }

/* -----------------------------------------------------------------------
   Avatares
   ----------------------------------------------------------------------- */
.dh-avatar {
    border-radius: 50%;
    object-fit:    cover;
    flex-shrink:   0;
}
.dh-avatar-sm { width: 24px; height: 24px; }
.dh-avatar-placeholder {
    display:       inline-block;
    border-radius: 50%;
    background:    var(--dh-border);
    flex-shrink:   0;
}

/* -----------------------------------------------------------------------
   Login
   ----------------------------------------------------------------------- */
.dh-login-wrap {
    min-height:      calc(100vh - var(--dh-header-h, 0px));
    display:         flex;
    align-items:     center;
    justify-content: center;
    padding:         32px 16px;
}
.dh-login-box {
    background:    var(--dh-surface);
    border:        1px solid var(--dh-border);
    border-radius: var(--dh-radius);
    padding:       40px;
    width:         100%;
    max-width:     380px;
    box-shadow:    var(--dh-shadow-md);
}
.dh-login-title {
    font-size:     22px;
    font-weight:   700;
    margin:        0 0 28px;
    text-align:    center;
}
.dh-login-form .dh-btn { margin-top: 8px; }

/* -----------------------------------------------------------------------
   Dashboard — Grilla de proyectos
   ----------------------------------------------------------------------- */
.dh-dashboard {
    max-width:  1200px;
    margin:     0 auto;
    padding:    32px 24px;
}
.dh-dashboard-toolbar {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    margin-bottom:   24px;
}
.dh-dashboard-toolbar h2 { margin: 0; font-size: 20px; }

.dh-projects-grid {
    display:               grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap:                   20px;
}

.dh-project-card {
    background:    var(--dh-surface);
    border:        1px solid var(--dh-border);
    border-radius: var(--dh-radius);
    padding:       20px;
    cursor:        pointer;
    transition:    box-shadow .15s, transform .1s;
}
.dh-project-card:hover {
    box-shadow: var(--dh-shadow-md);
    transform:  translateY(-1px);
}
.dh-project-card-header {
    display:         flex;
    justify-content: space-between;
    align-items:     flex-start;
    margin-bottom:   8px;
    gap:             8px;
}
.dh-project-card-header h3 { margin: 0; font-size: 15px; line-height: 1.3; }
.dh-project-card-desc {
    font-size:   13px;
    color:       var(--dh-text-muted);
    margin:      0 0 16px;
    line-height: 1.5;
}
.dh-project-card-meta {
    display:  flex;
    gap:      16px;
    font-size: 12px;
    color:    var(--dh-text-muted);
}

/* -----------------------------------------------------------------------
   Vista de proyecto — Layout
   ----------------------------------------------------------------------- */
.dh-project-body {
    display: flex;
    height:  calc(100vh - var(--dh-header-h));
    overflow: hidden;
}

/* Sidebar */
.dh-sidebar {
    width:        var(--dh-sidebar-w);
    flex-shrink:  0;
    background:   var(--dh-surface);
    border-right: 1px solid var(--dh-border);
    display:      flex;
    flex-direction: column;
    transition:   width .2s ease;
    overflow:     hidden;
}
.dh-sidebar.dh-sidebar-collapsed {
    width: 44px;
}
.dh-sidebar.dh-sidebar-collapsed .dh-sidebar-body { display: none; }
.dh-sidebar.dh-sidebar-collapsed #dh-project-info { display: none; }

.dh-sidebar-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    padding:         0 14px;
    border-bottom:   1px solid var(--dh-border);
    height:          56px;
    flex-shrink:     0;
}
.dh-sidebar-toggle {
    display:         flex;
    align-items:     center;
    justify-content: center;
    width:           26px;
    height:          26px;
    background:      var(--dh-surface);
    border:          1px solid var(--dh-border);
    border-radius:   50%;
    cursor:          pointer;
    flex-shrink:     0;
    padding:         0;
    transition:      background .15s, border-color .15s;
    position:        relative;
}
.dh-sidebar-toggle:hover {
    background:    var(--dh-surface-2);
    border-color:  var(--dh-text-muted);
}
/* Chevron izquierda — dos líneas diagonales */
.dh-sidebar-toggle::before,
.dh-sidebar-toggle::after {
    content:      '';
    position:     absolute;
    width:        5px;
    height:       1.5px;
    background:   var(--dh-text-muted);
    border-radius: 2px;
    transition:   transform .2s, left .2s;
    left:         10px;
}
.dh-sidebar-toggle::before { transform: rotate(-40deg) translateY(-2px); }
.dh-sidebar-toggle::after  { transform: rotate( 40deg) translateY( 2px); }

/* Colapsado: chevron apunta a la derecha */
.dh-sidebar-collapsed .dh-sidebar-toggle::before { transform: rotate( 40deg) translateY(-2px); }
.dh-sidebar-collapsed .dh-sidebar-toggle::after  { transform: rotate(-40deg) translateY( 2px); }

.dh-project-leader-info {
    display:     flex;
    align-items: center;
    gap:         10px;
    overflow:    hidden;
}
.dh-project-name-sm {
    display:     block;
    font-weight: 600;
    font-size:   13px;
    white-space: nowrap;
    overflow:    hidden;
    text-overflow: ellipsis;
}
.dh-leader-nombre {
    display:     block;
    font-weight: 600;
    font-size:   13px;
    white-space: nowrap;
    overflow:    hidden;
    text-overflow: ellipsis;
}
.dh-leader-label {
    display:   block;
    font-size: 11px;
    color:     var(--dh-text-muted);
    white-space: nowrap;
    overflow:  hidden;
    text-overflow: ellipsis;
}

.dh-sidebar-body {
    flex:       1;
    overflow-y: auto;
    padding:    12px;
}
.dh-section-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    margin-bottom:   10px;
}
.dh-section-title { font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--dh-text-muted); }

/* Lista de tareas */
.dh-tasks-list {
    list-style: none;
    margin:     0;
    padding:    0;
    display:    flex;
    flex-direction: column;
    gap:        4px;
}
.dh-task-item { border-radius: var(--dh-radius-sm); overflow: hidden; }
.dh-task-main {
    display:     flex;
    align-items: center;
    gap:         8px;
    padding:     7px 8px;
    cursor:      pointer;
}
.dh-task-main:hover { background: var(--dh-surface-2); }
.dh-task-toggle {
    background: none;
    border:     none;
    cursor:     pointer;
    font-size:  16px;
    padding:    0;
    flex-shrink: 0;
    color:      var(--dh-text-muted);
    line-height: 1;
}
.dh-task-toggle:hover { color: var(--dh-accent); }
.dh-task-title { flex: 1; font-size: 13px; }
.dh-task-status-done .dh-task-title { text-decoration: line-through; color: var(--dh-text-muted); }
.dh-task-expand {
    background: none;
    border:     none;
    cursor:     pointer;
    color:      var(--dh-text-muted);
    font-size:  15px;
    padding:    0 2px;
    pointer-events: none; /* la fila completa es el área clicable */
}
.dh-task-detail {
    padding:       8px 12px 10px 36px;
    background:    var(--dh-surface-2);
    font-size:     13px;
    color:         var(--dh-text-muted);
}
.dh-task-detail p { margin: 0 0 6px; }
.dh-task-meta-row {
    display: flex;
    gap:     12px;
    align-items: center;
    font-size: 12px;
    margin-bottom: 8px;
}
#dh-new-task-form {
    background:    var(--dh-surface-2);
    border:        1px solid var(--dh-border);
    border-radius: var(--dh-radius-sm);
    padding:       12px;
    margin-bottom: 10px;
}
#dh-new-task-form input,
#dh-new-task-form textarea,
#dh-new-task-form select { margin-bottom: 8px; }
.dh-empty-tasks { color: var(--dh-text-muted); font-size: 13px; padding: 8px; list-style: none; }

/* -----------------------------------------------------------------------
   Tablón kanban
   ----------------------------------------------------------------------- */
.dh-board-wrap {
    flex:       1;
    display:    flex;
    flex-direction: column;
    overflow:   hidden;
    background: var(--dh-bg);
}
.dh-board-toolbar {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    padding:         10px 20px;
    min-height:      56px;
    flex-shrink:     0;
    border-bottom:   1px solid var(--dh-border);
    background:      var(--dh-surface);
    gap:             12px;
}
.dh-board-toolbar h2 { margin: 0; font-size: 18px; flex: 1; min-width: 0; }
.dh-board-toolbar-actions {
    display:     flex;
    align-items: center;
    gap:         8px;
    flex-shrink: 0;
}
/* Texto de descripción de proyecto en el panel lateral */
.dh-project-desc-text {
    margin:      0;
    font-size:   14px;
    color:       var(--dh-text-muted);
    line-height: 1.7;
    white-space: pre-wrap;
}

/* Header derecho de tarjeta de proyecto */
.dh-project-card-header-right {
    display:     flex;
    align-items: center;
    gap:         8px;
    flex-shrink: 0;
}

/* Menú de 3 puntos en tarjeta de proyecto */
.dh-card-menu-wrap { position: relative; }
.dh-card-menu-btn {
    background:    none;
    border:        1px solid transparent;
    border-radius: var(--dh-radius-sm);
    cursor:        pointer;
    padding:       2px 7px;
    font-size:     18px;
    line-height:   1;
    color:         var(--dh-text-muted);
    opacity:       0;
    transition:    opacity .15s, background .15s, border-color .15s;
}
.dh-project-card:hover .dh-card-menu-btn,
.dh-card-menu-btn.dh-active { opacity: 1; }
.dh-card-menu-btn:hover,
.dh-card-menu-btn.dh-active { background: var(--dh-surface-2); border-color: var(--dh-border); }
.dh-card-dropdown {
    position:      absolute;
    top:           calc(100% + 4px);
    right:         0;
    background:    var(--dh-surface);
    border:        1px solid var(--dh-border);
    border-radius: var(--dh-radius);
    box-shadow:    var(--dh-shadow-md);
    min-width:     140px;
    z-index:       20;
    overflow:      hidden;
}
.dh-card-dropdown-item {
    display:    block;
    width:      100%;
    padding:    9px 14px;
    background: none;
    border:     none;
    text-align: left;
    font-size:  13px;
    cursor:     pointer;
    color:      var(--dh-text);
    transition: background .1s;
}
.dh-card-dropdown-item:hover { background: var(--dh-surface-2); }
.dh-card-dropdown-item.dh-danger { color: var(--dh-danger); }
.dh-card-dropdown-item.dh-danger:hover { background: #fef2f2; }
.dh-project-card.dh-menu-open { z-index: 2; }

.dh-board {
    display: flex;
    gap:     16px;
    padding: 20px;
    flex:    1;
    overflow-x: auto;
    align-items: flex-start;
}

.dh-column {
    flex:          0 0 300px;
    min-width:     0;
    border-radius: var(--dh-radius);
    overflow:      hidden;
    display:       flex;
    flex-direction: column;
    max-height:    100%;
}
.dh-column[data-status="in_progress"] { background: var(--dh-col-in-progress); }
.dh-column[data-status="review"]      { background: var(--dh-col-review); }
.dh-column[data-status="approved"]    { background: var(--dh-col-approved); }
.dh-column[data-status="discarded"]   { background: var(--dh-col-discarded); }

/* Columna Descartado — plegada por defecto */
.dh-column-discarded {
    flex:     0 0 52px;
    cursor:   pointer;
    transition: flex-basis .2s ease;
    min-width: 52px;
}
.dh-column-discarded.dh-expanded {
    flex:   0 0 300px;
    cursor: default;
}
.dh-column-discarded:not(.dh-expanded) .dh-column-header {
    flex-direction: column;
    align-items:    center;
    justify-content: flex-start;
    height:  100%;
    padding: 14px 6px;
    gap:     8px;
}
.dh-column-discarded:not(.dh-expanded) .dh-column-label {
    writing-mode:    vertical-rl;
    transform:       rotate(180deg);
    font-size:       11px;
    letter-spacing:  .4px;
    white-space:     nowrap;
}
.dh-column-discarded:not(.dh-expanded) .dh-column-cards { display: none; }
.dh-column-discarded.dh-expanded .dh-column-header {
    flex-direction: row;
    height:   auto;
    padding:  12px 14px;
    writing-mode: horizontal-tb;
}

.dh-column-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    padding:         12px 14px;
    font-weight:     600;
    font-size:       13px;
    letter-spacing:  .3px;
}
.dh-column-count {
    background:    rgba(0,0,0,.08);
    border-radius: 999px;
    padding:       1px 7px;
    font-size:     12px;
    font-weight:   600;
}

.dh-column-cards {
    flex:      1;
    padding:   8px 10px 20px; /* 20px bottom: espacio para la sombra de la última tarjeta apilada */
    display:   flex;
    flex-direction: column;
    gap:       10px;
    min-height: 80px;
    overflow-y: auto;
    isolation: isolate; /* crea stacking context para que z-index:-1 en tarjetas sea visible */
}
.dh-column-cards.dh-drag-over { outline: 2px dashed var(--dh-accent); outline-offset: -4px; }

/* Tarjeta de propuesta */
.dh-card {
    background:    var(--dh-surface);
    border:        1px solid var(--dh-border);
    border-radius: var(--dh-radius);
    cursor:        pointer;
    transition:    box-shadow .15s, transform .1s;
    user-select:   none;
}
.dh-card:hover    { box-shadow: var(--dh-shadow-md); transform: translateY(-1px); }
.dh-card.dh-dragging { opacity: .45; transform: scale(.97); }

.dh-card-thumb {
    height:        140px;
    overflow:      hidden;
    background:    var(--dh-surface-2);
    display:       flex;
    align-items:   center;
    justify-content: center;
    border-radius: var(--dh-radius) var(--dh-radius) 0 0;
}
.dh-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dh-card-thumb-pdf {
    flex-direction: column;
    gap: 6px;
}
.dh-pdf-icon {
    font-size:    11px;
    font-weight:  700;
    background:   var(--dh-danger);
    color:        #fff;
    padding:      3px 7px;
    border-radius: 4px;
}
.dh-pdf-name {
    font-size: 12px;
    color:     var(--dh-text-muted);
    max-width: 200px;
    overflow:  hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dh-card-body  { padding: 12px; }
.dh-card-title-row {
    display:         flex;
    align-items:     flex-start;
    justify-content: space-between;
    gap:             8px;
    margin-bottom:   6px;
}
.dh-card-title { font-weight: 600; font-size: 13px; line-height: 1.3; }
.dh-card-meta  { font-size: 12px; color: var(--dh-text-muted); margin-bottom: 8px; display: flex; gap: 8px; }
.dh-card-footer {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
}
.dh-card-votes { display: flex; gap: 6px; }
.dh-card-comments { font-size: 12px; color: var(--dh-text-muted); }

/* Etiqueta de tarea vinculada en la tarjeta */
.dh-card-task-row  { margin-bottom: 6px; }
.dh-card-task-badge {
    display:       inline-flex;
    align-items:   center;
    gap:           3px;
    font-size:     11px;
    color:         var(--dh-accent);
    background:    rgba(37,99,235,.08);
    border-radius: var(--dh-radius-sm);
    padding:       2px 7px;
    max-width:     100%;
    overflow:      hidden;
    text-overflow: ellipsis;
    white-space:   nowrap;
}

/* Contador de propuestas en el sidebar de tareas */
.dh-task-prop-count {
    font-size:    11px;
    color:        var(--dh-accent);
    margin-left:  auto;
    margin-right: 4px;
    white-space:  nowrap;
    flex-shrink:  0;
}

/* Badges de estado */
.dh-status-badge {
    display:       inline-block;
    padding:       2px 8px;
    border-radius: 999px;
    font-size:     11px;
    font-weight:   600;
    white-space:   nowrap;
    flex-shrink:   0;
}
.dh-status-in_progress { background: #dbeafe; color: #1d4ed8; }
.dh-status-review      { background: #fef9c3; color: #92400e; }
.dh-status-approved    { background: #dcfce7; color: #15803d; }
.dh-status-discarded   { background: #e5e7eb; color: #6b7280; }

/* Botones de voto */
.dh-vote-btn {
    background:    none;
    border:        1px solid var(--dh-border);
    border-radius: var(--dh-radius-sm);
    padding:       2px 8px;
    font-size:     12px;
    cursor:        pointer;
    transition:    background .12s, border-color .12s;
    display:       inline-flex;
    align-items:   center;
    gap:           3px;
}
.dh-vote-btn:hover   { background: var(--dh-surface-2); }
.dh-vote-btn.dh-voted { background: var(--dh-accent); color: #fff; border-color: var(--dh-accent); }

/* -----------------------------------------------------------------------
   Panel lateral
   ----------------------------------------------------------------------- */
.dh-panel {
    position:    fixed;
    top:         0;
    right:       0;
    width:       var(--dh-panel-w);
    max-width:   100vw;
    height:      100vh;
    background:  var(--dh-surface);
    border-left: 1px solid var(--dh-border);
    box-shadow:  var(--dh-shadow-md);
    transform:   translateX(100%);
    transition:  transform .25s ease;
    z-index:     200;
    display:     flex;
    flex-direction: column;
    overflow:    hidden;
}
.dh-panel.dh-panel-active { transform: translateX(0); }
.dh-panel-content { flex: 1; overflow-y: auto; padding-bottom: 32px; }

.dh-panel-overlay {
    position: fixed;
    inset:    0;
    background: rgba(0,0,0,.25);
    z-index:  199;
}

.dh-panel-loading { padding: 32px; text-align: center; color: var(--dh-text-muted); }

.dh-panel-header {
    display:         flex;
    align-items:     flex-start;
    justify-content: space-between;
    padding:         16px 20px 12px;
    border-bottom:   1px solid var(--dh-border);
    position:        sticky;
    top:             0;
    background:      var(--dh-surface);
    z-index:         1;
    gap:             12px;
}
.dh-panel-title {
    margin:      0;
    font-size:   16px;
    font-weight: 600;
    line-height: 1.3;
}
.dh-panel-close {
    background:    none;
    border:        none;
    cursor:        pointer;
    font-size:     16px;
    color:         var(--dh-text-muted);
    padding:       2px 6px;
    border-radius: var(--dh-radius-sm);
    flex-shrink:   0;
    line-height:   1;
}
.dh-panel-close:hover { background: var(--dh-surface-2); color: var(--dh-text); }

.dh-panel-status-row {
    padding: 10px 20px;
    border-bottom: 1px solid var(--dh-border);
}
.dh-status-select {
    width:         auto;
    min-width:     140px;
    font-size:     13px;
    padding:       5px 10px;
}

.dh-panel-section {
    padding:       16px 20px;
    border-bottom: 1px solid var(--dh-border);
}
.dh-panel-section:last-child { border-bottom: none; }

/* Preview de imagen */
.dh-preview-wrap {
    position:   relative;
    line-height: 0;
    border-radius: var(--dh-radius-sm);
    overflow:   hidden;
}
.dh-preview-img {
    width:      100%;
    height:     auto;
    display:    block;
}
.dh-preview-img.dh-pin-mode-active { cursor: crosshair; }

.dh-pins-svg {
    position:  absolute;
    top:       0;
    left:      0;
    width:     100%;
    height:    100%;
    pointer-events: none; /* se activa per-elemento en JS */
    overflow:  visible;
}
.dh-pin-circle {
    fill:   var(--dh-accent);
    stroke: #fff;
    stroke-width: 2;
    pointer-events: all;
    cursor: pointer;
}
.dh-pin-text {
    fill:      #fff;
    font-size: 10px;
    font-weight: 700;
    pointer-events: none;
}
.dh-pin-group.dh-pin-highlighted .dh-pin-circle { fill: var(--dh-danger); }
.dh-pin-pending {
    fill:    none;
    stroke:  var(--dh-accent);
    stroke-width: 2;
    stroke-dasharray: 4 2;
}
.dh-pin-tooltip-bg { fill: var(--dh-text); opacity: .9; }
.dh-pin-tooltip-autor {
    fill:      #fff;
    font-size: 10px;
    font-weight: 600;
}
.dh-pin-tooltip-texto {
    fill:      rgba(255,255,255,.8);
    font-size: 10px;
}
.dh-pin-line {
    stroke:       var(--dh-text);
    stroke-width: 1;
    opacity:      .6;
}

.dh-pdf-preview {
    display:        flex;
    flex-direction: column;
    align-items:    center;
    gap:            12px;
    padding:        24px 0;
}
.dh-pdf-icon-lg {
    font-size:     11px;
    font-weight:   700;
    background:    var(--dh-danger);
    color:         #fff;
    padding:       6px 14px;
    border-radius: 6px;
    letter-spacing: 1px;
}

/* Sección de votos en el panel */
.dh-votes-section {
    display: flex;
    gap:     12px;
}
.dh-vote-btn-lg {
    flex:          1;
    display:       flex;
    align-items:   center;
    justify-content: center;
    gap:           8px;
    padding:       10px;
    background:    var(--dh-surface-2);
    border:        1px solid var(--dh-border);
    border-radius: var(--dh-radius);
    font-size:     14px;
    cursor:        pointer;
    transition:    background .15s, border-color .15s;
}
.dh-vote-btn-lg:hover  { background: var(--dh-border); }
.dh-vote-btn-lg.dh-voted { background: var(--dh-accent); color: #fff; border-color: var(--dh-accent); }

/* -----------------------------------------------------------------------
   Comentarios
   ----------------------------------------------------------------------- */
.dh-comments-section .dh-section-title { display: block; margin-bottom: 12px; }

.dh-comments-list {
    display:        flex;
    flex-direction: column;
    gap:            12px;
    margin-bottom:  16px;
}
.dh-comment-item {
    font-size:     13px;
    transition:    background .2s;
    border-radius: var(--dh-radius-sm);
    padding:       8px;
}
.dh-comment-item.dh-comment-pin-hover { background: #eff6ff; }
.dh-comment-item.dh-comment-highlight {
    background: #fef9c3;
    transition: background 0s;
}
.dh-comment-item.dh-comment-anchored { border-left: 3px solid var(--dh-accent); padding-left: 10px; }

.dh-comment-header {
    display:     flex;
    align-items: center;
    gap:         6px;
    margin-bottom: 5px;
}
.dh-comment-author { font-weight: 600; }
.dh-comment-time   { color: var(--dh-text-muted); font-size: 11px; margin-left: auto; }
.dh-pin-badge {
    font-size:   13px;
    margin-right: 2px;
}
.dh-delete-comment-btn {
    background: none;
    border:     none;
    cursor:     pointer;
    color:      var(--dh-text-muted);
    font-size:  11px;
    padding:    0 3px;
    border-radius: 3px;
    opacity:    0;
    transition: opacity .15s;
}
.dh-comment-item:hover .dh-delete-comment-btn { opacity: 1; }
.dh-delete-comment-btn:hover { color: var(--dh-danger); background: #fef2f2; }

.dh-comment-body { margin: 0 0 6px; line-height: 1.5; }
.dh-reply-btn {
    background: none;
    border:     none;
    cursor:     pointer;
    font-size:  12px;
    color:      var(--dh-text-muted);
    padding:    2px 0;
}
.dh-reply-btn:hover { color: var(--dh-accent); }

.dh-replies {
    margin-top: 8px;
    padding-left: 20px;
    display:    flex;
    flex-direction: column;
    gap:        8px;
    border-left: 2px solid var(--dh-border);
}

.dh-reply-form {
    background:    var(--dh-surface-2);
    border-radius: var(--dh-radius-sm);
    padding:       10px;
    margin-top:    6px;
}
.dh-reply-form textarea { margin-bottom: 8px; }

/* Formulario de nuevo comentario */
.dh-comment-form-wrap { padding-top: 4px; }
.dh-comment-input-row {
    display:   flex;
    gap:       8px;
    align-items: flex-start;
}
.dh-comment-textarea { flex: 1; resize: vertical; }

.dh-pin-btn {
    background:    var(--dh-surface);
    border:        1px solid var(--dh-border);
    border-radius: var(--dh-radius-sm);
    padding:       7px 10px;
    cursor:        pointer;
    font-size:     16px;
    flex-shrink:   0;
    transition:    background .12s, border-color .12s;
    line-height:   1;
    margin-top:    1px;
}
.dh-pin-btn:hover  { background: var(--dh-surface-2); }
.dh-pin-btn.dh-active { background: var(--dh-accent); border-color: var(--dh-accent); }

.dh-anchor-indicator {
    font-size:     12px;
    color:         var(--dh-accent);
    margin-bottom: 6px;
    padding:       4px 8px;
    background:    #eff6ff;
    border-radius: var(--dh-radius-sm);
}

.dh-comment-form-actions {
    display:         flex;
    justify-content: flex-end;
    margin-top:      8px;
}

/* -----------------------------------------------------------------------
   Modal
   ----------------------------------------------------------------------- */
.dh-modal-backdrop {
    position:        fixed;
    inset:           0;
    background:      rgba(0,0,0,.4);
    z-index:         300;
    display:         flex;
    align-items:     center;
    justify-content: center;
    padding:         16px;
}
.dh-modal-box {
    background:    var(--dh-surface);
    border-radius: var(--dh-radius);
    padding:       0;
    width:         100%;
    max-width:     480px;
    box-shadow:    var(--dh-shadow-md);
    overflow:      hidden;
    max-height:    90vh;
    overflow-y:    auto;
}
.dh-modal-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    padding:         16px 20px;
    border-bottom:   1px solid var(--dh-border);
    position:        sticky;
    top:             0;
    background:      var(--dh-surface);
}
.dh-modal-header h3 { margin: 0; font-size: 16px; }
.dh-modal-close {
    background: none;
    border:     none;
    cursor:     pointer;
    font-size:  16px;
    color:      var(--dh-text-muted);
    padding:    2px 6px;
    border-radius: var(--dh-radius-sm);
    line-height: 1;
}
.dh-modal-close:hover { background: var(--dh-surface-2); }
.dh-modal-form { padding: 20px; }

/* -----------------------------------------------------------------------
   Toast de notificaciones
   ----------------------------------------------------------------------- */
.dh-toast {
    position:      fixed;
    bottom:        24px;
    right:         24px;
    padding:       12px 18px;
    border-radius: var(--dh-radius);
    font-size:     14px;
    font-weight:   500;
    box-shadow:    var(--dh-shadow-md);
    z-index:       400;
    opacity:       0;
    transform:     translateY(8px);
    transition:    opacity .25s, transform .25s;
    max-width:     320px;
    pointer-events: none;
}
.dh-toast.dh-toast-visible { opacity: 1; transform: translateY(0); }
.dh-toast-error   { background: var(--dh-danger); color: #fff; }
.dh-toast-success { background: var(--dh-success); color: #fff; }

/* ==========================================================================
   Escape del contenedor del tema — viewport completo
   El #dh-app se posiciona fixed sobre todo el viewport, independientemente
   del tema activo, su ancho máximo de contenido o sus sidebars.
   ========================================================================== */

body.dh-page {
    overflow: hidden !important;
}

/* Ocultar elementos típicos del tema que quedan por debajo del app */
body.dh-page #wpadminbar { z-index: 99999; } /* admin bar siempre encima */

#dh-app {
    position:   fixed !important;
    top:        0 !important;
    left:       0 !important;
    right:      0 !important;
    bottom:     0 !important;
    width:      100vw !important;
    max-width:  none !important;
    height:     100vh !important;
    margin:     0 !important;
    padding:    0 !important;
    z-index:    9990;
    overflow-y: auto;
    /* Evitar que el admin bar del WP tape el header de la app */
}

/* El admin bar se oculta vía PHP en páginas con el shortcode [design_hub],
   pero mantenemos el offset como seguro por si algún tema lo re-activa. */
body.admin-bar #dh-app {
    top:    32px !important;
    height: calc(100vh - 32px) !important;
}
@media screen and (max-width: 782px) {
    body.admin-bar #dh-app {
        top:    46px !important;
        height: calc(100vh - 46px) !important;
    }
}

/* -----------------------------------------------------------------------
   Avatar con iniciales
   ----------------------------------------------------------------------- */
.dh-avatar-initial {
    border-radius:   50%;
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    color:           #fff;
    font-weight:     700;
    flex-shrink:     0;
    user-select:     none;
    letter-spacing:  -.5px;
}

/* -----------------------------------------------------------------------
   Equipo en el header
   ----------------------------------------------------------------------- */
.dh-team-avatars {
    display:     flex;
    align-items: center;
    gap:         -6px; /* avatares ligeramente solapados */
    margin-right: 8px;
}
.dh-team-avatars .dh-avatar {
    border:     2px solid var(--dh-surface);
    margin-left: -6px;
    transition: transform .15s;
}
.dh-team-avatars .dh-avatar:first-child { margin-left: 0; }
.dh-team-avatars .dh-avatar:hover { transform: translateY(-2px); z-index: 1; }

.dh-current-user-self {
    border-left:  1px solid var(--dh-border);
    padding-left: 10px;
    margin-left:  4px;
}

/* -----------------------------------------------------------------------
   Lightbox
   ----------------------------------------------------------------------- */
.dh-lightbox {
    position:        fixed;
    inset:           0;
    background:      rgba(0,0,0,.92);
    z-index:         20000;
    display:         flex;
    align-items:     center;
    justify-content: center;
    cursor:          zoom-out;
    padding:         20px;
}
.dh-lightbox-inner {
    max-width:  95vw;
    max-height: 95vh;
    cursor:     default;
}
.dh-lightbox-inner img {
    max-width:   100%;
    max-height:  95vh;
    object-fit:  contain;
    border-radius: var(--dh-radius);
    display:     block;
}
.dh-lightbox-close {
    position:      fixed;
    top:           16px;
    right:         16px;
    background:    rgba(255,255,255,.1);
    border:        1px solid rgba(255,255,255,.2);
    color:         #fff;
    font-size:     18px;
    cursor:        pointer;
    width:         36px;
    height:        36px;
    border-radius: 50%;
    display:       flex;
    align-items:   center;
    justify-content: center;
    transition:    background .15s;
    line-height:   1;
}
.dh-lightbox-close:hover { background: rgba(255,255,255,.2); }

/* -----------------------------------------------------------------------
   Botón expandir en preview de imagen
   ----------------------------------------------------------------------- */
.dh-preview-expand-btn {
    position:        absolute;
    top:             8px;
    right:           8px;
    width:           30px;
    height:          30px;
    background:      rgba(0,0,0,.5);
    border:          none;
    border-radius:   var(--dh-radius-sm);
    cursor:          pointer;
    display:         flex;
    align-items:     center;
    justify-content: center;
    opacity:         0;
    transition:      opacity .15s, background .15s;
    z-index:         5;
}
.dh-preview-wrap:hover .dh-preview-expand-btn { opacity: 1; }
.dh-preview-expand-btn:hover { background: rgba(0,0,0,.75); }

/* Miniatura de PDF en el panel */
.dh-pdf-thumb-preview {
    width:         100%;
    max-height:    200px;
    object-fit:    contain;
    border-radius: var(--dh-radius-sm);
    margin-bottom: 8px;
    display:       block;
}

/* -----------------------------------------------------------------------
   Selector de versiones en el panel
   ----------------------------------------------------------------------- */
.dh-version-row {
    display:     flex;
    align-items: center;
    gap:         8px;
    padding-top: 10px;
    flex-wrap:   wrap;
}
.dh-version-select {
    flex:      1;
    min-width: 0;
    font-size: 12px;
    padding:   4px 8px;
}

/* -----------------------------------------------------------------------
   Efecto de tarjetas apiladas en el tablón (propuestas con múltiples versiones)
   z-index: -1 funciona porque .dh-column-cards tiene isolation: isolate,
   lo que crea un stacking context propio. Sin él, los pseudo-elementos caerían
   detrás del fondo del .dh-column y serían invisibles.
   ----------------------------------------------------------------------- */
.dh-card.dh-has-versions::before,
.dh-card.dh-has-versions::after {
    content:       '';
    position:      absolute;
    left:          0;
    right:         0;
    background:    var(--dh-surface);
    border:        1px solid var(--dh-border);
    border-radius: var(--dh-radius);
}
.dh-card.dh-has-versions::before {
    top:     5px;
    bottom:  -5px;
    z-index: -1;
}
.dh-card.dh-has-versions::after {
    top:     9px;
    bottom:  -9px;
    z-index: -2;
    opacity: .45;
}

/* -----------------------------------------------------------------------
   Eliminar propuesta
   ----------------------------------------------------------------------- */
/* Botón en el header del panel */
.dh-btn-danger-ghost {
    color:        var(--dh-danger);
    border-color: transparent;
}
.dh-btn-danger-ghost:hover { background: #fef2f2; border-color: var(--dh-danger); }

/* Botón en la tarjeta del tablón */
.dh-card-delete {
    position:      absolute;
    top:           6px;
    right:         6px;
    width:         22px;
    height:        22px;
    background:    rgba(220,38,38,.85);
    border:        none;
    border-radius: 50%;
    color:         #fff;
    font-size:     11px;
    cursor:        pointer;
    display:       flex;
    align-items:   center;
    justify-content: center;
    opacity:       0;
    transition:    opacity .15s;
    z-index:       2;
    line-height:   1;
    padding:       0;
}
.dh-card:hover .dh-card-delete { opacity: 1; }
.dh-card { position: relative; } /* necesario para el absolute del delete */

/* -----------------------------------------------------------------------
   Badge de versión en tarjeta
   ----------------------------------------------------------------------- */
.dh-version-badge {
    font-size:     10px;
    font-weight:   600;
    color:         var(--dh-accent);
    background:    rgba(37,99,235,.1);
    border-radius: 999px;
    padding:       1px 6px;
    flex-shrink:   0;
}
