:root {
  --ink: #19332d;
  --muted: #6f7b76;
  --green: #153f35;
  --green-2: #245b4d;
  --sage: #88a79c;
  --cream: #f6f2e9;
  --paper: #fffdf8;
  --sand: #e9dfcf;
  --terracotta: #d69b62;
  --danger: #b94b4b;
  --warning: #c7822b;
  --success: #2f7d5d;
  --border: #ded8cb;
  --shadow: 0 12px 35px rgba(29, 52, 45, .09);
  --radius: 20px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--cream);
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--cream); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 90% 0%, rgba(214,155,98,.16), transparent 28%), var(--cream); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 5px; text-transform: uppercase; letter-spacing: .13em; font-weight: 800; font-size: 11px; color: var(--green-2); }
.eyebrow.light { color: #d7e5df; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.035em; }
h2 { margin-bottom: 7px; font-size: clamp(25px, 3vw, 38px); letter-spacing: -.035em; }
h3 { margin-bottom: 0; font-size: 19px; letter-spacing: -.02em; }

.app-shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 18px; color: #eff6f2; background: linear-gradient(180deg, #143d34, #0f3029); box-shadow: 8px 0 32px rgba(16, 44, 37, .13); z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 25px; }
.brand img { border-radius: 14px; box-shadow: 0 7px 18px rgba(0,0,0,.18); }
.brand strong { display: block; font-size: 17px; letter-spacing: -.02em; }
.brand span { display: block; color: #b9cec6; margin-top: 2px; font-size: 12px; }
.nav-list { display: grid; gap: 7px; }
.nav-button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 0 15px; border: 0; border-radius: 14px; color: #cbdad5; background: transparent; text-align: left; font-weight: 720; transition: .2s ease; }
.nav-button span { width: 22px; font-size: 20px; text-align: center; }
.nav-button:hover { background: rgba(255,255,255,.07); color: white; }
.nav-button.active { color: #173c33; background: #f5f0e5; box-shadow: 0 8px 18px rgba(5, 24, 19, .13); }
.sidebar-bottom { margin-top: auto; padding: 16px 7px 0; }
.sidebar-bottom > p { color: #93aaa2; font-size: 11px; line-height: 1.55; margin: 13px 4px 0; }
.connection-card { display: flex; gap: 10px; align-items: center; padding: 12px; border: 1px solid rgba(255,255,255,.11); background: rgba(255,255,255,.06); border-radius: 15px; }
.connection-card strong { display: block; font-size: 12px; }
.connection-card small { display: block; color: #a9beb7; margin-top: 2px; font-size: 10px; }
.status-dot { width: 9px; height: 9px; border-radius: 99px; flex: 0 0 auto; background: var(--warning); box-shadow: 0 0 0 5px rgba(199,130,43,.15); }
.status-dot.online { background: #63c49a; box-shadow: 0 0 0 5px rgba(99,196,154,.14); }
.status-dot.offline { background: #dd7777; box-shadow: 0 0 0 5px rgba(221,119,119,.14); }

.content-column { min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 104px; padding: 22px clamp(22px, 4vw, 52px); border-bottom: 1px solid rgba(107,121,115,.12); background: rgba(246,242,233,.85); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 15; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.save-state { color: var(--muted); font-size: 12px; font-weight: 700; }
.save-state.saving { color: var(--warning); }
.save-state.error { color: var(--danger); }
main { padding: 28px clamp(18px, 4vw, 52px) 70px; max-width: 1700px; margin: 0 auto; }
.view { display: none; animation: fadeUp .28s ease; }
.view.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

.panel { background: rgba(255,253,248,.92); border: 1px solid rgba(189,180,164,.55); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; padding: 22px 24px 10px; }
.primary-button, .secondary-button, .danger-button, .icon-button { border: 0; border-radius: 12px; min-height: 43px; padding: 0 16px; font-weight: 800; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.primary-button { color: white; background: var(--green); box-shadow: 0 7px 17px rgba(21,63,53,.18); }
.primary-button:hover { background: var(--green-2); transform: translateY(-1px); }
.primary-button.compact { min-height: 40px; padding-inline: 14px; }
.secondary-button { color: var(--green); background: #edf1ed; border: 1px solid #d7dfda; }
.secondary-button:hover { background: #e3eae6; }
.danger-button { color: #9c3535; background: #f9e9e7; border: 1px solid #ebc7c3; }
.danger-button:hover { background: #f5dcda; }
.icon-button { width: 42px; padding: 0; font-size: 22px; color: var(--green); background: #ebe8df; }
.text-button { border: 0; padding: 3px 0; background: none; color: var(--green-2); font-weight: 800; font-size: 12px; }
.button-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; width: fit-content; }

.hero-card { display: grid; grid-template-columns: 1fr auto; align-items: center; min-height: 224px; padding: 34px clamp(25px, 4vw, 48px); color: white; background: linear-gradient(125deg, #123c32 0%, #215b4c 62%, #337766 100%); border-radius: 28px; box-shadow: 0 20px 45px rgba(25,72,60,.22); overflow: hidden; position: relative; }
.hero-card::before { content: ""; position: absolute; width: 350px; height: 350px; border-radius: 50%; right: -125px; top: -165px; background: rgba(255,255,255,.08); }
.hero-card::after { content: ""; position: absolute; width: 185px; height: 185px; border-radius: 50%; right: 90px; bottom: -120px; border: 32px solid rgba(214,155,98,.14); }
.hero-copy, .hero-progress-wrap { position: relative; z-index: 1; }
.hero-copy h2 { font-size: clamp(42px, 7vw, 72px); margin: 0 0 8px; color: white; }
.hero-copy p:last-child { margin-bottom: 0; color: #d4e1dc; max-width: 600px; }
.hero-ring { --pct: 0deg; width: 145px; height: 145px; border-radius: 50%; display: grid; place-content: center; text-align: center; background: radial-gradient(circle 58px, #1b5144 98%, transparent 100%), conic-gradient(#e2b17e var(--pct), rgba(255,255,255,.16) 0); box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); }
.hero-ring span { font-size: 28px; font-weight: 900; letter-spacing: -.04em; }
.hero-ring small { color: #c5d8d1; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin: 18px 0; }
.kpi-card { padding: 20px; min-height: 126px; background: var(--paper); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 8px 25px rgba(32,51,45,.06); }
.kpi-card .kpi-label { color: var(--muted); font-size: 12px; font-weight: 750; }
.kpi-card strong { display: block; margin: 12px 0 5px; font-size: clamp(22px, 2.8vw, 30px); letter-spacing: -.04em; }
.kpi-card small { color: var(--muted); font-size: 11px; }
.kpi-card.positive strong { color: var(--success); }
.kpi-card.negative strong { color: var(--danger); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(310px, .65fr); gap: 18px; margin-top: 18px; }
.dashboard-grid.lower { grid-template-columns: 1fr 1fr; }
.category-panel { min-height: 410px; }
.category-chart { padding: 12px 24px 27px; display: grid; gap: 14px; }
.category-row { display: grid; grid-template-columns: minmax(150px, 220px) 1fr 90px; gap: 13px; align-items: center; }
.category-name { min-width: 0; font-weight: 760; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 10px; background: #ebe7dc; border-radius: 99px; overflow: hidden; }
.bar-value { height: 100%; min-width: 3px; border-radius: inherit; }
.category-amount { text-align: right; font-size: 12px; font-weight: 850; }
.donut-layout { display: grid; place-items: center; padding: 7px 22px 26px; }
#phase-chart { width: 240px; max-width: 100%; height: auto; }
.legend { width: 100%; display: grid; gap: 10px; margin-top: -6px; }
.legend-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.legend-label { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.legend-swatch { width: 10px; height: 10px; border-radius: 50%; }
.legend-row strong { color: var(--ink); }
.simple-list { padding: 5px 24px 23px; }
.simple-list-row { display: grid; grid-template-columns: 35px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px 0; border-bottom: 1px solid #ebe5d9; }
.simple-list-row:last-child { border-bottom: 0; }
.rank { width: 28px; height: 28px; display: grid; place-items: center; background: #ede8dd; color: var(--green); border-radius: 9px; font-weight: 900; font-size: 11px; }
.simple-list-row strong { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.simple-list-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.simple-list-row .amount { font-weight: 900; font-size: 12px; }
.planning-kpi { padding: 12px 24px 25px; }
.planning-kpi .big-progress { display: flex; justify-content: space-between; align-items: end; margin-bottom: 13px; }
.planning-kpi .big-progress strong { font-size: 36px; letter-spacing: -.05em; }
.progress-track { height: 11px; border-radius: 99px; background: #ebe7dc; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--green-2), var(--sage)); border-radius: inherit; }
.status-badges { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.status-badge { padding: 6px 9px; border-radius: 9px; font-size: 10px; font-weight: 800; background: #f0ede5; color: var(--muted); }

.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(135px, auto)) auto auto auto; gap: 10px; padding: 14px; align-items: center; }
.search-box { min-height: 43px; display: flex; align-items: center; gap: 9px; padding: 0 13px; background: #f7f4ec; border: 1px solid var(--border); border-radius: 12px; }
.search-box input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
select, input, textarea { width: 100%; border: 1px solid #d9d4c9; border-radius: 11px; background: #fffefa; color: var(--ink); outline: 0; transition: border-color .15s ease, box-shadow .15s ease; }
select, input { min-height: 43px; padding: 0 12px; }
textarea { padding: 11px 12px; resize: vertical; }
select:focus, input:focus, textarea:focus { border-color: var(--sage); box-shadow: 0 0 0 4px rgba(136,167,156,.15); }
.budget-summary-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.mini-stat { padding: 13px 16px; background: rgba(255,253,248,.76); border: 1px solid var(--border); border-radius: 14px; }
.mini-stat span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.mini-stat strong { display: block; margin-top: 7px; font-size: 18px; }
.table-panel { overflow: hidden; }
.table-scroll { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 980px; }
.data-table th { padding: 15px 17px; color: #6e7773; background: #f3f0e8; border-bottom: 1px solid var(--border); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; text-align: left; white-space: nowrap; }
.data-table td { padding: 14px 17px; border-bottom: 1px solid #eee9df; vertical-align: middle; font-size: 12px; }
.data-table tbody tr:hover { background: rgba(237,241,237,.65); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .number { text-align: right; font-variant-numeric: tabular-nums; }
.item-title { max-width: 360px; }
.item-title strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.item-title small { display: block; color: var(--muted); margin-top: 4px; }
.category-pill, .phase-pill, .table-status { display: inline-flex; align-items: center; border-radius: 8px; padding: 5px 8px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.category-pill { color: #33413d; background: #eeeae1; }
.phase-pill { color: #255c4d; background: #e2eee9; }
.table-status { color: #665f53; background: #f0ece4; }
.table-status[data-status="Payé"], .table-status[data-status="Terminé"] { color: #246048; background: #dff0e8; }
.table-status[data-status="En cours"], .table-status[data-status="Commandé"] { color: #8a5a1e; background: #f7ead6; }
.table-status[data-status="Bloqué"] { color: #963d3d; background: #f6e1df; }
.row-actions { display: flex; justify-content: flex-end; gap: 5px; }
.row-action { width: 32px; height: 32px; border: 0; border-radius: 9px; background: #efede6; color: var(--green); font-weight: 900; }
.row-action.delete { color: var(--danger); background: #f8e8e6; }
.empty-state { display: grid; place-items: center; text-align: center; min-height: 220px; padding: 40px; color: var(--muted); }
.empty-state strong { color: var(--ink); margin-bottom: 7px; }
.empty-state span { font-size: 12px; }

.planning-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.planning-heading h2 { margin-bottom: 4px; }
.gantt-panel { padding: 17px; overflow-x: auto; }
.gantt { min-width: 1180px; }
.gantt-header, .gantt-row { display: grid; grid-template-columns: 265px repeat(16, 1fr) 80px; }
.gantt-header { position: sticky; top: 0; z-index: 2; background: var(--paper); }
.gantt-header > div { padding: 10px 5px; color: var(--muted); border-bottom: 1px solid var(--border); text-align: center; font-size: 9px; font-weight: 850; text-transform: uppercase; }
.gantt-header > div:first-child { text-align: left; padding-left: 12px; }
.gantt-row { min-height: 62px; align-items: center; border-bottom: 1px solid #ede8de; position: relative; }
.gantt-row:last-child { border-bottom: 0; }
.gantt-label { padding: 8px 12px; min-width: 0; }
.gantt-label strong { display: block; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-label small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.week-cell { height: 100%; border-left: 1px solid #f0ece4; background: linear-gradient(90deg, transparent 0, transparent calc(100% - 1px), rgba(230,225,214,.6) 100%); }
.gantt-bar { height: 26px; align-self: center; margin: 0 2px; border-radius: 8px; display: flex; align-items: center; padding: 0 8px; color: white; font-size: 9px; font-weight: 850; white-space: nowrap; overflow: hidden; z-index: 1; box-shadow: 0 5px 13px rgba(36,91,77,.14); }
.gantt-bar.todo { background: #81968f; }
.gantt-bar.progress { background: #d09351; }
.gantt-bar.done { background: #2f7d5d; }
.gantt-bar.blocked { background: #b94b4b; }
.gantt-actions { display: flex; gap: 4px; justify-content: end; }
.mobile-task-panel { display: none; overflow: hidden; }
.task-card { padding: 17px; border-bottom: 1px solid #ebe5d9; }
.task-card:last-child { border-bottom: 0; }
.task-card-head { display: flex; justify-content: space-between; gap: 12px; }
.task-card p { color: var(--muted); font-size: 11px; line-height: 1.5; }
.task-meta { display: flex; gap: 7px; flex-wrap: wrap; }

.document-hero { display: flex; align-items: center; justify-content: space-between; gap: 25px; padding: 28px; margin-bottom: 16px; }
.document-hero p:last-child { margin-bottom: 0; color: var(--muted); max-width: 720px; }
.document-categories { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.document-category-card { border: 1px solid var(--border); border-radius: 16px; background: var(--paper); padding: 17px; box-shadow: 0 7px 20px rgba(32,51,45,.05); }
.document-category-card span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: #eeeae1; font-size: 18px; }
.document-category-card strong { display: block; margin-top: 11px; font-size: 12px; }
.document-category-card small { color: var(--muted); font-size: 10px; }
.document-list-head select { width: 210px; }
.document-list { padding: 0 23px 12px; }
.document-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) 120px 85px 112px; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid #ece7dd; }
.document-row:last-child { border-bottom: 0; }
.file-type-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: #eeeae1; color: var(--green); font-size: 10px; font-weight: 900; }
.document-name { min-width: 0; }
.document-name strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; }
.document-name small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.document-row > small { color: var(--muted); font-size: 10px; }
.document-actions { display: flex; justify-content: flex-end; gap: 5px; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.settings-card { padding: 25px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.settings-card.wide { grid-column: 1 / -1; }
.settings-card > p:not(.eyebrow) { color: var(--muted); line-height: 1.6; font-size: 12px; }
.settings-card label { width: 100%; color: var(--muted); font-size: 11px; font-weight: 800; }
.settings-card label input { margin-top: 7px; }
.settings-card .danger-button { margin-top: 2px; }
.instructions { margin: 0; padding-left: 22px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.notice { display: flex; gap: 12px; padding: 14px; border-radius: 13px; background: #f6ead9; color: #755321; font-size: 11px; line-height: 1.45; }
.notice strong { flex: 0 0 auto; }
code { padding: 2px 5px; background: #eeeae2; border-radius: 5px; font-size: .9em; }

.modal { width: min(760px, calc(100% - 28px)); max-height: calc(100vh - 30px); padding: 0; border: 0; border-radius: 24px; background: var(--paper); color: var(--ink); box-shadow: 0 30px 90px rgba(21,42,35,.32); overflow: auto; }
.modal::backdrop { background: rgba(11,30,25,.62); backdrop-filter: blur(4px); }
.modal form { padding: 25px; }
.small-modal { width: min(560px, calc(100% - 28px)); }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; margin-bottom: 20px; }
.modal-header h2 { margin-bottom: 0; font-size: 27px; }
.modal-close { width: 38px; height: 38px; border: 0; border-radius: 11px; background: #eeeae2; color: var(--ink); font-size: 25px; line-height: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label, .modal > form > label { color: var(--muted); font-size: 11px; font-weight: 800; }
.form-grid label input, .form-grid label select, .form-grid label textarea, .modal > form > label input, .modal > form > label select { margin-top: 7px; }
.span-2 { grid-column: 1 / -1; }
.checkbox-label { display: flex; align-items: center; gap: 9px; min-height: 43px; padding-top: 21px; }
.checkbox-label input { width: 18px; min-height: 18px; margin: 0 !important; }
.calculation-preview { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; padding: 15px 17px; border-radius: 14px; background: #edf2ef; color: var(--green); }
.calculation-preview span { font-size: 11px; font-weight: 800; }
.calculation-preview strong { font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.file-drop { display: grid; place-items: center; text-align: center; min-height: 190px; margin-top: 14px; padding: 24px; border: 2px dashed #cfc8bb; border-radius: 17px; background: #f8f5ed; cursor: pointer; }
.file-drop.dragging { border-color: var(--sage); background: #edf3ef; }
.file-drop input { position: absolute; opacity: 0; pointer-events: none; }
.file-drop strong { color: var(--ink); margin-top: 7px; }
.file-drop small { color: var(--muted); margin-top: 6px; font-weight: 500; }
.file-icon { font-size: 30px; color: var(--green); }
.selected-files { display: grid; gap: 6px; margin-top: 10px; }
.selected-file { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 9px; background: #f0ede6; font-size: 10px; }

.toast-container { position: fixed; right: 22px; bottom: 22px; z-index: 100; display: grid; gap: 9px; pointer-events: none; }
.toast { min-width: 250px; max-width: 390px; padding: 13px 15px; border-radius: 13px; color: white; background: var(--green); box-shadow: 0 12px 35px rgba(16,48,40,.25); font-size: 12px; font-weight: 750; animation: toastIn .2s ease; }
.toast.error { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
.mobile-nav { display: none; }

@media (max-width: 1180px) {
  .toolbar { grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(140px, auto)); }
  .toolbar .primary-button, .toolbar .secondary-button { width: 100%; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .document-categories { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .content-column { padding-bottom: 74px; }
  .topbar { min-height: 85px; padding: 16px 18px; }
  .topbar .eyebrow { display: none; }
  .topbar-actions .save-state, .topbar-actions .icon-button { display: none; }
  .topbar-actions .primary-button { font-size: 0; width: 42px; padding: 0; }
  .topbar-actions .primary-button::after { content: "+"; font-size: 23px; }
  main { padding: 18px 14px 30px; }
  .mobile-nav { display: grid; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; grid-template-columns: repeat(5, 1fr); min-height: 67px; padding: 6px 5px calc(6px + env(safe-area-inset-bottom)); background: rgba(255,253,248,.96); border-top: 1px solid var(--border); backdrop-filter: blur(14px); box-shadow: 0 -8px 30px rgba(31,54,46,.09); }
  .mobile-nav button { display: grid; place-items: center; gap: 1px; border: 0; border-radius: 11px; background: transparent; color: #7a8580; }
  .mobile-nav button span { font-size: 20px; line-height: 1; }
  .mobile-nav button small { font-size: 9px; font-weight: 750; }
  .mobile-nav button.active { color: var(--green); background: #edf1ed; }
  .hero-card { min-height: 190px; padding: 25px; }
  .hero-ring { width: 105px; height: 105px; background: radial-gradient(circle 41px, #1b5144 98%, transparent 100%), conic-gradient(#e2b17e var(--pct), rgba(255,255,255,.16) 0); }
  .hero-ring span { font-size: 21px; }
  .dashboard-grid, .dashboard-grid.lower { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar .search-box { grid-column: 1 / -1; }
  .budget-summary-strip { grid-template-columns: repeat(2, 1fr); }
  .planning-heading { align-items: center; }
  .gantt-panel { display: none; }
  .mobile-task-panel { display: block; }
  .document-hero { align-items: flex-start; }
  .document-row { grid-template-columns: 42px minmax(0,1fr) 100px; }
  .document-row > .doc-category, .document-row > .doc-date { display: none; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-card.wide { grid-column: auto; }
}
@media (max-width: 600px) {
  .topbar h1 { font-size: 23px; }
  .hero-card { grid-template-columns: 1fr; gap: 20px; }
  .hero-copy h2 { font-size: 43px; }
  .hero-progress-wrap { display: none; }
  .kpi-grid { gap: 9px; }
  .kpi-card { min-height: 105px; padding: 15px; }
  .kpi-card strong { font-size: 22px; }
  .category-row { grid-template-columns: minmax(120px, 1fr) 80px; gap: 9px; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .category-amount { grid-column: 2; grid-row: 1; }
  .toolbar { grid-template-columns: 1fr; }
  .toolbar .search-box { grid-column: auto; }
  .toolbar select { display: none; }
  .toolbar .secondary-button, .toolbar .primary-button { display: inline-flex; align-items: center; justify-content: center; }
  .budget-summary-strip { grid-template-columns: 1fr 1fr; }
  .planning-heading { align-items: flex-start; }
  .planning-heading .primary-button { font-size: 0; width: 43px; padding: 0; }
  .planning-heading .primary-button::after { content: "+"; font-size: 23px; }
  .document-hero { display: block; }
  .document-hero .primary-button { margin-top: 14px; width: 100%; }
  .document-categories { grid-template-columns: 1fr 1fr; gap: 8px; }
  .document-category-card { padding: 13px; }
  .document-list-head { display: block; }
  .document-list-head select { width: 100%; margin-top: 10px; }
  .document-row { grid-template-columns: 38px minmax(0,1fr) 72px; gap: 8px; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .checkbox-label { padding-top: 0; }
  .modal form { padding: 19px; }
  .modal-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .toast-container { left: 12px; right: 12px; bottom: 83px; }
  .toast { min-width: 0; max-width: none; }
}

/* Photos et albums — version 1.2 */
.photo-hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 28px; margin-bottom: 16px; }
.photo-hero p:last-child { margin-bottom: 0; max-width: 720px; color: var(--muted); }
.photo-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.album-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.album-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 18px; background: var(--paper); box-shadow: 0 8px 24px rgba(32,51,45,.06); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.album-card:hover { transform: translateY(-2px); box-shadow: 0 13px 30px rgba(32,51,45,.10); }
.album-card.active { border-color: var(--sage); box-shadow: 0 0 0 2px rgba(87,128,111,.16), 0 12px 28px rgba(32,51,45,.09); }
.album-cover { position: relative; display: block; width: 100%; aspect-ratio: 16 / 10; padding: 0; overflow: hidden; border: 0; background: linear-gradient(145deg, #e8ede9, #d7dfda); cursor: pointer; }
.album-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-cover-placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: var(--green); font-size: 34px; background: linear-gradient(145deg, #f1eee7, #e2e8e3); }
.album-cover::after { content: ""; position: absolute; inset: auto 0 0; height: 45%; background: linear-gradient(transparent, rgba(11,30,25,.26)); pointer-events: none; }
.album-info { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 14px; }
.album-info-button { min-width: 0; flex: 1; padding: 0; border: 0; background: transparent; text-align: left; cursor: pointer; color: inherit; }
.album-info strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; }
.album-info small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.album-card-actions { display: flex; gap: 4px; flex: 0 0 auto; }
.album-card-actions .row-action { width: 29px; height: 29px; }
.photo-library-panel { overflow: hidden; }
.photo-library-head { align-items: center; padding: 22px 23px 10px; }
.photo-library-head .muted { margin: 3px 0 0; font-size: 11px; }
.photo-gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 12px 18px 22px; }
.photo-card { position: relative; min-width: 0; aspect-ratio: 1 / 1; overflow: hidden; border-radius: 15px; background: #e9ece8; box-shadow: inset 0 0 0 1px rgba(25,62,51,.06); }
.photo-open { width: 100%; height: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.photo-open img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .22s ease; }
.photo-card:hover .photo-open img { transform: scale(1.035); }
.photo-card-overlay { position: absolute; inset: auto 0 0; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; padding: 28px 9px 9px; background: linear-gradient(transparent, rgba(9,26,21,.72)); color: white; pointer-events: none; }
.photo-card-overlay span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 10px; font-weight: 750; }
.photo-delete { position: absolute; top: 8px; right: 8px; z-index: 2; width: 31px; height: 31px; border: 0; border-radius: 10px; background: rgba(19,38,32,.72); color: white; font-size: 18px; cursor: pointer; backdrop-filter: blur(5px); }
.photo-delete:hover { background: var(--danger); }
.photo-placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: var(--green); font-size: 28px; background: linear-gradient(145deg, #eef1ed, #dfe5e1); }
.photo-lightbox { width: 100vw; max-width: none; height: 100vh; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(4,14,11,.96); color: white; overflow: hidden; }
.photo-lightbox::backdrop { background: rgba(4,14,11,.96); }
.photo-lightbox[open] { display: grid; grid-template-columns: 72px minmax(0, 1fr) 72px; align-items: center; }
.photo-lightbox figure { min-width: 0; height: 100vh; margin: 0; padding: 50px 16px 26px; display: grid; grid-template-rows: minmax(0,1fr) auto; gap: 14px; }
.photo-lightbox img { width: 100%; height: 100%; max-height: calc(100vh - 115px); object-fit: contain; }
.photo-lightbox figcaption { display: flex; justify-content: center; align-items: baseline; gap: 12px; min-width: 0; text-align: center; }
.photo-lightbox figcaption strong { max-width: 65vw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; }
.photo-lightbox figcaption span { color: rgba(255,255,255,.62); font-size: 10px; }
.lightbox-close { position: fixed; top: 16px; right: 18px; z-index: 3; width: 43px; height: 43px; border: 0; border-radius: 13px; background: rgba(255,255,255,.12); color: white; font-size: 28px; cursor: pointer; }
.lightbox-nav { width: 48px; height: 62px; justify-self: center; border: 0; border-radius: 14px; background: rgba(255,255,255,.11); color: white; font-size: 42px; line-height: 1; cursor: pointer; }
.lightbox-nav:disabled { opacity: .2; cursor: default; }
.document-category-card.photo-category { cursor: pointer; }
.document-category-card.photo-category:hover { border-color: var(--sage); }

@media (max-width: 1180px) {
  .album-grid, .photo-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .mobile-nav { grid-template-columns: repeat(6, 1fr); }
  .photo-hero { align-items: flex-start; }
  .album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .photo-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .photo-hero { display: block; padding: 21px; }
  .photo-hero-actions { display: grid; grid-template-columns: 1fr 1fr; margin-top: 15px; }
  .photo-hero-actions button { width: 100%; padding-left: 10px; padding-right: 10px; }
  .album-grid { gap: 9px; }
  .album-info { padding: 11px; }
  .album-card-actions { position: absolute; top: 7px; right: 7px; z-index: 2; }
  .album-card-actions .row-action { background: rgba(255,255,255,.90); }
  .photo-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; padding: 10px 10px 16px; }
  .photo-library-head { padding: 18px 14px 8px; }
  .photo-lightbox[open] { grid-template-columns: 44px minmax(0,1fr) 44px; }
  .photo-lightbox figure { padding-left: 4px; padding-right: 4px; }
  .lightbox-nav { width: 38px; height: 52px; font-size: 34px; }
  .mobile-nav button small { font-size: 8px; }
}
.photo-open { position: relative; overflow: hidden; }
.photo-open .photo-placeholder, .photo-open img { position: absolute; inset: 0; }
.photo-open img:not([src]) { opacity: 0; }
.photo-open img[src] { opacity: 1; }

.conversion-note { display: block; margin-top: 3px; color: var(--green); font-size: 9px; font-style: normal; font-weight: 750; }


/* Import CSV — version 1.4 */
.csv-import-modal { width: min(980px, calc(100% - 28px)); }
.csv-intro { margin: -7px 0 16px; color: var(--muted); line-height: 1.55; font-size: 12px; }
.csv-drop { min-height: 138px; }
.csv-import-workspace { display: grid; gap: 16px; margin-top: 16px; }
.csv-options { display: flex; align-items: end; justify-content: space-between; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 15px; background: #faf7f0; }
.csv-options label { min-width: min(340px, 100%); color: var(--muted); font-size: 11px; font-weight: 800; }
.csv-options select { width: 100%; margin-top: 7px; }
.csv-template-button { flex: 0 0 auto; padding-bottom: 10px; }
.csv-detection { display: flex; flex-wrap: wrap; gap: 8px; }
.csv-detection span { padding: 8px 11px; border-radius: 99px; background: #edf1ed; color: var(--muted); font-size: 10px; font-weight: 750; }
.csv-detection strong { color: var(--green); }
.csv-mapping-section, .csv-preview-section { padding: 17px; border: 1px solid var(--border); border-radius: 17px; background: #fffefa; }
.csv-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 13px; }
.csv-section-heading h3 { font-size: 16px; }
.csv-section-heading > small { max-width: 390px; color: var(--muted); text-align: right; line-height: 1.45; }
.csv-mapping-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.csv-mapping-grid label { min-width: 0; color: var(--muted); font-size: 10px; font-weight: 800; }
.csv-mapping-grid select { width: 100%; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; }
.csv-preview-scroll { border: 1px solid #e7e0d3; border-radius: 12px; }
.csv-preview-table { min-width: 680px; }
.csv-preview-table td, .csv-preview-table th { padding-top: 11px; padding-bottom: 11px; }
.csv-warnings { display: grid; gap: 8px; margin-top: 10px; }
.csv-warnings .notice { margin: 0; }
button:disabled { opacity: .48; cursor: not-allowed; transform: none !important; }
@media (max-width: 800px) {
  .csv-mapping-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .csv-section-heading { display: block; }
  .csv-section-heading > small { display: block; margin-top: 6px; text-align: left; }
}
@media (max-width: 600px) {
  .csv-options { display: block; }
  .csv-template-button { margin-top: 10px; padding-bottom: 0; }
  .csv-mapping-grid { grid-template-columns: 1fr; }
  .csv-import-modal .modal-actions { position: sticky; bottom: -19px; padding: 12px 0 0; background: var(--paper); }
}
