* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #0f172a; color: #e2e8f0; min-height: 100vh; }
a { cursor: pointer; color: #60a5fa; text-decoration: none; }

header { background: #1e293b; border-bottom: 1px solid #334155; padding: 0.5rem 1rem; display: flex; align-items: center; gap: 0.75rem; flex-wrap: nowrap; overflow-x: auto; }
header h1 { font-size: 1.1rem; font-weight: 700; color: #60a5fa; white-space: nowrap; }
header .brand { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
nav { display: flex; gap: 0.15rem; flex-shrink: 0; overflow-x: auto; scrollbar-width: none; }
nav::-webkit-scrollbar { display: none; }
nav a { padding: 0.35rem 0.6rem; border-radius: 6px; font-size: 0.78rem; color: #94a3b8; transition: all .15s; white-space: nowrap; }
nav a:hover { background: #334155; color: #e2e8f0; }
nav a.active { background: #2563eb; color: #fff; }
.logout-link { color: #f87171 !important; margin-left: auto; }

.btn-refresh { background: #334155; margin-right: 0.5rem; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; }
.btn-refresh:hover { background: #475569; }

.stats-bar { display: flex; gap: 0.6rem; font-size: 0.7rem; color: #94a3b8; align-items: center; margin-left: auto; flex-shrink: 0; }
.stats-bar .debit { color: #f87171; }
.stats-bar .credit { color: #34d399; }
.stats-bar .warning { color: #fbbf24; }
.stats-bar .stat-item { display: flex; align-items: center; gap: 0.25rem; white-space: nowrap; }
.app-select, .app-input { background: #1e293b; color: #e2e8f0; border: 1px solid #334155; border-radius: 6px; padding: 0.35rem 0.5rem; font-size: 0.8rem; outline: none; transition: border-color .15s; }
.app-select:hover, .app-input:hover { border-color: #60a5fa; }
.app-select:focus, .app-input:focus { border-color: #60a5fa; box-shadow: 0 0 0 2px #60a5fa40; }
.app-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2364748b'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.4rem center; padding-right: 1.4rem; cursor: pointer; }
.app-input::placeholder { color: #64748b; }

main { padding: 1.5rem 2rem; max-width: 1400px; margin: 0 auto; }

.card { background: #1e293b; border: 1px solid #334155; border-radius: 10px; padding: 1.25rem; margin-bottom: 1rem; }
.card h3 { font-size: 0.95rem; font-weight: 600; color: #94a3b8; margin-bottom: 0.25rem; text-transform: uppercase; letter-spacing: 0.5px; }
.card-subtitle { font-size: 0.8rem; color: #64748b; margin-bottom: 1rem; }
.card.full { grid-column: 1 / -1; }

.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.chart-grid .card { margin-bottom: 0; }

canvas { max-height: 300px; }

.toolbar { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.search-input { flex: 1; min-width: 200px; padding: 0.5rem 0.75rem; border: 1px solid #334155; border-radius: 6px; background: #1e293b; color: #e2e8f0; font-size: 0.9rem; }
.toolbar select { padding: 0.5rem; border: 1px solid #334155; border-radius: 6px; background: #1e293b; color: #e2e8f0; }
input, select { outline: none; }
input:focus, select:focus { border-color: #60a5fa; }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th { text-align: left; padding: 0.6rem 0.5rem; color: #64748b; font-weight: 600; border-bottom: 1px solid #334155; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: #60a5fa; }
.sort-arrow { font-size: 0.65rem; margin-left: 0.15rem; color: #64748b; }
td { padding: 0.4rem 0.5rem; border-bottom: 1px solid #1e293b; }
tr:hover td { background: #0f172a40; }
tr.uncat td { background: #7c3aed10; }
tr.exceptional td { opacity: 0.5; text-decoration: line-through; color: #94a3b8; }
tr.exceptional td .btn-small { opacity: 1; }
.label-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.label-cell.clickable { cursor: pointer; text-decoration: underline dotted #64748b; text-underline-offset: 3px; }
.label-cell.clickable:hover { color: #60a5fa; text-decoration-color: #60a5fa; }
.debit { color: #f87171; }
.credit { color: #34d399; }
td select { padding: 0.2rem 0.4rem; border: 1px solid #334155; border-radius: 4px; color: #fff; font-size: 0.8rem; max-width: 130px; }
.col-check { width: 30px; }
.col-actions { white-space: nowrap; width: 70px; }
.tx-legend { display: flex; gap: 1rem; align-items: center; padding: 0.4rem 0.5rem; font-size: 0.7rem; color: #94a3b8; border-bottom: 1px solid #1e293b; }
.tx-legend .legend-item { display: flex; align-items: center; gap: 0.25rem; }

.batch-bar { display: flex; gap: 0.5rem; align-items: center; padding: 0.5rem 0; margin-bottom: 0.5rem; background: #2563eb20; border-radius: 6px; padding: 0.5rem 0.75rem; }
.btn-tiny { background: none; border: 1px solid #334155; color: #94a3b8; cursor: pointer; padding: 0.1rem 0.3rem; border-radius: 4px; font-size: 0.75rem; }
.btn-tiny:hover { background: #1e293b; color: #e2e8f0; }
.filter-label { display: flex; align-items: center; gap: 0.3rem; font-size: 0.75rem; color: #94a3b8; cursor: pointer; white-space: nowrap; }
.filter-label input { cursor: pointer; }
.batch-bar select { padding: 0.3rem 0.5rem; border: 1px solid #334155; border-radius: 4px; background: #1e293b; color: #e2e8f0; }

.pagination { display: flex; gap: 1rem; align-items: center; justify-content: center; padding: 1rem 0; }
.pagination button { padding: 0.3rem 0.8rem; border: 1px solid #334155; border-radius: 4px; background: #1e293b; color: #e2e8f0; cursor: pointer; }
.pagination button:disabled { opacity: 0.4; cursor: default; }

.form-row { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.form-row input[type="text"], .form-row input[type="color"] { padding: 0.5rem; border: 1px solid #334155; border-radius: 6px; background: #0f172a; color: #e2e8f0; }
.form-row input[type="text"] { flex: 1; }

button { padding: 0.4rem 1rem; border: none; border-radius: 6px; background: #2563eb; color: #fff; cursor: pointer; font-size: 0.85rem; transition: background .15s; }
button:hover { background: #1d4ed8; }
button:disabled { opacity: 0.5; cursor: default; }
.btn-small { padding: 0.2rem 0.5rem; font-size: 0.75rem; }
.danger { background: #dc2626; }
.danger:hover { background: #b91c1c; }

.keyword-list, .cat-rules { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.5rem 0; }
.tag { background: #334155; padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.75rem; display: flex; align-items: center; gap: 0.3rem; }
.tag button { background: none; color: #94a3b8; padding: 0; font-size: 0.8rem; line-height: 1; }
.tag button:hover { color: #f87171; }

.cat-list { display: flex; flex-direction: column; gap: 0.5rem; }
.cat-item { padding: 0.75rem; background: #0f172a; border-radius: 6px; }
.cat-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.cat-color { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.cat-count { font-size: 0.75rem; color: #64748b; margin-left: auto; }
.cat-edit-form { margin-top: 0.75rem; padding: 0.75rem; background: #0f172a; border-radius: 6px; border: 1px solid #2563eb; }

.upload-zone { border: 2px dashed #334155; border-radius: 8px; padding: 2rem; text-align: center; cursor: pointer; transition: border-color .15s; }
.upload-zone:hover { border-color: #60a5fa; }
.upload-zone input { display: none; }
.upload-zone p { color: #64748b; }

.import-result { margin-top: 0.5rem; padding: 0.5rem; border-radius: 6px; }
.import-result.success { background: #065f4620; color: #34d399; }
.import-result.error { background: #7f1d1d20; color: #f87171; }

.import-item { display: flex; gap: 1rem; padding: 0.4rem 0; border-bottom: 1px solid #334155; font-size: 0.85rem; }
.import-item .muted { color: #64748b; }

.alert { padding: 0.75rem; margin-bottom: 0.5rem; border-radius: 6px; font-size: 0.85rem; }
.alert-info { background: #1e3a5f20; border-left: 3px solid #60a5fa; }
.alert-warning { background: #713f1220; border-left: 3px solid #fbbf24; }
.alert-error { background: #7f1d1d20; border-left: 3px solid #f87171; }
.alert strong { display: block; margin-bottom: 0.25rem; }
.alert-items { margin-top: 0.5rem; }
.alert-item { padding: 0.2rem 0; font-size: 0.8rem; color: #94a3b8; }
.muted { color: #64748b; }
.empty { text-align: center; padding: 2rem; color: #64748b; }

.modal-overlay { position: fixed; inset: 0; background: #00000080; display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #1e293b; border: 1px solid #334155; border-radius: 10px; padding: 1.5rem; max-width: 500px; width: 90%; }
.modal p { margin-bottom: 0.5rem; }
.modal button { margin-top: 1rem; }

.half { width: calc(50% - 0.5rem); display: inline-block; vertical-align: top; }
.half:nth-child(odd) { margin-right: 1rem; }

.date-range { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.date-range label { font-size: 0.85rem; color: #94a3b8; display: flex; align-items: center; gap: 0.3rem; }
.date-range input[type=date] { padding: 0.4rem 0.6rem; border: 1px solid #334155; border-radius: 6px; background: #0f172a; color: #e2e8f0; font-size: 0.85rem; }
.date-input { width: 140px; padding: 0.5rem; border: 1px solid #334155; border-radius: 6px; background: #0f172a; color: #e2e8f0; font-size: 0.85rem; }

.summary-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.summary-card { text-align: center; padding: 0.75rem; margin-bottom: 0; }
.summary-label { display: block; font-size: 0.7rem; text-transform: uppercase; color: #64748b; letter-spacing: 0.5px; margin-bottom: 0.3rem; }
.summary-value { font-size: 1.2rem; font-weight: 700; }
.cat-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 0.3rem; vertical-align: middle; }

.trend { font-size: 0.8rem; padding: 0.15rem 0.4rem; border-radius: 4px; }
.trend-up { color: #f87171; background: #7f1d1d40; }
.trend-down { color: #34d399; background: #065f4640; }
.trend-flat { color: #94a3b8; background: #33415540; }

.top-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0; border-bottom: 1px solid #1e293b; font-size: 0.8rem; }
.top-rank { width: 20px; height: 20px; border-radius: 50%; background: #334155; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; flex-shrink: 0; }
.top-info { flex: 1; min-width: 0; }
.top-label { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-meta { display: block; font-size: 0.7rem; color: #64748b; }
.top-amount { font-weight: 700; color: #f87171; white-space: nowrap; }

.savings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; }
.savings-card { background: #0f172a; border-radius: 8px; padding: 1rem; text-align: center; }
.savings-header { margin-bottom: 0.5rem; }
.savings-total { font-size: 1.4rem; font-weight: 700; color: #f87171; }
.savings-detail { font-size: 0.8rem; color: #64748b; margin: 0.3rem 0; }
.savings-suggest { font-size: 0.8rem; color: #34d399; background: #065f4620; padding: 0.3rem; border-radius: 4px; margin-top: 0.3rem; }

.recurring-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.75rem; }
.recurring-card { background: #0f172a; border-radius: 8px; padding: 0.75rem; }
.recurring-header { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.5rem; font-size: 0.85rem; }
.recurring-cat { font-size: 0.65rem; color: #64748b; background: #1e293b; padding: 0.1rem 0.4rem; border-radius: 3px; margin-left: auto; }
.recurring-stats { display: flex; gap: 0.75rem; font-size: 0.75rem; color: #94a3b8; margin-bottom: 0.25rem; }
.recurring-total { margin-left: auto; font-weight: 700; color: #f87171; }
.recurring-sparkline { line-height: 0; margin: 0.25rem 0; overflow: visible; }
.recurring-sparkline svg { display: block; overflow: visible; }
.spark-dot { transition: opacity 0.1s; cursor: pointer; }
.spark-dot-group:hover .spark-dot { opacity: 1; }
.spark-dot-group:hover .spark-label { display: block !important; }
.spark-label { font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,0.8); }
.recurring-months { display: flex; justify-content: space-between; font-size: 0.55rem; color: #64748b; padding: 0 4px; }
.recurring-months span { flex: 1; text-align: center; }

.tx-pie-row { display: flex; gap: 1rem; margin-bottom: 1rem; align-items: stretch; }
.tx-pie-card { flex: 0 0 200px; margin-bottom: 0; display: flex; align-items: center; justify-content: center; }
.tx-pie-card canvas { max-height: 180px; max-width: 180px; }
.tx-pie-legend { flex: 1; display: flex; flex-wrap: wrap; gap: 0.3rem; align-content: flex-start; }
.tx-legend-item { display: flex; align-items: center; gap: 0.3rem; padding: 0.3rem 0.5rem; background: #0f172a; border-radius: 6px; cursor: pointer; font-size: 0.8rem; transition: all .15s; min-width: 120px; }
.tx-legend-item:hover { background: #1e293b; }
.tx-legend-item.disabled { opacity: 0.35; text-decoration: line-through; }
.tx-legend-label { flex: 1; }
.tx-legend-count { color: #64748b; font-size: 0.7rem; }
.tx-legend-amount { font-weight: 600; }

.virement-sums { display: flex; flex-direction: column; font-size: 0.75rem; margin: 0.2rem 0; line-height: 1.1; }
.virement-cell { display: flex; flex-direction: column; font-size: 0.7rem; line-height: 1.2; padding: 0.2rem 0; }
.virement-flows { display: flex; flex-direction: column; opacity: 0.8; font-size: 0.65rem; }
.virement-balance { display: flex; flex-direction: column; border-top: 1px solid #334155; margin-top: 0.2rem; padding-top: 0.1rem; }
.virement-balance strong { font-size: 0.85rem; }
.virement-diff { font-size: 0.65rem; font-weight: 600; opacity: 0.9; }

.suggestions-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.5rem; }
.suggestion-item { background: #0f172a; padding: 0.5rem 0.75rem; border-radius: 6px; display: flex; align-items: center; justify-content: space-between; font-size: 0.8rem; border: 1px solid #334155; }
.suggestion-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 0.5rem; }

.flex-between { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
tr.active td { background: #2563eb20; }

.advanced-chart-box { padding: 0.5rem 0; }
.fixed-var-bar { display: flex; height: 24px; border-radius: 6px; overflow: hidden; margin-bottom: 1rem; font-size: 0.75rem; font-weight: 600; color: #fff; line-height: 24px; }
.bar-part { text-align: center; white-space: nowrap; transition: width 0.3s; }
.bar-part.fixed { background: #3b82f6; }
.bar-part.variable { background: #f59e0b; }
.advanced-details p { font-size: 0.85rem; color: #94a3b8; margin-bottom: 0.25rem; }

.distrib-grid { display: flex; flex-direction: column; gap: 0.5rem; }
.distrib-item { display: flex; align-items: center; gap: 0.75rem; font-size: 0.8rem; }
.distrib-label { width: 120px; color: #94a3b8; }
.distrib-bar-bg { flex: 1; height: 8px; background: #334155; border-radius: 4px; overflow: hidden; }
.distrib-bar-fill { height: 100%; background: #60a5fa; border-radius: 4px; }
.distrib-pct { width: 40px; text-align: right; font-weight: 600; }

.savings-rate-row { display: flex; gap: 1rem; overflow-x: auto; padding: 0.5rem 0; }
.savings-rate-item { flex: 0 0 80px; text-align: center; display: flex; flex-direction: column; gap: 0.5rem; }
.rate-bubble { width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto; font-size: 0.8rem; font-weight: 700; border: 2px solid transparent; }
.rate-high { background: #065f4640; color: #34d399; border-color: #34d399; }
.rate-mid { background: #713f1240; color: #fbbf24; border-color: #fbbf24; }
.rate-neg { background: #7f1d1d40; color: #f87171; border-color: #f87171; }

/* Financial Health */
.finhealth-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.fh-card { background: #0f172a; border: 1px solid #334155; border-radius: 10px; padding: 1rem; text-align: center; }
.fh-card .fh-label { display: block; font-size: 0.65rem; text-transform: uppercase; color: #64748b; letter-spacing: 0.5px; margin-bottom: 0.3rem; }
.fh-card .fh-value { font-size: 1.3rem; font-weight: 700; }
.fh-card .fh-sub { font-size: 0.75rem; color: #64748b; margin-top: 0.2rem; }
.fh-card .fh-bar-bg { height: 6px; background: #334155; border-radius: 3px; margin: 0.5rem 0; overflow: hidden; }
.fh-card .fh-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s; }
.fh-trend-up { color: #34d399; }
.fh-trend-down { color: #f87171; }
.fh-trend-stable { color: #fbbf24; }

.fh-highlight { border: 1px solid #2563eb; background: #1e3a5f20; }
.fh-row { display: flex; gap: 0.5rem; align-items: center; }

.recommendations { display: flex; flex-direction: column; gap: 0.5rem; }
.rec-card { padding: 0.75rem; border-radius: 8px; border-left: 3px solid; font-size: 0.85rem; }
.rec-card.rec-success { background: #065f4620; border-color: #34d399; }
.rec-card.rec-info { background: #1e3a5f20; border-color: #60a5fa; }
.rec-card.rec-warning { background: #713f1220; border-color: #fbbf24; }
.rec-card.rec-error { background: #7f1d1d20; border-color: #f87171; }
.rec-card .rec-title { font-weight: 600; margin-bottom: 0.2rem; }
.rec-card .rec-msg { color: #94a3b8; margin-bottom: 0.3rem; }
.rec-card .rec-solution { color: #e2e8f0; font-size: 0.8rem; background: #0f172a; padding: 0.4rem 0.6rem; border-radius: 6px; }
.rec-card .rec-solution::before { content: "💡 "; }

/* Budget */
.budget-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.75rem; }
.budget-card { background: #0f172a; border-radius: 8px; padding: 0.75rem; border: 1px solid #334155; }
.budget-card.budget-over { border-color: #f87171; }
.budget-header { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; margin-bottom: 0.5rem; }
.budget-header strong { flex: 1; }
.budget-bar-bg { height: 8px; background: #334155; border-radius: 4px; overflow: hidden; margin-bottom: 0.4rem; }
.budget-bar-fill { height: 100%; border-radius: 4px; transition: width 0.3s; }
.budget-numbers { display: flex; gap: 0.3rem; font-size: 0.8rem; align-items: baseline; }
.budget-numbers .muted { font-size: 0.75rem; }
.budget-edit { margin-top: 0.3rem; }
.budget-input { width: 80px; padding: 0.2rem 0.4rem; border: 1px solid #334155; border-radius: 4px; background: #0f172a; color: #e2e8f0; font-size: 0.8rem; }

/* Charges fixes */
.fixed-grid { display: flex; flex-direction: column; gap: 0.4rem; }
.fixed-item { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.5rem 0.6rem; background: #0f172a; border-radius: 6px; border: 1px solid #1e293b; font-size: 0.8rem; }
.fixed-item.fixed-inactive { opacity: 0.5; }
.fixed-item.fixed-auto { border-left: 3px solid #3b82f6; }
.fixed-header { display: flex; align-items: center; gap: 0.3rem; flex: 1; min-width: 140px; }
.fixed-source-badge { font-size: 0.7rem; }
.fixed-details { display: flex; gap: 0.5rem; align-items: center; }
.fixed-amount { font-weight: 600; color: #f87171; }
.fixed-actions { display: flex; gap: 0.2rem; margin-left: auto; }
.fixed-edit-form { display: flex; gap: 0.3rem; width: 100%; margin-top: 0.3rem; padding-top: 0.3rem; border-top: 1px solid #1e293b; }
.fixed-edit-form input, .fixed-edit-form select { flex: 1; }
.fixed-add-form { background: #0f172a; border-radius: 8px; padding: 0.7rem; margin-bottom: 0.7rem; border: 1px solid #334155; }
.fixed-tx-list { width: 100%; margin-top: 0.3rem; padding-top: 0.3rem; border-top: 1px solid #1e293b; max-height: 180px; overflow-y: auto; }
.fixed-tx-item { display: flex; gap: 0.4rem; align-items: center; padding: 0.2rem 0; border-bottom: 1px solid #0f172a; }
.budget-tx-list { width: 100%; margin-top: 0.3rem; padding-top: 0.3rem; border-top: 1px solid #1e293b; max-height: 200px; overflow-y: auto; }
.budget-tx-item { display: flex; gap: 0.4rem; align-items: center; padding: 0.2rem 0; border-bottom: 1px solid #0f172a; }

/* 50/30/20 Rule */
.rule-50-30-20-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.rule-card { background: #0f172a; border-radius: 8px; padding: 1rem; border: 1px solid #334155; }
.rule-card.rule-ok { border-color: #334155; }
.rule-card.rule-over { border-color: #f87171; }
.rule-header { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.5rem; }
.rule-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.rule-pct { margin-left: auto; font-weight: 700; font-size: 1rem; }
.rule-bar-bg { height: 6px; background: #334155; border-radius: 3px; overflow: hidden; margin-bottom: 0.4rem; }
.rule-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
.rule-numbers { display: flex; justify-content: space-between; font-size: 0.75rem; color: #94a3b8; }
.rule-warning { margin-top: 0.3rem; font-size: 0.75rem; color: #f87171; }
.rule-explain { background: #0f172a; border-radius: 8px; padding: 0.75rem 1rem; margin-bottom: 0.75rem; font-size: 0.85rem; line-height: 1.5; }
.rule-explain ul { margin: 0.5rem 0 0 1rem; }
.rule-explain li { margin-bottom: 0.3rem; }
.rule-summary { margin-top: 0.75rem; padding: 0.75rem; background: #0f172a; border-radius: 8px; font-size: 0.85rem; line-height: 1.5; }

/* Goals */
.goals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.75rem; }
.goal-card { background: #0f172a; border-radius: 8px; padding: 0.75rem; border: 1px solid #334155; }
.goal-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.goal-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; flex-shrink: 0; }
.goal-info { flex: 1; }
.goal-info strong { display: block; font-size: 0.9rem; }
.goal-bar-bg { height: 10px; background: #334155; border-radius: 5px; overflow: hidden; margin-bottom: 0.3rem; }
.goal-bar-fill { height: 100%; border-radius: 5px; transition: width 0.5s; }
.goal-numbers { display: flex; gap: 0.3rem; font-size: 0.85rem; align-items: baseline; }
.goal-pct { margin-left: auto; font-weight: 700; font-size: 0.9rem; }
.goal-details { display: flex; gap: 0.75rem; font-size: 0.7rem; color: #64748b; margin-top: 0.3rem; }
.goal-add { display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; border-style: dashed; min-height: 120px; }
.goal-add:hover { border-color: #60a5fa; }
.goal-add-icon { font-size: 2rem; color: #64748b; margin-bottom: 0.3rem; }
.goal-form { background: #0f172a; border-radius: 8px; padding: 1rem; margin-top: 0.75rem; border: 1px solid #2563eb; }

/* Simulation */
.sim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; }
.sim-field label { display: block; font-size: 0.75rem; color: #64748b; margin-bottom: 0.2rem; }
.sim-result { margin-top: 0.75rem; }
.sim-result-cards { display: flex; gap: 1rem; }
.sim-result-card { background: #0f172a; border-radius: 8px; padding: 0.75rem 1rem; text-align: center; flex: 1; border: 1px solid #334155; }
.sim-result-card strong { display: block; font-size: 1.2rem; margin: 0.2rem 0; }
.sim-result-card .muted { font-size: 0.7rem; }

/* Forecast */
.forecast-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.forecast-chart-box { margin: 1rem 0; background: #0f172a; border-radius: 8px; padding: 0.5rem; }
.premium-badge { font-size: 0.65rem; color: #fbbf24; background: #713f1240; padding: 0.15rem 0.5rem; border-radius: 4px; border: 1px solid #fbbf2440; white-space: nowrap; cursor: help; }
.license-active { padding: 1rem; background: #0f172a; border-radius: 8px; border: 1px solid #10b98140; }
.badge-warning { font-size: 0.75rem; color: #fbbf24; background: #713f1240; padding: 0.15rem 0.5rem; border-radius: 4px; }
.badge-ok { font-size: 0.75rem; color: #34d399; background: #064e3b40; padding: 0.15rem 0.5rem; border-radius: 4px; }

/* Analyse IA */
.ia-score { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; padding: 1.5rem; }
.ia-grade { font-size: 3rem; font-weight: 800; line-height: 1; }
.ia-grade-A .ia-grade { color: #34d399; }
.ia-grade-B .ia-grade { color: #60a5fa; }
.ia-grade-C .ia-grade { color: #fbbf24; }
.ia-grade-D .ia-grade { color: #f87171; }
.ia-score-num { font-size: 1rem; color: #94a3b8; }
.ia-grade-A { border: 2px solid #34d39940; background: #064e3b20; border-radius: 12px; }
.ia-grade-B { border: 2px solid #60a5fa40; background: #1e3a5f20; border-radius: 12px; }
.ia-grade-C { border: 2px solid #fbbf2440; background: #713f1220; border-radius: 12px; }
.ia-grade-D { border: 2px solid #f8717140; background: #7f1d1d20; border-radius: 12px; }
.mom-grid { display: flex; gap: 1.5rem; justify-content: center; text-align: center; }
.mom-grid div { flex: 1; padding: 0.5rem; background: #0f172a; border-radius: 8px; border: 1px solid #1e293b; }
.ia-reco { padding: 0.75rem; margin-bottom: 0.5rem; border-radius: 8px; border-left: 4px solid; }
.ia-reco-critical { background: #7f1d1d20; border-color: #f87171; }
.ia-reco-warning { background: #713f1220; border-color: #fbbf24; }
.ia-reco-success { background: #064e3b20; border-color: #34d399; }
.ia-reco-info { background: #1e3a5f20; border-color: #60a5fa; }
.ia-reco-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.3rem; }
.ia-reco-icon { font-size: 1.2rem; }
.ia-reco-action { margin-top: 0.3rem; font-size: 0.8rem; color: #94a3b8; font-style: italic; }

.ia-ai-response { background: #1e293b; border-radius: 8px; padding: 1rem; margin-top: 0.5rem; line-height: 1.7; font-size: 0.9rem; }

.ia-ai-response h2 { color: #60a5fa; margin: 1rem 0 0.5rem; font-size: 1.1rem; }
.ia-ai-response h3 { color: #a78bfa; margin: 0.8rem 0 0.3rem; font-size: 1rem; }
.ia-ai-response h4 { color: #34d399; margin: 0.5rem 0 0.2rem; font-size: 0.95rem; }
.ia-ai-response strong { color: #fbbf24; }
.ia-ai-response br + br { display: block; margin: 0.5rem 0; }

.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.btn-small { padding: 0.35rem 0.75rem; font-size: 0.8rem; border-radius: 6px; border: 1px solid #334155; background: #1e293b; color: #e2e8f0; cursor: pointer; white-space: nowrap; }
.btn-small:hover { background: #334155; }
.btn-small:disabled { opacity: 0.5; cursor: default; }
.btn-small:disabled:hover { background: #1e293b; }

.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: #60a5fa; }

.highlight { background: #1e293b; font-weight: 600; }
.color-input { width: 40px; height: 32px; padding: 0; border: 1px solid #334155; border-radius: 4px; background: transparent; cursor: pointer; }

/* Auth screen */
.auth-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 2rem;
}
.auth-card {
  background: #1e293b; border: 1px solid #334155; border-radius: 12px;
  padding: 2rem; width: 100%; max-width: 400px;
}
.auth-logo { text-align: center; margin-bottom: 0.5rem; }
.auth-logo h1 { font-size: 1.5rem; color: #60a5fa; margin-top: 0.5rem; }
.auth-subtitle { text-align: center; color: #64748b; font-size: 0.85rem; margin-bottom: 1.5rem; }
.auth-tabs { display: flex; border: 1px solid #334155; border-radius: 8px; overflow: hidden; margin-bottom: 1rem; }
.auth-tabs button {
  flex: 1; padding: 0.5rem; border: none; background: transparent;
  color: #94a3b8; cursor: pointer; font-size: 0.85rem; transition: all .15s;
}
.auth-tabs button.active { background: #2563eb; color: #fff; }
.auth-tabs button:hover:not(.active) { background: #334155; }
.auth-error { background: #7f1d1d40; color: #f87171; padding: 0.5rem 0.75rem; border-radius: 6px; font-size: 0.8rem; margin-bottom: 0.75rem; }
.btn {
  padding: 0.65rem 1.2rem; background: #2563eb; color: #fff;
  border: none; border-radius: 8px; font-size: 0.9rem; cursor: pointer;
}
.btn:hover { background: #1d4ed8; }
.btn.btn-secondary { background: #334155; }
.btn.btn-secondary:hover { background: #475569; }
.auth-card .form-row { margin-bottom: 0.75rem; }
.auth-card .app-input {
  width: 100%; padding: 0.6rem 0.75rem; font-size: 0.9rem;
}

.scenario { background: #1e293b; border-radius: 6px; padding: 0.4rem 0.6rem; font-size: 0.8rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.3rem; }
.scenario-ok { border-left: 3px solid #34d399; }
.scenario-warn { border-left: 3px solid #fbbf24; }
.scenario-ko { border-left: 3px solid #f87171; }

@media (max-width: 768px) {
  .chart-grid { grid-template-columns: 1fr; }
  .half { width: 100%; display: block; }
  .half:nth-child(odd) { margin-right: 0; }
  header { flex-wrap: nowrap; gap: 0.5rem; padding: 0.4rem 0.5rem; }
  .stats-bar { margin-left: 0; flex-wrap: nowrap; gap: 0.3rem; }
  .stats-bar .stat-item { font-size: 0.65rem; }
}
