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

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background-color: #0d0d1b;
    color: #e0e0ff;
}

a {
    color: #b79dfa;
}

a:hover {
    color: #d6c6fb;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    color: #8a5cf8;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

p {
    color: #a0a0c0;
}

.add-task,
.stats,
.tasks-list {
    background: #1a1a2e;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.add-task h2,
.tasks-list h2 {
    margin-bottom: 15px;
    color: #ffffff;
}

input[type="text"],
input[type="date"],
input[type="email"],
input[type="password"],
textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: #2d2d44;
    color: white;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.15s ease;
}

textarea {
    resize: vertical;
}

input:focus,
textarea:focus {
    outline: none;
    border: 1px solid #8a5cf8;
}

#add-task-btn {
    width: 100%;
    padding: 12px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

#add-task-btn:hover {
    background: #059669;
}

.stats {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    align-items: center;
}

.stat {
    text-align: center;
}

.stat span {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
    color: #8a5cf8;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tasks-list table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    margin-top: 15px;
}

.tasks-list th {
    background: #2d2d44;
    padding: 12px;
    text-align: left;
}

.tasks-list td {
    padding: 12px;
    border-bottom: 1px solid #333;
}

.status-pending {
    background: #fbbf24;
    color: black;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.status-completed {
    background: #10b981;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.action-buttons button {
    padding: 8px 12px;
    margin-right: 5px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.action-buttons .complete {
    background: #10b981;
    color: white;
}

.action-buttons .undo {
    background: #f59e0b;
    color: white;
}

.action-buttons .delete {
    background: #ef4444;
    color: white;
}

footer {
    text-align: center;
    margin-top: 20px;
    color: #a0a0c0;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .stats {
        flex-direction: column;
        gap: 10px;
    }

    .action-buttons button {
        padding: 6px 8px;
        font-size: 0.8rem;
    }

    /* Tablas -> tarjetas apiladas, sin depender de scroll horizontal */
    .table-responsive {
        overflow-x: visible;
    }

    .tasks-list table {
        min-width: 0;
        font-size: 0.9rem;
    }

    .tasks-list table,
    .tasks-list thead,
    .tasks-list tbody,
    .tasks-list th,
    .tasks-list td,
    .tasks-list tr {
        display: block;
    }

    .tasks-list thead tr {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    .tasks-list tbody tr {
        margin-bottom: 14px;
        border: 1px solid rgba(138, 92, 248, 0.15);
        border-radius: 10px;
        padding: 6px 0;
        background: #16162a;
    }

    .tasks-list tbody td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        border: none;
        border-bottom: 1px solid #2d2d44;
        padding: 10px 14px;
        text-align: right;
    }

    .tasks-list tbody tr td:last-child {
        border-bottom: none;
    }

    .tasks-list tbody td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        text-align: left;
        font-weight: 600;
        color: #a0a0c0;
        font-size: 0.85rem;
    }

    .tasks-list tbody td .action-buttons {
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 6px;
    }
}

/* ==================== Navbar ==================== */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 40px;
    background: rgba(13, 13, 27, 0.7);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid rgba(138, 92, 248, 0.15);
}

.navbar-brand {
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-user {
    color: #a0a0c0;
    font-size: 0.9rem;
    margin-right: 4px;
}

.navbar-links {
    display: flex;
    gap: 4px;
}

.navbar-link {
    color: #a0a0c0;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

.navbar-link:hover {
    color: #ffffff;
    background: rgba(224, 224, 255, 0.06);
}

.navbar-link.active {
    color: #ffffff;
    background: rgba(138, 92, 248, 0.18);
}

@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        gap: 10px;
    }

    .navbar-links {
        order: 3;
        width: 100%;
        justify-content: center;
    }
}

/* ==================== Botones ==================== */
.btn-primary,
.btn-ghost {
    display: inline-block;
    padding: 10px 22px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #8a5cf8, #6d3ff0);
    color: white;
    box-shadow: 0 4px 16px rgba(138, 92, 248, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(138, 92, 248, 0.5);
}

.btn-ghost {
    background: transparent;
    color: #e0e0ff;
    border: 1px solid rgba(224, 224, 255, 0.25);
}

.btn-ghost:hover {
    background: rgba(224, 224, 255, 0.08);
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1.05rem;
}

.btn-block {
    width: 100%;
    text-align: center;
}

/* ==================== Hero ==================== */
.hero {
    text-align: center;
    max-width: 780px;
    margin: 90px auto 100px;
    padding: 0 20px;
}

.hero h1 {
    font-size: 3rem;
    line-height: 1.15;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #ffffff 20%, #b79dfa 70%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero p {
    font-size: 1.15rem;
    color: #a0a0c0;
    margin-bottom: 36px;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* ==================== Features ==================== */
.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 100px;
}

.feature-card {
    background: #1a1a2e;
    border: 1px solid rgba(138, 92, 248, 0.15);
    border-radius: 14px;
    padding: 30px 24px;
    text-align: center;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: rgba(138, 92, 248, 0.5);
}

.feature-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 12px;
}

.feature-card h3 {
    color: #ffffff;
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 0.92rem;
}

@media (max-width: 768px) {
    .navbar {
        padding: 14px 20px;
    }

    .hero {
        margin: 50px auto 60px;
    }

    .hero h1 {
        font-size: 2.1rem;
    }

    .features {
        grid-template-columns: 1fr;
    }
}

/* ==================== Auth (login/registro) ==================== */
.auth-wrapper {
    min-height: calc(100vh - 70px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: #1a1a2e;
    border: 1px solid rgba(138, 92, 248, 0.15);
    border-radius: 14px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.auth-brand {
    text-align: center;
    margin-bottom: 24px;
}

.auth-brand-icon {
    font-size: 2.2rem;
    display: block;
    margin-bottom: 8px;
}

.auth-brand h2 {
    color: #ffffff;
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.auth-brand p {
    font-size: 0.88rem;
}

.auth-tabs {
    display: flex;
    margin-bottom: 24px;
    background: #0d0d1b;
    border-radius: 8px;
    padding: 4px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    color: #a0a0c0;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.auth-tab.active {
    background: #8a5cf8;
    color: white;
}

.auth-form label {
    display: block;
    color: #a0a0c0;
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.auth-hint {
    font-size: 0.8rem;
    margin: -8px 0 15px;
}

.turnstile-widget {
    display: flex;
    justify-content: center;
    margin-top: 6px;
}

.auth-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.88rem;
    margin-bottom: 18px;
}

.auth-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.88rem;
    margin-bottom: 18px;
}

.auth-forgot {
    text-align: right;
    font-size: 0.82rem;
    margin: -8px 0 15px;
}

.auth-forgot a {
    color: #ffffff;
}

.auth-forgot a:hover {
    color: #b79dfa;
}

.password-field {
    position: relative;
    margin-bottom: 15px;
}

.password-field input {
    margin-bottom: 0;
    padding-right: 60px;
}

.password-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #a0a0c0;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 8px;
}

.password-toggle:hover {
    color: #e0e0ff;
}

/* ==================== Reportes ==================== */
.reports-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.reports-actions {
    display: flex;
    gap: 10px;
}

.report-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.report-card {
    background: #1a1a2e;
    border: 1px solid rgba(138, 92, 248, 0.15);
    border-radius: 12px;
    padding: 18px 20px;
    text-align: center;
}

.report-card span {
    display: block;
    font-size: 1.7rem;
    font-weight: bold;
    color: #8a5cf8;
}

.report-card.warning span {
    color: #f59e0b;
}

.report-card.success span {
    color: #10b981;
}

.report-card p {
    font-size: 0.85rem;
    margin-top: 4px;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: #1a1a2e;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.chart-card h3 {
    color: #ffffff;
    margin-bottom: 16px;
    font-size: 1.05rem;
}

.chart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.chart-card-header h3 {
    margin-bottom: 0;
}

.period-tabs {
    display: flex;
    gap: 4px;
    background: #0d0d1b;
    border-radius: 8px;
    padding: 3px;
}

.period-tab {
    padding: 6px 12px;
    background: transparent;
    border: none;
    color: #a0a0c0;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.period-tab.active {
    background: #8a5cf8;
    color: white;
}

.chart-card canvas {
    max-height: 260px;
}

.section-hint {
    font-size: 0.85rem;
    margin-bottom: 15px;
}

.empty-state {
    text-align: center;
    color: #a0a0c0;
    padding: 40px 20px;
}

.overdue-row td {
    color: #fca5a5;
}

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

@media print {
    .navbar,
    .reports-actions,
    footer {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .report-card,
    .chart-card,
    .tasks-list {
        background: white;
        border: 1px solid #ccc;
        box-shadow: none;
        color: black;
    }

    .report-card span,
    .chart-card h3 {
        color: black;
    }
}

/* ==================== Paginación ==================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid rgba(138, 92, 248, 0.3);
    background: transparent;
    color: #e0e0ff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.88rem;
    transition: background 0.15s ease;
}

.pagination button:hover:not(:disabled) {
    background: rgba(138, 92, 248, 0.15);
}

.pagination button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pagination-label {
    color: #a0a0c0;
    font-size: 0.88rem;
}

/* ==================== Filas destacadas / clicables ==================== */
.task-name-link {
    background: none;
    border: none;
    color: #e0e0ff;
    text-align: left;
    padding: 0;
    font-size: inherit;
    cursor: pointer;
    text-decoration: underline dotted;
    text-underline-offset: 3px;
}

.task-name-link:hover {
    color: #b79dfa;
}

@keyframes task-highlight-fade {
    from {
        background: rgba(138, 92, 248, 0.35);
    }
    to {
        background: transparent;
    }
}

.task-highlight {
    animation: task-highlight-fade 2s ease-out;
}

.overdue-row td {
    cursor: pointer;
}

/* ==================== Modal de detalle de tarea ==================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}

.modal-overlay[hidden] {
    display: none;
}

.modal-card {
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    background: #1a1a2e;
    border: 1px solid rgba(138, 92, 248, 0.2);
    border-radius: 14px;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.modal-header h3 {
    color: #ffffff;
    font-size: 1.15rem;
}

.modal-close {
    background: none;
    border: none;
    color: #a0a0c0;
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: #ffffff;
}

.modal-card label {
    display: block;
    color: #a0a0c0;
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.modal-card textarea {
    min-height: 120px;
}

.modal-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.modal-meta div {
    font-size: 0.85rem;
    color: #a0a0c0;
}

.modal-meta strong {
    display: block;
    color: #e0e0ff;
    font-size: 0.95rem;
    margin-top: 2px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ==================== Páginas legales ==================== */
.legal-page {
    max-width: 720px;
}

.legal-content {
    background: #1a1a2e;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.legal-content h2 {
    color: #ffffff;
    font-size: 1.1rem;
    margin: 24px 0 10px;
}

.legal-content h2:first-child {
    margin-top: 0;
}

.legal-content p {
    margin-bottom: 4px;
    line-height: 1.6;
}

.legal-content a {
    color: #b79dfa;
}

footer a {
    color: #a0a0c0;
}

footer a:hover {
    color: #b79dfa;
}
