/* =============================================
   TimeTracker Pro - Design System
   ============================================= */

:root {
    /* Colors */
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16162a;
    --bg-card-hover: #1e1e3a;
    --bg-input: #1e1e36;
    --bg-sidebar: #12121f;

    --text-primary: #e8e8f0;
    --text-secondary: #9ca3b4;
    --text-muted: #6b7280;

    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;

    --border: rgba(255, 255, 255, 0.06);
    --border-focus: rgba(99, 102, 241, 0.5);

    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;

    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);

    --sidebar-width: 240px;
    --topbar-height: 64px;

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 24px;
    border-bottom: 1px solid var(--border);
}

.brand-icon {
    width: 40px; height: 40px;
    background: var(--accent-gradient);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; color: white;
    box-shadow: 0 0 20px var(--accent-glow);
}

.brand-text h1 { font-size: 1.15rem; font-weight: 700; line-height: 1.2; }
.brand-text span { font-size: 0.75rem; color: var(--accent-light); font-weight: 600; letter-spacing: 2px; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500; font-size: 0.93rem;
    transition: var(--transition);
    text-decoration: none;
}

.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); text-decoration: none; }

.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent-light);
    box-shadow: inset 3px 0 0 var(--accent);
}

.nav-item i { font-size: 1.25rem; width: 22px; text-align: center; }

.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--border); }
.sidebar-version { font-size: 0.75rem; color: var(--text-muted); }

/* ===== Main Content ===== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: calc(100% - var(--sidebar-width));
    overflow-x: hidden;
}

/* ===== Topbar ===== */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky; top: 0; z-index: 50;
    backdrop-filter: blur(12px);
}

.topbar-title { font-size: 1.15rem; font-weight: 600; flex: 1; }
.topbar-actions { display: flex; gap: 10px; }
.menu-toggle { display: none; background: none; border: none; color: var(--text-primary); font-size: 1.4rem; cursor: pointer; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    border: none;
    font-family: inherit; font-size: 0.875rem; font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-glow); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent-light); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-icon {
    width: 32px; height: 32px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    background: transparent; border: none;
    color: var(--text-secondary); cursor: pointer;
    transition: var(--transition);
}
.btn-icon:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.btn-icon.danger:hover { color: var(--danger); }

/* ===== Views ===== */
.view-container { 
    padding: 24px; 
    flex: 1; 
    min-width: 0;
    width: 100%;
}
.view { display: none; animation: fadeIn 0.3s ease; }
.view.active { display: block; }
#view-tasks { width: 100%; min-width: 0; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent-gradient);
}

.stat-card:hover { transform: translateY(-2px); border-color: var(--border-focus); }

.stat-card .stat-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; margin: 6px 0 2px; }
.stat-card .stat-sub { font-size: 0.8rem; color: var(--text-secondary); }

.stat-card .stat-icon {
    position: absolute; top: 16px; right: 16px;
    width: 40px; height: 40px;
    background: var(--accent-glow);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; color: var(--accent-light);
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
}

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

.card-header h3 { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-header h3 i { color: var(--accent-light); }
.card-body { padding: 20px; }

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

/* ===== Chart bars ===== */
.client-bars { display: flex; flex-direction: column; gap: 16px; }

.client-bar-item { display: flex; flex-direction: column; gap: 6px; }
.client-bar-label { display: flex; justify-content: space-between; font-size: 0.85rem; }
.client-bar-label span:last-child { color: var(--text-muted); }

.client-bar-track {
    height: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    overflow: hidden;
}

.client-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

/* ===== Monthly Canvas ===== */
.chart-card .card-body { min-height: 220px; }
canvas { width: 100% !important; height: 200px !important; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tfoot td {
    padding: 12px;
    border-top: 2px double var(--border);
    border-bottom: none;
    font-weight: 700;
    vertical-align: middle;
}

.table tfoot tr {
    background: rgba(255, 255, 255, 0.02);
}

.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: rgba(255,255,255,0.02); }

.th-check { width: 36px; }
.th-check input, .table td input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

/* ===== Status Badges ===== */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem; font-weight: 600;
    text-transform: capitalize;
}

.badge-pendiente { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-reportado { background: rgba(6, 182, 212, 0.15); color: #22d3ee; }
.badge-facturado { background: rgba(99, 102, 241, 0.15); color: #a5b4fc; }
.badge-pagado { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-por_catalogar { background: rgba(249, 115, 22, 0.15); color: #fb923c; border: 1px solid rgba(249,115,22,.3); }

/* ===== Filters Bar ===== */
.filters-bar {
    display: flex; flex-wrap: wrap; gap: 10px;
    margin-bottom: 16px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.filter-group { flex: 1; min-width: 140px; }

/* ===== Entries Summary ===== */
.entries-summary {
    display: flex; gap: 20px;
    margin-bottom: 16px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.entries-summary .sum-item { display: flex; align-items: center; gap: 6px; }
.entries-summary .sum-value { font-weight: 700; color: var(--text-primary); }

/* ===== Batch Actions ===== */
.batch-actions {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 10px 20px;
    display: flex; align-items: center; gap: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 60;
    animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { transform: translateX(-50%) translateY(20px); opacity: 0; } }

#selected-count { font-weight: 600; color: var(--accent-light); }

/* ===== Forms / Inputs ===== */
.input {
    width: 100%;
    padding: 9px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    transition: var(--transition);
    outline: none;
}

.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.input::placeholder { color: var(--text-muted); }

select.input { cursor: pointer; }
textarea.input { resize: vertical; }

.input-color { padding: 4px; height: 40px; cursor: pointer; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.3px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ===== Modals ===== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none; align-items: center; justify-content: center;
    z-index: 200;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%; max-width: 600px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}

.modal-sm { max-width: 420px; }

@keyframes modalIn { from { transform: scale(0.95) translateY(10px); opacity: 0; } }

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 { font-size: 1.1rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }

.modal-close {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none; background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer; transition: var(--transition);
    display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }

.modal-body { padding: 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding-top: 16px; border-top: 1px solid var(--border); margin-top: 8px; }

/* ===== Clients Grid ===== */
.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.client-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.client-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
}

.client-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.client-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.client-card-name { font-size: 1.15rem; font-weight: 700; }
.client-card-rate { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }

.client-card-actions { display: flex; gap: 4px; }

.client-card-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.client-stat { text-align: center; padding: 10px; background: rgba(255,255,255,0.03); border-radius: var(--radius-sm); }
.client-stat-val { font-size: 1.3rem; font-weight: 700; }
.client-stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; margin-top: 2px; }

.client-subs { border-top: 1px solid var(--border); padding-top: 14px; }
.client-subs-title { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; font-weight: 600; }

.sub-tag {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px;
    background: rgba(255,255,255,0.05);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 2px;
    transition: var(--transition);
}
.sub-tag:hover { background: rgba(255,255,255,0.08); }

.sub-tag .remove-sub {
    cursor: pointer; color: var(--text-muted);
    font-size: 0.65rem;
    transition: var(--transition);
}
.sub-tag .remove-sub:hover { color: var(--danger); }

.btn-add-sub {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px;
    border: 1px dashed var(--border);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: none;
    cursor: pointer;
    margin: 2px;
    transition: var(--transition);
}
.btn-add-sub:hover { border-color: var(--accent); color: var(--accent-light); }

/* ===== Toasts ===== */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }

.toast {
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    font-size: 0.875rem;
    display: flex; align-items: center; gap: 8px;
    animation: slideIn 0.3s ease;
    min-width: 260px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } }

/* ===== Amount Formatting ===== */
.amount { font-variant-numeric: tabular-nums; }
.text-success { color: var(--success); }
.text-muted { color: var(--text-muted); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .topbar-actions { gap: 6px; }
    .btn span { display: none; }
    .filters-bar { flex-direction: column; }
    .filter-group { min-width: 100%; }
}

/* =============================================
   Light Theme Overrides
   ============================================= */
body.light-theme {
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-input: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border: rgba(0, 0, 0, 0.08);
    --border-focus: rgba(99, 102, 241, 0.6);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.06);
}

/* Force dark sidebar in light theme */
.sidebar {
    --bg-sidebar: #12121f;
    --border: rgba(255, 255, 255, 0.06);
    --text-primary: #e8e8f0;
    --text-secondary: #9ca3b4;
    --text-muted: #6b7280;
    --accent-glow: rgba(99, 102, 241, 0.2);
    --accent-light: #818cf8;
}

/* Maintain dark sidebar icons and branding */
body.light-theme .sidebar-brand {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
body.light-theme .sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
body.light-theme .nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #e8e8f0;
}

/* Enhance styling for light theme elements */
body.light-theme .client-stat {
    background: rgba(0, 0, 0, 0.02);
}
body.light-theme .sub-tag {
    background: rgba(0, 0, 0, 0.04);
}
body.light-theme .sub-tag:hover {
    background: rgba(0, 0, 0, 0.07);
}
body.light-theme .btn-add-sub {
    border-color: rgba(0, 0, 0, 0.15);
}
body.light-theme .table tbody tr:hover {
    background: rgba(0, 0, 0, 0.015);
}
body.light-theme .table tfoot tr {
    background: rgba(0, 0, 0, 0.01);
}

/* High contrast status badges for light theme */
body.light-theme .badge-pendiente {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}
body.light-theme .badge-reportado {
    background: rgba(6, 182, 212, 0.12);
    color: #0891b2;
}
body.light-theme .badge-facturado {
    background: rgba(99, 102, 241, 0.12);
    color: #4f46e5;
}
body.light-theme .badge-pagado {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}
body.light-theme .badge-por_catalogar {
    background: rgba(249, 115, 22, 0.12);
    color: #c2410c;
    border: 1px solid rgba(249, 115, 22, 0.2);
}

/* Buttons outline style in light theme */
body.light-theme .btn-outline {
    border-color: rgba(0, 0, 0, 0.12);
}
body.light-theme .btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}
body.light-theme .btn-ghost:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* Input custom design in light theme */
body.light-theme .input {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.12);
}
body.light-theme .input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Scrollbar adjustment in light theme */
body.light-theme ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}
body.light-theme ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* =============================================
   Tareas en Proceso (Kanban & Google Tasks)
   ============================================= */
.tasks-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    background: var(--bg-card);
    padding: 12px 18px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.tasks-view-modes {
    display: flex;
    gap: 4px;
    background: var(--bg-primary);
    padding: 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.btn-mode {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.btn-mode:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.btn-mode.active {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 2px 8px var(--accent-glow);
}

.tasks-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tasks-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.tasks-search-wrap i {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.tasks-search-wrap .input {
    padding-left: 32px;
    width: 200px;
}

.tasks-nav-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-primary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* Kanban Board Layout */
.kanban-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 20px;
    min-height: calc(100vh - 210px);
    align-items: flex-start;
    width: 100%;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Styled horizontal scrollbar for kanban board */
.kanban-board::-webkit-scrollbar {
    height: 8px;
}
.kanban-board::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    margin: 0 4px;
}
.kanban-board::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 8px;
    opacity: 0.6;
}
.kanban-board::-webkit-scrollbar-thumb:hover {
    background: var(--accent-light);
}

.kanban-column {
    flex: 0 0 320px;
    min-width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 210px);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.kanban-column:hover {
    border-color: rgba(99, 102, 241, 0.25);
}

.kanban-col-header {
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.015);
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
}

.kanban-col-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.kanban-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-weight: 600;
    border: 1px solid var(--border);
}

.kanban-col-add-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    transition: var(--transition);
}

.kanban-col-add-btn:hover {
    color: var(--accent-light);
    background: rgba(99, 102, 241, 0.1);
}

.kanban-col-body {
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-height: 120px;
    border-radius: 0 0 var(--radius) var(--radius);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.kanban-col-body.drag-over {
    background: rgba(99, 102, 241, 0.08);
    border: 2px dashed var(--accent);
}

/* Task Cards */
.task-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    cursor: grab;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, opacity 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    user-select: none;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
}

.task-card.dragging {
    opacity: 0.4;
    transform: scale(0.97);
    cursor: grabbing;
}

.task-card-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

/* Checkbox circular custom */
.task-check-wrap {
    margin-top: 2px;
    flex-shrink: 0;
}

.task-check {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--text-muted);
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    place-content: center;
    transition: all 0.2s ease;
}

.task-check:hover {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

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

.task-check:checked::before {
    content: "✓";
    color: #fff;
    font-size: 11px;
    font-weight: bold;
}

.task-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
    word-break: break-word;
    flex: 1;
}

.task-notes {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-left: 28px;
    white-space: pre-line;
}

.task-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-left: 28px;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}

body.light-theme .task-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.03);
}

.task-tags {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.task-date-badge {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.task-date-badge.overdue {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.task-date-badge.today {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.task-date-badge.future {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-light);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.task-date-badge.nodate {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
}

.task-client-tag {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.light-theme .task-client-tag {
    background: rgba(0, 0, 0, 0.05);
}

.task-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0.3;
    transition: opacity 0.2s ease;
}

.task-card:hover .task-actions {
    opacity: 1;
}

.task-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 3px;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition);
}

.task-action-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.task-action-btn.btn-del:hover {
    color: var(--danger);
}

/* Priority 5-Star System (Internal TimeTracker) */
.task-priority-stars {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    padding: 2px 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s ease, border-color 0.2s ease;
}

body.light-theme .task-priority-stars {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.06);
}

.task-priority-stars:hover {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.25);
}

.card-star {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.2);
    transition: transform 0.12s ease, color 0.12s ease;
    padding: 1px;
}

body.light-theme .card-star {
    color: rgba(0, 0, 0, 0.2);
}

.card-star:hover {
    transform: scale(1.3);
    color: #fbbf24 !important;
}

.card-star.active {
    color: #f59e0b;
    text-shadow: 0 0 6px rgba(245, 158, 11, 0.45);
}

/* Priority Left Accent on Kanban Cards */
.task-card.priority-5 {
    border-left: 3px solid #f59e0b;
}

.task-card.priority-4 {
    border-left: 3px solid rgba(245, 158, 11, 0.75);
}

.task-card.priority-3 {
    border-left: 3px solid rgba(245, 158, 11, 0.5);
}

/* Modal 5-Star Rating Selector */
.task-modal-stars {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.star-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-muted);
    transition: all 0.18s ease;
}

body.light-theme .star-btn {
    background: rgba(0, 0, 0, 0.04);
}

.star-btn:hover {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.4);
    transform: scale(1.1);
}

.star-btn.active {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    border-color: #f59e0b;
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

/* Completed Animation */
@keyframes taskCompleteFade {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.96) translateX(20px); opacity: 0.5; }
    100% { transform: scale(0.8) translateX(60px); opacity: 0; max-height: 0; padding: 0; margin: 0; }
}

.task-completed-anim {
    animation: taskCompleteFade 0.4s forwards cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

/* Spin animation for sync button */
.spin-anim {
    animation: spin 1s infinite linear;
    display: inline-block;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== Switch Toggle ===== */
.switch input:checked + .slider {
    background-color: #714B67;
}
.switch input:focus + .slider {
    box-shadow: 0 0 1px #714B67;
}
.switch input:checked + .slider:before {
    transform: translateX(18px);
}
.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

/* ===== Odoo Badges & Buttons ===== */
.odoo-badge {
    background: rgba(113, 75, 103, 0.18);
    color: #d8b4fe;
    border: 1px solid rgba(113, 75, 103, 0.4);
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
}
.odoo-badge:hover {
    background: rgba(113, 75, 103, 0.35);
    color: #ffffff;
    border-color: #a855f7;
    text-decoration: none;
    transform: translateY(-1px);
}
.btn-sync-odoo {
    background: rgba(113, 75, 103, 0.15);
    color: #c084fc;
    border: 1px solid rgba(113, 75, 103, 0.35);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.btn-sync-odoo:hover {
    background: #714B67;
    color: #ffffff;
    border-color: #714B67;
}
.task-odoo-badge {
    transition: var(--transition);
}
.task-odoo-badge:hover {
    background: rgba(113, 75, 103, 0.4) !important;
    border-color: #c084fc !important;
    transform: translateY(-1px);
}
.odoo-badge.odoo-task-badge,
.task-odoo-badge.task-odoo-project {
    background: rgba(14, 165, 233, 0.18) !important;
    color: #38bdf8 !important;
    border: 1px solid rgba(56, 189, 248, 0.4) !important;
}
.odoo-badge.odoo-task-badge:hover,
.task-odoo-badge.task-odoo-project:hover {
    background: rgba(14, 165, 233, 0.35) !important;
    color: #ffffff !important;
    border-color: #0ea5e9 !important;
    transform: translateY(-1px);
}
.task-stage-tag {
    transition: var(--transition);
}
body.privacy-mode .amount,
body.privacy-mode .client-card-rate,
body.privacy-mode .client-stat-val.amount,
body.privacy-mode .stat-value.amount,
body.privacy-mode .money-val,
body.privacy-mode .client-bar-label .amount,
body.privacy-mode #client-rate,
body.privacy-mode #entries-summary .sum-item:last-child .sum-value,
body.privacy-mode #reports-summary .sum-item:nth-child(n+3) .sum-value,
body.privacy-mode #chart-monthly {
    filter: blur(6px);
    user-select: none;
    transition: filter 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body.privacy-mode .amount:hover,
body.privacy-mode .client-card-rate:hover,
body.privacy-mode .client-stat-val.amount:hover,
body.privacy-mode .stat-value.amount:hover,
body.privacy-mode .money-val:hover,
body.privacy-mode .client-bar-label .amount:hover,
body.privacy-mode #client-rate:focus,
body.privacy-mode #client-rate:hover {
    filter: blur(0px);
}

.btn-privacy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 1.15rem;
    border-radius: 8px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    border: 1px solid transparent;
}
.btn-privacy:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}
body.privacy-mode .btn-privacy {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.4);
}

/* ===== Responsive Breakpoints for Tablet & Mobile ===== */
@media (max-width: 1024px) {
    .view-container {
        padding: 16px;
    }
    .kanban-column {
        flex: 0 0 280px;
        min-width: 280px;
    }
    .tasks-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .tasks-view-modes {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
    }
    .tasks-controls {
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    .menu-toggle {
        display: block;
    }
    .kanban-column {
        flex: 0 0 270px;
        min-width: 270px;
    }
    .tasks-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .tasks-search-wrap .input {
        width: 100%;
    }
    .tasks-nav-controls {
        justify-content: center;
    }
}

/* ===== Custom Multi-Select Dropdown (Client Filter) ===== */
.multi-select-group {
    position: relative;
}

.multi-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    text-align: left;
    cursor: pointer;
    user-select: none;
    min-height: 38px;
}

.multi-select-trigger:hover {
    border-color: rgba(99, 102, 241, 0.4);
}

.multi-select-trigger.open,
.multi-select-trigger.has-selection {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.multi-select-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.multi-select-trigger.has-selection .multi-select-label {
    color: var(--accent-light);
    font-weight: 600;
}

.multi-select-arrow {
    font-size: 1.1rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.multi-select-trigger.open .multi-select-arrow {
    transform: rotate(180deg);
    color: var(--accent-light);
}

.multi-select-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 260px;
    width: max-content;
    max-width: 340px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-focus);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 150;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: fadeIn 0.15s ease;
}

.multi-select-dropdown.open {
    display: flex;
}

.multi-select-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}

.multi-select-header-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.multi-select-clear-btn {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-light);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.multi-select-clear-btn:hover {
    background: var(--accent);
    color: #ffffff;
}

.multi-select-options {
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.multi-select-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 0.85rem;
    color: var(--text-primary);
    user-select: none;
}

.multi-select-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

body.light-theme .multi-select-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

.multi-select-item.checked {
    background: rgba(99, 102, 241, 0.12);
}

.multi-select-item input[type="checkbox"] {
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
    cursor: pointer;
    flex-shrink: 0;
}

.multi-select-color-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.multi-select-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.multi-select-rate {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* =============================================
   Pizarra & Calculadora (Scratchpad View)
   ============================================= */

#view-scratchpad {
    width: 100%;
    min-width: 0;
}

.scratchpad-container {
    display: flex;
    gap: 20px;
    align-items: stretch;
    height: calc(100vh - var(--topbar-height) - 48px);
    min-height: 600px;
    width: 100%;
}

@media (max-width: 1100px) {
    .scratchpad-container {
        flex-direction: column;
        height: auto;
    }
}

/* ===== Columna Izquierda: Bloc de Notas / Pizarra ===== */
.scratchpad-notepad-card {
    flex: 1;
    min-width: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.scratchpad-notepad-card:focus-within {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 4px 30px rgba(99, 102, 241, 0.12);
}

/* Notepad Tabs Bar */
.notepad-header {
    display: flex;
    align-items: center;
    background: rgba(15, 15, 26, 0.85);
    border-bottom: 1px solid var(--border);
    padding: 6px 12px 0 12px;
    gap: 6px;
    user-select: none;
}

body.light-theme .notepad-header {
    background: #f1f5f9;
}

.notepad-tabs-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
}

.notepad-tabs-wrapper::-webkit-scrollbar {
    display: none;
}

.notepad-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 500;
    transition: var(--transition);
    max-width: 200px;
    position: relative;
}

.notepad-tab:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.notepad-tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border);
    border-top: 2px solid var(--accent);
    font-weight: 600;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
}

body.light-theme .notepad-tab.active {
    background: #ffffff;
    border-color: rgba(0,0,0,0.1);
    border-top: 2px solid var(--accent);
}

.notepad-tab-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notepad-tab-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    opacity: 0.5;
    font-size: 13px;
    transition: var(--transition);
    margin-left: 2px;
}

.notepad-tab-close:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.notepad-add-tab-btn {
    width: 28px;
    height: 28px;
    margin-bottom: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.notepad-add-tab-btn:hover {
    border-color: var(--accent);
    color: var(--accent-light);
    background: rgba(99, 102, 241, 0.1);
}

.notepad-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 3px;
    margin-left: 6px;
    flex-shrink: 0;
}

/* Notepad Editor Area */
.notepad-editor-area {
    flex: 1;
    display: flex;
    position: relative;
    background: var(--bg-card);
    overflow: hidden;
}

.notepad-textarea {
    width: 100%;
    height: 100%;
    resize: none;
    border: none;
    outline: none;
    background: transparent;
    color: #e2e8f0;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', 'Roboto Mono', 'Courier New', monospace;
    font-size: 13.5px;
    line-height: 1.65;
    padding: 18px 22px;
    tab-size: 4;
    -moz-tab-size: 4;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
}

body.light-theme .notepad-textarea {
    color: #0f172a;
    background: #ffffff;
}

.notepad-textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

/* Notepad Footer Status Bar */
.notepad-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 18px;
    background: rgba(15, 15, 26, 0.7);
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
    user-select: none;
}

body.light-theme .notepad-footer {
    background: #f8fafc;
    border-color: rgba(0,0,0,0.06);
}

.notepad-status-info, .notepad-status-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notepad-sep {
    opacity: 0.4;
    font-size: 10px;
}

.notepad-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 4px;
    transition: var(--transition);
}

.notepad-status-badge.saved {
    color: #10b981;
    background: rgba(16, 185, 129, 0.12);
}

.notepad-status-badge.saving {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
}

/* ===== Columna Derecha: Calculadora Estándar ===== */
.scratchpad-calculator-card {
    width: 350px;
    min-width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow);
    position: relative;
    user-select: none;
}

@media (max-width: 1100px) {
    .scratchpad-calculator-card {
        width: 100%;
        max-width: 420px;
        margin: 0 auto;
    }
}

.calc-top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(15, 15, 26, 0.6);
}

body.light-theme .calc-top-header {
    background: #f1f5f9;
}

.calc-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.calc-header-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Calculator Screen */
.calc-screen {
    padding: 16px 20px 12px;
    background: rgba(10, 10, 18, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
    border-bottom: 1px solid var(--border);
    min-height: 105px;
    word-break: break-all;
    cursor: pointer;
    transition: var(--transition);
}

.calc-screen:hover {
    background: rgba(10, 10, 18, 0.85);
}

body.light-theme .calc-screen {
    background: #ffffff;
}

.calc-expr {
    font-size: 13px;
    color: var(--text-muted);
    font-family: 'Cascadia Code', 'Consolas', monospace;
    min-height: 18px;
    letter-spacing: 0.5px;
}

.calc-main-display {
    font-size: 2.3rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, sans-serif;
    line-height: 1.15;
    margin-top: 4px;
    transition: font-size 0.1s ease;
    text-align: right;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Memory Row */
.calc-mem-buttons {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 5px 12px;
    background: rgba(15, 15, 26, 0.4);
    border-bottom: 1px solid var(--border);
}

body.light-theme .calc-mem-buttons {
    background: #f8fafc;
}

.calc-btn-m {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 5px 2px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.calc-btn-m:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

body.light-theme .calc-btn-m:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Keypad Grid */
.calc-keypad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 12px;
    flex: 1;
    align-content: stretch;
}

.calc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.04);
    cursor: pointer;
    transition: all 0.12s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    min-height: 46px;
}

.calc-btn:active {
    transform: scale(0.96);
}

.calc-btn.num {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-weight: 600;
}

.calc-btn.num:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

body.light-theme .calc-btn.num {
    background: #f8fafc;
    border-color: rgba(0, 0, 0, 0.08);
    color: #1e293b;
}

body.light-theme .calc-btn.num:hover {
    background: #e2e8f0;
}

.calc-btn.op {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.calc-btn.op:hover {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-primary);
}

body.light-theme .calc-btn.op {
    background: #f1f5f9;
    color: #475569;
}

.calc-btn.op-main {
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent-light);
    font-size: 1.25rem;
    font-weight: 600;
    border-color: rgba(99, 102, 241, 0.2);
}

.calc-btn.op-main:hover {
    background: rgba(99, 102, 241, 0.22);
    color: #ffffff;
    border-color: var(--accent);
}

body.light-theme .calc-btn.op-main {
    background: rgba(99, 102, 241, 0.12);
    color: #4f46e5;
}

.calc-btn.equals {
    background: var(--accent-gradient);
    color: #ffffff;
    font-size: 1.35rem;
    font-weight: 700;
    box-shadow: 0 2px 10px var(--accent-glow);
    border: none;
}

.calc-btn.equals:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 18px var(--accent-glow);
    filter: brightness(1.1);
}

/* History Drawer */
.calc-history-drawer {
    position: absolute;
    top: 50px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-card);
    z-index: 20;
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    animation: fadeIn 0.15s ease;
    border-top: 1px solid var(--border);
}

.calc-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.calc-history-items {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.calc-history-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 30px;
}

.calc-history-item {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    text-align: right;
}

.calc-history-item:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
}

.calc-history-item-expr {
    font-size: 11.5px;
    color: var(--text-muted);
    font-family: 'Cascadia Code', 'Consolas', monospace;
    margin-bottom: 3px;
}

.calc-history-item-val {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}
