.workspace .company-picker {
  min-width: 220px;
  margin: 0;
  padding: 7px 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 2px 4px #193d2e05;
}

.workspace .header-actions {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 20;
}

.workspace {
  margin: 0 auto;
  align-self: start;
  min-width: 0;
}

.workspace .grid { grid-template-columns: repeat(12,minmax(0,1fr)); }
.workspace .grid > *, .workspace .card, .workspace .form-grid > * { min-width: 0; }
.workspace .form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }

.user-card #user-role {
  font-size: 8px;
  letter-spacing: .02em;
  line-height: 1.1;
}

.sidebar nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.sidebar .management-nav {
  display: grid;
  gap: 3px;
  margin-top: auto;
  padding-top: 18px;
  padding-bottom: 18px;
  border-top: 1px solid rgba(255, 255, 255, .09);
}

.sidebar .management-nav p {
  margin-top: 0;
}

.sidebar .nav-tree { overflow-y: auto; margin-top: 12px; scrollbar-width: thin; }
.sidebar #nav a[data-view] { display: flex; align-items: center; gap: 11px; min-height: 36px; padding: 10px 12px; border-radius: 8px; color: #afc4bd; font-size: 13px; text-align: left; text-decoration: none; }
.sidebar #nav a[data-view]:hover,.sidebar #nav a[data-view].active { color: #fff; background: #ffffff10; }
.sidebar .nav-parent { width: 100%; color: #dfeae6; font-weight: 750; }
.sidebar .nav-parent span,.sidebar .nav-section span { margin-left: auto; font-size: 10px; transition: transform .2s; }
.sidebar .nav-children,.sidebar .nav-leaves { display: none; }
.sidebar .nav-children.open,.sidebar .nav-leaves.open { display: grid; gap: 2px; }
.sidebar .nav-section { padding: 8px 10px 5px 22px; color: #8faba1; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.sidebar .nav-leaves button,.sidebar .nav-leaves a[data-view] { padding: 7px 9px 7px 35px; color: #a9bdb6; font-size: 11px; }
.sidebar .nav-leaves button.active,.sidebar .nav-leaves a[data-view].active { color: #fff; background: #ffffff10; }

.span6 { grid-column: span 6; }
.subtotal th { background: #f1f6f3; color: var(--green); }
#bilan-v2 .form-actions { grid-column: 1 / -1; justify-content: center; }

.filing-checklist { display: grid; gap: 9px; margin: 18px 0; padding: 0; list-style: none; }
.filing-checklist li { position: relative; padding: 9px 10px 9px 32px; border: 1px solid #ead7b2; border-radius: 9px; background: #fffaf0; color: #725c32; font-size: 12px; }
.filing-checklist li::before { content: "!"; position: absolute; left: 11px; top: 8px; width: 15px; height: 15px; border-radius: 50%; background: #d4a84d; color: #fff; font-size: 10px; font-weight: 900; line-height: 15px; text-align: center; }
.filing-checklist li.done { border-color: #cfe3d8; background: #f2faf6; color: var(--green); }
.filing-checklist li.done::before { content: "OK"; width: 19px; border-radius: 5px; background: var(--green2); font-size: 7px; }
.check-line { display: flex !important; grid-template-columns: 18px 1fr; align-items: start; gap: 9px !important; font-weight: 600 !important; }
#abbreviated-eligibility[hidden] { display: none !important; }
.check-line input { width: 16px; height: 16px; margin: 1px 0 0; padding: 0; }
a.ghost { display: inline-block; color: var(--ink); text-decoration: none; }
.table-scroll { width: 100%; overflow-x: auto; }

@media (max-width: 1400px) {
  .filing-layout > .span8,
  .filing-layout > .span4 { grid-column: span 12; }
  .filing-layout .form-grid { grid-template-columns: minmax(0,1fr); }
  .filing-layout .form-grid > .full { grid-column: 1; }
  .annual-preview-grid > .span6 { grid-column: span 12; }
}

@media (max-width: 600px) {
  .workspace .form-grid { grid-template-columns: minmax(0,1fr); }
  .workspace .form-grid > .full { grid-column: 1; }
}

.account-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 4px 0;
  padding: 12px 14px;
  border: 1px solid #dbe8e2;
  border-radius: 12px;
  background: #f5f9f7;
}

.account-tools strong,
.account-tools small { display: block; }
.account-tools small { margin-top: 3px; color: #6c7d76; }
.account-tools-actions { display: flex; flex: 0 0 auto; gap: 8px; }
.account-list { max-height: min(56vh, 560px); overflow: auto; margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; }
.account-list table { margin: 0; }
.account-list thead { position: sticky; top: 0; z-index: 1; }
.account-filter-label { display: grid; gap: 7px; color: #40534c; font-size: 13px; font-weight: 700; }
.account-filter-label input { border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px; outline: none; }
.account-filter-label input:focus { border-color: var(--green2); box-shadow: 0 0 0 3px #1c7a5819; }

.account-picker { position: relative; min-width: 0; }
.account-picker .account-search { width: 100%; min-height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #fff; outline: none; }
.account-picker .account-search:focus { border-color: var(--green2); box-shadow: 0 0 0 3px #1c7a5819; }
.account-results { position: absolute; z-index: 80; top: calc(100% + 4px); left: 0; right: 0; min-width: 390px; max-height: 320px; overflow: auto; padding: 6px; border: 1px solid #cbdad3; border-radius: 11px; background: #fff; box-shadow: 0 16px 38px #102d2526; }
.account-results[hidden] { display: none; }
.account-results button { display: grid; grid-template-columns: 88px 1fr; width: 100%; gap: 10px; padding: 9px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.account-results button:hover,.account-results button.active { background: #eef7f2; }
.account-results button strong { color: var(--green); font-variant-numeric: tabular-nums; }
.account-results button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-no-result { padding: 16px; color: var(--muted); text-align: center; }

dialog.wide { max-width: 1040px; }
.import-tools { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 4px 0; padding: 13px 15px; border: 1px solid #d9e2ed; border-radius: 12px; background: #f5f8fc; }
.import-tools strong,.import-tools small { display: block; }
.import-tools small { margin-top: 3px; color: #66788b; }
.import-tools-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.import-drop { padding: 16px; border: 1px dashed #a9bcb3; border-radius: 12px; background: #f9fbfa; }
.import-drop input { padding: 9px; border-style: dashed; }
.import-drop small,.import-section-title small,.form-grid label small { color: var(--muted); font-size: 11px; font-weight: 500; }
.import-section-title { margin-top: 6px; padding: 11px 13px; border-radius: 9px; background: #edf5f1; color: var(--green); font-weight: 800; }
.import-section-title small { display: block; margin-top: 3px; }
.import-summary { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin: 14px 0; }
.import-summary > div { padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: #fafcfb; }
.import-summary small { display: block; color: var(--muted); }
.import-summary strong { display: block; margin-top: 7px; font: 600 24px Georgia,serif; }
.import-errors { margin: 14px 0; padding: 14px 16px; border-left: 3px solid var(--danger); border-radius: 8px; background: #fff1f1; color: #7c2929; font-size: 12px; }
.import-errors ul,.notice ul { max-height: 190px; overflow: auto; margin: 8px 0 0; padding-left: 20px; }
.import-errors li,.notice li { margin: 5px 0; }
.import-preview-table { max-height: 310px; }
.import-control-total { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 22px; padding: 14px 4px; font-size: 13px; }
.import-confirm { display: flex; align-items: flex-start; gap: 9px; margin: 12px 0; padding: 13px; border: 1px solid #bcd8ca; border-radius: 9px; background: #f1faf5; color: var(--green); font-size: 13px; font-weight: 700; }
.import-confirm input { margin-top: 2px; }

@media (max-width: 900px) {
  .span6 { grid-column: span 12; }
  .account-tools { align-items: stretch; flex-direction: column; }
  .account-tools-actions { flex-wrap: wrap; }
  .import-tools { align-items: stretch; flex-direction: column; }
  .import-tools-actions { justify-content: flex-start; }
  .import-summary { grid-template-columns: repeat(2,1fr); }
  .account-results { min-width: 100%; }
}

.workspace .company-picker span {
  display: block;
  margin-bottom: 1px;
  color: #7b8a84;
  font-size: 8px;
  letter-spacing: .13em;
  font-weight: 800;
}

.workspace .company-picker select {
  width: 100%;
  padding: 1px 22px 1px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  outline: none;
}

@media (max-width: 700px) {
  .workspace > header { min-height: 112px; gap: 18px; }
  .workspace .header-actions { position: absolute; top: 8px; right: 8px; left: 8px; align-items: stretch; flex-wrap: wrap; justify-content: flex-end; }
  .workspace .company-picker { min-width: 0; flex: 1 1 145px; }
  .workspace .status { display: none; }
  .workspace .header-actions #refresh { flex: 0 0 auto; }
  .workspace #page-title,.workspace #breadcrumb { margin-top: 72px; }
  .entry-lines { overflow-x: auto; }
  .entry-line { min-width: 720px; }
  table { display: block; max-width: 100%; overflow-x: auto; }
}

.user-card {
  grid-template-columns: 34px minmax(0, 1fr) auto;
}

.user-card #logout {
  width: auto;
  padding: 6px 0;
  font-size: 11px;
  font-weight: 700;
}

.dialog-close {
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 700px) {
  .user-card { grid-template-columns: 34px minmax(0,1fr); }
  .user-card button { display: none; }
}

.statement-edition { display: grid; gap: 18px; }
.statement-config { display: grid; grid-template-columns: minmax(240px, .8fr) minmax(620px, 2fr); align-items: end; gap: 28px; border-top: 4px solid var(--green); }
.statement-config-title h2 { margin-bottom: 7px; font-size: 24px; }
.statement-config-title p:last-child { max-width: 620px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.statement-filter { display: grid; grid-template-columns: 1.25fr 1fr 1fr 1.25fr auto; align-items: end; gap: 11px; }
.statement-filter label { display: grid; gap: 6px; color: #40534c; font-size: 11px; font-weight: 800; }
.statement-filter input,.statement-filter select { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; background: #fff; color: var(--ink); outline: none; }
.statement-filter input:focus,.statement-filter select:focus { border-color: var(--green2); box-shadow: 0 0 0 3px #1c7a5819; }
.statement-filter .primary { min-height: 42px; align-items: center; white-space: nowrap; }
.statement-print-root { padding: 0; overflow: hidden; }
.statement-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 20px; border-bottom: 1px solid var(--line); background: #fbfcfb; }
.statement-tabs { display: flex; align-items: center; gap: 4px; }
.statement-tabs button { width: auto; border: 0; border-radius: 8px; padding: 9px 13px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 800; cursor: pointer; }
.statement-tabs button:hover { color: var(--green); background: #edf6f1; }
.statement-tabs button.active { color: #fff; background: var(--green); }
.statement-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.statement-control { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; margin: 18px 20px 0; padding: 11px 13px; border: 1px solid #ead7b2; border-radius: 9px; background: #fffaf0; color: #725c32; font-size: 11px; }
.statement-control.valid { border-color: #cfe3d8; background: #f2faf6; color: var(--green); }
.statement-control strong { font-size: 12px; }
.statement-paper-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin: 22px 20px 0; padding: 18px 20px; border-radius: 12px; background: #102d25; color: #fff; }
.statement-paper-header > div { display: grid; gap: 3px; }
.statement-paper-header > div:last-child { justify-items: end; text-align: right; }
.statement-paper-header strong { font: 600 16px Georgia,serif; }
.statement-paper-header span { color: #c5d8d1; font-size: 10px; }
.statement-paper-header #statement-document-title { color: #fff; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.statement-panel { display: none; padding: 22px 20px 8px; }
.statement-panel.active { display: block; }
.statement-sheet-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding: 0 2px; }
.statement-sheet-title span { color: var(--muted); font-size: 11px; font-weight: 700; }
.statement-sheet-title strong { color: var(--green); font-size: 17px; letter-spacing: .05em; }
.statement-table-block { margin-bottom: 20px; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.statement-table-block h3 { margin: 0; padding: 11px 13px; background: #eaf4ef; color: var(--green); font-size: 12px; letter-spacing: .09em; }
.statement-table-block table { font-size: 11px; }
.statement-table-block thead th { background: #f6f8f7; color: #5e7068; }
.statement-table-block tbody tr:nth-child(even) { background: #fbfcfb; }
.statement-table-block td { padding: 9px 10px; }
.statement-table-block tfoot th { padding: 11px 10px; border-top: 2px solid #bcd4c8; background: #eaf4ef; color: var(--green); }
.statement-screen-note { margin: 0; padding: 0 22px 20px; }

@media (max-width: 1600px) {
  .statement-config { grid-template-columns: 1fr; align-items: stretch; }
  .statement-filter { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .statement-filter .primary { grid-column: 1 / -1; justify-content: center; }
}

@media (max-width: 820px) {
  .statement-filter { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .statement-toolbar,.statement-paper-header { align-items: stretch; flex-direction: column; }
  .statement-tabs { overflow-x: auto; }
  .statement-tabs button { white-space: nowrap; }
  .statement-actions { justify-content: flex-start; }
  .statement-paper-header > div:last-child { justify-items: start; text-align: left; }
}

@media (max-width: 520px) {
  .statement-filter { grid-template-columns: minmax(0,1fr); }
  .statement-filter .primary { grid-column: 1; }
}

@media print {
  @page { size: A4 portrait; margin: 12mm; }
  body.statement-print-mode { background: #fff; }
  body.statement-print-mode .sidebar,
  body.statement-print-mode .workspace > header,
  body.statement-print-mode .statement-config,
  body.statement-print-mode .statement-toolbar,
  body.statement-print-mode #statement-status,
  body.statement-print-mode .statement-screen-note { display: none !important; }
  body.statement-print-mode .app { display: block !important; min-height: auto; }
  body.statement-print-mode .workspace { display: block; width: 100%; max-width: none; margin: 0; padding: 0; }
  body.statement-print-mode .statement-edition { display: block; }
  body.statement-print-mode .statement-print-root { border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
  body.statement-print-mode .statement-paper-header { margin: 0 0 8mm; padding: 5mm 6mm; border-radius: 0; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  body.statement-print-mode .statement-panel { display: none !important; padding: 0; }
  body.statement-print-mode .statement-panel.active { display: block !important; }
  body.statement-print-mode .statement-table-block { break-inside: auto; border-radius: 0; }
  body.statement-print-mode .statement-table-block h3,
  body.statement-print-mode .statement-table-block thead th,
  body.statement-print-mode .statement-table-block tfoot th,
  body.statement-print-mode .subtotal { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  body.statement-print-mode .table-scroll { overflow: visible; }
  body.statement-print-mode table { display: table; overflow: visible; font-size: 8.5pt; }
  body.statement-print-mode tr { break-inside: avoid; }
  body.statement-print-mode th,body.statement-print-mode td { padding: 5px 6px; }
}

/* Cohérence UI globale */
html,body { max-width: 100%; overflow-x: hidden; }
button { max-width: 100%; }
.primary,.ghost,.danger { align-items: center; justify-content: center; min-height: 36px; line-height: 1.25; text-align: center; }
button:disabled,.primary:disabled,.ghost:disabled,.danger:disabled { opacity: .45; cursor: not-allowed; filter: saturate(.45); box-shadow: none; }
button:disabled:hover,.primary:disabled:hover { background: var(--green); }
.workspace .form-grid input,
.workspace .form-grid select,
.workspace .form-grid textarea,
dialog .form-grid input,
dialog .form-grid select,
dialog .form-grid textarea { width: 100%; min-width: 0; }
.workspace .form-grid label,
dialog .form-grid label { min-width: 0; }
.workspace .form-grid label:has(> input[type="checkbox"]) { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #f8fbf9; }
.workspace .form-grid label:has(> input[type="checkbox"]) input { flex: 0 0 auto; width: 18px; height: 18px; margin: 0; }
.table-scroll { max-width: 100%; border-radius: 10px; }
.table-scroll table { width: max-content; min-width: 100%; }

/* Navigation accordéon */
.sidebar .nav-tree { padding-right: 4px; overscroll-behavior: contain; }
.sidebar .nav-parent,.sidebar .nav-section { position: relative; padding-right: 36px; }
.sidebar .nav-parent::after,.sidebar .nav-section::after { content: ""; position: absolute; right: 13px; top: 50%; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-65%) rotate(45deg); transition: transform .18s ease; opacity: .8; }
.sidebar [aria-expanded="true"]::after { transform: translateY(-35%) rotate(225deg); }
.sidebar .nav-section { min-height: 33px; font-size: 10.5px; }
.sidebar .nav-leaves button,.sidebar .nav-leaves a[data-view] { min-height: 32px; font-size: 12px; line-height: 1.25; }
.sidebar .nav-leaves button.active,.sidebar .nav-leaves a[data-view].active { box-shadow: inset 3px 0 0 #78b79c; }
.sidebar .nav-children.open,.sidebar .nav-leaves.open { animation: menu-open .16s ease-out; }
@keyframes menu-open { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } }
.sidebar-close,.mobile-nav-toggle,.nav-backdrop { display: none; }
.page-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }

@media (min-width: 1251px) {
  .page-heading { max-width: calc(100% - 720px); }
  #breadcrumb { max-width: 100%; line-height: 1.45; overflow-wrap: anywhere; }
}

/* Fenêtres et formulaires */
dialog { max-height: calc(100dvh - 32px); overflow: auto; overscroll-behavior: contain; }
dialog.wide { width: min(1040px,calc(100% - 32px)); }
.dialog-close { position: sticky; z-index: 5; top: 0; display: block; margin: -12px -12px 8px auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
#modal-content { min-width: 0; }
#modal-content .form-actions { position: sticky; z-index: 4; bottom: -28px; margin: 18px -4px -4px; padding: 16px 4px 4px; border-top: 1px solid #edf0ee; background: linear-gradient(180deg,#ffffffee,#fff 35%); }
.required-field { position: relative; padding-top: 18px; }
.required-field::before { content: "Obligatoire"; position: absolute; top: 0; right: 0; color: #75847e; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.choice-section { min-width: 0; margin: 0; padding: 15px; border: 1px solid var(--line); border-radius: 11px; }
.choice-section legend { padding: 0 7px; color: var(--ink); font-weight: 800; }
.choice-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 4px; }
.choice-card { display: flex !important; align-items: center; gap: 10px !important; min-width: 0; min-height: 42px; padding: 9px 11px; border: 1px solid #dfe7e3; border-radius: 9px; background: #f8fbf9; color: var(--ink) !important; cursor: pointer; }
.choice-card:hover { border-color: #9fc8b5; background: #f1f8f4; }
.choice-card input { flex: 0 0 auto; width: 17px !important; height: 17px; margin: 0; }
.choice-card span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
input[type="file"] { padding: 8px !important; background: #fbfcfb !important; }
input[type="file"]::file-selector-button { margin-right: 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 7px; background: #eef6f2; color: var(--green); font-weight: 750; cursor: pointer; }

/* États vides et cartes */
.empty { display: grid; place-items: center; align-content: center; gap: 7px; min-height: 130px; margin-top: 12px; border: 1px dashed #d8e2dd; border-radius: 11px; background: linear-gradient(145deg,#fbfcfb,#f5f9f7); color: var(--muted); }
.empty::before,.empty-visual { content: ""; display: block; width: 38px; height: 38px; border: 8px solid #dcece4; border-radius: 50%; background: #edf6f2; }
.compact-empty { min-height: 150px; }
.compact-empty strong,.compact-empty span { display: block; text-align: center; }
.compact-empty strong { color: var(--ink); font: 600 17px Georgia,serif; }
.compact-empty span { max-width: 560px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.dashboard-empty { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 18px; min-height: 160px; padding: 24px; border: 1px dashed #d5e2dc; border-radius: 12px; background: linear-gradient(135deg,#fbfdfc,#f2f8f5); }
.dashboard-empty h3 { margin: 0 0 6px; font: 600 18px Georgia,serif; }
.dashboard-empty p { max-width: 680px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.report-card { border-top: 4px solid var(--green); }
.filing-layout { align-items: start; }
.filing-layout > .card { align-self: start; }
.company-grid { align-items: start; }
.company-grid .management-hero { padding-block: 20px; }
.company-card { grid-column: span 6; min-height: 230px; }
.company-card-head { display: flex; align-items: center; gap: 14px; }
.company-card-head h2 { margin: 0 0 4px; }
.company-card-head p { margin: 0; }
.company-years { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 22px; }
.user-card #user-role { font-size: 9px; }

/* L’en-tête reste au bord sur grand écran, puis se réorganise avant de se chevaucher. */
@media (max-width: 1250px) {
  .workspace > header { display: grid; gap: 18px; align-items: start; }
  .workspace .header-actions { position: static; display: grid; grid-template-columns: minmax(180px,1fr) minmax(220px,1fr) auto auto; width: 100%; }
}

@media (max-width: 950px) {
  body.nav-locked { overflow: hidden; }
  .app { display: block; min-height: 100vh; }
  .workspace { grid-column: 1; max-width: none; padding: 24px 22px 48px; }
  .sidebar { z-index: 70; width: min(290px,88vw); padding: 18px 16px; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 18px 0 50px #0a211a42; }
  .app.nav-open .sidebar { transform: translateX(0); }
  .nav-backdrop { position: fixed; z-index: 65; inset: 0; width: 100%; height: 100%; border: 0; background: #071b1575; }
  .app.nav-open .nav-backdrop { display: block; }
  .mobile-nav-toggle { display: inline-flex; flex: 0 0 auto; align-items: center; min-height: 38px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); font-weight: 750; }
  .sidebar-close { display: block; margin: 0 0 10px auto; padding: 7px 9px; border: 1px solid #ffffff24; border-radius: 8px; background: #ffffff0d; color: #dce9e4; font-size: 11px; }
  .sidebar .logo > div:last-child { display: block; }
  .sidebar nav p { display: block; font-size: 9px; }
  .sidebar nav button,.sidebar nav button:not(.active),.sidebar #nav a[data-view],.sidebar #nav a[data-view]:not(.active) { font-size: 13px; }
  .sidebar .nav-section,.sidebar .nav-section:not(.active) { font-size: 10.5px; }
  .sidebar .nav-leaves button,.sidebar .nav-leaves button:not(.active),.sidebar .nav-leaves a[data-view],.sidebar .nav-leaves a[data-view]:not(.active) { font-size: 12px; }
  .sidebar .user-card { grid-template-columns: 34px minmax(0,1fr) auto; }
  .sidebar .user-card > div:not(:first-child),.sidebar .user-card button { display: block; }
  .metric { grid-column: span 6; }
  .company-card { grid-column: span 12; }
}

@media (max-width: 760px) {
  .workspace .header-actions { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .workspace .header-actions .status { display: inline-flex; align-items: center; justify-content: center; }
  .workspace .header-actions #refresh { width: 100%; }
  .workspace #page-title,.workspace #breadcrumb { margin-top: 0; }
  .workspace > header { min-height: 0; }
  .dashboard-empty { grid-template-columns: 1fr; text-align: center; }
  .dashboard-empty .empty-visual { margin: auto; }
  .dashboard-empty .ghost { width: 100%; }
  .card-head { align-items: flex-start; gap: 14px; }
}

@media (max-width: 600px) {
  .workspace { padding: 18px 14px 40px; }
  .workspace .header-actions { grid-template-columns: minmax(0,1fr); }
  .workspace .company-picker { min-width: 0; width: 100%; }
  .workspace .header-actions .status { display: none; }
  .workspace h1 { font-size: 27px; }
  .card { padding: 18px; border-radius: 13px; }
  .card-head { flex-direction: column; }
  .card-head > button,.card-head > .primary { width: 100%; }
  .metric { grid-column: span 12; }
  .choice-grid { grid-template-columns: minmax(0,1fr); }
  dialog,dialog.wide { width: calc(100% - 20px); max-height: calc(100dvh - 20px); padding: 20px 16px; }
  #modal-content .form-grid { grid-template-columns: minmax(0,1fr); }
  #modal-content .form-grid > .full { grid-column: 1; }
  #modal-content .form-actions { flex-wrap: wrap-reverse; }
  #modal-content .form-actions button { flex: 1 1 100%; }
  .account-tools-actions,.import-tools-actions { display: grid; grid-template-columns: minmax(0,1fr); }
  .account-tools-actions button,.import-tools-actions button { width: 100%; }
}

@media print {
  .mobile-nav-toggle,.sidebar-close,.nav-backdrop { display: none !important; }
}

/* Saisie des opérations diverses */
.entry-workspace { padding: 0; overflow: visible; }
.entry-card-head { margin: 0; padding: 14px 18px 12px; border-bottom: 1px solid #e6ece8; }
.entry-card-head .eyebrow { margin-bottom: 3px; }
.entry-card-head h2 { font-size: 20px; }
.entry-card-head p:last-child { margin-top: 3px; font-size: 11px; }
.entry-card-head .badge { flex: 0 0 auto; }
#entry-form { display: grid; gap: 10px; padding: 14px 18px 16px; }
.entry-meta { padding: 11px 12px; border: 1px solid #dfe7e3; border-radius: 10px; background: #fafcfb; }
.entry-meta .form-grid { grid-template-columns: 140px 155px minmax(190px,.8fr) minmax(260px,1.3fr); gap: 9px; }
.entry-meta .form-grid > .full { grid-column: 1 / -1; }
.entry-meta .form-grid label { gap: 4px; font-size: 10px; }
.entry-meta .form-grid input,.entry-meta .form-grid select { min-height: 38px; padding: 8px 10px; }
.entry-attachment { display: grid !important; grid-template-columns: 135px minmax(220px,1fr) auto; align-items: center; gap: 10px !important; padding: 6px 9px; border: 1px dashed #cbd9d2; border-radius: 8px; background: #fff; }
.entry-attachment input { min-height: 34px !important; padding: 5px !important; }
.entry-attachment small { color: var(--muted); font-size: 9px; font-weight: 500; white-space: nowrap; }
.entry-lines { margin: 0; border: 1px solid #dce5e0; border-radius: 12px; overflow: visible; background: #fff; }
.entry-lines-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 11px; border-bottom: 1px solid #e4ebe7; background: #f7faf8; border-radius: 12px 12px 0 0; }
.entry-lines-heading > div { display: grid; gap: 3px; }
.entry-lines-heading strong { color: var(--ink); font: 600 15px Georgia,serif; }
.entry-lines-heading span { color: var(--muted); font-size: 10px; line-height: 1.35; }
.entry-lines-actions { display: flex !important; flex: 0 0 auto; grid-auto-flow: column; gap: 6px !important; }
.entry-lines-actions button { min-height: 34px; padding: 7px 10px; font-size: 10px; }
.entry-lines-heading #add-line { flex: 0 0 auto; border-color: #b8d2c6; background: var(--green); color: #fff; }
.entry-lines-heading #add-line:hover { border-color: var(--green2); background: #eef7f2; }
.entry-line { grid-template-columns: minmax(230px,1.65fr) minmax(180px,1.35fr) minmax(105px,.55fr) minmax(105px,.55fr) 78px; gap: 10px; margin: 0; }
.entry-line-header { align-items: center; padding: 7px 10px 5px; background: #fff; }
.entry-line-header strong { padding: 0 4px; color: #687a72; font-size: 9px; line-height: 1.3; text-transform: uppercase; letter-spacing: .09em; }
.entry-line-header strong:nth-child(3),.entry-line-header strong:nth-child(4) { text-align: right; }
.entry-line-header strong:last-child { text-align: center; }
.entry-line-row { position: relative; align-items: start; padding: 5px 10px; border-top: 1px solid #edf1ef; }
.entry-line-row:first-child { border-top: 0; }
.entry-line-row input,.entry-line-row select,.entry-line-row .account-search { min-height: 38px; padding: 8px 9px; border: 1px solid #d8e1dc; border-radius: 7px; background: #fff; font-size: 11px; }
.entry-line-row input:focus,.entry-line-row .account-search:focus { border-color: var(--green2); box-shadow: 0 0 0 3px #1c7a5817; }
.entry-line-row .line-debit,.entry-line-row .line-credit { text-align: right; font-variant-numeric: tabular-nums; }
.entry-line-row .account-picker { min-width: 0; }
.entry-line-row .account-results { min-width: min(520px,calc(100vw - 64px)); }
.entry-line-row .entry-remove { width: 100%; min-height: 38px; padding: 7px 6px; border: 1px solid #efcece; border-radius: 7px; background: #fff7f7; color: #a63b3b; font-size: 10px; font-weight: 750; }
.entry-line-row .entry-remove:hover { border-color: #d99f9f; background: #fdeeee; }
.entry-totals { display: flex; align-items: stretch; justify-content: flex-end; flex-wrap: wrap; gap: 6px; padding: 8px 10px; border-top: 1px solid #dfe8e3; background: #f8faf9; border-radius: 0 0 12px 12px; }
.entry-totals > span { display: grid; align-content: center; min-width: 135px; min-height: 40px; padding: 6px 9px; border: 1px solid #dce5e0; border-radius: 7px; background: #fff; }
.entry-totals small { color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.entry-totals b { margin-top: 1px; color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; }
.entry-totals #difference { min-width: 215px; color: #8d5d24; background: #fffaf0; font-size: 10px; font-weight: 750; text-align: center; }
.entry-totals #difference.unbalanced { border-color: #efc5c5; color: #a33a3a; background: #fff4f4; }
.entry-bottom-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.entry-bottom-bar > small { color: var(--muted); font-size: 9px; }
.entry-form-actions { margin: 0; padding: 0; }
.entry-form-actions button { min-height: 38px; padding: 8px 13px; }
.entry-form-actions .primary { min-width: 210px; }

.portable-backup-layout { display: grid; gap: 18px; }
.portable-backup-hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; background: linear-gradient(135deg,#f8fbf9,#edf6f1); }
.portable-backup-hero h2 { margin: 3px 0 5px; font-size: clamp(22px,3vw,32px); }
.portable-backup-hero p:last-child { color: var(--muted); }
.portable-backup-hero .primary { flex: 0 0 auto; min-width: 220px; }
.portable-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.portable-metrics article { display: grid; gap: 3px; padding: 17px 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 8px 25px rgba(19,55,43,.04); }
.portable-metrics strong { color: var(--green); font: 600 24px/1 Georgia,serif; }
.portable-metrics span { color: var(--muted); font-size: 11px; }
.portable-file-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin: 16px 0; }
.portable-file-grid > div { display: grid; gap: 5px; padding: 15px; border: 1px solid #dfe9e4; border-radius: 10px; background: #fbfdfc; }
.portable-file-grid strong { color: var(--ink); font-size: 12px; }
.portable-file-grid span { color: var(--muted); font-size: 11px; line-height: 1.5; }
.portable-backup-notes { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(270px,.8fr); gap: 28px; }
.portable-backup-notes p { margin-top: 7px; color: var(--muted); line-height: 1.6; }
.portable-backup-notes dl { display: grid; gap: 8px; margin: 0; }
.portable-backup-notes dl div { display: flex; justify-content: space-between; gap: 15px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.portable-backup-notes dt { color: var(--muted); font-size: 10px; }
.portable-backup-notes dd { margin: 0; font-size: 11px; font-weight: 800; }

.od-journal { padding: 0; overflow: hidden; }
.od-journal-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 18px; border-bottom: 1px solid #e3ebe7; }
.od-journal-head .eyebrow { margin-bottom: 3px; }
.od-journal-head h2 { font-size: 20px; }
.od-journal-head p:last-child { margin-top: 3px; color: var(--muted); font-size: 10px; }
.od-month-navigation { display: flex; align-items: end; gap: 7px; }
.od-month-navigation label { display: grid; gap: 3px; color: var(--muted); font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.od-month-navigation select,.od-month-navigation button { min-height: 38px; padding: 8px 10px; }
.od-month-navigation select { min-width: 118px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.od-month-navigation label:nth-of-type(2) select { min-width: 86px; }
.od-journal .table-scroll { border: 0; border-radius: 0; }
.od-journal-table { margin: 0; min-width: 1050px; }
.od-journal-table th { padding: 9px 10px; font-size: 9px; }
.od-journal-table td { padding: 8px 10px; font-size: 10px; vertical-align: top; }
.od-journal-table tbody tr.od-journal-entry-start td { border-top: 2px solid #d6e2dc; }
.od-journal-table tbody tr:first-child td { border-top-width: 1px; }
.od-journal-table td:nth-child(5) strong,.od-journal-table td:nth-child(4) strong { white-space: nowrap; }
.od-journal-table td span:not(.badge) { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.od-piece-number { min-width: 105px; }
.od-piece-number > strong { display: block; margin-bottom: 5px; }
.od-piece-number .badge { padding: 4px 6px; font-size: 7px; }
.od-day { width: 42px; text-align: center; font-weight: 800; }
.od-row-actions { display: grid; min-width: 88px; gap: 5px; }
.od-row-actions button { min-height: 30px; padding: 5px 7px; font-size: 9px; }
.od-journal-table tfoot th { padding: 10px; background: #f4f8f6; }
.od-journal-empty { display: grid; justify-items: center; gap: 5px; margin: 0; padding: 28px 18px; border: 0; border-radius: 0; }
.od-journal-empty strong { color: var(--ink); }
.od-journal-empty span { color: var(--muted); font-size: 10px; }

@media (max-width: 900px) {
  .portable-backup-hero { align-items: stretch; flex-direction: column; }
  .portable-backup-hero .primary { width: 100%; }
  .portable-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .portable-backup-notes { grid-template-columns: minmax(0,1fr); }
  .entry-meta .form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .entry-lines { overflow-x: auto; }
  .entry-line { min-width: 790px; }
  .entry-totals { min-width: 790px; }
  .od-journal-head { align-items: stretch; flex-direction: column; }
  .od-month-navigation { flex-wrap: wrap; }
}

@media (max-width: 600px) {
  .portable-file-grid,.portable-metrics { grid-template-columns: minmax(0,1fr); }
  .entry-card-head { align-items: flex-start; flex-direction: column; padding: 14px 12px 11px; }
  #entry-form { padding: 12px; }
  .entry-meta { padding: 10px; }
  .entry-meta .form-grid { grid-template-columns: minmax(0,1fr); }
  .entry-meta .form-grid > .full { grid-column: 1; }
  .entry-attachment { grid-template-columns: minmax(0,1fr); }
  .entry-attachment small { white-space: normal; }
  .entry-lines-heading { align-items: stretch; flex-direction: column; }
  .entry-lines-actions { grid-auto-flow: row; grid-template-columns: minmax(0,1fr); }
  .entry-lines-actions button { width: 100%; }
  .entry-bottom-bar { align-items: stretch; flex-direction: column; }
  .entry-form-actions button { width: 100%; }
  .od-journal-head { padding: 14px 12px; }
  .od-month-navigation { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .od-month-navigation label,.od-month-navigation select,.od-month-navigation button { width: 100%; }
}

/* Les téléphones sont volontairement exclus de l'interface comptable. */
.mobile-device-warning {
  display: none;
  position: fixed;
  z-index: 1000;
  inset: 0;
  min-height: 100dvh;
  padding: 24px;
  place-items: center;
  overflow: auto;
  background:
    radial-gradient(circle at 82% 10%,rgba(108,183,149,.24),transparent 34%),
    linear-gradient(145deg,#0b2b22,#143e32 62%,#1d503e);
}

.mobile-device-card {
  width: min(100%,430px);
  padding: 32px 28px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 22px;
  background: #f8faf8;
  box-shadow: 0 28px 80px rgba(4,24,18,.34);
}

.mobile-device-card .brandmark { margin-bottom: 24px; }
.mobile-device-card h1 { margin: 0 0 14px; font: 600 32px/1.08 Georgia,serif; letter-spacing: -.025em; }
.mobile-device-card > p:not(.eyebrow) { margin: 0; color: #5c6f67; font-size: 14px; line-height: 1.6; }
.mobile-device-advice { display: grid; gap: 5px; margin-top: 24px; padding: 15px 16px; border-left: 4px solid var(--green2); border-radius: 10px; background: #eaf4ef; }
.mobile-device-advice strong { color: var(--green); font-size: 13px; }
.mobile-device-advice span { color: #53675e; font-size: 12px; line-height: 1.45; }

html.phone-device,html.phone-device body { min-height: 100%; overflow: hidden; }
html.phone-device .mobile-device-warning { display: grid; }
html.phone-device body > :not(.mobile-device-warning) { visibility: hidden !important; pointer-events: none !important; }

@media (max-width: 599px) {
  .mobile-device-warning { display: grid; }
  body > :not(.mobile-device-warning) { visibility: hidden !important; pointer-events: none !important; }
}

/* Tablettes, du petit portrait au paysage. */
@media (min-width: 600px) and (max-width: 950px) {
  .workspace { padding: 22px 20px 46px; }
  .workspace .company-picker { min-height: 50px; }
  .workspace .company-picker select { min-height: 28px; padding-block: 4px; }
  .mobile-nav-toggle { min-height: 42px; }
  .statement-tabs button,
  .statement-tabs button:not(.active) { min-height: 40px; padding: 9px 12px; font-size: 12px; }
  .statement-actions .ghost { min-height: 40px; }
  .entry-line,
  .entry-totals { min-width: 0; }
  .entry-line { grid-template-columns: minmax(160px,1.45fr) minmax(130px,1.25fr) minmax(70px,.6fr) minmax(70px,.6fr) 62px; gap: 8px; }
  .entry-line-row .account-results { min-width: min(440px,calc(100vw - 52px)); }
  .od-journal-table { min-width: 920px; }
}

@media (min-width: 600px) and (max-width: 700px) {
  .table-scroll { overflow-x: auto; }
  .table-scroll table { display: table; max-width: none; overflow: visible; }
  .entry-lines-actions { display: grid !important; grid-template-columns: repeat(3,minmax(0,1fr)); grid-auto-flow: row; }
  .entry-lines-actions button { width: 100%; }
}
