/* Reset & Variables */
:root {
    --bg-dark: #F7F3E9; /* Warm Ivory/Cream Apple Style */
    --card-bg: rgba(255, 255, 255, 0.75); /* Frosted Glass */
    --card-border: rgba(0, 0, 0, 0.08); /* Clean light border */
    --text-main: #1d1d1f; /* Apple Dark Gray */
    --text-muted: #86868b; /* Apple Gray */
    --primary: #0071e3; /* Apple Blue */
    --primary-hover: #0059b3;
    --secondary: #5e5ce6; /* Apple Indigo */
    --secondary-hover: #4b49c0;
    --accent: #ff3b30; /* Apple Red (Urgent) */
    --accent-hover: #d32f2f;
    --success: #34c759; /* Apple Green */
    --success-bg: rgba(52, 199, 89, 0.12);
    --urgent-bg: rgba(255, 59, 48, 0.1);
    --info: #5ac8fa; /* Apple Cyan */
    --warning: #ff9500; /* Apple Orange */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --radius-lg: 18px;
    --radius-md: 12px;
    --shadow-premium: 0 8px 30px rgba(0, 0, 0, 0.04);
}

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

html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.5;
}

/* Background blob decorations */
.glass-bg-decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.06; /* Soft pastel background blur */
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--primary) 0%, transparent 80%);
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 45vw;
    height: 45vw;
    background: radial-gradient(circle, var(--secondary) 0%, transparent 80%);
}

.blob-3 {
    top: 40%;
    left: 50%;
    width: 30vw;
    height: 30vw;
    background: radial-gradient(circle, var(--accent) 0%, transparent 80%);
}

/* App Container */
.app-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Glassmorphism utility */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-premium);
    transition: var(--transition-smooth);
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: #1d1d1f; /* Premium dark background */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.brand h1 {
    font-size: 1.6rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff, #a1a1a6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand .tagline {
    font-size: 0.85rem;
    color: #a1a1a6; /* Apple Light Gray for dark background */
}

/* Sync Button and Badge inside Dark Header */
.btn-sync {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #0a84ff; /* Apple System Blue for dark background */
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: var(--transition-smooth);
}

.btn-sync:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    color: #ffffff;
}

.btn-sync.connected {
    background: rgba(48, 209, 88, 0.15); /* Apple system green background tint */
    border: 1px solid rgba(48, 209, 88, 0.4);
    color: #30d158; /* Apple neon green for dark mode */
}

.btn-sync.connected:hover {
    background: rgba(48, 209, 88, 0.25);
    border-color: #30d158;
}

/* Stats Dashboard */
.dashboard-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

.stat-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow-premium);
    transition: var(--transition-smooth);
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.12);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-info h3 {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.1;
}

.stat-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Stat card thematic accents */
.urgent-card .stat-icon {
    background: rgba(244, 63, 94, 0.12);
    color: var(--accent);
}
.urgent-card {
    border-left: 4px solid var(--accent);
}

.progress-card .stat-icon {
    background: rgba(139, 92, 246, 0.12);
    color: var(--secondary);
}
.progress-card {
    border-left: 4px solid var(--secondary);
}

.support-card .stat-icon {
    background: rgba(14, 165, 233, 0.12);
    color: var(--info);
}
.support-card {
    border-left: 4px solid var(--info);
}

.completion-card .stat-icon {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
}
.completion-card {
    border-left: 4px solid var(--success);
}

/* Tabs Navigation */
.app-tabs {
    display: flex;
    gap: 0.25rem;
    background: rgba(120, 120, 128, 0.08);
    padding: 0.25rem;
    border-radius: 50px;
    align-self: center;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.tab-btn {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    background: #ffffff;
    color: var(--text-main);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Tab Pane visibility */
.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Layouts */
.agenda-layout, .goals-layout {
    display: block;
    width: 100%;
}

/* Forms */
.form-card {
    padding: 1.75rem;
}

.form-card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: var(--radius-md);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-smooth);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.form-row {
    display: block;
    width: 100%;
}

/* Form Checkbox custom */
.checkbox-label-wrapper {
    display: flex !important;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    user-select: none;
    padding: 0.25rem 0;
}

.checkbox-label-wrapper input {
    display: none;
}

.custom-checkbox {
    width: 18px;
    height: 18px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: #ffffff;
    border-radius: 4px;
    display: inline-block;
    position: relative;
    transition: var(--transition-smooth);
}

.checkbox-label-wrapper input:checked + .custom-checkbox {
    background: var(--accent);
    border-color: var(--accent);
}

.checkbox-label-wrapper input:checked + .custom-checkbox::after {
    content: "\f00c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: white;
    font-size: 10px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.label-text {
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition-smooth);
}

.text-urgent {
    color: var(--accent);
}

.form-tip {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    line-height: 1.3;
}

/* Buttons */
.btn {
    border: none;
    outline: none;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    transition: var(--transition-smooth);
}

.btn-full {
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 113, 227, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 113, 227, 0.35);
}

.btn-secondary {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.02);
    transform: translateY(-2px);
}

.btn-file-label {
    position: relative;
    cursor: pointer;
}

.btn-file-label input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
}

/* Filters & Search Card */
.filters-card {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.filters-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.search-bar {
    position: relative;
    flex-grow: 1;
}

.search-bar i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-bar input {
    width: 100%;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 50px;
    padding: 0.65rem 1rem 0.65rem 2.5rem;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-smooth);
}

.search-bar input:focus {
    border-color: var(--primary);
}

.filters-btn-group {
    display: flex;
    gap: 0.5rem;
}

@media (max-width: 750px) {
    .filters-btn-group {
        flex-wrap: wrap;
        width: 100%;
        gap: 0.5rem;
    }
}

.filter-btn {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition-smooth);
    white-space: nowrap;
}

.filter-btn:hover {
    color: var(--text-main);
    border-color: rgba(0, 0, 0, 0.2);
}

.filter-btn.active {
    background: rgba(0, 113, 227, 0.08);
    border-color: var(--primary);
    color: var(--primary);
}

/* Tasks Grid/List Container */
.tasks-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Task Item */
.task-item {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    transition: var(--transition-smooth);
}

.task-item:hover {
    transform: scale(1.01) translateY(-2px);
    border-color: rgba(0, 0, 0, 0.12);
    background: #ffffff;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05);
}

.task-item.is-urgent {
    border-left: 4px solid var(--accent);
    background: linear-gradient(to right, rgba(255, 59, 48, 0.03), var(--card-bg));
    box-shadow: 0 4px 15px rgba(255, 59, 48, 0.01), var(--shadow-premium);
}

.task-item.has-goal {
    border-left: 4px solid var(--secondary);
    background: linear-gradient(to right, rgba(94, 92, 230, 0.03), var(--card-bg));
    box-shadow: 0 4px 15px rgba(94, 92, 230, 0.01), var(--shadow-premium);
}

.task-item.is-general {
    border-left: 4px solid var(--info);
    background: linear-gradient(to right, rgba(90, 200, 250, 0.03), var(--card-bg));
    box-shadow: 0 4px 15px rgba(90, 200, 250, 0.01), var(--shadow-premium);
}

.task-item.is-urgent:hover {
    box-shadow: 0 8px 30px rgba(255, 59, 48, 0.08), var(--shadow-premium);
    border-left-color: #ff6b8b;
}

.task-item.has-goal:hover {
    box-shadow: 0 8px 30px rgba(94, 92, 230, 0.08), var(--shadow-premium);
    border-left-color: #a78bfa;
}

.task-item.is-general:hover {
    box-shadow: 0 8px 30px rgba(90, 200, 250, 0.08), var(--shadow-premium);
    border-left-color: #38bdf8;
}

.task-item.is-completed {
    opacity: 0.65;
}

.task-item.is-completed .task-text h3 {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-left {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex-grow: 1;
    min-width: 0;
}

/* Task checkbox style */
.task-check-wrapper {
    cursor: pointer;
    margin-top: 0.2rem;
}

.task-check-wrapper input {
    display: none;
}

.task-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--card-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.task-check-wrapper:hover .task-checkbox {
    border-color: var(--primary);
}

.task-check-wrapper input:checked + .task-checkbox {
    background: var(--success);
    border-color: var(--success);
}

.task-check-wrapper input:checked + .task-checkbox::after {
    content: "\f00c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: white;
    font-size: 11px;
}

.task-text {
    flex-grow: 1;
    min-width: 0;
}

.task-text h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.task-text p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

/* Badges */
.badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: normal;
    word-break: break-word;
    max-width: 100%;
}

.badge-urgent {
    background: var(--urgent-bg);
    color: var(--accent);
}

.badge-goal {
    background: rgba(94, 92, 230, 0.08);
    color: var(--secondary);
    border: 1px solid rgba(94, 92, 230, 0.15);
}

.badge-general {
    background: rgba(90, 200, 250, 0.08);
    color: #007aff;
    border: 1px solid rgba(90, 200, 250, 0.15);
}

.badge-date {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-muted);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.badge-date.overdue {
    background: var(--urgent-bg);
    color: var(--accent);
    border: 1px solid rgba(255, 59, 48, 0.15);
}

/* Actions in task item */
.task-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    background: transparent;
    border: none;
    outline: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.action-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-main);
}

.btn-delete:hover {
    background: var(--urgent-bg);
    color: var(--accent);
}

/* Empty placeholder */
.empty-placeholder {
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-placeholder i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Goals Grid */
.goals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

/* Goal Card */
.goal-card {
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.goal-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.goal-card-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.3;
}

.goal-horizon-badge {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.05);
    color: var(--text-muted);
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    text-transform: uppercase;
}

.goal-progress-section {
    margin-bottom: 1.25rem;
}

.progress-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.progress-bar-bg {
    height: 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    width: 0%;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 4px;
}

.goal-stats-summary {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--card-border);
    padding-top: 0.85rem;
}

.goal-delete-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    opacity: 0;
    transition: var(--transition-smooth);
}

.goal-card:hover .goal-delete-btn {
    opacity: 1;
}

/* Sincronización Styles */
.sync-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.sync-card, .backup-card {
    padding: 2rem;
}

.sync-card h2, .backup-card h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.description {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.steps-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.step-item {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

.step-num {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-weight: 700;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.25);
}

.step-text {
    line-height: 1.5;
    padding-top: 0.2rem;
}

.sync-actions {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}

.sync-file-path {
    font-size: 0.85rem;
    font-family: monospace;
    color: var(--text-muted);
}

.backup-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--primary);
    color: var(--text-main);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition-smooth);
    animation: slideIn 0.3s ease forwards;
}

.toast.hidden {
    display: none;
}

@keyframes slideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Mobile Toggles & FAB Button Styles */
.mobile-fab {
    display: none; /* Hidden on desktop */
}

/* Global Modal Sidebars (Popup Windows) */
.agenda-sidebar, .goals-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(29, 29, 31, 0.45); /* Dark translucent Apple-like backdrop overlay */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 300;
    display: flex;
    align-items: flex-start; /* Align to top to prevent top/bottom clipping on tall forms */
    justify-content: center;
    padding: 2rem 1rem;
    overflow-y: auto;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.agenda-sidebar.open, .goals-sidebar.open {
    visibility: visible;
    opacity: 1;
}

.agenda-sidebar .form-card, .goals-sidebar .form-card {
    width: 100%;
    max-width: 480px;
    border-radius: var(--radius-lg);
    background: #ffffff;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    padding: 1.75rem;
}

.agenda-sidebar.open .form-card, .goals-sidebar.open .form-card {
    transform: scale(1) translateY(0);
}

/* Form Card Header (Global) */
.form-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.75rem;
}

.form-card-header h2 {
    margin-bottom: 0;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
}

.btn-close-modal {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid var(--card-border);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-close-modal:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-main);
}

/* Action Trigger Buttons in desktop/iPad Layout */
#btn-new-task-desktop, #btn-new-goal-desktop {
    display: inline-flex;
}

.goals-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.goals-header-row h2 {
    font-size: 1.4rem;
    font-weight: 700;
}

/* Mobile & Tablet Media Queries */
@media (max-width: 768px) {
    /* Responsive Adjustments */
    .app-container {
        padding: 1rem 1rem 6.5rem 1rem; /* Padding at bottom for sticky navbar */
        gap: 1rem;
    }

    .app-header {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
        padding: 1rem;
    }

    .brand {
        flex-direction: column;
        gap: 0.4rem;
    }

    /* Compact 2x2 Dashboard on Mobile */
    .dashboard-section {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stat-card {
        padding: 0.85rem;
        gap: 0.75rem;
        border-radius: var(--radius-md);
        flex-direction: row;
        align-items: center;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
        flex-shrink: 0;
    }

    .stat-info h3 {
        font-size: 1.3rem;
    }

    .stat-info p {
        font-size: 0.7rem;
        line-height: 1.2;
    }

    .app-tabs {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 0;
        border: none;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        background: rgba(245, 245, 247, 0.95);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        z-index: 150;
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom)) 0.5rem;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
        align-self: auto;
    }

    .tab-btn {
        flex: 1;
        justify-content: center;
        padding: 0.4rem 0.2rem;
        font-size: 0.72rem;
        gap: 0.25rem;
        flex-direction: column;
        border-radius: 8px;
        white-space: normal;
        text-align: center;
        word-break: break-word;
    }
    
    .tab-btn.active {
        background: transparent;
        color: var(--primary);
        box-shadow: none;
        border: none;
    }
    
    .tab-btn i {
        font-size: 1.2rem;
    }

    /* Floating Action Button (FAB) */
    .mobile-fab {
        display: flex;
        position: fixed;
        bottom: 5.5rem;
        right: 1.25rem;
        width: 52px;
        height: 52px;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        border: none;
        outline: none;
        color: white;
        align-items: center;
        justify-content: center;
        font-size: 1.3rem;
        box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
        z-index: 140;
        cursor: pointer;
        transition: var(--transition-smooth);
    }

    .mobile-fab:active {
        transform: scale(0.9) translateY(2px);
    }

    /* Sidebar Modals / Bottom Sheets Mobile Overrides */
    .agenda-sidebar, .goals-sidebar {
        align-items: flex-start; /* Align to top to allow natural scroll down on small mobile screens */
    }

    .agenda-sidebar .form-card, .goals-sidebar .form-card {
        padding: 1.25rem; /* Reduced padding on mobile */
        max-width: 450px;
    }

    #btn-new-task-desktop, #btn-new-goal-desktop {
        display: none !important; /* Hide trigger buttons on mobile, FAB is used instead */
    }



    /* Task check elements resizing for thumb-friendly clicks */
    .task-checkbox {
        width: 24px;
        height: 24px;
    }
    
    .task-check-wrapper input:checked + .task-checkbox::after {
        font-size: 12px;
    }

    .task-item {
        padding: 1rem;
        gap: 0.75rem;
    }

    .action-btn {
        width: 36px;
        height: 36px;
        background: rgba(255, 255, 255, 0.03);
    }

    /* Hide FAB if not on Daily Agenda or Goals Tab */
    .mobile-fab.hidden {
        display: none !important;
    }

    /* Hide form tip to save height space on mobile */
    .form-tip {
        display: none !important;
    }

    /* Stacking form rows on mobile */
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    /* Compact sync cards padding on mobile */
    .sync-card, .backup-card {
        padding: 1.25rem;
    }
}

/* Toggle link styling (global) */
.btn-toggle-link {
    background: transparent;
    border: none;
    outline: none;
    color: #a5b4fc; /* light indigo */
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0;
    font-family: var(--font-sans);
    transition: var(--transition-smooth);
}

.btn-toggle-link:hover {
    color: var(--primary);
}

@media (min-width: 769px) and (max-width: 1024px) {
    /* Tablet Layout scaling */
    .stat-card {
        padding: 1rem;
    }
}


/* ==========================================================================
   Subtasks Form Styles
   ========================================================================== */
.subtasks-form-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.subtask-form-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    width: 100%;
}

.subtask-form-row input {
    flex-grow: 1;
}

.btn-remove-subtask-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.btn-remove-subtask-input:hover {
    background: rgba(244, 63, 94, 0.1);
    color: var(--accent);
}

/* ==========================================================================
   Subtasks Card Render Styles
   ========================================================================== */
.task-progress-container {
    width: 100%;
    margin-top: 0.5rem;
}

.task-progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.task-progress-bg {
    height: 4px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    overflow: hidden;
}

.task-progress-fill {
    height: 100%;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    width: 0%;
    transition: width 0.3s ease;
}

.btn-toggle-subtasks {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.4rem;
    font-family: var(--font-sans);
    transition: var(--transition-smooth);
}

.btn-toggle-subtasks:hover {
    color: var(--text-main);
}

.task-subtasks-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.5rem;
    padding-left: 0.5rem;
    border-left: 2px dashed rgba(0, 0, 0, 0.08);
}

.subtask-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
}

.subtask-checkbox-wrapper {
    cursor: pointer;
    display: flex;
    align-items: center;
}

.subtask-checkbox-wrapper input {
    display: none;
}

.subtask-checkbox {
    width: 16px;
    height: 16px;
    border: 1px solid var(--card-border);
    border-radius: 3px;
    display: inline-block;
    position: relative;
    transition: var(--transition-smooth);
}

.subtask-checkbox-wrapper input:checked + .subtask-checkbox {
    background: var(--success);
    border-color: var(--success);
}

.subtask-checkbox-wrapper input:checked + .subtask-checkbox::after {
    content: "\f00c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: white;
    font-size: 9px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.subtask-title {
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.subtask-checkbox-wrapper input:checked ~ .subtask-title {
    text-decoration: line-through;
    color: rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   Eisenhower Matrix Styles
   ========================================================================== */
.matrix-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.matrix-header {
    text-align: center;
}

.matrix-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.matrix-quadrant {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(12px);
    transition: var(--transition-smooth);
}

.matrix-quadrant.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

.quad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.75rem;
}

.quad-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.quad-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.quad-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex-grow: 1;
    overflow-y: auto;
    max-height: 400px;
}

.quad-content::-webkit-scrollbar {
    width: 6px;
}

.quad-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

/* Color thematic quadrants border accents */
.quad-urgent-important {
    border-top: 4px solid var(--accent);
}
.quad-important-not-urgent {
    border-top: 4px solid var(--secondary);
}
.quad-urgent-not-important {
    border-top: 4px solid var(--info);
}
.quad-not-urgent-not-important {
    border-top: 4px solid var(--text-muted);
}

/* Draggable Task Styles inside Matrix */
.task-item.draggable {
    cursor: grab;
    user-select: none;
    -webkit-user-select: none; /* Previene selección de texto en iOS/Android */
    -webkit-touch-callout: none; /* Desactiva el menú contextual de pulsación larga en iOS */
}

.task-item.draggable:active {
    cursor: grabbing;
}

.task-item.dragging {
    opacity: 0.4;
    border-style: dashed;
}

/* ==========================================================================
   Focus Mode / Pomodoro Styles
   ========================================================================== */
.focus-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(245, 245, 247, 0.96);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: focus-fade-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes focus-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.focus-overlay.hidden {
    display: none !important;
}

.focus-container {
    width: 100%;
    max-width: 900px;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 3rem;
    align-items: center;
    position: relative;
}

.btn-close-focus {
    position: absolute;
    top: -2.5rem;
    right: 0;
    background: rgba(0,0,0,0.05);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.btn-close-focus:hover {
    background: rgba(244, 63, 94, 0.15);
    color: var(--accent);
    transform: rotate(90deg);
}

.focus-timer-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.timer-ring-wrapper {
    position: relative;
    width: 220px;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timer-ring-svg {
    transform: rotate(-90deg);
    position: absolute;
}

.timer-ring-circle-progress {
    stroke-dasharray: 597; /* 2 * PI * r = 2 * 3.14159 * 95 */
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}

.timer-display {
    text-align: center;
    display: flex;
    flex-direction: column;
}

#focus-timer-time {
    font-size: 3.2rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
}

#focus-timer-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 2px;
}

.focus-controls {
    display: flex;
    gap: 1.5rem;
}

.btn-focus-control {
    border: none;
    outline: none;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    transition: var(--transition-smooth);
}

.btn-focus-control.btn-play {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35);
}

.btn-focus-control.btn-play.is-playing {
    background: var(--warning);
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.35);
}

.btn-focus-control.btn-reset {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid var(--card-border);
    color: var(--text-main);
}

.btn-focus-control:hover {
    transform: scale(1.08) translateY(-2px);
}

.focus-task-card {
    padding: 2.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.focus-task-card h2 {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
}

.focus-task-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.focus-checklist-container {
    margin-top: 1rem;
    border-top: 1px solid var(--card-border);
    padding-top: 1.25rem;
}

.focus-checklist-container h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   Responsive Eisenhower Grid & Focus Mode
   ========================================================================== */
@media (max-width: 768px) {
    .matrix-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .matrix-quadrant {
        min-height: auto;
    }
    .focus-overlay {
        padding: 1rem;
        overflow-y: auto;
        align-items: flex-start;
    }
    .focus-container {
        grid-template-columns: 1fr;
        gap: 2rem;
        margin-top: 2rem;
    }
    .btn-close-focus {
        top: -1.5rem;
        right: 0.5rem;
    }
}

/* ==========================================================================
   Módulo de Medicación & Tratamientos Diarios
   ========================================================================== */
.meds-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 2rem;
    align-items: start;
}

.meds-main {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.meds-summary-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.summary-info {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.summary-badge-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--secondary), #ec4899);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
}

.meds-quick-stats {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.quick-stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.quick-stat-num {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
}

.quick-stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Tomas de Hoy */
.meds-today-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.med-today-card {
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    border-left: 4px solid var(--secondary);
    transition: var(--transition-smooth);
}

.med-today-card:hover {
    transform: translateX(4px);
}

.med-today-card.is-taken {
    border-left-color: var(--success);
    background: rgba(16, 185, 129, 0.04);
}

.med-today-card.is-overdue {
    border-left-color: var(--accent);
}

.med-today-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex: 1;
}

.med-time-pill {
    padding: 0.4rem 0.85rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
    background: rgba(139, 92, 246, 0.15);
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.med-time-pill.is-taken {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.med-today-info h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.med-today-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.med-today-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-take-dose {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.btn-take-dose:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.4);
}

.dose-taken-badge {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-undo-dose {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    transition: var(--transition-smooth);
}

.btn-undo-dose:hover {
    color: var(--accent);
    background: rgba(244, 63, 94, 0.1);
}

/* Mis Tratamientos Grid */
.meds-treatments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.med-treatment-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    border-top: 3px solid var(--secondary);
}

.med-treatment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.med-treatment-title h4 {
    font-size: 1.15rem;
    font-weight: 700;
}

.med-treatment-title p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.med-treatment-type-badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    white-space: nowrap;
}

.med-treatment-schedules {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.schedule-tag {
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    background: rgba(139, 92, 246, 0.12);
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.med-progress-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.med-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.med-treatment-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    border-top: 1px solid var(--card-border);
    padding-top: 0.75rem;
}

/* Horarios en el formulario */
.med-schedules-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.schedule-input-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
}

.schedule-input-row input[type="time"] {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
}

.btn-remove-schedule {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem;
}

.btn-remove-schedule:hover {
    color: var(--accent);
}

/* Servidor Status Banner */
.server-status-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.2);
    margin-bottom: 1.5rem;
}

.server-status-banner.is-offline {
    background: rgba(244, 63, 94, 0.06);
    border-color: rgba(244, 63, 94, 0.2);
}

.server-status-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
    flex-shrink: 0;
}

.server-status-banner.is-offline .server-status-dot {
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}

.server-status-details {
    display: flex;
    flex-direction: column;
}

.server-status-details strong {
    font-size: 1rem;
    font-weight: 700;
}

.server-status-details span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Responsividad para Medicación */
@media (max-width: 992px) {
    .meds-layout {
        grid-template-columns: 1fr;
    }
    .meds-sidebar {
        position: fixed;
        top: 0;
        right: -100%;
        width: 90%;
        max-width: 440px;
        height: 100vh;
        z-index: 999;
        overflow-y: auto;
        transition: right 0.3s ease;
        background: rgba(9, 10, 15, 0.95);
        backdrop-filter: blur(20px);
        padding: 1.5rem;
    }
    .meds-sidebar.open {
        right: 0;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.7);
    }
}

/* ==========================================================================
   Pantalla de Bloqueo por PIN de Seguridad
   ========================================================================== */
.pin-lock-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(9, 10, 15, 0.88);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.pin-lock-card {
    max-width: 440px;
    width: 100%;
    padding: 2.75rem 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    border-radius: 20px;
    background: rgba(20, 22, 35, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
    animation: pinModalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pinModalIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.pin-lock-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

.pin-lock-card h2 {
    font-size: 1.6rem;
    font-weight: 800;
}

.pin-lock-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-top: -0.5rem;
}

#pin-lock-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.5rem;
}

.pin-input-box {
    position: relative;
    width: 100%;
}

.pin-input-box input {
    width: 100%;
    padding: 1rem 3rem 1rem 1.25rem;
    font-size: 1.2rem;
    text-align: center;
    letter-spacing: 3px;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-main);
    outline: none;
    transition: var(--transition-smooth);
}

.pin-input-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
    background: rgba(255, 255, 255, 0.09);
}

.btn-toggle-eye {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.4rem;
    transition: var(--transition-smooth);
    z-index: 5;
}

.btn-toggle-eye:hover {
    color: var(--text-main);
}

.pin-error-message {
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

body.app-locked .app-container {
    filter: blur(24px);
    pointer-events: none;
    user-select: none;
    transition: filter 0.3s ease;
}

.pin-lock-card.shake {
    animation: shakeCard 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shakeCard {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(4px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
    40%, 60% { transform: translate3d(6px, 0, 0); }
}

.btn-lock {
    background: rgba(239, 68, 68, 0.12) !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    color: #f87171 !important;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-lock:hover {
    background: rgba(239, 68, 68, 0.25) !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
    color: #fca5a5 !important;
    transform: translateY(-1px);
}



