.pen-page { max-width: 960px; padding: 1.25rem 1rem 2.5rem; }

.pen-top {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.pen-top h1 { margin: 0; font-size: 1.4rem; color: #0f172a; }
.pen-top p { margin: 0.25rem 0 0; color: #64748b; font-size: 0.9rem; }

.pen-nav { display: flex; flex-wrap: wrap; gap: 0.65rem; font-size: 0.88rem; align-items: center; }
.pen-nav a { color: #6366f1; font-weight: 600; text-decoration: none; }

.pen-kpi {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.pen-kpi-item {
    text-align: center;
    padding: 0.75rem 0.5rem;
    background: #eef2ff;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #3730a3;
}

.pen-kpi-item span { display: block; font-size: 1.45rem; font-weight: 800; }
.pen-kpi-warn { background: #fef3c7; color: #92400e; }
.pen-kpi-info { background: #dbeafe; color: #1e40af; }
.pen-kpi-ok { background: #d1fae5; color: #065f46; }
.pen-kpi-alert { background: #fee2e2; color: #991b1b; }

.pen-week-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.pen-week-label { font-weight: 600; color: #334155; font-size: 0.92rem; text-align: center; flex: 1; }

.pen-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding: 0.75rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    align-items: flex-end;
}

.pen-bar label { font-size: 0.85rem; font-weight: 600; }
.pen-bar input, .pen-bar select { padding: 0.5rem; border: 1px solid #e5e7eb; border-radius: 8px; font: inherit; margin-top: 0.25rem; display: block; }

.pen-btn {
    padding: 0.5rem 1rem;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
}

.pen-btn-outline { background: #fff; color: #6366f1; border: 1px solid #6366f1; }
.pen-btn-sm {
    padding: 0.45rem 0.7rem;
    font-size: 0.8rem;
    min-width: 2.35rem;
    height: 2.35rem;
    line-height: 1;
}

.pen-btn-icon { min-width: 2.35rem; padding: 0.45rem; font-size: 0.95rem; }

.pen-empty { text-align: center; padding: 2rem; }
.pen-empty p { margin-bottom: 1rem; color: #64748b; }

.pen-agenda { display: flex; flex-direction: column; gap: 1.5rem; }

.pen-dia {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
}

.pen-dia-hoy { border-color: #6366f1; box-shadow: 0 4px 20px rgba(99, 102, 241, 0.12); }
.pen-dia-pasado { opacity: 0.92; }

.pen-dia-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem 1rem;
    padding: 0.85rem 1.15rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.pen-dia-hoy .pen-dia-head { background: #eef2ff; }

.pen-dia-head h2 { margin: 0; font-size: 1.1rem; color: #0f172a; }
.pen-dia-head time { font-size: 0.85rem; color: #64748b; }
.pen-dia-count { margin-left: auto; font-size: 0.78rem; font-weight: 600; color: #94a3b8; }

.pen-lista { list-style: none; margin: 0; padding: 0; }

.pen-item {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    gap: 0.75rem 1rem;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid #f1f5f9;
    align-items: center;
}

.pen-item:last-child { border-bottom: none; }
.pen-item-done { opacity: 0.65; }
.pen-item-done h3 { text-decoration: line-through; color: #94a3b8; }

.pen-item-hora { text-align: center; padding-top: 0.15rem; }
.pen-item-hora strong { font-size: 1rem; color: #4338ca; }
.pen-sin-hora { font-size: 0.72rem; color: #94a3b8; font-weight: 600; text-transform: uppercase; }

.pen-item-body h3 { margin: 0.35rem 0 0.25rem; font-size: 1.05rem; color: #0f172a; }
.pen-desc { margin: 0.25rem 0 0.5rem; font-size: 0.9rem; color: #475569; line-height: 1.5; }

.pen-item-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.pen-tag { padding: 0.12rem 0.45rem; border-radius: 4px; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.pen-tag-baja { background: #f1f5f9; color: #64748b; }
.pen-tag-media { background: #dbeafe; color: #1d4ed8; }
.pen-tag-alta { background: #ffedd5; color: #c2410c; }
.pen-tag-urgente { background: #fee2e2; color: #b91c1c; }
.pen-tag-estado { background: #f3f4f6; color: #4b5563; }

.pen-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; font-size: 0.82rem; color: #64748b; margin-top: 0.35rem; }

.pen-item-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* Bootstrap: formulario inline, botones horizontales */
.pen-page .pen-item-actions .pen-bs-form {
    display: inline-block;
    margin: 0;
    padding: 0;
    vertical-align: middle;
}

.pen-page .pen-item-actions .pen-bs-form input[type="hidden"] {
    display: none !important;
}

.pen-page .pen-item-actions .btn-group .btn,
.pen-page .pen-item-actions > .d-inline-flex > .btn {
    width: 2rem;
    height: 2rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.pen-page .pen-item-actions .btn i {
    font-size: 1rem;
    line-height: 1;
}

.pen-form label { display: block; margin-bottom: 1rem; font-weight: 600; color: #1f2937; }
.pen-form input, .pen-form select, .pen-form textarea { width: 100%; margin-top: 0.25rem; }

.module-back { margin: 0 0 0.35rem; font-size: 0.88rem; }
.module-back a { color: #6366f1; font-weight: 600; text-decoration: none; }

.pen-item-highlight {
    animation: pen-flash 2s ease;
}

@keyframes pen-flash {
    0%, 100% { background: transparent; }
    30% { background: #eef2ff; }
}

@media (max-width: 640px) {
    .pen-item { grid-template-columns: 1fr; align-items: start; }
    .pen-item-hora { text-align: left; }
    .pen-item-actions { justify-content: flex-start; }
    .pen-week-nav { flex-direction: column; text-align: center; }
}
