*{margin:0;padding:0;box-sizing:border-box}
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;background:#f0f2f5;color:#1a1a2e}
.header{background:linear-gradient(135deg,#1a1a2e,#16213e,#0f3460);color:#fff;padding:20px 40px;display:flex;align-items:center;justify-content:space-between;box-shadow:0 2px 10px rgba(0,0,0,.2)}
.header h1{font-size:24px;font-weight:700}
.header .subtitle{font-size:13px;color:#8899b0;margin-top:4px}
.header-right{display:flex;align-items:center;gap:12px}
.header-right .user-info{display:flex;align-items:center;gap:8px;font-size:13px}
.header-right .user-info img{width:28px;height:28px;border-radius:50%;object-fit:cover}
.header-right .user-info .user-name{color:#cbd5e1}
.header-right .user-info .logout-link{color:#94a3b8;font-size:11px;text-decoration:none}
.header-right .user-info .logout-link:hover{color:#fff}
.login-prompt{display:flex;justify-content:center;align-items:center;min-height:400px;padding:40px}
.login-card{background:#fff;border-radius:16px;padding:48px 40px;text-align:center;box-shadow:0 4px 24px rgba(0,0,0,.1);max-width:420px}
.login-card h2{font-size:22px;color:#1e293b;margin-bottom:12px}
.login-card p{color:#64748b;font-size:14px;line-height:1.5;margin-bottom:28px}
.google-btn{display:inline-flex;align-items:center;gap:10px;padding:12px 28px;background:#fff;border:1px solid #e2e8f0;border-radius:8px;color:#1e293b;font-size:14px;font-weight:500;text-decoration:none;transition:all .2s;cursor:pointer;font-family:inherit}
.google-btn:hover{background:#f8fafc;border-color:#0f3460;box-shadow:0 2px 8px rgba(0,0,0,.08)}
.file-upload-area{background:#fff;border-radius:12px;padding:16px;margin-bottom:20px;box-shadow:0 1px 3px rgba(0,0,0,.08)}
.upload-dropzone{border:2px dashed #cbd5e1;border-radius:10px;padding:24px;text-align:center;cursor:pointer;transition:all .2s}
.upload-dropzone:hover,.upload-dropzone.dragover{border-color:#0f3460;background:#f1f5f9}
.upload-icon{font-size:32px;color:#94a3b8;margin-bottom:6px}
.upload-text{font-size:14px;color:#475569;font-weight:500}
.upload-sub{font-size:12px;color:#94a3b8;margin-top:4px}
.file-list{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.file-item{display:flex;align-items:center;gap:8px;padding:6px 12px;background:#f1f5f9;border-radius:6px;font-size:12px}
.file-item .file-name{color:#1e293b}
.file-item .file-del{cursor:pointer;color:#94a3b8;font-size:14px;line-height:1}
.file-item .file-del:hover{color:#ef4444}
.badge{background:rgba(255,255,255,.1);padding:6px 14px;border-radius:20px;font-size:12px;color:#aab8cc;white-space:nowrap}
.cuenta-selector{background:#fff;border-radius:12px;padding:12px 20px;margin-bottom:16px;box-shadow:0 1px 3px rgba(0,0,0,.08)}
.cuenta-selector-row{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px}
.cuenta-select-group{display:flex;align-items:center;gap:8px}
.cuenta-select-group label{font-size:13px;color:#64748b;font-weight:500}
.cuenta-select-group select{padding:8px 12px;border:1px solid #e2e8f0;border-radius:8px;font-size:14px;font-weight:500;background:#f8fafc;outline:none;font-family:inherit;min-width:180px}
.cuenta-select-group select:focus{border-color:#0f3460}
.cuenta-actions{display:flex;gap:8px;flex-wrap:wrap}
.modal-overlay{position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.4);z-index:1000;display:flex;align-items:center;justify-content:center}
.modal{background:#fff;border-radius:16px;max-width:600px;width:90%;max-height:80vh;overflow-y:auto;box-shadow:0 8px 32px rgba(0,0,0,.15)}
.modal-header{display:flex;justify-content:space-between;align-items:center;padding:20px 24px;border-bottom:1px solid #e2e8f0}
.modal-header h3{font-size:16px;font-weight:600}
.modal-close{background:none;border:none;font-size:20px;color:#94a3b8;cursor:pointer;padding:4px}
.modal-close:hover{color:#ef4444}
.modal-body{padding:20px 24px}
.cuenta-form{display:flex;gap:8px;margin-bottom:16px}
.cuenta-form input{flex:1;padding:8px 12px;border:1px solid #e2e8f0;border-radius:8px;font-size:13px;font-family:inherit;outline:none}
.cuenta-form input:focus{border-color:#0f3460}
.cuenta-grid{display:grid;gap:10px}
.cuenta-card{display:flex;align-items:center;justify-content:space-between;padding:14px 16px;border:1px solid #e2e8f0;border-radius:10px;transition:all .15s}
.cuenta-card:hover{border-color:#0f3460}
.cuenta-card .cc-info{display:flex;align-items:center;gap:10px;flex:1}
.cuenta-card .cc-dot{width:12px;height:12px;border-radius:50%;flex-shrink:0}
.cuenta-card .cc-name{font-weight:500;font-size:14px}
.cuenta-card .cc-meta{font-size:11px;color:#94a3b8;margin-top:2px}
.cuenta-card .cc-actions{display:flex;gap:4px}
.cuenta-card .cc-actions button{padding:4px 10px;font-size:11px;border:1px solid #e2e8f0;border-radius:6px;background:#fff;cursor:pointer;font-family:inherit}
.cuenta-card .cc-actions button:hover{background:#f8fafc}
.container{max-width:1400px;margin:0 auto;padding:20px}
.tabs{display:flex;gap:4px;background:#fff;border-radius:12px;padding:4px;margin-bottom:20px;box-shadow:0 1px 3px rgba(0,0,0,.08);overflow-x:auto}
.tab-btn{padding:10px 20px;border:none;background:transparent;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;color:#64748b;transition:all .2s;white-space:nowrap;font-family:inherit}
.tab-btn:hover{background:#f1f5f9;color:#1a1a2e}
.tab-btn.active{background:#1a1a2e;color:#fff}
.tab-content{display:none}
.tab-content.active{display:block}
.filters-bar{background:#fff;border-radius:12px;padding:16px 20px;display:flex;align-items:center;gap:12px;flex-wrap:wrap;box-shadow:0 1px 3px rgba(0,0,0,.08);margin-bottom:20px}
.filters-bar label{font-size:13px;color:#64748b;font-weight:500}
.filters-bar select,.filters-bar input{padding:8px 12px;border:1px solid #e2e8f0;border-radius:8px;font-size:13px;background:#f8fafc;font-family:inherit;outline:none}
.filters-bar select:focus,.filters-bar input:focus{border-color:#0f3460}
.btn{padding:8px 16px;border:none;border-radius:8px;font-size:13px;font-weight:500;cursor:pointer;transition:all .2s;font-family:inherit}
.btn-primary{background:#0f3460;color:#fff}
.btn-primary:hover{background:#1a4a7a}
.btn-success{background:#10b981;color:#fff}
.btn-success:hover{background:#059669}
.btn-danger{background:#ef4444;color:#fff}
.btn-outline{background:transparent;border:1px solid #e2e8f0;color:#64748b}
.btn-outline:hover{background:#f8fafc}
.btn-sm{padding:6px 12px;font-size:12px}
.metrics-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:16px;margin-bottom:20px}
.metric-card{background:#fff;border-radius:12px;padding:20px;box-shadow:0 1px 3px rgba(0,0,0,.08);text-align:center}
.metric-card .label{font-size:11px;text-transform:uppercase;letter-spacing:1px;color:#94a3b8;margin-bottom:8px}
.metric-card .value{font-size:26px;font-weight:700}
.metric-card .value.positive{color:#10b981}
.metric-card .value.negative{color:#ef4444}
.charts-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-bottom:20px}
.chart-card{background:#fff;border-radius:12px;padding:20px;box-shadow:0 1px 3px rgba(0,0,0,.08)}
.chart-card h3{font-size:14px;font-weight:600;color:#1e293b;margin-bottom:16px}
.chart-card .chart-container{position:relative;height:300px}
.table-wrapper{background:#fff;border-radius:12px;box-shadow:0 1px 3px rgba(0,0,0,.08);overflow:hidden}
.table-toolbar{display:flex;align-items:center;gap:12px;padding:16px 20px;border-bottom:1px solid #e2e8f0;flex-wrap:wrap}
.table-toolbar .search-box{flex:1;min-width:200px}
.table-toolbar .search-box input{width:100%;padding:8px 12px 8px 36px;border:1px solid #e2e8f0;border-radius:8px;font-size:13px;background:#f8fafc;outline:none;font-family:inherit}
table{width:100%;border-collapse:collapse;font-size:13px}
th{padding:12px 16px;text-align:left;font-weight:600;color:#64748b;border-bottom:1px solid #e2e8f0;cursor:pointer;user-select:none;white-space:nowrap;background:#f8fafc}
th:hover{color:#1a1a2e}
td{padding:10px 16px;border-bottom:1px solid #f1f5f9}
tr:hover td{background:#f8fafc}
.badge-cat{display:inline-block;padding:2px 10px;border-radius:12px;font-size:11px;font-weight:500;background:#e2e8f0}
.badge-ingreso{background:#d1fae5;color:#065f46}
.badge-gasto{background:#fee2e2;color:#991b1b}
.importe-pos{color:#10b981;font-weight:600}
.importe-neg{color:#ef4444;font-weight:600}
.pagination{display:flex;align-items:center;justify-content:space-between;padding:12px 20px;border-top:1px solid #e2e8f0}
.pagination-info{font-size:13px;color:#64748b}
.pagination-btns{display:flex;gap:4px}
.pagination-btns button{padding:6px 12px;border:1px solid #e2e8f0;border-radius:6px;background:#fff;cursor:pointer;font-size:13px;font-family:inherit}
.pagination-btns button:hover{background:#f8fafc}
.pagination-btns button.active{background:#0f3460;color:#fff;border-color:#0f3460}
.analisis-controls{background:#fff;border-radius:12px;padding:16px 20px;display:flex;align-items:center;gap:12px;flex-wrap:wrap;box-shadow:0 1px 3px rgba(0,0,0,.08);margin-bottom:20px}
.analisis-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:20px;margin-bottom:20px}
.analisis-texto{background:#1e293b;border-radius:12px;padding:20px;box-shadow:0 1px 3px rgba(0,0,0,.08);margin-bottom:20px;color:#e2e8f0;font-family:'Courier New',monospace;font-size:13px;line-height:1.6;max-height:400px;overflow-y:auto}
.analisis-texto .cat-title{color:#fbbf24;font-weight:600}
.analisis-texto .cat-val{color:#34d399}
.analisis-texto .cat-pct{color:#94a3b8}
.analisis-texto .trans-item{color:#cbd5e1;padding-left:20px}
.analisis-texto .trans-importe{color:#f87171}
.analisis-texto .separator{color:#475569}
.analisis-texto .summary{color:#60a5fa;font-weight:600}
.cat-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px}
.cat-card{background:#fff;border-radius:12px;padding:20px;box-shadow:0 1px 3px rgba(0,0,0,.08)}
.cat-card h3{font-size:14px;font-weight:600;color:#1e293b;margin-bottom:12px}
.cat-list{list-style:none;max-height:400px;overflow-y:auto}
.cat-list li{padding:10px 14px;border:1px solid #e2e8f0;border-radius:8px;margin-bottom:6px;cursor:pointer;transition:all .15s;font-size:13px}
.cat-list li:hover{border-color:#0f3460;background:#f1f5f9}
.cat-list li.active{border-color:#0f3460;background:#eef2ff}
.cat-list li .cat-meta{font-size:11px;color:#94a3b8;margin-top:4px}
.palabras-area{min-height:150px;width:100%;padding:12px;border:1px solid #e2e8f0;border-radius:8px;font-size:13px;font-family:'Courier New',monospace;background:#f8fafc;resize:vertical;outline:none}
.palabras-area:focus{border-color:#0f3460}
.cat-stats{background:#f8fafc;border-radius:8px;padding:14px;margin-top:12px;font-size:13px;line-height:1.8}
.cat-stats .stat-label{color:#64748b}
.cat-stats .stat-val{font-weight:600;color:#1a1a2e}
.toast{position:fixed;bottom:20px;right:20px;padding:12px 20px;border-radius:10px;color:#fff;font-size:13px;font-weight:500;box-shadow:0 4px 12px rgba(0,0,0,.15);z-index:1000;transform:translateY(100px);opacity:0;transition:all .3s ease}
.toast.show{transform:translateY(0);opacity:1}
.toast.success{background:#10b981}
.toast.error{background:#ef4444}
.toast.info{background:#0f3460}
.sugerencias-card{background:#fff;border-radius:12px;padding:20px;margin-top:20px;box-shadow:0 1px 3px rgba(0,0,0,.08)}
.sugerencias-card h3{font-size:14px;font-weight:600;color:#1e293b;margin-bottom:4px}
.sugerencias-sub{font-size:12px;color:#94a3b8;margin-bottom:16px}
.sugerencia-item{display:flex;align-items:center;justify-content:space-between;padding:12px 14px;border:1px solid #e2e8f0;border-radius:8px;margin-bottom:8px;gap:12px;flex-wrap:wrap}
.sugerencia-item:hover{background:#f8fafc}
.sugerencia-palabra{font-weight:600;font-size:13px;color:#0f3460;min-width:120px}
.sugerencia-info{font-size:12px;color:#64748b;flex:1}
.sugerencia-ejemplos{font-size:11px;color:#94a3b8;margin-top:2px}
.sugerencia-accion{display:flex;gap:6px;align-items:center}
.sugerencia-accion select{padding:5px 8px;border:1px solid #d1d5db;border-radius:6px;font-size:12px;font-family:inherit;background:#fff;outline:none}
.sugerencia-accion button{padding:5px 12px;font-size:11px;border:none;border-radius:6px;cursor:pointer;font-family:inherit;font-weight:500}
.sugerencia-accion .btn-asignar{background:#0f3460;color:#fff}
.sugerencia-accion .btn-asignar:hover{background:#16213e}
.sugerencia-accion .btn-omitir{background:#e2e8f0;color:#64748b}
.sugerencia-accion .btn-omitir:hover{background:#cbd5e1}
.sugerencia-vacia{color:#94a3b8;font-size:13px;padding:12px 0;text-align:center}

/* Categoria inline edit */
.cat-text{cursor:pointer;color:#0f3460;font-weight:500;padding:2px 6px;border-radius:4px;display:inline-block;transition:background .15s}
.cat-text:hover{background:#e8edf5}
.cat-selector-popup button:hover{background:#f0f4ff!important}
@media(max-width:900px){.charts-grid,.analisis-grid,.cat-grid{grid-template-columns:1fr}.metrics-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:600px){.metrics-grid{grid-template-columns:1fr}.header{padding:15px 20px;flex-direction:column;text-align:center;gap:10px}}
