/* ==========================================================================
   Reset, variables, screen transitions, topbar, toggle, multi-select,
   pill-select, FAB, inputs, buttons, form, file inputs, content list,
   popup, duration/provider rows, filter bar, date header, toast,
   offline banner, and badge system are in shell.css.
   ========================================================================== */

/* ==========================================================================
   3. LAYOUT
   ========================================================================== */

#app {
    position: fixed; inset: 0;
    display: flex; flex-direction: column;
    overflow: hidden;
}
#screens { flex: 1; min-height: 0; position: relative; overflow: hidden; }

/* ---- Sections ---- */
#screen-main { overflow: hidden; }
#main-sections {
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
}
.section {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 5rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 150ms ease, visibility 150ms;
}
.section.section-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ---- Install screen ---- */
.install-screen {
    position: fixed; inset: 0; z-index: 9999;
    background: #fff;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.install-content {
    display: flex; flex-direction: column; align-items: center;
    padding: calc(3rem + var(--safe-top)) 2rem calc(2rem + var(--safe-bottom));
    max-width: 400px; margin: 0 auto;
    text-align: center;
}
.install-logo {
    width: 80px; height: 80px;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    margin-bottom: 1.25rem;
}
.install-title {
    font-size: 1.6rem; font-weight: 600;
    margin-bottom: .25rem;
}
.install-subtitle {
    color: var(--text-muted); font-size: 1rem;
    margin-bottom: 2rem; line-height: 1.5;
}
.install-steps {
    width: 100%; text-align: left;
    display: flex; flex-direction: column; gap: 1.25rem;
    margin-bottom: 2.5rem;
}
.install-step {
    display: flex; gap: .85rem; align-items: flex-start;
}
.install-step-num {
    flex-shrink: 0;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff; font-weight: 600; font-size: .95rem;
    display: flex; align-items: center; justify-content: center;
}
.install-step-text {
    font-size: .95rem; line-height: 1.5;
    padding-top: .3rem;
}
.install-step-text .install-icon {
    display: inline-block; vertical-align: middle;
    margin: 0 .15rem;
}
.install-already {
    border-top: 1px solid var(--border);
    padding-top: 1.5rem; width: 100%;
    text-align: center;
}
.install-already-title {
    font-weight: 600; font-size: 1rem;
    margin-bottom: .5rem;
}
.install-already-text {
    color: var(--text-muted); font-size: .9rem;
    line-height: 1.5;
}

/* ---- Login ---- */
.login-container {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 2rem; flex: 1; gap: 1rem;
}
.login-logo { margin-bottom: .5rem; }
.login-container h1 { font-size: 1.6rem; }
.subtitle { color: var(--text-muted); font-size: .9rem; }
#form-login {
    width: 100%; max-width: 340px;
    display: flex; flex-direction: column; gap: .75rem;
    margin-top: 1.5rem;
}
.error-msg { color: var(--danger); font-size: .85rem; text-align: center; margin-top: .5rem; }
.link-btn {
    background: none; border: none; color: var(--primary); font-size: .9rem;
    cursor: pointer; padding: .5rem; margin-top: .5rem; text-decoration: underline;
}

/* Notification badge */
.notif-bell-btn { position: relative; }
.notif-badge { position: absolute; top: 2px; right: 2px; background: var(--danger); color: #fff; border-radius: 50%; min-width: 18px; height: 18px; font-size: .7rem; display: flex; align-items: center; justify-content: center; font-weight: 700; line-height: 1; padding: 0 4px; }

/* Notification list */
.notif-list { flex: 1; min-height: 0; overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif-item:active { background: var(--gray-100); }
.notif-unread { background: rgba(184, 148, 95, 0.08); }
.notif-icon { flex-shrink: 0; color: var(--text-muted); padding-top: 2px; }
.notif-content { flex: 1; min-width: 0; }
.notif-message { font-size: .875rem; color: var(--text); line-height: 1.4; }
.notif-unread .notif-message { font-weight: 600; }
.notif-meta { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.notif-actions { display: flex; gap: 6px; padding: 8px 16px; flex-wrap: wrap; }
.notif-action-badge { cursor: pointer; transition: all .15s; }
.notif-action-badge.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Settings */
.settings-section { padding: 16px 0; border-bottom: 1px solid var(--border); }
.settings-section h3 { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.settings-desc { font-size: .8rem; color: var(--text-muted); margin-bottom: 12px; }
.settings-toggle-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; font-size: .9rem; }
.setting-group-title { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); padding: 16px 0 4px; }
.setting-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.setting-label { flex: 1; min-width: 0; }
.setting-title { font-size: 0.9rem; font-weight: 500; color: var(--text); }
.setting-desc { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ---- Bottom bar wrapper ---- */
#bottom-bar-wrapper {
    flex-shrink: 0;
    position: relative;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

#bottom-bar {
    display: flex;
    align-items: flex-start;
    padding-bottom: var(--safe-bottom);
}

.bar-item {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    gap: 2px; padding: .5rem 0;
    background: none; border: none; color: var(--text-muted);
    font-size: .7rem; font-weight: 600; cursor: pointer;
    transition: color .25s ease;
}
.bar-item.active { color: var(--accent); }
.bar-item svg { stroke: currentColor; }

.bar-item-home {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    gap: 4px; padding-bottom: .5rem; margin-top: -28px;
    background: none; border: none; color: var(--text-muted);
    font-size: .7rem; font-weight: 600; cursor: pointer;
    transition: color .25s ease;
}
.bar-item-home.active { color: var(--accent); }

.home-circle {
    width: 50px; height: 50px;
    border: 2px solid var(--border); border-radius: 50%;
    background: var(--surface);
    display: flex; align-items: center; justify-content: center;
    transition: border-color .25s ease, box-shadow .25s ease, transform 0.15s ease;
    position: relative;
}
.bar-item-home.active .home-circle {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* ---- Admin bottom bar (flat, no notch) ---- */
#bottom-bar-admin-wrapper {
    flex-shrink: 0;
    position: relative;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
#bottom-bar-admin {
    display: flex;
    padding: .3rem 0 calc(.5rem + var(--safe-bottom));
}
.bar-item-admin {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    gap: 4px; padding-bottom: .5rem;
    background: none; border: none; color: var(--text-muted);
    font-size: .7rem; font-weight: 600; cursor: pointer;
    transition: color .25s ease;
}
.bar-item-admin.active { color: var(--accent); }
.bar-item-admin svg { stroke: currentColor; }
.bar-item-admin-empty { opacity: 0.3; pointer-events: none; }

/* ---- Garden bottom bar ---- */
#bottom-bar-garden-wrapper {
    flex-shrink: 0;
    position: relative;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
#bottom-bar-garden {
    display: flex;
    align-items: flex-start;
    padding-bottom: env(safe-area-inset-bottom, var(--safe-bottom));
}
.bar-item-garden {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    gap: 2px; padding: .5rem 0; min-height: 48px; min-width: 48px;
    background: none; border: none; color: var(--text-muted);
    font-size: .7rem; font-weight: 600; cursor: pointer;
    transition: color .25s ease;
}
.bar-item-garden.active { color: var(--green-600, #2d6a4f); }
.bar-item-garden svg { stroke: currentColor; }

.bar-item-garden-home {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    gap: 4px; padding-bottom: .5rem; margin-top: -28px;
    background: none; border: none; color: var(--text-muted);
    font-size: .7rem; font-weight: 600; cursor: pointer;
    transition: color .25s ease;
}
.bar-item-garden-home.active { color: var(--green-600, #2d6a4f); }

#bottom-bar-garden .garden-home-circle {
    border-color: var(--green-600, #2d6a4f);
}
.bar-item-garden-home.active .garden-home-circle {
    border-color: var(--green-600, #2d6a4f);
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.2);
}

/* Leaf badge on main Home button */
.home-leaf-badge {
    position: absolute; top: -2px; right: -2px;
    width: 14px; height: 14px;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
}

/* Long-press feedback */
.home-circle.pressing {
    transform: scale(1.08);
    transition: transform 0.3s ease;
}

/* ---- Admin sections ---- */
#admin-sections {
    flex: 1; min-height: 0; overflow: hidden; position: relative;
}
#admin-sections > .section {
    display: none; overflow-y: auto; height: 100%;
}
#admin-sections > .section-active {
    display: block;
}
.admin-section-content {
    padding: 16px;
}

/* ==========================================================================
   4. COMMON COMPONENTS (module-specific)
   ========================================================================== */

#pwd-requirements { margin-top: 6px; }
#pwd-requirements > div { font-size: 0.8rem; margin-bottom: 2px; }
.pwd-req-unmet { color: var(--danger); }
.pwd-req-met { color: var(--success); }
.pwd-forced-msg { color: var(--text-muted); font-size: 0.85rem; text-align: center; }
.action-linked-badge { font-size: .75rem; color: var(--success); margin-top: .2rem; font-weight: 500; }
.validation-users-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.validation-users-list label { display: flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; }
.validation-photo { margin-top: 12px; }
.validation-photo > label { font-size: .85rem; color: var(--gray-600); display: block; margin-bottom: 8px; }

/* ==========================================================================
   5. DASHBOARD
   ========================================================================== */

.dashboard-cards {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.dash-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
}
.compta-cash-card {
    margin: 1rem 1rem 0;
    box-shadow: var(--shadow-md);
    border-color: var(--accent-light);
}
.compta-cash-card .dash-cash-title-row {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}
#dash-cash {
    box-shadow: var(--shadow-md);
    border-color: var(--accent-light);
}
#dash-wallbox {
    position: relative;
    overflow: hidden;
}
#dash-wallbox .dash-card-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.wb-card-month {
    font-size: .75rem;
    font-weight: normal;
    color: var(--text-muted);
    text-transform: capitalize;
    padding-right: 28px;
}
#dash-wallbox::after {
    content: '';
    position: absolute;
    bottom: -60px; right: -210px;
    width: 300px; height: 350px;
    background: linear-gradient(
        135deg,
        transparent 47.5%,
        #1E88E5 47.5%, #1E88E5 49.5%,
        #1B2A6B 49.5%, #1B2A6B 51.5%,
        #EB0A1E 51.5%, #EB0A1E 53.5%,
        transparent 53.5%
    );
    pointer-events: none;
}
.dash-card-clickable {
    cursor: pointer;
}
.dash-card-title {
    font-size: .85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    padding-bottom: .4rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: .5rem;
}
.dash-card-title-underline {
    position: relative;
    padding-bottom: 6px;
    margin-bottom: 8px;
    border-bottom: none;
}
.dash-card-title-underline::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--border);
}
#dash-cash .dash-card-title {
    padding-bottom: 0;
    border-bottom: none;
    margin-bottom: 0;
}
.dash-card-value-row {
    display: flex;
    align-items: baseline;
    gap: .4rem;
}
.dash-card-value {
    font-size: 1.6rem;
    font-weight: 700;
}
.dash-card-value-label {
    font-size: .95rem;
    color: var(--text-secondary);
    font-weight: 400;
}
.dash-card-value.positive { color: var(--success); }
.dash-card-value.negative { color: var(--danger); }
.dash-card-detail {
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: .25rem;
}
.dash-card-empty {
    color: var(--text-muted);
    font-size: .85rem;
    padding: .5rem 0;
}
.dash-task-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    cursor: pointer;
}
.dash-task-row:active { opacity: 0.7; }
.dash-task-count {
    font-weight: 700;
    font-size: 1rem;
    min-width: 24px;
    text-align: right;
    color: var(--text);
}
.dash-task-row[data-status="awaiting_approval"] .dash-task-count  { color: var(--warning); }
.dash-task-row[data-status="waiting_for_quote"] .dash-task-count  { color: var(--warning); }
.dash-task-row[data-status="intervention_planned"] .dash-task-count { color: var(--teal); }
.dash-task-row[data-status="site_visit_planned"] .dash-task-count  { color: var(--teal); }
.dash-task-row[data-status="post_visit_planned"] .dash-task-count  { color: var(--teal); }
.dash-task-row[data-status="waiting_for_delivery"] .dash-task-count { color: var(--purple); }
.dash-task-row[data-status="in_progress"] .dash-task-count         { color: var(--primary); }
.dash-task-row[data-status="not_started"] .dash-task-count         { color: var(--text-muted); }
.dash-task-separator {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}
.dash-rdv {
    position: relative;
    padding: .5rem 28px .5rem 0;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
}
.dash-rdv:last-child {
    border-bottom: none;
}
.dash-rdv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.dash-rdv-date {
    font-size: .8rem;
    font-weight: 600;
    color: var(--primary);
}
.dash-rdv-title {
    font-size: .9rem;
    font-weight: 500;
    margin-top: .15rem;
}
.dash-rdv-provider {
    font-size: .8rem;
    color: var(--text-muted);
}
.dash-rdv-badge.in-progress {
    font-size: .75rem;
    font-weight: 600;
    color: var(--warning);
}
.dash-rdv-delay-btn {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 4px;
    cursor: pointer;
}
.dash-rdv-delay-btn:hover { color: var(--primary); }
.dash-rdv-delay-btn svg { width: 16px; height: 16px; }
.dash-delay-current {
    color: var(--text-muted);
    font-size: .85rem;
    margin-bottom: 16px;
}

.dash-hk-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .4rem 0;
    font-size: .9rem;
}
.dash-hk-ago {
    color: var(--text-muted);
    font-size: .8rem;
}

/* Dashboard employees card */
.dash-emp-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .3rem 0;
    font-size: .9rem;
}
.dash-emp-validated {
    color: var(--success);
    font-size: .8rem;
    margin-left: .25rem;
}
.dash-emp-extra {
    font-size: .8rem;
    color: var(--text-muted);
    padding-left: .75rem;
}
.dash-emp-total {
    display: flex;
    justify-content: space-between;
    padding-top: .5rem;
    margin-top: .5rem;
    border-top: 1px solid var(--gray-200);
    font-weight: 700;
    font-size: .95rem;
}

/* Cash balance dual layout */
.dash-cash-title-row {
    border-bottom: 1px solid var(--border);
    padding-bottom: .4rem;
    margin-bottom: .4rem;
}
.dash-cash-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}
.dash-cash-col {
    flex: 1;
    min-width: 0;
}
.dash-cash-toggle {
    text-align: center;
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: .5rem;
    cursor: pointer;
}
.dash-cash-detail {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}
.dash-cash-detail.open {
    max-height: 500px;
    transition: max-height 0.4s ease-in;
}
.dash-cash-detail-inner {
    margin-top: .5rem;
    border-top: 1px solid var(--gray-400);
    padding-top: .75rem;
}

/* ==========================================================================
   6. COMPTA
   ========================================================================== */

/* ---- Summary ---- */
.summary[hidden] { display: none; }
.summary {
    display: flex; align-items: baseline; justify-content: center; gap: .6rem; flex-wrap: wrap;
    padding: .5rem 1rem; background: var(--surface); margin: 0 1rem .5rem; border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,.06); font-size: .9rem; font-weight: 600;
}
.summary-in { color: var(--success); }
.summary-out { color: var(--danger); }
.summary-balance { color: var(--gray-600); }
.summary-count { color: var(--text-muted); font-weight: 400; font-size: .8rem; }

/* ---- Compta items ---- */
.compta-item {
    display: flex; align-items: flex-start; gap: .75rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem;
    margin-bottom: .5rem; cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform .1s;
}
.compta-item:active { transform: scale(.98); }
.compta-info { flex: 1; min-width: 0; }
.compta-desc { font-size: .9rem; white-space: normal; word-wrap: break-word; }
.compta-cat { font-size: .8rem; color: var(--text-muted); }
.compta-shop { display: flex; align-items: center; gap: 4px; font-size: .75rem; color: var(--text-muted); }
.compta-right { text-align: right; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.compta-amount { font-weight: 700; font-size: 1rem; }
.compta-amount.negative { color: var(--danger); }
.compta-amount.positive { color: var(--success); }
.compta-date { font-size: .75rem; color: var(--text-muted); }

.badge-recurring {
    font-size: .65rem; background: var(--gray-100); color: var(--text-muted);
    border: 1px solid var(--border); padding: .1rem .4rem;
}
/* .badge-cash/.badge-moyen removed — replaced by .badge.badge-payment-method */

/* ==========================================================================
   7. TASKS
   ========================================================================== */

/* ---- Task filters ---- */
.task-filters { padding: .6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.task-search-row { margin-top: .5rem; }

/* ---- Task items (refreshed — direction B aéré) ---- */
.task-item {
    border-radius: 16px; padding: 1.1rem 1.2rem;
    margin-bottom: .8rem; cursor: pointer;
    box-shadow: 0 3px 12px rgba(0,0,0,.06);
    transition: transform .1s;
    border: none;
}
.task-item:active { transform: scale(.98); }

/* Pulse for attention-needed statuses */
.task-card-awaiting_approval,
.task-card-pending_decision,
.task-card-waiting_for_answer { animation: pulse-alert 3s ease-in-out infinite; }

@keyframes pulse-alert {
    0%,100% { box-shadow: 0 3px 12px rgba(0,0,0,.06); }
    50%      { box-shadow: 0 3px 16px rgba(192,57,43,.15); }
}
@media (prefers-reduced-motion: reduce) {
    .task-item[data-status="awaiting_approval"],
    .task-item[data-status="pending_decision"],
    .task-item[data-status="waiting_for_answer"] { animation: none; }
}

.task-item-header { display: flex; align-items: center; gap: .5rem; margin-bottom: .7rem; }
.task-status-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(0,0,0,.08);
}
.badge-answer-needed { color: var(--danger); border-color: var(--danger); }
.badge-answer-needed.active { background: var(--danger); color: #fff; border-color: var(--danger); animation: pulse-danger 2s infinite; }
@keyframes pulse-danger { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }
.dash-task-row .badge-status-awaiting_approval { animation: awaiting-pulse 2s ease-in-out infinite; }
@keyframes awaiting-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(183, 121, 31, 0); }
    50%       { box-shadow: 0 0 0 4px rgba(183, 121, 31, 0.25); }
}
.task-card-secondary-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.task-card-secondary-badges .badge { font-size: 0.65rem; padding: 1px 6px; opacity: 0.8; }
.task-item-title {
    font-weight: 700; font-size: .95rem; flex: 1;
    line-height: 1.3; color: var(--text);
}
.task-card-pills {
    display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .8rem;
}
.task-pill {
    border-radius: 8px; padding: 5px 10px;
    font-size: .73rem; font-weight: 500;
}
.task-card-provider {
    display: flex; align-items: center; gap: 4px;
    font-size: .8rem; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-top: 2px;
}
.task-card-intervention-date {
    display: flex; align-items: center; gap: 4px;
    font-size: .8rem; color: var(--teal);
    margin-top: 2px;
}
.task-card-intervention-rel { color: var(--text-muted); }
.task-card-meta { display: flex; gap: .5rem; margin-top: 4px; }
.task-card-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding-top: .6rem; border-top: 1px solid rgba(0,0,0,.05);
}
.task-card-footer-left {
    display: flex; gap: .8rem; font-size: .72rem; color: var(--text-muted);
}
.task-card-assignees { display: flex; }
.task-card-avatar {
    width: 24px; height: 24px; border-radius: 50%;
    color: #fff; font-size: .65rem; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--surface);
}
.task-card-avatar + .task-card-avatar { margin-left: -6px; }
.task-card-date { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; text-align: right; }
.task-card-date-label { display: block; font-size: 0.65rem; opacity: 0.7; }
.datetime-row { display: flex; gap: 8px; }
.datetime-row input { flex: 1; }
/* ---- Completed drawer ---- */
.completed-drawer { margin-top: .5rem; }
.completed-drawer-toggle {
    width: 100%; padding: .7rem 1rem; border: none; border-radius: 12px;
    background: var(--surface-alt); color: var(--text-muted); font-size: .85rem;
    font-weight: 600; cursor: pointer; text-align: center;
    transition: background .15s;
}
.completed-drawer-toggle:active { background: var(--gray-100); }
.completed-drawer-list { margin-top: .6rem; display: flex; flex-direction: column; gap: .6rem; }
.completed-drawer-list .task-item { opacity: .7; }

/* ---- Task reminder badge ---- */
.task-reminder-badge {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .3rem .6rem; border-radius: 8px; font-size: .8rem;
    cursor: pointer; border: 1px solid var(--border);
    background: var(--surface-alt); color: var(--text-muted);
    transition: background .15s;
}
.task-reminder-badge.active {
    background: rgba(183,121,31,.1); color: var(--warning);
    border-color: rgba(183,121,31,.2);
}
.task-reminder-badge:active { opacity: .7; }

/* ---- Dashboard reminders ---- */
.dash-reminder-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: .6rem .2rem; cursor: pointer;
    border-bottom: 1px solid rgba(0,0,0,.04);
}
.dash-reminder-row:last-child { border-bottom: none; }
.dash-reminder-info { flex: 1; min-width: 0; }
.dash-reminder-title { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-reminder-note { font-size: .8rem; color: var(--text); margin-top: .15rem; }
.dash-reminder-date { font-size: .75rem; color: var(--text-muted); margin-top: .15rem; }
.dash-reminder-dismiss {
    flex-shrink: 0; width: 28px; height: 28px; border: none; border-radius: 50%;
    background: var(--surface-alt); color: var(--text-muted); font-size: 1.1rem;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.dash-reminder-dismiss:active { background: var(--gray-100); }

/* ---- Task detail ---- */
.task-detail-content { flex: 1; min-height: 0; padding: 1rem 1rem 5rem; overflow-y: auto; -webkit-overflow-scrolling: touch; }   /* réserve basse : le FAB recouvrait la dernière carte */
.task-detail-header { margin-bottom: 1rem; }
.task-detail-header h3 { font-size: 1.1rem; margin-bottom: .5rem; }
.task-detail-status-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .5rem; }
.task-detail-status-row select {
    width: auto; padding: .35rem .75rem; font-size: .85rem; border-radius: 8px;
    padding-right: 2rem;
}
/* ---- FAB speed dial (task detail) ---- */
.fab-task {
    position: absolute;
    bottom: 16px;
    right: 16px;
    z-index: 20;
    transition: transform .2s ease;
}
.fab-task.open { transform: rotate(45deg); }
.speed-dial-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 19;
}
.speed-dial-items {
    position: absolute;
    bottom: 80px;
    right: 16px;
    display: flex;
    flex-direction: column-reverse;
    gap: 12px;
}
.speed-dial-item {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.15s ease-out, transform 0.15s ease-out;
    cursor: pointer;
}
.speed-dial-item.show { opacity: 1; transform: translateY(0); }
.speed-dial-label {
    background: var(--surface);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    color: var(--text);
}
.speed-dial-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    flex-shrink: 0;
}

/* ---- Timeline cards ---- */
.timeline { display: flex; flex-direction: column; gap: 12px; }
.action-highlight { animation: highlight-pulse 2s ease-in-out infinite; }
.compta-highlight { animation: highlight-pulse 2s ease-in-out infinite; border-radius: 12px; }
@keyframes highlight-pulse { 0% { box-shadow: 0 0 0 2px var(--accent); } 50% { box-shadow: 0 0 0 4px var(--accent-light); } 100% { box-shadow: 0 0 0 2px var(--accent); } }
/* ---- Timeline verticale (refreshed) ---- */
.timeline-container {
    position: relative;
    padding-left: 2rem;
}
.timeline-container::before {
    content: '';
    position: absolute;
    left: 11px; top: 0; bottom: 0;
    width: 2px;
    background: var(--border);
    border-radius: 1px;
}
.timeline-avatar {
    position: absolute;
    left: -2rem; top: .5rem;
    width: 24px; height: 24px; border-radius: 50%;
    color: #fff; font-size: .6rem; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
    z-index: 1; border: 2px solid var(--bg);
}
.timeline-entry {
    position: relative;
    margin-bottom: .8rem;
}
.timeline-card {
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
    padding: .75rem .9rem;
}
.timeline-cat-creation      { background: var(--surface); border: 1px solid var(--border); }
.timeline-cat-notes         { background: linear-gradient(135deg, rgba(44,95,138,.06) 0%, var(--surface) 50%); }
.timeline-cat-questions     { background: linear-gradient(135deg, rgba(59,130,246,.06) 0%, var(--surface) 50%); }
.timeline-cat-quotes        { background: linear-gradient(135deg, #FEF3C7 0%, var(--surface) 50%); border: 1px solid rgba(183,121,31,.12); }
.timeline-cat-payments      { background: linear-gradient(135deg, #E8F5EE 0%, var(--surface) 50%); border: 1px solid rgba(30,125,74,.1); }
.timeline-cat-interventions { background: linear-gradient(135deg, #F3EEFB 0%, var(--surface) 50%); border: 1px solid rgba(124,58,237,.1); }
.timeline-cat-validation    { background: linear-gradient(135deg, rgba(184,148,95,.08) 0%, var(--surface) 50%); border: 1px solid rgba(184,148,95,.12); }
.timeline-cat-traceability  { background: rgba(0, 0, 0, 0.03); opacity: 0.85; font-size: 0.92em; }
.timeline-cat-reopened      { background: linear-gradient(135deg, rgba(192,57,43,.06) 0%, var(--surface) 50%); border: 1px solid rgba(192,57,43,.1); }
.timeline-card-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}
.timeline-card-header-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.timeline-card-header-row .badge { font-size: .78rem; }
.timeline-card-header-row .timeline-action-btns { margin-left: auto; flex-shrink: 0; }
.timeline-meta {
    font-size: .73rem;
    color: var(--text-muted);
}
.timeline-assigned {
    font-size: .73rem;
    color: var(--text-muted);
}
.timeline-card-body:empty { display: none; }
.timeline-action-btns { display: flex; gap: 2px; flex-shrink: 0; margin-left: 8px; }
.timeline-edit-btn, .timeline-delete-btn {
    background: none; border: none; padding: 4px; cursor: pointer;
    color: var(--text-muted); border-radius: 4px; line-height: 0;
}
.timeline-edit-btn:hover { color: var(--primary); background: var(--gray-100); }
.timeline-delete-btn:hover { color: var(--danger); background: var(--gray-100); }
.timeline-delay-btn { background: none; border: none; padding: 4px; cursor: pointer; color: var(--text-muted); border-radius: 4px; line-height: 0; }
.timeline-delay-btn:hover { color: var(--warning); background: var(--gray-100); }
.existing-attachment { position: relative; }
.existing-attachment .file-preview-remove { background: var(--danger); }
.timeline-text { font-size: .9rem; line-height: 1.4; color: var(--text); }
.timeline-text a, .timeline-reply-body a, .compta-desc a { color: var(--primary); text-decoration: underline; word-break: break-all; }
.attachment-grid { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }

/* Quote validation badges */
.quote-status-badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .15rem .5rem; border-radius: 999px; margin-left: 4px; }
.quote-approved { background: var(--success-light); color: var(--success); }
.quote-rejected { background: var(--danger-light); color: var(--danger); }
.quote-pending { background: var(--warning-light); color: var(--warning); }
.quote-pending.badge-solid { color: #fff; background: var(--warning); border-color: var(--warning); }
/* Quote validations list */
.quote-validations { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.quote-validations .approved { color: var(--success); }
.quote-validations .rejected { color: var(--danger); }
/* Quote approve/reject buttons */
.quote-approve-btn, .quote-reject-btn { display: inline-flex; align-items: center; gap: 4px; padding: 6px 14px; border-radius: 999px; font-size: .85rem; font-weight: 600; border: none; cursor: pointer; }
.quote-approve-btn { background: var(--success-light); color: var(--success); }
.quote-reject-btn { background: var(--danger-light); color: var(--danger); }
/* Quote request: received button + info */
.quote-received-btn { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 999px; font-size: .78rem; font-weight: 500; border: 1px solid var(--border); cursor: pointer; background: transparent; color: var(--text-muted); margin-top: 4px; }
.quote-received-btn:hover { background: var(--gray-100); }
.quote-received-info { font-size: .8rem; color: var(--success); margin-top: 4px; }
/* Label hint */
.label-hint { font-size: .8rem; color: var(--text-muted); font-weight: normal; }
/* Enhanced amounts for financial cards */
.timeline-cat-payments .action-amount,
.timeline-cat-quotes .action-amount { font-size: 1.1rem; font-weight: 700; }
.timeline-cat-payments .action-amount { color: var(--success); }
.attachment-thumb {
    width: 72px; height: 72px; border-radius: 8px; overflow: hidden;
    border: 1px solid var(--bottombar-border); cursor: pointer;
}
.attachment-thumb img { width: 100%; height: 100%; object-fit: cover; }
.attachment-thumb .pdf-label {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    background: var(--gray-100); font-size: .7rem; color: var(--gray-600); font-weight: 600;
}

/* ---- Action details (timeline) ---- */
.action-amount-line { display: flex; align-items: center; gap: 8px; }
.action-amount { font-weight: 600; color: var(--text); font-size: .95rem; }
.payment-hint { font-size: .78rem; color: var(--text-muted); }
.payment-hint-full { color: var(--success); }
/* Provider line with building icon */
.timeline-provider { display: flex; align-items: center; gap: 6px; font-size: 0.85em; color: var(--text); margin: 4px 0; }
.timeline-provider svg { flex-shrink: 0; color: var(--text-muted); }
.timeline-shop { display: flex; align-items: center; gap: 4px; font-size: .85rem; color: var(--text-secondary); margin-top: 2px; }
.badge-shop-online { font-size: .65rem; padding: 1px 6px; color: var(--purple); border-color: var(--purple); }
.timeline-delivered { font-size: .8rem; color: var(--success); margin-top: 2px; }
.mark-delivered-btn {
    display: inline-block; font-size: .75rem; font-weight: 600;
    padding: 4px 12px; border-radius: 999px; border: none;
    background: var(--purple); color: #fff; cursor: pointer;
    transition: opacity .15s;
}
.mark-delivered-btn:active { opacity: .8; }
.action-payment-method { margin: 2px 0; }
.action-remaining {
    font-size: .8rem; color: var(--primary); font-weight: 500; margin-top: 2px;
}
.action-remaining.paid { color: var(--success); }
.action-intervention-date { font-size: .85rem; color: var(--gray-600); }

/* Scroll wheel picker */
.wheel-container { display: flex; align-items: center; justify-content: center; gap: 4px; margin: 12px 0; user-select: none; }
.wheel-col { position: relative; height: 180px; width: 54px; overflow: hidden; }
.wheel-col-mask { mask-image: linear-gradient(transparent, black 30%, black 70%, transparent); -webkit-mask-image: linear-gradient(transparent, black 30%, black 70%, transparent); }
.wheel-scroller { height: 100%; overflow-y: auto; scroll-snap-type: y mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.wheel-scroller::-webkit-scrollbar { display: none; }
.wheel-item { height: 36px; line-height: 36px; text-align: center; font-size: .9rem; color: var(--text-muted); scroll-snap-align: center; }
.wheel-item.active { color: var(--text); font-weight: 600; font-size: 1rem; }
.wheel-col::before, .wheel-col::after { content: ''; position: absolute; left: 0; right: 0; height: 1px; background: var(--border); z-index: 1; pointer-events: none; }
.wheel-col::before { top: 72px; }
.wheel-col::after { top: 108px; }
.wheel-label { font-size: .8rem; color: var(--text-muted); font-weight: 500; padding: 0 2px; align-self: center; }

/* Sheet sections */
.sheet-section { padding: 0 0 16px; }
.sheet-section-border { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 4px; }
.sheet-section-title { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 12px; font-weight: 600; }

/* Origin pills */
.origin-pills { display: flex; gap: 8px; margin-bottom: 12px; }
.origin-pill { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: .82rem; cursor: pointer; transition: all .15s; }
.origin-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Traceability comments in timeline */
.timeline-undo-hint { font-size: .72rem; color: var(--text-muted); font-style: italic; margin-top: 2px; }
.timeline-cat-traceability .badge { background: var(--gray-100); color: var(--text-muted); font-weight: 500; }
/* Pending quote card */
.timeline-card-pending { background: rgba(183, 121, 31, 0.15); border: 1.5px solid rgba(183, 121, 31, 0.4); }
.timeline-card-pending .badge-solid { background: var(--warning); border-color: var(--warning); }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.pulse-dot { animation: pulse-dot 1.5s ease-in-out infinite; }
/* Linked depense badge */
.badge-linked-account { color: var(--success); border-color: var(--success); cursor: pointer; margin-top: 4px; align-self: flex-start; }
.badge-linked-account:hover { background: var(--success-light); }
.linked-depense-link { cursor: pointer; }

/* Threaded replies */
.timeline-replies { margin-top: 8px; padding-left: 12px; border-left: 2px solid var(--border); }
.timeline-reply { padding: 6px 0; font-size: 0.9em; }
.timeline-reply + .timeline-reply { border-top: 1px solid var(--border); }
.timeline-reply-header { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.timeline-reply-author { font-weight: 600; font-size: .85em; }
.timeline-reply-date { font-size: .75em; color: var(--text-muted); }
.timeline-reply-header .timeline-action-btns { margin-left: auto; }
.timeline-reply-body { margin-top: 4px; color: var(--text); line-height: 1.4; }
/* Sub-replies (level 2) */
.timeline-sub-replies { margin-top: 4px; padding-left: 10px; border-left: 2px solid var(--border); }
.timeline-sub-replies .timeline-reply { font-size: 0.95em; }
/* Card footer: reply left, actions right */
.timeline-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 8px; }
.timeline-card-footer-right { display: flex; gap: 8px; align-items: center; }
/* Reply button */
.reply-btn { cursor: pointer; background: transparent; border: 1px solid var(--border); color: var(--text-muted); font-size: .78rem; }
.reply-btn:hover { background: var(--gray-100); }

.action-validation { font-size: .9rem; color: var(--success); font-weight: 500; }
.action-details { margin-top: .25rem; display: flex; flex-direction: column; gap: 2px; }
/* Active state for filter sheet pills */

/* ==========================================================================
   8. EMPLOYEES
   ========================================================================== */

/* ---- Housekeeping ---- */
.hk-month-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
}
.hk-nav-btn {
    background: none;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    width: 36px;
    height: 36px;
    font-size: 1.4rem;
    color: var(--gray-600);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hk-nav-btn:active {
    background: var(--gray-100);
}
.hk-month-label {
    font-size: 1.1rem;
    font-weight: 700;
    min-width: 160px;
    text-align: center;
}
.hk-summary-card {
    margin: 0 1rem;
    text-align: center;
}
.hk-validated-badge {
    font-size: .85rem;
    color: var(--success);
    font-weight: 600;
    margin-top: .5rem;
}
.hk-btn-primary {
    margin-top: .75rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: .5rem 1.25rem;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
}
.hk-btn-danger {
    margin-top: .75rem;
    background: var(--danger);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: .5rem 1.25rem;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
}
.hk-actions {
    padding: .75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}
.hk-rate-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
}
.hk-rate-row label {
    font-weight: 600;
}
.hk-rate-input {
    width: 80px;
    padding: .4rem .5rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    text-align: right;
}
.hk-date-input {
    width: 100%;
    padding: .5rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: .9rem;
}
.hk-btn-add {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: .75rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
}
.hk-btn-add:active {
    opacity: .85;
}
.hk-visit-list {
    padding: 0 1rem;
}
.hk-visit-item {
    display: flex;
    align-items: center;
    padding: .75rem 0;
    border-bottom: 1px solid var(--gray-100);
    gap: .5rem;
}
.hk-visit-item:last-child {
    border-bottom: none;
}
.hk-visit-date {
    flex: 1;
    font-size: .9rem;
}
.hk-visit-amount {
    font-size: .9rem;
    font-weight: 600;
}
.hk-visit-delete {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 1.3rem;
    cursor: pointer;
    padding: .25rem .5rem;
    line-height: 1;
}

/* ==========================================================================
   9. WALLBOX
   ========================================================================== */

.wallbox-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* State dot indicator */
.wb-state-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: .4rem;
    vertical-align: middle;
}
.wb-state-ready { background: var(--primary); }
.wb-state-idle { background: var(--gray-400); }
.wb-state-charging { background: var(--success); animation: wb-pulse 1.5s infinite; }
.wb-state-error { background: var(--danger); }

@keyframes wb-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* BMW card month stats */
.wb-month-stats {
    font-size: .9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Dashboard card stats */
.wb-card-stats {
    font-size: 1.1rem;
    font-weight: 600;
    margin: .25rem 0;
}
.wb-card-power { color: var(--success); }

/* HC/HP bar */
.wb-hc-bar {
    height: 6px;
    background: var(--warning);
    border-radius: 3px;
    margin: .5rem 0 .25rem;
    overflow: hidden;
}
.wb-hc-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px 0 0 3px;
}
.wb-card-hc-label {
    font-size: .75rem;
    color: var(--text-muted);
}

/* Wallbox summary card */
.wb-summary-row {
    display: flex;
    justify-content: space-between;
    gap: .5rem;
}
.wb-summary-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.wb-summary-label {
    font-size: .75rem;
    color: var(--text-secondary);
    margin-bottom: .25rem;
}
.wb-summary-value {
    font-size: 1.1rem;
    font-weight: 700;
}

/* Session card */
.wb-session {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .75rem;
    box-shadow: var(--shadow-sm);
}
.wb-session-header {
    display: flex;
    justify-content: space-between;
    font-size: .8rem;
    color: var(--text-secondary);
    margin-bottom: .25rem;
}
.wb-session-values {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 1rem;
}
.wb-session-split {
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: .25rem;
}

/* ===== Energy module ===== */

/* Dashboard card */
.energy-card-loading, .energy-card-error {
    font-size: .85rem;
    color: var(--text-muted);
    padding: .25rem 0;
}
.energy-card-row {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.energy-card-power {
    font-size: 1.1rem;
    font-weight: 700;
}
.energy-card-tariff {
    font-size: .7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.energy-tariff-hc {
    color: var(--primary);
}
.energy-tariff-hp {
    color: var(--warning);
}
.energy-card-tariff.energy-tariff-hc {
    background: var(--primary-light);
    color: var(--primary-dark);
}
.energy-card-tariff.energy-tariff-hp {
    background: var(--warning-light);
    color: var(--warning);
}
.energy-card-cost {
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: .25rem;
}

.wb-rate-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: .25rem .5rem;
    padding: .5rem 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: .85rem;
}
.wb-rate-date {
    font-weight: 500;
    flex-basis: 100%;
    color: var(--text-secondary);
    font-size: .8rem;
}
.wb-rate-slots {
    color: var(--text-muted);
    font-size: .8rem;
}
/* ==========================================================================
   10. ADMIN
   ========================================================================== */

.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.admin-header h3 { margin: 0; font-size: 1.1rem; }
.admin-user-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px; border-bottom: 1px solid var(--bottombar-border); gap: 8px;
}
.admin-user-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.admin-user-info strong { font-size: .95rem; }
.admin-user-info span { font-size: .8rem; color: var(--gray-600); }
.admin-role-badge {
    display: inline-block; font-size: .7rem; font-weight: 600; padding: 2px 6px;
    border-radius: 4px; width: fit-content;
}
.role-admin { background: var(--primary-light); color: var(--primary-dark); }
.role-gardener { background: #e3f1e6; color: #1e7d4a; }
.role-user { background: var(--gray-100); color: var(--gray-600); }
.admin-user-actions { display: flex; gap: 6px; flex-shrink: 0; }
#admin-form-container {
    background: var(--surface-alt); border-radius: 8px; padding: 12px; margin-bottom: 16px;
}
#admin-form-container h4 { margin: 0 0 8px; font-size: .95rem; }
.admin-form-actions { display: flex; gap: 8px; margin-top: 8px; }

/* ---- Activity log ---- */
.activity-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.activity-table th { text-align: left; padding: 8px; border-bottom: 2px solid var(--border); color: var(--text-muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; }
.activity-table td { padding: 8px; border-bottom: 1px solid var(--border); }
.activity-table tbody tr:nth-child(even) { background: var(--gray-100); }
.activity-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px 0; font-size: .85rem; color: var(--text-muted); }
.filter-select-small { padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .85rem; background: var(--surface); }

/* ---- Settings screen ---- */
.settings-content {
    flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px;
    max-width: 500px; margin: 0 auto;
}
/* ==========================================================================
   11. IMAGE VIEWER & EDITOR
   ========================================================================== */

/* ---- Image Editor ---- */
/* ---- Image Editor ---- */
#screen-editor {
    background: rgba(0,0,0,0.95);
    z-index: 100001;
}
.editor-topbar {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    padding-top: calc(8px + var(--safe-top));
    background: rgba(0,0,0,0.8);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.editor-undo-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.9);
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: opacity 0.2s;
}
.editor-save-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
#editor-canvas-container {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
    position: relative;
}
#editor-canvas { touch-action: none; }
.editor-footer {
    flex-shrink: 0;
    padding-bottom: var(--safe-bottom);
    background: rgba(0,0,0,0.8);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.editor-params {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.editor-params[hidden] { display: none; }
.editor-tools {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 12px 16px;
}
.editor-tool {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: rgba(255,255,255,0.9);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.editor-tool.active {
    background: rgba(255,255,255,0.15);
    color: var(--accent);
}
.editor-colors {
    display: flex;
    gap: 6px;
    align-items: center;
}
.editor-color-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.25);
    background: var(--swatch);
    cursor: pointer;
    padding: 0;
    transition: border-color 0.15s, transform 0.15s;
}
.editor-color-btn.active {
    border-color: #fff;
    transform: scale(1.15);
}
.editor-sizes {
    display: flex;
    gap: 6px;
    align-items: center;
}
.editor-size {
    background: none;
    border: 2px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
    transition: border-color 0.15s;
}
.editor-size.active { border-color: var(--accent); }
.editor-size span {
    display: block;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
}
.editor-size[data-size="2"] span { width: 6px; height: 6px; }
.editor-size[data-size="4"] span { width: 10px; height: 10px; }
.editor-size[data-size="8"] span { width: 14px; height: 14px; }
/* ---- Preview annotation button ---- */
.preview-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    height: 100%;
}
.preview-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.preview-edit-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    padding: 0;
    line-height: 1;
}

/* ---- Image viewer ---- */
/* PhotoSwipe custom UI */
.pswp__top-bar,
.pswp__counter {
    display: none !important;
}
.pswp-custom-topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    padding: 8px 12px;
    padding-top: calc(8px + var(--safe-top));
    z-index: 10;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
    color: #fff;
    gap: 12px;
}
.pswp-topbar-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}
.pswp-topbar-info {
    flex: 1;
    font-size: 13px;
    opacity: 0.85;
    text-align: center;
}
.pswp-topbar-counter {
    font-size: 13px;
    opacity: 0.85;
    flex-shrink: 0;
}
.pswp-custom-bottombar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 10;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
    gap: 16px;
}
.pswp-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}
.pswp-action-btn:active {
    background: rgba(255,255,255,0.3);
}
.pswp-action-btn--danger {
    border-color: rgba(239,68,68,0.5);
    color: #fca5a5;
}
.pswp-action-btn--danger:active {
    background: rgba(239,68,68,0.3);
}
.pswp-action-btn span {
    white-space: nowrap;
}

/* Attachment quote (photo comment reference) */
.attachment-quote {
    float: left;
    margin-right: 8px;
    margin-bottom: 4px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
}
.attachment-quote-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

/* ==========================================================================
   12. FILTER BOTTOM SHEET
   ========================================================================== */

/* Compta inline filters */
.compta-filter-row {
    display: flex;
    gap: .5rem;
    padding: .5rem 1rem;
}
.compta-filter-row > * {
    flex: 1;
    min-width: 0;
}
#compta-list {
    transition: opacity .15s ease;
}
#compta-list.compta-list-fade {
    opacity: 0;
}

/* Override popup-overlay alignment for bottom sheet */
#dash-delay-sheet-overlay,
#depense-sheet-overlay,
#revenu-sheet-overlay,
#delivered-sheet-overlay,
#reminder-sheet-overlay {
    align-items: flex-end;
    padding: 0;
}

.filter-sheet {
    width: 100%;
    background: var(--surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 85vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateY(100%);
    transition: transform .4s cubic-bezier(.32,.72,0,1);
}
.filter-sheet.open { transform: translateY(0); }

.sheet-handle {
    display: flex; justify-content: center; padding: 12px 0 4px;
}
.sheet-handle span {
    display: block; width: 36px; height: 4px;
    background: var(--border); border-radius: 2px;
}

.sheet-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 20px 12px;
    border-bottom: 1px solid var(--border);
}
.sheet-title { font-size: 1.05rem; font-weight: 600; }

.sheet-body { padding: 16px 20px 0; }
.filter-section { margin-bottom: 20px; }
.filter-label {
    font-size: .7rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .06em; color: var(--text-muted); margin-bottom: 10px;
}

.month-nav {
    width: 32px; height: 32px; border-radius: 50%;
    border: 1px solid var(--border); background: var(--surface);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0; color: var(--text);
    transition: opacity .15s;
}
.month-nav:disabled { opacity: .35; cursor: default; }

.sheet-footer {
    flex-shrink: 0;
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--surface); border-top: 1px solid var(--border);
    /* .filter-sheet défile en interne (85vh) sans barre visible : le pied reste collé en bas de la
       zone visible, sinon Save passait sous le pli en paysage / fenêtre courte (audit 2026-09-07) */
    position: sticky; bottom: 0; z-index: 1;
}
.btn-apply {
    width: 100%; padding: 14px;
    background: var(--accent); color: #fff;
    border: none; border-radius: var(--radius);
    font-size: 1rem; font-weight: 600; cursor: pointer;
    transition: opacity .15s;
}
.btn-apply:active { opacity: .85; }
.sheet-delete-btn {
    width: 100%; margin-top: 8px;
}

/* === Export popup === */
.export-popup-content { padding-bottom: 16px; }

.export-section-label {
    display: block; font-size: .75rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .05em;
    color: var(--text-muted); margin: 14px 0 8px;
}
.export-popup-content > .export-section-label:first-of-type { margin-top: 8px; }

.export-period-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.export-pill {
    padding: 7px 14px; border-radius: 20px;
    border: 1px solid var(--border); background: var(--surface);
    font-size: .85rem; font-weight: 500; color: var(--text);
    cursor: pointer; font-family: inherit;
    transition: background .15s, border-color .15s, color .15s;
}
.export-pill.active {
    background: var(--primary); border-color: var(--primary); color: #fff;
}

.export-custom-range { margin-top: 10px; }
.export-date-row { display: flex; gap: 10px; }
.export-date-field { flex: 1; }
.export-date-field label { display: block; font-size: .8rem; font-weight: 500; color: var(--text-muted); margin-bottom: 4px; }
.export-date-field input[type="date"] { width: 100%; }

.export-options { display: flex; gap: 8px; }

.export-option {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 14px 8px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--surface);
    cursor: pointer; text-align: center;
    transition: border-color .15s, background .15s;
    font-family: inherit;
}
.export-option:active { background: var(--surface-alt); border-color: var(--accent); }

.export-option-icon {
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; color: #fff;
}
.export-icon-xlsx { background: #1D6F42; }
.export-icon-pdf  { background: #C0392B; }
.export-icon-csv  { background: var(--primary); }

.export-option-name { font-weight: 600; font-size: .9rem; color: var(--text); }
.export-option-desc { font-size: .75rem; color: var(--text-muted); }

.export-option.exporting { opacity: .6; pointer-events: none; }
