/* =============================================================================
   DETALLE DE CLASE (/clases/detalle)
   Cabecera oscura compacta con la clase y el progreso de confirmaciones,
   tarjetas de estado que además filtran la lista, pestañas del sistema y un
   panel por pestaña. Los diálogos (mensaje a un alumno, recordatorio a los
   pendientes) reutilizan .sb-dialog-*.
   ============================================================================= */

.hcd {
    display: flex;
    flex-direction: column;
    gap: var(--sb-space-4);
}

.hcd-loading,
.hcd-alert {
    padding: var(--sb-space-5) var(--sb-space-6);
    border-radius: var(--sb-radius-xl);
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    color: var(--sb-text-muted);
    font-weight: var(--sb-weight-semibold);
}

.hcd-alert--error {
    background: var(--sb-danger-surface);
    border-color: var(--sb-danger-border);
    color: var(--sb-danger-text);
}

.hcd-alert--warning {
    background: var(--sb-warning-surface);
    border-color: var(--sb-warning-border);
    color: var(--sb-warning-text);
}

/* ------------------------------------------------------------- Cabecera --- */
.hcd-hero {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--sb-space-6);
    padding: var(--sb-space-5) var(--sb-space-6);
    border-radius: 18px;
    background: linear-gradient(135deg, var(--sb-neutral-900) 0%, var(--sb-neutral-800) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--sb-text-on-inverse);
    box-shadow: var(--sb-shadow-md);
}

.hcd-hero::after {
    content: "";
    position: absolute;
    top: -50%;
    right: -10%;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(200, 40, 0, 0.22) 0%, transparent 70%);
    pointer-events: none;
}

.hcd-hero-main,
.hcd-hero-side {
    position: relative;
    z-index: var(--sb-z-raised);
    min-width: 0;
}

.hcd-hero-main {
    display: flex;
    flex-direction: column;
    gap: var(--sb-space-2);
}

.hcd-back {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: var(--sb-space-2);
    padding: 6px 12px 6px 10px;
    border-radius: var(--sb-radius-full);
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: var(--sb-text-on-inverse);
    font-family: inherit;
    font-size: var(--sb-text-sm);
    font-weight: var(--sb-weight-bold);
    cursor: pointer;
    transition: background var(--sb-duration-fast) var(--sb-ease);
}

.hcd-back:hover {
    background: rgba(255, 255, 255, 0.2);
}

.hcd-hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sb-space-2);
    margin-top: var(--sb-space-1);
}

.hcd-hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--sb-radius-full);
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.88);
    font-size: var(--sb-text-xs);
    font-weight: var(--sb-weight-bold);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.hcd-hero-pill i {
    color: var(--sb-brand-accent);
}

.hcd-hero-title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: var(--sb-weight-black);
    letter-spacing: -0.02em;
    line-height: var(--sb-leading-tight);
    color: var(--sb-text-on-inverse);
}

.hcd-hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sb-space-2) var(--sb-space-4);
    margin: 0;
    padding: 0;
    list-style: none;
}

.hcd-hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: var(--sb-text-md);
    color: rgba(255, 255, 255, 0.75);
}

.hcd-hero-tag i {
    width: 16px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
}

.hcd-hero-tag strong {
    color: var(--sb-text-on-inverse);
    font-weight: var(--sb-weight-bold);
}

/* Progreso de confirmaciones, a la derecha de la cabecera. */
.hcd-hero-side {
    display: flex;
    flex-direction: column;
    gap: var(--sb-space-3);
    min-width: 260px;
    padding: var(--sb-space-4) var(--sb-space-5);
    border-radius: var(--sb-radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
}

.hcd-progress-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--sb-space-3);
}

.hcd-progress-label {
    font-size: var(--sb-text-xs);
    font-weight: var(--sb-weight-bold);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
}

.hcd-progress-value {
    font-size: var(--sb-text-3xl);
    font-weight: var(--sb-weight-black);
    line-height: 1;
    color: var(--sb-text-on-inverse);
}

.hcd-progress-value small {
    font-size: var(--sb-text-md);
    font-weight: var(--sb-weight-semibold);
    color: rgba(255, 255, 255, 0.6);
}

.hcd-progress-bar {
    height: 8px;
    border-radius: var(--sb-radius-full);
    background: rgba(255, 255, 255, 0.14);
    overflow: hidden;
}

.hcd-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--sb-green-500), var(--sb-green-200));
    transition: width var(--sb-duration-slow) var(--sb-ease);
}

.hcd-progress-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sb-space-2) var(--sb-space-4);
    font-size: var(--sb-text-sm);
    color: rgba(255, 255, 255, 0.75);
}

.hcd-progress-legend strong {
    color: var(--sb-text-on-inverse);
}

.hcd-hero-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sb-space-2);
    min-height: var(--sb-control-height);
    padding: 9px 14px;
    border-radius: var(--sb-radius-md);
    border: 1px solid var(--sb-amber-500);
    background: var(--sb-amber-500);
    color: var(--sb-neutral-900);
    font-family: inherit;
    font-size: var(--sb-text-md);
    font-weight: var(--sb-weight-black);
    cursor: pointer;
    transition: filter var(--sb-duration-fast) var(--sb-ease), transform var(--sb-duration-fast) var(--sb-ease);
}

.hcd-hero-cta:hover:not(:disabled) {
    filter: brightness(1.06);
    transform: translateY(-1px);
}

.hcd-hero-cta:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* --------------------------------------------- Tarjetas de estado (filtran) --- */
.hcd-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--sb-space-3);
}

.hcd-stat {
    --stat-color: var(--sb-neutral-700);
    --stat-surface: var(--sb-surface);
    --stat-soft: var(--sb-surface-muted);
    display: flex;
    flex-direction: column;
    gap: var(--sb-space-2);
    padding: var(--sb-space-3);
    border-radius: var(--sb-radius-xl);
    border: 1px solid var(--sb-border);
    background: var(--sb-surface);
    box-shadow: var(--sb-shadow-xs);
    transition: border-color var(--sb-duration-fast) var(--sb-ease), box-shadow var(--sb-duration-fast) var(--sb-ease), transform var(--sb-duration-fast) var(--sb-ease);
}

.hcd-stat:hover {
    border-color: var(--stat-color);
    transform: translateY(-1px);
    box-shadow: var(--sb-shadow-md);
}

.hcd-stat.is-active {
    border-color: var(--stat-color);
    background: color-mix(in srgb, var(--stat-color) 6%, var(--sb-surface));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--stat-color) 18%, transparent);
}

.hcd-stat--confirmados { --stat-color: var(--sb-green-600); --stat-soft: var(--sb-green-50); }
.hcd-stat--pendientes  { --stat-color: var(--sb-amber-600); --stat-soft: var(--sb-amber-50); }
.hcd-stat--noasiste    { --stat-color: var(--sb-red-600);   --stat-soft: var(--sb-red-50); }
.hcd-stat--total       { --stat-color: var(--sb-neutral-600); --stat-soft: var(--sb-neutral-100); }

.hcd-stat-main {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: var(--sb-space-3);
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.hcd-stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--sb-radius-lg);
    background: var(--stat-soft);
    color: var(--stat-color);
    font-size: 1rem;
}

.hcd-stat-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.hcd-stat-label {
    font-size: var(--sb-text-sm);
    font-weight: var(--sb-weight-bold);
    color: var(--sb-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hcd-stat-value {
    font-size: var(--sb-text-2xl);
    font-weight: var(--sb-weight-black);
    line-height: 1;
    color: var(--sb-text);
}

.hcd-stat-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--sb-text-on-brand);
    background: var(--stat-color);
    opacity: 0;
    transform: scale(0.6);
    transition: opacity var(--sb-duration-fast) var(--sb-ease), transform var(--sb-duration-fast) var(--sb-ease);
}

.hcd-stat.is-active .hcd-stat-check {
    opacity: 1;
    transform: scale(1);
}

.hcd-stat-roles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sb-space-2);
    padding-top: var(--sb-space-2);
    border-top: 1px dashed var(--sb-border);
}

.hcd-role-chip {
    --role-color: var(--sb-neutral-600);
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 5px 9px;
    border-radius: var(--sb-radius-sm);
    border: 1px solid transparent;
    background: color-mix(in srgb, var(--role-color) 9%, var(--sb-surface));
    color: var(--role-color);
    font-family: inherit;
    font-size: var(--sb-text-xs);
    font-weight: var(--sb-weight-bold);
    cursor: pointer;
    transition: border-color var(--sb-duration-fast) var(--sb-ease), background var(--sb-duration-fast) var(--sb-ease);
}

.hcd-role-chip strong {
    font-size: var(--sb-text-md);
    font-weight: var(--sb-weight-black);
}

.hcd-role-chip:hover,
.hcd-role-chip.is-active {
    border-color: var(--role-color);
}

.hcd-role-chip.is-active {
    background: var(--role-color);
    color: var(--sb-text-on-brand);
}

.hcd-role-chip--lider    { --role-color: var(--sb-role-leader); }
.hcd-role-chip--follower { --role-color: var(--sb-role-follower); }

/* ------------------------------------------------------------- Pestañas --- */
.hcd-tabs {
    margin-bottom: 0;
    width: 100%;
    display: flex;
}

.hcd-tabs .sb-tab {
    flex: 1 1 0;
    justify-content: center;
}

.hcd-tabs .sb-seg-count {
    background: var(--sb-surface-muted);
    color: var(--sb-text-muted);
}

.hcd-tabs .sb-tab.is-active .sb-seg-count {
    background: var(--sb-brand);
    color: var(--sb-text-on-brand);
}

/* ---------------------------------------------------------------- Panel --- */
.hcd-panel {
    display: flex;
    flex-direction: column;
    gap: var(--sb-space-4);
    padding: var(--sb-space-5);
    border-radius: var(--sb-radius-xl);
    border: 1px solid var(--sb-border);
    background: var(--sb-surface);
    box-shadow: var(--sb-shadow-sm);
}

.hcd-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sb-space-4);
    flex-wrap: wrap;
}

.hcd-panel-head h2 {
    margin: 0;
    font-size: var(--sb-text-xl);
    font-weight: var(--sb-weight-black);
    color: var(--sb-text);
    letter-spacing: -0.01em;
}

.hcd-panel-head p {
    margin: 4px 0 0;
    font-size: var(--sb-text-md);
    color: var(--sb-text-muted);
}

.hcd-panel-tools {
    display: flex;
    align-items: center;
    gap: var(--sb-space-2);
    flex-wrap: wrap;
}

.hcd-search {
    display: inline-flex;
    align-items: center;
    gap: var(--sb-space-2);
    min-width: 260px;
    min-height: var(--sb-control-height);
    padding: 0 var(--sb-space-3);
    border-radius: var(--sb-radius-md);
    border: 1px solid var(--sb-border);
    background: var(--sb-surface-subtle);
    color: var(--sb-text-subtle);
    transition: border-color var(--sb-duration-fast) var(--sb-ease), box-shadow var(--sb-duration-fast) var(--sb-ease);
}

.hcd-search:focus-within {
    border-color: var(--sb-brand);
    background: var(--sb-surface);
    box-shadow: 0 0 0 3px rgba(200, 40, 0, 0.12);
}

.hcd-search input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    outline: none;
    font-family: inherit;
    font-size: var(--sb-text-base);
    color: var(--sb-text);
}

.hcd-search input::placeholder {
    color: var(--sb-text-subtle);
}

.hcd-list-summary {
    display: flex;
    align-items: center;
    gap: var(--sb-space-2);
    font-size: var(--sb-text-sm);
    color: var(--sb-text-muted);
}

.hcd-list-summary .sb-badge {
    text-transform: none;
}

.hcd-warning {
    display: flex;
    align-items: flex-start;
    gap: var(--sb-space-2);
    padding: var(--sb-space-3) var(--sb-space-4);
    border-radius: var(--sb-radius-lg);
    background: var(--sb-warning-surface);
    border: 1px solid var(--sb-warning-border);
    color: var(--sb-warning-text);
    font-size: var(--sb-text-md);
    font-weight: var(--sb-weight-semibold);
}

/* -------------------------------------------------------------- Alumnos --- */
.hcd-students {
    display: flex;
    flex-direction: column;
    gap: var(--sb-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.hcd-student {
    --row-accent: var(--sb-neutral-300);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--sb-space-4);
    padding: var(--sb-space-3) var(--sb-space-4);
    border-radius: var(--sb-radius-lg);
    border: 1px solid var(--sb-border);
    border-left: 4px solid var(--row-accent);
    background: var(--sb-surface);
    transition: background var(--sb-duration-fast) var(--sb-ease), border-color var(--sb-duration-fast) var(--sb-ease);
}

.hcd-student:hover {
    background: var(--sb-surface-subtle);
}

.hcd-student.is-asiste    { --row-accent: var(--sb-green-500); }
.hcd-student.is-pendiente { --row-accent: var(--sb-amber-500); }
.hcd-student.is-noasiste  { --row-accent: var(--sb-red-500); }

.hcd-avatar {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--sb-border);
    background: var(--sb-surface-muted);
    color: var(--sb-text-strong);
    font-family: inherit;
    font-size: var(--sb-text-md);
    font-weight: var(--sb-weight-black);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    overflow: hidden;
}

.hcd-avatar--photo {
    cursor: zoom-in;
}

.hcd-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hcd-avatar--sm {
    width: 36px;
    height: 36px;
    font-size: var(--sb-text-sm);
}

.hcd-student-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.hcd-student-name {
    font-size: var(--sb-text-base);
    font-weight: var(--sb-weight-black);
    color: var(--sb-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hcd-student-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.hcd-role {
    --role-color: var(--sb-neutral-600);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: var(--sb-radius-full);
    background: color-mix(in srgb, var(--role-color) 10%, var(--sb-surface));
    color: var(--role-color);
    font-size: var(--sb-text-xs);
    font-weight: var(--sb-weight-bold);
}

.hcd-role--lider    { --role-color: var(--sb-role-leader); }
.hcd-role--follower { --role-color: var(--sb-role-follower); }

.hcd-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: var(--sb-radius-full);
    font-size: var(--sb-text-xs);
    font-weight: var(--sb-weight-bold);
    background: var(--sb-surface-muted);
    color: var(--sb-text-muted);
}

.hcd-status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.hcd-status--asiste    { background: var(--sb-success-surface); color: var(--sb-success-text); }
.hcd-status--pendiente { background: var(--sb-warning-surface); color: var(--sb-warning-text); }
.hcd-status--noasiste  { background: var(--sb-danger-surface);  color: var(--sb-danger-text); }

.hcd-student-checkin {
    font-size: var(--sb-text-xs);
    color: var(--sb-text-subtle);
}

.hcd-student-actions {
    display: flex;
    align-items: center;
    gap: var(--sb-space-2);
    flex-wrap: nowrap;
}

/* Conmutador Asiste / No asiste. */
.hcd-toggle {
    display: inline-flex;
    padding: 3px;
    border-radius: var(--sb-radius-md);
    background: var(--sb-surface-muted);
    border: 1px solid var(--sb-border);
}

.hcd-toggle-btn {
    --toggle-color: var(--sb-neutral-700);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 12px;
    border: 0;
    border-radius: calc(var(--sb-radius-md) - 3px);
    background: transparent;
    color: var(--sb-text-muted);
    font-family: inherit;
    font-size: var(--sb-text-sm);
    font-weight: var(--sb-weight-bold);
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--sb-duration-fast) var(--sb-ease), color var(--sb-duration-fast) var(--sb-ease);
}

.hcd-toggle-btn:hover:not(:disabled) {
    color: var(--toggle-color);
}

.hcd-toggle-btn.is-active {
    background: var(--toggle-color);
    color: var(--sb-text-on-brand);
    box-shadow: var(--sb-shadow-sm);
}

.hcd-toggle-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}

.hcd-toggle-btn--yes { --toggle-color: var(--sb-green-600); }
.hcd-toggle-btn--no  { --toggle-color: var(--sb-red-600); }

.hcd-msg-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: var(--sb-control-height);
    padding: 0 14px;
    border-radius: var(--sb-radius-md);
    border: 1px solid var(--sb-info-border);
    background: var(--sb-info-surface);
    color: var(--sb-info-text);
    font-family: inherit;
    font-size: var(--sb-text-sm);
    font-weight: var(--sb-weight-bold);
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--sb-duration-fast) var(--sb-ease), color var(--sb-duration-fast) var(--sb-ease), border-color var(--sb-duration-fast) var(--sb-ease);
}

.hcd-msg-btn:hover {
    background: var(--sb-info);
    border-color: var(--sb-info);
    color: var(--sb-text-on-brand);
}

.hcd-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sb-space-2);
    padding: var(--sb-space-8) var(--sb-space-4);
    border-radius: var(--sb-radius-xl);
    border: 1px dashed var(--sb-border-strong);
    background: var(--sb-surface-subtle);
    text-align: center;
    color: var(--sb-text-muted);
}

.hcd-empty i {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--sb-radius-xl);
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    color: var(--sb-text-subtle);
    font-size: 1.3rem;
}

.hcd-empty strong {
    color: var(--sb-text-strong);
}

.hcd-empty p {
    margin: 0;
    font-size: var(--sb-text-md);
}

/* ----------------------------------------------------------- Formularios --- */
.hcd-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sb-space-4);
}

.hcd-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.hcd-field--full {
    grid-column: 1 / -1;
}

.hcd-field label {
    font-size: var(--sb-text-sm);
    font-weight: var(--sb-weight-bold);
    color: var(--sb-text-strong);
}

.hcd-field-hint {
    display: flex;
    justify-content: space-between;
    gap: var(--sb-space-2);
    font-size: var(--sb-text-xs);
    color: var(--sb-text-subtle);
}

.hcd-actions {
    display: flex;
    align-items: center;
    gap: var(--sb-space-2);
    flex-wrap: wrap;
}

.hcd-actions--end {
    justify-content: flex-end;
}

.hcd-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sb-space-2);
}

.hcd-link-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--sb-radius-full);
    border: 1px solid var(--sb-brand-border);
    background: var(--sb-brand-surface);
    color: var(--sb-brand);
    font-size: var(--sb-text-sm);
    font-weight: var(--sb-weight-bold);
    text-decoration: none;
    transition: background var(--sb-duration-fast) var(--sb-ease), color var(--sb-duration-fast) var(--sb-ease);
}

.hcd-link-chip:hover {
    background: var(--sb-brand);
    color: var(--sb-text-on-brand);
}

/* ---------------------------------------------------------- Comentarios --- */
.hcd-composer {
    display: flex;
    flex-direction: column;
    gap: var(--sb-space-3);
    padding: var(--sb-space-4);
    border-radius: var(--sb-radius-lg);
    border: 1px solid var(--sb-border);
    background: var(--sb-surface-subtle);
}

.hcd-comments {
    display: flex;
    flex-direction: column;
    gap: var(--sb-space-3);
}

.hcd-comment {
    display: flex;
    flex-direction: column;
    gap: var(--sb-space-3);
    padding: var(--sb-space-4);
    border-radius: var(--sb-radius-lg);
    border: 1px solid var(--sb-border);
    background: var(--sb-surface);
}

.hcd-comment-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sb-space-3);
    flex-wrap: wrap;
}

.hcd-author {
    display: flex;
    align-items: center;
    gap: var(--sb-space-3);
    min-width: 0;
}

.hcd-author-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.hcd-author-name {
    font-weight: var(--sb-weight-black);
    color: var(--sb-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hcd-author-date {
    font-size: var(--sb-text-xs);
    color: var(--sb-text-subtle);
}

.hcd-comment-text {
    margin: 0;
    color: var(--sb-text-strong);
    line-height: var(--sb-leading-relaxed);
    white-space: pre-wrap;
}

.hcd-comment-actions {
    display: flex;
    align-items: center;
    gap: var(--sb-space-2);
}

/* ------------------------------------------------------------ Valoración --- */
.hcd-rating-grid {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: var(--sb-space-4);
}

.hcd-rating-summary {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--sb-space-2);
    padding: var(--sb-space-5);
    border-radius: var(--sb-radius-xl);
    background: linear-gradient(135deg, var(--sb-neutral-900), var(--sb-neutral-800));
    color: var(--sb-text-on-inverse);
}

.hcd-rating-summary-label {
    font-size: var(--sb-text-xs);
    font-weight: var(--sb-weight-bold);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
}

.hcd-rating-summary-value {
    font-size: 3rem;
    font-weight: var(--sb-weight-black);
    line-height: 1;
    letter-spacing: -0.03em;
}

.hcd-rating-summary-caption {
    font-size: var(--sb-text-sm);
    color: rgba(255, 255, 255, 0.7);
}

.hcd-rating-mine {
    display: flex;
    flex-direction: column;
    gap: var(--sb-space-3);
    padding: var(--sb-space-5);
    border-radius: var(--sb-radius-xl);
    border: 1px solid var(--sb-border);
    background: var(--sb-surface-subtle);
}

.hcd-rating-mine-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sb-space-3);
    flex-wrap: wrap;
}

.hcd-rating-mine h3 {
    margin: 0;
    font-size: var(--sb-text-lg);
    font-weight: var(--sb-weight-black);
    color: var(--sb-text);
}

.hcd-rating-mine p {
    margin: 4px 0 0;
    font-size: var(--sb-text-sm);
    color: var(--sb-text-muted);
}

.hcd-stars {
    display: flex;
    align-items: center;
    gap: var(--sb-space-2);
}

.hcd-star {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--sb-radius-lg);
    border: 1px solid var(--sb-border);
    background: var(--sb-surface);
    color: var(--sb-neutral-300);
    font-size: 1.25rem;
    cursor: pointer;
    transition: transform var(--sb-duration-fast) var(--sb-ease), color var(--sb-duration-fast) var(--sb-ease), border-color var(--sb-duration-fast) var(--sb-ease);
}

.hcd-star:hover {
    transform: translateY(-2px);
    border-color: var(--sb-gold);
}

.hcd-star.is-active {
    color: var(--sb-gold);
    border-color: var(--sb-gold);
    background: color-mix(in srgb, var(--sb-gold) 12%, var(--sb-surface));
}

.hcd-stars-static {
    display: inline-flex;
    gap: 3px;
    color: var(--sb-neutral-300);
    font-size: var(--sb-text-md);
}

.hcd-stars-static .is-active {
    color: var(--sb-gold);
}

.hcd-rating-dist {
    display: flex;
    flex-direction: column;
    gap: var(--sb-space-2);
}

.hcd-dist-row {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr) 32px;
    align-items: center;
    gap: var(--sb-space-3);
    font-size: var(--sb-text-sm);
    font-weight: var(--sb-weight-bold);
    color: var(--sb-text-muted);
}

.hcd-dist-row strong {
    text-align: right;
    color: var(--sb-text);
}

.hcd-dist-bar {
    height: 10px;
    border-radius: var(--sb-radius-full);
    background: var(--sb-surface-muted);
    overflow: hidden;
}

.hcd-dist-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--sb-gold-strong), var(--sb-gold));
    transition: width var(--sb-duration-slow) var(--sb-ease);
}

.hcd-ratings {
    display: flex;
    flex-direction: column;
    gap: var(--sb-space-2);
}

.hcd-rating-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sb-space-3);
    padding: var(--sb-space-3) var(--sb-space-4);
    border-radius: var(--sb-radius-lg);
    border: 1px solid var(--sb-border);
    background: var(--sb-surface);
    flex-wrap: wrap;
}

.hcd-rating-item-side {
    display: flex;
    align-items: center;
    gap: var(--sb-space-3);
}

.hcd-subhead {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hcd-subhead h3 {
    margin: 0;
    font-size: var(--sb-text-lg);
    font-weight: var(--sb-weight-black);
    color: var(--sb-text);
}

.hcd-subhead p {
    margin: 0;
    font-size: var(--sb-text-sm);
    color: var(--sb-text-muted);
}

/* -------------------------------------------------------------- Diálogos --- */
/* Por debajo de los avisos flotantes: si el envío falla, el toast se ve
   encima del diálogo abierto. */
.hcd-overlay {
    z-index: var(--sb-z-modal);
}

.hcd-dialog {
    width: 100%;
    max-width: 580px;
}

.hcd-dialog-body {
    display: flex;
    flex-direction: column;
    gap: var(--sb-space-4);
}

.hcd-dialog-who {
    display: flex;
    align-items: center;
    gap: var(--sb-space-3);
    padding: var(--sb-space-3);
    border-radius: var(--sb-radius-lg);
    background: var(--sb-surface-subtle);
    border: 1px solid var(--sb-border);
}

.hcd-dialog-who-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.hcd-dialog-who-name {
    font-weight: var(--sb-weight-black);
    color: var(--sb-text);
}

.hcd-dialog-who-context {
    font-size: var(--sb-text-sm);
    color: var(--sb-text-muted);
}

.hcd-channels {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sb-space-3);
    margin: 0;
    padding: 0;
    border: 0;
}

.hcd-channels legend {
    padding: 0;
    margin-bottom: var(--sb-space-2);
    font-size: var(--sb-text-sm);
    font-weight: var(--sb-weight-bold);
    color: var(--sb-text-strong);
}

.hcd-channel {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: center;
    gap: var(--sb-space-3);
    padding: var(--sb-space-3);
    border-radius: var(--sb-radius-lg);
    border: 1px solid var(--sb-border);
    background: var(--sb-surface);
    cursor: pointer;
    transition: border-color var(--sb-duration-fast) var(--sb-ease), background var(--sb-duration-fast) var(--sb-ease);
}

.hcd-channel:hover {
    border-color: var(--sb-border-strong);
}

.hcd-channel.is-on {
    border-color: var(--sb-brand);
    background: var(--sb-brand-surface);
}

.hcd-channel input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--sb-brand);
    cursor: pointer;
}

.hcd-channel-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--sb-radius-md);
    background: var(--sb-surface-muted);
    color: var(--sb-text-muted);
}

.hcd-channel.is-on .hcd-channel-icon {
    background: var(--sb-brand);
    color: var(--sb-text-on-brand);
}

.hcd-channel-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.hcd-channel-copy strong {
    font-size: var(--sb-text-md);
    color: var(--sb-text);
}

.hcd-channel-copy small {
    font-size: var(--sb-text-xs);
    color: var(--sb-text-muted);
    line-height: 1.3;
}

.hcd-channel-copy small.is-ok {
    color: var(--sb-success-text);
}

.hcd-channel-copy small.is-warn {
    color: var(--sb-warning-text);
}

.hcd-recipients {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 120px;
    overflow-y: auto;
    padding: var(--sb-space-2);
    border-radius: var(--sb-radius-md);
    background: var(--sb-surface-subtle);
    border: 1px solid var(--sb-border);
}

/* ------------------------------------------------------------ Responsive --- */
@media (max-width: 1080px) {
    .hcd-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .hcd-hero {
        grid-template-columns: 1fr;
    }

    .hcd-hero-side {
        min-width: 0;
    }

    .hcd-tabs {
        overflow-x: auto;
    }

    .hcd-tabs .sb-tab {
        flex: 0 0 auto;
    }

    .hcd-rating-grid,
    .hcd-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .hcd-hero {
        padding: var(--sb-space-4);
    }

    .hcd-hero-title {
        font-size: 1.4rem;
    }

    .hcd-panel {
        padding: var(--sb-space-4);
    }

    .hcd-panel-tools,
    .hcd-search {
        width: 100%;
        min-width: 0;
    }

    .hcd-student {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .hcd-student-actions {
        grid-column: 1 / -1;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .hcd-toggle {
        flex: 1 1 auto;
    }

    .hcd-toggle-btn {
        flex: 1 1 0;
        justify-content: center;
    }

    .hcd-msg-btn {
        flex: 1 1 auto;
        justify-content: center;
    }

    .hcd-stats {
        grid-template-columns: 1fr;
    }

    .hcd-channels {
        grid-template-columns: 1fr;
    }

    .hcd-dist-row {
        grid-template-columns: 76px minmax(0, 1fr) 28px;
    }

    .hcd-actions .sb-btn {
        flex: 1 1 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hcd-stat,
    .hcd-stat-check,
    .hcd-star,
    .hcd-hero-cta,
    .hcd-progress-fill,
    .hcd-dist-fill {
        transition: none;
    }
}
