* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f0f;
    color: #e0e0e0;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 600px;
    margin: 0 auto;
}

.container-wide {
    max-width: 1100px;
    margin: 0 auto;
}

.container-xwide {
    max-width: 1500px;
    margin: 0 auto;
}

/* --- Header --- */

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #2a2a2a;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 5px;
}

.fecha {
    color: #888;
    font-size: 0.95rem;
}

.volver {
    display: inline-block;
    color: #888;
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 15px;
    transition: color 0.2s;
}

.volver:hover {
    color: #fff;
}

h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

/* --- Index: Grid de usuarios --- */

.usuarios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 30px;
}

.usuario-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: #1a1a1a;
    border: 2px solid #2a2a2a;
    border-radius: 14px;
    padding: 24px 16px;
    text-decoration: none;
    color: #e0e0e0;
    transition: all 0.25s ease;
}

.usuario-btn:hover {
    border-color: var(--color);
    background: #1e1e1e;
    transform: translateY(-2px);
}

.avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
}

.nombre {
    font-size: 1rem;
    font-weight: 500;
}

.seccion-admin {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #2a2a2a;
}

.btn-admin {
    display: inline-block;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #ccc;
    padding: 12px 28px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.btn-admin:hover {
    background: #222;
    border-color: #555;
    color: #fff;
}

/* --- Usuario header --- */

.usuario-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}

.avatar-grande {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.usuario-header h1 {
    text-align: left;
    margin-bottom: 0;
}

.usuario-header .fecha {
    text-align: left;
}

/* --- Tareas (check diario) --- */

.tarea {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.tarea:hover {
    border-color: #3a3a3a;
}

.tarea.completada {
    opacity: 0.5;
    border-color: #1a3a1a;
}

.tarea.completada .texto {
    text-decoration: line-through;
    color: #666;
}

.tarea label {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 12px;
}

.tarea input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 2px solid #444;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.tarea input[type="checkbox"]:checked + .checkmark {
    background: var(--color, #22c55e);
    border-color: var(--color, #22c55e);
}

.tarea input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.texto {
    font-size: 1rem;
    line-height: 1.4;
}

.sin-tareas {
    color: #666;
    text-align: center;
    padding: 30px 0;
    font-style: italic;
}

/* --- Progreso --- */

.progreso {
    margin-top: 20px;
    padding: 15px 0;
}

.barra {
    height: 8px;
    background: #2a2a2a;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.barra-relleno {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #4ade80);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.progreso-texto {
    font-size: 0.85rem;
    color: #888;
}

/* --- Pendientes --- */

.tareas-pendientes {
    margin-top: 35px;
    padding-top: 25px;
    border-top: 1px solid #2a2a2a;
}

.tareas-pendientes h2 {
    color: #ef4444;
}

.grupo-pendiente {
    margin-bottom: 20px;
}

.grupo-pendiente h3 {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 10px;
    font-weight: 400;
}

.tarea.pendiente {
    border-color: #3a1a1a;
    transition: opacity 0.3s ease;
}

.tarea.pendiente .checkmark {
    border-color: #ef4444;
}

/* --- Tareas admin (gestión) --- */

.tabs-usuarios {
    display: flex;
    gap: 6px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.tab {
    padding: 8px 16px;
    border-radius: 8px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    color: #888;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.tab:hover {
    border-color: var(--color);
    color: #ddd;
}

.tab.activo {
    background: var(--color);
    border-color: var(--color);
    color: #fff;
    font-weight: 600;
}

.lista-tareas-admin {
    margin-bottom: 0;
}

/* Grid de paneles de administración (tareas.php) */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    align-items: start;
    margin-bottom: 20px;
}

.admin-grid .form-tarea,
.admin-grid .lista-tareas-admin {
    margin: 0;
}

.tarea-admin {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 6px;
    transition: opacity 0.3s ease;
}

.tarea-admin-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tarea-admin-texto {
    font-size: 1rem;
    color: #e0e0e0;
}

.tarea-admin-freq {
    font-size: 0.8rem;
    color: #666;
}

.btn-eliminar {
    background: none;
    border: 1px solid #3a1a1a;
    color: #ef4444;
    font-size: 1.3rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-eliminar:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
}

.btn-editar {
    background: none;
    border: 1px solid #2a2a2a;
    color: #9ca3af;
    font-size: 1rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-right: 4px;
}

.btn-editar:hover {
    background: #2a2a2a;
    border-color: #444;
    color: #fff;
}

.tarea-admin .prioridad-stars {
    margin-right: 8px;
}

.tarea-admin {
    gap: 4px;
}

.tarea-admin .tarea-admin-info {
    flex: 1;
    min-width: 0;
}

/* --- Formulario --- */

.form-tarea {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 14px;
    padding: 20px;
}

.form-tarea h2 {
    margin-bottom: 18px;
}

.campo {
    margin-bottom: 14px;
}

.campo label {
    display: block;
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 6px;
}

.campo input[type="text"],
.campo input[type="number"],
.campo input[type="date"],
.campo select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #333;
    border-radius: 8px;
    background: #0f0f0f;
    color: #e0e0e0;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.campo input:focus,
.campo select:focus {
    border-color: #555;
}

.btn-agregar {
    width: 100%;
    padding: 12px;
    background: #22c55e;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 5px;
}

.btn-agregar:hover {
    background: #16a34a;
}

/* --- Grid de días de la semana --- */

.dias-grid {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.dia-check {
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-bottom: 0 !important;
}

.dia-check input[type="checkbox"] {
    display: none;
}

.dia-check span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 40px;
    border: 1px solid #333;
    border-radius: 8px;
    background: #0f0f0f;
    color: #888;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    user-select: none;
}

.dia-check input[type="checkbox"]:checked + span {
    background: #22c55e;
    border-color: #22c55e;
    color: #fff;
    font-weight: 600;
}

/* --- Login --- */

.login-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 40px;
}

.login-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 15px;
}

.login-nombre {
    text-transform: none;
    letter-spacing: 0;
    color: #fff;
    font-size: 1.4rem;
    margin-bottom: 20px;
}

.login-error {
    background: #3a1a1a;
    border: 1px solid #ef4444;
    color: #ef4444;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 15px;
    width: 100%;
    max-width: 300px;
    text-align: center;
}

.login-form {
    width: 100%;
    max-width: 300px;
}

.login-form .campo input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #333;
    border-radius: 10px;
    background: #1a1a1a;
    color: #e0e0e0;
    font-size: 1rem;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

.login-form .campo input:focus {
    border-color: #555;
}

.btn-login {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-login:hover {
    opacity: 0.85;
}

/* --- Header nav (volver + logout) --- */

.header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.btn-logout {
    color: #666;
    text-decoration: none;
    font-size: 0.85rem;
    padding: 6px 12px;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-logout:hover {
    color: #ef4444;
    border-color: #ef4444;
}

/* --- Mensaje contraseña --- */

.pw-msg {
    text-align: center;
    font-size: 0.9rem;
    margin-top: 12px;
    min-height: 1.2em;
}

.pw-msg.ok {
    color: #22c55e;
}

.pw-msg.error {
    color: #ef4444;
}

/* --- Seguridad toggles --- */

.seguridad-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.seguridad-toggle {
    display: flex !important;
    cursor: pointer;
    margin-bottom: 0 !important;
}

.seguridad-toggle input[type="checkbox"] {
    display: none;
}

.seguridad-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border: 1px solid #333;
    border-radius: 8px;
    background: #0f0f0f;
    color: #666;
    font-size: 0.85rem;
    transition: all 0.2s;
    user-select: none;
}

.seguridad-toggle input[type="checkbox"]:checked + .seguridad-label {
    background: var(--color);
    border-color: var(--color);
    color: #fff;
    font-weight: 600;
}

/* --- Tareas únicas --- */

.seccion-unicas h2 {
    margin-bottom: 12px;
}

.unica-form {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.unica-form input[type="text"] {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #333;
    border-radius: 8px;
    background: #1a1a1a;
    color: #e0e0e0;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.unica-form input[type="text"]:focus {
    border-color: #555;
}

.btn-unica {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.btn-unica:hover {
    opacity: 0.85;
}

.tarea-unica {
    transition: all 0.3s ease;
}

/* --- Layout usuario.php ---
   Top: 2 columnas paralelas (Tareas del día | Tareas únicas)
   Abajo: pendientes y historial como acordeones a todo el ancho. */

.paneles-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 5px;
    margin-bottom: 20px;
    align-items: start;
}

.paneles-top + .acordeon,
.acordeon + .acordeon {
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .paneles-top {
        grid-template-columns: 1fr;
    }
}

/* --- Diario --- */

.panel-diario h2 {
    margin-bottom: 15px;
}

.diario-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.diario-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #333;
    border-radius: 8px;
    background: #1a1a1a;
    color: #e0e0e0;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}

.diario-form textarea:focus {
    border-color: #555;
}

.btn-nota {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    align-self: flex-end;
}

.btn-nota:hover {
    opacity: 0.85;
}

.diario-entradas {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 500px;
    overflow-y: auto;
}

.diario-preview {
    max-height: 300px;
}

.diario-celda {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    padding: 12px 14px;
    transition: opacity 0.3s ease;
}

.diario-celda.diario-admin {
    border-color: #4a1a1a;
    background: #1a1010;
}

.diario-celda.diario-admin .diario-texto {
    color: #b91c1c;
}

.diario-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.diario-fecha {
    font-size: 0.75rem;
    color: #555;
}

.diario-autor {
    font-size: 0.75rem;
    color: #b91c1c;
    font-weight: 600;
}

.diario-borrar {
    margin-left: auto;
    background: none;
    border: none;
    color: #444;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.diario-borrar:hover {
    color: #ef4444;
}

.diario-texto {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #ccc;
    word-break: break-word;
}

/* scrollbar diario */
.diario-entradas::-webkit-scrollbar {
    width: 4px;
}
.diario-entradas::-webkit-scrollbar-track {
    background: transparent;
}
.diario-entradas::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 2px;
}

/* --- Fecha larga en pendientes --- */

.fecha-larga {
    color: #666;
    font-size: 0.85rem;
    font-style: italic;
}

/* --- Historial de tareas realizadas --- */

.seccion-historial h2 {
    color: #22c55e;
}

#lista-historial {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 400px;
    overflow-y: auto;
}

#lista-historial::-webkit-scrollbar {
    width: 4px;
}
#lista-historial::-webkit-scrollbar-track {
    background: transparent;
}
#lista-historial::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 2px;
}

.historial-entrada {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #1a1a1a;
    border: 1px solid #1a3a1a;
    border-radius: 10px;
    padding: 12px 16px;
    transition: opacity 0.3s ease;
}

.historial-check {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 6px;
    background: var(--color, #22c55e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: #fff;
    font-weight: 700;
}

.historial-info {
    flex: 1;
    min-width: 0;
}

.historial-texto {
    font-size: 0.95rem;
    color: #ccc;
}

.historial-separador {
    color: #444;
}

.historial-fecha {
    font-size: 0.85rem;
    color: #888;
    font-style: italic;
}

.historial-tipo {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.historial-tipo-diaria {
    background: #1a2a1a;
    color: #4ade80;
    border: 1px solid #2a3a2a;
}

.historial-tipo-unica {
    background: #1a1a2a;
    color: #60a5fa;
    border: 1px solid #2a2a3a;
}

.historial-tipo-pendiente {
    background: #2a1a1a;
    color: #f87171;
    border: 1px solid #3a2a2a;
}

@media (max-width: 768px) {
    .historial-entrada {
        flex-wrap: wrap;
        gap: 8px;
    }
    .historial-info {
        flex-basis: calc(100% - 40px);
    }
    .historial-tipo {
        margin-left: 36px;
    }
}

/* ========================================================
   CUADRO: sección como caja única con lista numerada
   homogénea. Los items pierden su card individual y se
   muestran como filas de una sola lista.
   ======================================================== */

.cuadro {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 14px;
    padding: 20px 22px;
    counter-reset: cuadro-num;
}

.cuadro > h2 {
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cuadro > h3,
.cuadro .grupo-pendiente > h3 {
    font-size: 0.8rem;
    color: #888;
    margin: 14px 0 2px;
    font-weight: 500;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* --- Items: comportamiento de lista uniforme --- */
.cuadro .tarea,
.cuadro .tarea-admin,
.cuadro .diario-celda,
.cuadro .historial-entrada {
    background: transparent;
    border: none;
    border-radius: 0;
    margin: 0;
    padding: 8px 0 8px 30px;
    position: relative;
    counter-increment: cuadro-num;
    transition: opacity 0.3s ease;
}

.cuadro .tarea::before,
.cuadro .tarea-admin::before,
.cuadro .diario-celda::before,
.cuadro .historial-entrada::before {
    content: counter(cuadro-num) ".";
    position: absolute;
    left: 0;
    top: 8px;
    color: #666;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    min-width: 24px;
}

/* Separador sutil entre filas */
.cuadro .tarea + .tarea,
.cuadro .tarea-admin + .tarea-admin,
.cuadro .diario-celda + .diario-celda,
.cuadro .historial-entrada + .historial-entrada {
    border-top: 1px dashed #232323;
}

/* --- Tarea (checkbox + label) en cuadro --- */
.cuadro .tarea label {
    gap: 10px;
}

.cuadro .tarea.completada,
.cuadro .tarea.pendiente {
    border-color: transparent;
}

.cuadro .tarea .checkmark {
    width: 18px;
    height: 18px;
    min-width: 18px;
    border-width: 1.5px;
    border-radius: 4px;
}

.cuadro .tarea .texto {
    font-size: 0.95rem;
}

/* --- Diario celda en cuadro --- */
.cuadro .diario-celda {
    display: block;
}

.cuadro .diario-celda.diario-admin {
    background: transparent;
}

.cuadro .diario-celda .diario-meta {
    margin-bottom: 4px;
}

.cuadro .diario-celda .diario-texto {
    font-size: 0.9rem;
}

/* --- Historial en cuadro --- */
.cuadro .historial-entrada {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cuadro .historial-entrada .historial-check {
    width: 18px;
    height: 18px;
    min-width: 18px;
    font-size: 0.65rem;
    border-radius: 4px;
}

.cuadro .historial-texto {
    font-size: 0.9rem;
}

/* --- Tarea admin en cuadro --- */
.cuadro .tarea-admin {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cuadro .tarea-admin .tarea-admin-info {
    flex: 1;
    min-width: 0;
}

.cuadro .btn-eliminar {
    width: 26px;
    height: 26px;
    font-size: 1rem;
    flex-shrink: 0;
}

/* --- Forms dentro de cuadro --- */
.cuadro .unica-form,
.cuadro .diario-form {
    margin-bottom: 14px;
}

/* --- Scrollbox de diario / historial dentro de cuadro --- */
.cuadro .diario-entradas {
    max-height: 520px;
    overflow-y: auto;
}

.cuadro #lista-historial {
    max-height: 620px;
    overflow-y: auto;
    display: block;
}

/* --- Progreso pegado al cuadro de tareas --- */
.cuadro .progreso {
    margin-top: 14px;
    padding: 10px 0 0;
    border-top: 1px solid #2a2a2a;
}

/* --- Subgrupos (pendientes por fecha) --- */
.cuadro .grupo-pendiente {
    margin-bottom: 8px;
}

.cuadro .grupo-pendiente:first-of-type > h3 {
    margin-top: 4px;
}

/* ========================================================
   ACORDEÓN (<details><summary>) — usado en pendientes
   ======================================================== */

.acordeon > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    user-select: none;
    padding: 2px 0;
    border-bottom: none;
    transition: padding-bottom 0.15s, margin-bottom 0.15s;
}

.acordeon > summary::-webkit-details-marker {
    display: none;
}

.acordeon > summary > h2 {
    margin: 0;
    padding: 0;
    border: none;
    flex: 1;
}

.acordeon-badge {
    background: #2a1a1a;
    color: #ef4444;
    border: 1px solid #3a2a2a;
    font-size: 0.75rem;
    padding: 2px 9px;
    border-radius: 999px;
    font-weight: 600;
    line-height: 1.4;
    min-width: 24px;
    text-align: center;
}

.acordeon-icon {
    color: #888;
    font-size: 0.85rem;
    transition: transform 0.2s ease;
    display: inline-block;
}

.acordeon[open] .acordeon-icon {
    transform: rotate(90deg);
}

.acordeon[open] > summary {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #2a2a2a;
}

/* El cuadro normal añade border-bottom al h2 directo; aquí lo neutralizamos
   porque el header lo gestiona el summary. */
.acordeon > summary > h2 {
    border-bottom: none !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

/* ========================================================
   Pendiente: layout en cuadro con botón eliminar a la derecha
   ======================================================== */

.cuadro .tarea.pendiente {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cuadro .tarea.pendiente label {
    flex: 1;
    min-width: 0;
}

.cuadro .btn-eliminar-pendiente {
    width: 24px;
    height: 24px;
    font-size: 1rem;
    flex-shrink: 0;
    opacity: 0.55;
    transition: opacity 0.2s, background 0.2s, color 0.2s;
}

.cuadro .tarea.pendiente:hover .btn-eliminar-pendiente,
.cuadro .btn-eliminar-pendiente:focus {
    opacity: 1;
}

/* ========================================================
   Botón + dentro del h2 de un cuadro (para abrir dialog)
   ======================================================== */

.btn-h2-add {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s, transform 0.15s;
    line-height: 1;
    padding: 0;
}

.btn-h2-add:hover {
    opacity: 0.85;
    transform: scale(1.05);
}

/* h2 que contiene el botón usa flex normal (ya está en .cuadro > h2),
   pero el span del título debe poder truncarse. */
.cuadro > h2 > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* ========================================================
   Dialog: programar tarea
   ======================================================== */

.dialog-tarea {
    position: fixed;
    inset: 0;
    margin: auto;
    border: 1px solid #2a2a2a;
    border-radius: 14px;
    background: #1a1a1a;
    color: #e0e0e0;
    padding: 0;
    max-width: 480px;
    width: 92vw;
    max-height: 90vh;
    overflow: visible;
}

.dialog-tarea::backdrop {
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(2px);
}

.dialog-tarea form {
    padding: 22px 24px;
    max-height: 90vh;
    overflow-y: auto;
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #2a2a2a;
}

.dialog-header h2 {
    margin: 0;
    color: #fff;
    text-transform: none;
    letter-spacing: 0;
    font-size: 1.1rem;
}

.dialog-close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.dialog-close:hover {
    color: #fff;
    background: #2a2a2a;
}

/* ========================================================
   Prioridad: estrellas y menú contextual
   ======================================================== */

/* En una tarea con prioridad, el layout es: label + stars a la derecha. */
.cuadro .tarea.con-prioridad {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cuadro .tarea.con-prioridad label {
    flex: 1;
    min-width: 0;
}

.prioridad-stars {
    font-size: 0.85rem;
    letter-spacing: 1px;
    user-select: none;
    cursor: context-menu;
    flex-shrink: 0;
    white-space: nowrap;
}

.stars-on  { color: #fbbf24; }
.stars-off { color: #444; }

/* Tareas completadas: estrellas atenuadas */
.cuadro .tarea.completada .stars-on  { color: #5a4a1a; }
.cuadro .tarea.completada .stars-off { color: #2a2a2a; }

/* Menú contextual flotante */
.menu-prioridad {
    position: fixed;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6);
    z-index: 1000;
    min-width: 130px;
    animation: menu-aparece 0.12s ease-out;
}

@keyframes menu-aparece {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

.menu-prioridad .menu-header {
    font-size: 0.7rem;
    color: #888;
    padding: 4px 10px 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #2a2a2a;
    margin-bottom: 4px;
    font-weight: 600;
}

.menu-prioridad .menu-opcion {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 7px 12px;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 6px;
    letter-spacing: 1px;
    transition: background 0.12s;
    font-family: inherit;
}

.menu-prioridad .menu-opcion:hover {
    background: #2a2a2a;
}

.menu-prioridad .menu-opcion.activa {
    background: #2a2a2a;
}

.menu-prioridad .menu-opcion.activa .stars-on {
    color: #fcd34d;
}
