/* ============================================
   PITCHU BUDGET - Desktop-First Design
   ============================================ */

:root {
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --accent: #8b5cf6;
    --accent-light: #ede9fe;
    --accent-dark: #7c3aed;
    --accent-blue: #3b82f6;
    --accent-blue-light: #dbeafe;
    --accent-green: #10b981;
    --accent-green-light: #d1fae5;
    --accent-red: #ef4444;
    --accent-red-light: #fee2e2;
    --accent-amber: #f59e0b;
    --accent-amber-light: #fef3c7;
    --pawel: #8b5cf6;
    --pawel-light: #ede9fe;
    --seb: #f59e0b;
    --seb-light: #fef3c7;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08);
    --radius: 14px;
    --radius-sm: 10px;
    --radius-full: 9999px;
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: var(--bg);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
    text-align: center;
}

.login-logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent), var(--accent-blue));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin: 0 auto 1rem;
    box-shadow: var(--shadow);
}

.login-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.login-error {
    color: var(--accent-red);
    font-size: 0.8125rem;
    margin-top: 1rem;
    min-height: 1.25rem;
}

/* ============================================
   HEADER
   ============================================ */
.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: var(--shadow-sm);
}

.header-inner {
    max-width: 1500px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 60px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-logo {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--accent), var(--accent-blue));
    border: none;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, var(--accent), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    cursor: pointer;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-user {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg);
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-full);
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-card);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   TABS NAVIGATION
   ============================================ */
.tabs-nav {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 60px;
    z-index: 190;
}

.tabs-inner {
    max-width: 1500px;
    margin: 0 auto;
    display: flex;
    gap: 0;
    padding: 0 2rem;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.tabs-inner::-webkit-scrollbar { display: none; }

.tab-btn {
    background: none;
    border: none;
    padding: 0.875rem 1.25rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.tab-btn.active {
    color: var(--accent);
    font-weight: 600;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0.5rem;
    right: 0.5rem;
    height: 2px;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
}

.tab-icon {
    font-size: 1rem;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.app-main {
    max-width: 1500px;
    margin: 0 auto;
    padding: 2rem;
}

.page-section {
    display: none;
}

.page-section.active {
    display: block;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--text);
    background: var(--bg-card);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-blue));
    border: none;
    color: white;
    padding: 0.625rem 1.5rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.625rem 1.5rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--text-muted);
    color: var(--text);
}

.btn-danger {
    background: var(--accent-red-light);
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: var(--accent-red);
    color: white;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

/* ============================================
   SUMMARY CARDS
   ============================================ */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

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

.summary-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.summary-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.summary-label {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
}

.summary-value {
    font-size: 1.625rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.summary-card.positive .summary-icon { background: var(--accent-green-light); color: var(--accent-green); }
.summary-card.positive .summary-value { color: var(--accent-green); }
.summary-card.negative .summary-icon { background: var(--accent-red-light); color: var(--accent-red); }
.summary-card.negative .summary-value { color: var(--accent-red); }
.summary-card.savings .summary-icon { background: var(--accent-light); color: var(--accent); }
.summary-card.savings .summary-value { color: var(--accent); }
.summary-card.balance .summary-icon { background: var(--accent-blue-light); color: var(--accent-blue); }
.summary-card.balance .summary-value { color: var(--accent-blue); }

/* ============================================
   TABLE CONTAINER
   ============================================ */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
    overflow: hidden;
}

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

.table-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.table-scroll {
    overflow-x: auto;
}

/* Dashboard budget table: sticky thead clone fixed at top when scrolling */
.budget-thead-clone {
    position: fixed;
    top: 105px; /* header 60px + tabs 45px */
    z-index: 180;
    background: var(--bg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-bottom: 2px solid var(--border);
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
}

.budget-thead-clone.visible {
    opacity: 1;
    pointer-events: auto;
}

.budget-thead-clone table {
    border-collapse: separate;
    border-spacing: 0;
}

.budget-thead-clone th {
    background: var(--bg);
    padding: 0.625rem 0.5rem;
    text-align: right;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: none;
    white-space: nowrap;
}

.budget-thead-clone th:first-child {
    text-align: left;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 800px;
}

table.budget-table {
    min-width: 0;
}

thead th {
    background: var(--bg);
    padding: 0.75rem 0.875rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
}

tbody td {
    padding: 0.75rem 0.875rem;
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:hover {
    background: var(--bg-card-hover);
}

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

/* Budget table specific */
.budget-table {
    table-layout: fixed;
    width: 100%;
    min-width: 0;
}

.budget-table th, .budget-table td {
    text-align: right;
    padding: 0.625rem 0.5rem;
    font-size: 0.8rem;
    white-space: nowrap;
}

.budget-table th:first-child, .budget-table td:first-child {
    text-align: left;
    width: 140px;
    min-width: 110px;
    font-weight: 500;
    position: sticky;
    left: 0;
    background: inherit;
    z-index: 1;
    white-space: normal;
}

.budget-table .row-total {
    font-weight: 600;
    background: var(--bg);
}

.budget-table .row-section-header td {
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: 1rem 0.875rem;
    background: var(--bg);
}

.budget-table .grand-total-row {
    background: var(--accent-blue-light);
}

.budget-table .grand-total-row td {
    font-weight: 700;
    font-size: 0.875rem;
}

.positive-value { color: var(--accent-green); font-weight: 500; }
.negative-value { color: var(--accent-red); font-weight: 500; }
.savings-value { color: var(--accent); font-weight: 500; }
.balance-value { color: var(--accent-blue); font-weight: 600; }
.auto-solde-value { color: var(--text-muted); font-weight: 500; font-style: italic; }
.auto-solde-negative { color: var(--accent-red); font-weight: 500; font-style: italic; opacity: 0.7; }

/* Year selector */
.year-selector {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
}

.year-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.year-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text);
}

.year-display {
    font-size: 1rem;
    font-weight: 600;
    min-width: 60px;
    text-align: center;
}

/* Magic mode button */
.magic-btn {
    background: var(--bg);
    border: 2px solid var(--border);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.8125rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    font-family: inherit;
}

.magic-btn:hover {
    border-color: var(--accent-amber);
    color: var(--accent-amber);
}

.magic-btn.active {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    border-color: transparent;
    color: white;
    box-shadow: var(--shadow);
}

.magic-btn .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.magic-btn.active .status-dot {
    background: white;
    box-shadow: 0 0 8px rgba(255,255,255,0.8);
    animation: pulse 1.5s ease-in-out infinite;
}

/* ============================================
   CRUD TABLE (Recettes, Depenses, etc.)
   ============================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h2 {
    font-size: 1.375rem;
    font-weight: 700;
}

.filters-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.filters-card.compact {
    padding: 0.625rem 0.875rem;
}

.filters-toolbar {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-wrap: wrap;
}

.filters-status {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 0.25rem 0.625rem;
}

.filter-search-input {
    width: auto;
    min-width: 200px;
    max-width: 260px;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-full);
}

.filter-sort-select {
    width: auto;
    min-width: 130px;
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-top: 0.625rem;
}

.filters-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.25rem;
}

.page-filters {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-chip {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-chip:hover, .filter-chip.active {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.crud-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.375rem;
    border-radius: 6px;
    color: var(--text-muted);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background: var(--bg);
    color: var(--text);
}

.action-btn.edit:hover { color: var(--accent-blue); background: var(--accent-blue-light); }
.action-btn.delete:hover { color: var(--accent-red); background: var(--accent-red-light); }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    font-weight: 600;
}

.badge-active { background: var(--accent-green-light); color: var(--accent-green); }
.badge-inactive { background: var(--bg); color: var(--text-muted); }
.badge-freq { background: var(--accent-blue-light); color: var(--accent-blue); }
.badge-cat { background: var(--accent-light); color: var(--accent); }

.meta-info {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
}

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

.modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: var(--bg);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--accent-red-light);
    color: var(--accent-red);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ============================================
   PROJECTS CARDS
   ============================================ */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

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

.project-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-blue));
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.project-name { font-weight: 600; font-size: 1rem; }

.project-category {
    font-size: 0.6875rem;
    font-weight: 500;
    background: var(--accent-light);
    color: var(--accent);
    padding: 0.25rem 0.625rem;
    border-radius: 20px;
}

.project-description {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.project-details {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.project-detail { text-align: center; }
.project-detail-label { font-size: 0.6875rem; color: var(--text-muted); margin-bottom: 0.25rem; text-transform: uppercase; letter-spacing: 0.03em; }
.project-detail-value { font-weight: 600; font-size: 0.875rem; color: var(--accent); }
.project-detail-value.deadline { color: var(--accent-amber); }

/* ============================================
   VIREMENTS PROGRESS BAR
   ============================================ */

/* Full-size progress bar (detail view) */
.virement-progress-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
}

.virement-progress-bar {
    height: 12px;
    background: var(--bg);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.virement-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
    min-width: 0;
}

.virement-progress-label {
    text-align: center;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Mini progress bar (list view, inside table cells) */
.virement-progress-mini {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 120px;
}

.virement-progress-bar-mini {
    height: 6px;
    background: var(--bg);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.virement-progress-fill-mini {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
    min-width: 0;
}

.virement-progress-text {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ============================================
   TOOLTIPS
   ============================================ */
.cell-with-tooltip {
    position: relative;
    cursor: help;
}

.tooltip {
    display: none;
    position: fixed;
    z-index: 1000;
    background: var(--text);
    color: white;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    max-width: 400px;
    white-space: normal;
    pointer-events: none;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: var(--text);
}

.cell-with-tooltip:hover .tooltip {
    display: block;
}

.tooltip-title {
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.tooltip-item {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 0.375rem 0;
}

.tooltip-item-label { color: rgba(255,255,255,0.85); flex: 1; }
.tooltip-item-amount { font-weight: 600; white-space: nowrap; }

/* ============================================
   LOADING
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(248, 250, 252, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.3s;
}

.loading-overlay.hidden { opacity: 0; pointer-events: none; }

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    margin-top: 1.25rem;
    color: var(--text-secondary);
    font-weight: 500;
}

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.875rem 1.25rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    animation: slideIn 0.3s ease;
    min-width: 280px;
}

.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--accent-red); }
.toast.info { border-left: 3px solid var(--accent-blue); }

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

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.empty-state h4 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.param-help {
    padding: 1rem 1.5rem 1.25rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.param-help p {
    margin-bottom: 0.625rem;
}

.param-help pre {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.625rem 0.75rem;
    overflow-x: auto;
    margin-bottom: 0.625rem;
}

.param-help code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8125rem;
}

.param-help ul {
    margin: 0 0 0.75rem 1rem;
}

.param-help-note {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* ============================================
   CONFIRM DIALOG
   ============================================ */
.confirm-text {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-secondary);
    text-align: center;
    padding: 1rem 0;
}

.confirm-text strong {
    color: var(--text);
}

/* ============================================
   MENU (reuse same as taches)
   ============================================ */
.site-menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 300;
}

.site-menu-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.site-menu-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    background: var(--bg-card);
    z-index: 310;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.site-menu-panel.open {
    transform: translateX(0);
}

.site-menu-group { margin-bottom: 1.25rem; }

.site-menu-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.625rem;
    padding-left: 0.5rem;
}

.site-menu-items { display: flex; flex-direction: column; gap: 0.25rem; }

.site-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s;
}

.site-menu-item:hover { background: var(--bg); }

.site-menu-item.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

.site-menu-icon { font-size: 1.125rem; width: 1.5rem; text-align: center; }
.site-menu-divider { height: 1px; background: var(--border); margin: 0.75rem 0; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .header-inner { padding: 0 1rem; }
    .tabs-inner { padding: 0 1rem; }
    .app-main { padding: 1.25rem; }
    .summary-grid { grid-template-columns: 1fr 1fr; }
    .projects-grid { grid-template-columns: 1fr; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .filter-grid { grid-template-columns: 1fr 1fr; }
    .filters-toolbar { gap: 0.5rem; }
    .filters-status { order: 3; width: 100%; }
    .filter-sort-select { min-width: 0; width: calc(50% - 0.25rem); }
    .page-header { flex-direction: column; align-items: flex-start; }
}

/* ---- Edit History (modal) ---- */

.edit-history {
    margin-top: 1.5rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.edit-history-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.75rem;
}

.edit-history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.edit-history-entry {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
}

.edit-history-meta {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.edit-history-changes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.history-change {
    background: var(--accent-light);
    color: var(--accent);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    white-space: nowrap;
}

.history-change strong {
    font-weight: 600;
}

/* ---- Corbeille (Deleted Items) ---- */

.deleted-section {
    margin-top: 1.5rem;
}

.deleted-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: background 0.15s;
    user-select: none;
}

.deleted-header:hover {
    background: var(--bg-card-hover);
}

.deleted-chevron {
    margin-left: auto;
    transition: transform 0.2s;
}

.deleted-header.open .deleted-chevron {
    transform: rotate(180deg);
}

.deleted-body {
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    background: var(--bg-card);
}

.deleted-body table {
    opacity: 0.65;
}

.deleted-row td {
    text-decoration: line-through;
    color: var(--text-muted);
}

.deleted-row .badge,
.deleted-row .positive-value,
.deleted-row .negative-value {
    opacity: 0.6;
}

.deleted-row .restore-btn {
    text-decoration: none;
}

.action-btn.restore-btn {
    color: var(--accent-green);
    border-color: var(--accent-green);
}

.action-btn.restore-btn:hover {
    background: var(--accent-green-light);
}

/* ---- Category Editor ---- */

.cat-editor-list {
    padding: 0.5rem 0;
}

.cat-editor-items {
    display: flex;
    flex-direction: column;
}

.cat-editor-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.5rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

.cat-editor-item:last-child {
    border-bottom: none;
}

.cat-editor-item:hover {
    background: var(--bg);
}

.cat-editor-emoji {
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

.cat-editor-name {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
}

.cat-editor-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.cat-editor-item:hover .cat-editor-actions {
    opacity: 1;
}

.cat-editor-actions .action-btn {
    width: 28px;
    height: 28px;
}

.cat-editor-actions .action-btn[disabled] {
    opacity: 0.2;
    pointer-events: none;
}

/* Emoji input field */
.cat-emoji-input {
    text-align: center;
    font-size: 1.25rem;
    padding: 0.5rem;
    width: 100%;
}

/* Clickable emoji button in category editor */
.cat-emoji-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
    padding: 0;
}

.cat-emoji-btn:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    transform: scale(1.15);
}
