/* Une hiérarchie commune pour l’espace de travail OptiControl. */
:root { --aside-w: 250px; }
[hidden] { display: none !important; }
.ui-icon { flex: 0 0 auto; vertical-align: middle; }
.btn { min-height: 40px; gap: 8px; }
.btn-sm { min-height: 34px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-ghost { box-shadow: none; }
.logo-mark { border-radius: 10px; }
.auth-logo .ui-icon { width: 36px; height: 36px; }
.auth-card .g_id_signin { display: flex; justify-content: center; }
.ph { align-items: center; gap: 20px; margin-bottom: 24px; }
.ph-sub { line-height: 1.6; }
main { padding: 28px 32px 80px; }
aside { display: flex; flex-direction: column; padding: 24px 12px 64px; }
.side-heading { padding: 0 12px 18px; color: var(--text3); font-size: 11px; font-weight: 700; letter-spacing: 1px; }
.side-section { margin-bottom: 8px; }
.side-section summary { display: flex; align-items: center; gap: 10px; padding: 12px; cursor: pointer; font-weight: 600; color: var(--text2); border-radius: 10px; list-style: none; font-size: 14px; }
.side-section summary::-webkit-details-marker, .action-menu summary::-webkit-details-marker { display: none; }
.side-section summary:hover { background: var(--surface2); }
.side-section[open] > summary { color: var(--text); }
.side-chevron { margin-left: auto; font-size: 22px; line-height: 1; transition: transform .15s; }
.side-section[open] .side-chevron { transform: rotate(90deg); }
.side-item { width: 100%; text-align: left; border: 0; background: transparent; font-family: var(--sans); min-height: 40px; font-size: 13px; }
.side-section .side-item { padding-left: 24px; }
.side-ico { display: inline-flex; }
.side-ico .ui-icon { width: 17px; height: 17px; }
.side-footer { border-top: 1px solid var(--border); padding-top: 14px; margin-top: auto; }
.side-sections { padding-bottom: 24px; }
.side-count.sc { font-size: 11px; }
#oc-search-trigger { border-color: transparent; background: var(--surface2); min-width: 245px; }
#oc-search-trigger kbd { margin-left: auto; font-size: 11px; border: 1px solid var(--border); padding: 1px 5px; border-radius: 5px; }
.nav-status { background: none; border: 0; font-size: 12px; }
.dashboard-actions { display: flex; gap: 10px; align-items: center; }
.action-menu { position: relative; }
.action-menu > summary { list-style: none; user-select: none; }
.action-menu-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 240px; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 350; }
.action-menu-panel .btn, #export-sage { width: 100%; border: 0; justify-content: flex-start; border-radius: 8px; background: transparent; color: var(--text2); font-size: 13px; }
.menu-label { display: block; padding: 12px 12px 5px; color: var(--text3); font-size: 11px; text-transform: uppercase; letter-spacing: .8px; }
.welcome-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: clamp(24px,4vw,54px); display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; margin-top: 30px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; color: var(--text3); }
.welcome-copy h1 { font-family: var(--display); font-size: clamp(32px,3.7vw,50px); font-weight: 400; line-height: 1.1; margin: 18px 0; max-width: 440px; }
.welcome-copy > p { font-size: 15px; color: var(--text2); max-width: 440px; line-height: 1.8; margin-bottom: 26px; }
.welcome-formats { display: block; color: var(--text3); font-size: 12px; margin-top: 14px; }
.welcome-steps { list-style: none; padding: 26px; background: var(--surface2); border-radius: 14px; align-self: center; }
.welcome-steps li { display: flex; gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--border); }
.welcome-steps li:first-child { padding-top: 0; }
.welcome-steps li:last-child { padding-bottom: 0; border: 0; }
.welcome-steps li > span { color: var(--accent3); font-family: var(--mono); font-size: 12px; padding-top: 3px; }
.welcome-steps strong { font-size: 14px; }
.welcome-steps p { margin-top: 5px; font-size: 13px; line-height: 1.6; color: var(--text3); }
.is-empty .kpi-row, .is-empty #dashboard-table, .is-empty #dash-alertes, .is-empty #dashboard-more, .is-empty #dashboard-primary, .is-empty #periode-filter-wrap { display: none; }
.dashboard-context { display: flex; gap: 12px 24px; flex-wrap: wrap; color: var(--text3); font-size: 12px; margin: -4px 0 24px; }
.dashboard-context strong { color: var(--text2); margin-right: 6px; font-weight: 600; }
.context-file { margin-left: auto; max-width: 100%; overflow-wrap: anywhere; }
.kpi-row { gap: 16px; margin-bottom: 24px; }
.kpi { padding: 22px; }
.kpi-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px; background: var(--surface2); color: var(--accent3); }
.kpi-label { font-size: 12px; letter-spacing: .3px; }
.kpi-sub { font-size: 12px; line-height: 1.6; }
.priority-card { padding: 24px; margin-bottom: 24px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.section-heading h2 { font-size: 19px; font-weight: 600; margin-top: 5px; }
.section-description { font-size: 12px; color: var(--text3); margin: 8px 0 12px; }
.priority-row { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-top: 1px solid var(--border); }
.priority-symbol { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; flex-shrink: 0; }
.priority-symbol.err { background: var(--err-soft); color: var(--err); }
.priority-symbol.warn { background: var(--warn-soft); color: var(--warn); }
.priority-copy { flex: 1; min-width: 0; }
.priority-copy strong { font-size: 14px; }
.priority-copy p { font-size: 12px; color: var(--text3); margin-top: 4px; overflow-wrap: anywhere; }
.priority-amount { text-align: right; }
.priority-amount strong { display: block; font-family: var(--mono); font-size: 14px; }
.priority-amount span { color: var(--text3); font-size: 11px; }
.priority-done { display: flex; gap: 14px; align-items: center; padding: 22px 0 6px; color: var(--ok); }
.priority-done p { font-size: 13px; color: var(--text3); margin-top: 4px; }
#dashboard-table { scroll-margin-top: 88px; }
#periode-filter-wrap { padding: 18px 20px; margin: 0 !important; border-bottom: 1px solid var(--border); }
#periode-filter-wrap input { min-height: 34px; color: var(--text); }
#periode-filter-wrap span, #periode-filter-wrap button { font-size: 12px !important; }
.table-toolbar { gap: 14px; flex-wrap: wrap; padding: 18px 20px; }
.table-ttl { font-size: 15px; }
.ftag { font-family: var(--sans); min-height: 32px; font-size: 12px; cursor: pointer; }
th { font-size: 12px; }
td { font-size: 13px; }
th.amount, td.amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
#dashboard-table table { min-width: 720px; }
#dashboard-table td { padding: 16px 18px; }
#dashboard-table .anomaly-description { min-width: 170px; max-width: 300px; white-space: normal; line-height: 1.6; color: var(--text2); }
#dashboard-table .traitement-badge { margin-top: 5px; }
#dashboard-table tfoot { background: var(--surface2); border-top: 1px solid var(--border); font-size: 12px; }
#dashboard-table tfoot td { font-size: 12px; }
#dashboard-no-results td { text-align: center; color: var(--text3); padding: 36px; }
#modal-detail.invoice-drawer { justify-content: flex-end; padding: 0; background: rgba(14,52,64,.18); backdrop-filter: none; z-index: 8500; }
#modal-detail.invoice-drawer .modal-box { width: min(560px,100%); max-width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 18px 0 0 18px; margin: 0; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
#modal-detail.invoice-drawer .modal-header { flex-shrink: 0; padding: 24px; }
#modal-detail.invoice-drawer .modal-body { overflow-y: auto; padding: 24px; flex: 1; }
#modal-detail .modal-close { width: 36px; height: 36px; }
#modal-detail.invoice-drawer .modal-body > div:first-child { gap: 20px !important; }
#modal-detail.invoice-drawer .modal-body > div:first-child > div > div:first-child { font-size: 12px !important; letter-spacing: .3px !important; }
#oc-sticky-bar { gap: 20px; }
@media (max-width: 1150px) {
  main { padding: 24px 22px 80px; }
  .nav-status { display: none; }
  .welcome-card { gap: 24px; }
  .kpi-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 900px) {
  .welcome-card { grid-template-columns: 1fr; }
  .priority-row { flex-wrap: wrap; gap: 10px; }
  .priority-copy { flex-basis: calc(100% - 50px); }
  .priority-amount { margin-left: 46px; margin-right: auto; text-align: left; }
}
@media (max-width: 768px) {
  aside { width: 270px; padding-top: 18px; }
  main { padding: 20px 16px 90px; }
  .welcome-card { margin-top: 12px; }
  .dashboard-actions { width: 100%; justify-content: flex-end; }
  .dashboard-context { gap: 8px; flex-direction: column; }
  .context-file { margin-left: 0; }
  .priority-card { padding: 18px; }
  .section-heading h2 { font-size: 17px; }
  .section-heading .badge { white-space: nowrap; }
  .kpi { padding: 16px; }
  #modal-detail.invoice-drawer .modal-box { border-radius: 0; }
  #modal-detail.invoice-drawer .modal-body, #modal-detail.invoice-drawer .modal-header { padding: 20px 16px; }
  #oc-sticky-bar { padding: 8px 12px; gap: 10px; flex-wrap: wrap; }
}
body:has(#page-dashboard.active) #oc-sticky-bar { display: none; }
#modal-detail.invoice-drawer .modal-box { padding: 0; }
#modal-detail.invoice-drawer .modal-body { max-height: none; min-height: 0; }
#page-dashboard .dash-widget.hidden-widget { display: none; }
#page-dashboard.editing .dash-widget.hidden-widget { display: block; }
#page-dashboard.editing .kpi-row.hidden-widget { display: grid; }
#page-dashboard.is-empty .dash-widget { display: none; }
.upload-card:focus-visible { outline: 3px solid var(--accent3); outline-offset: 4px; }
@media (max-width: 480px) {
  .kpi-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .kpi-val { font-size: 28px; overflow-wrap: anywhere; }
  .kpi-sub { font-size: 11px; }
  .welcome-card { padding: 24px; }
  .welcome-copy .btn { white-space: normal; text-align: left; }
}

/* Contrôle des deux fichiers : résultats conservés dans cette session. */
.local-upload { display:flex; flex-direction:column; gap:14px; padding:28px; border:2px dashed var(--border2); border-radius:18px; background:var(--surface); cursor:pointer; min-width:0; }
.local-upload strong { font-size:17px; }
.local-upload span { color:var(--text2); overflow-wrap:anywhere; }
.local-upload input { display:block; max-width:100%; font:inherit; font-size:12px; }
.local-upload:focus-within { outline:3px solid var(--accent3); outline-offset:3px; }
.local-actions { display:flex; gap:10px; flex-wrap:wrap; margin:18px 0; }
#local-status { color:var(--text2); line-height:1.6; margin-bottom:22px; }
.local-summary { padding:24px; margin:20px 0; }
.local-summary h2 { font-size:20px; margin-bottom:12px; }
.local-summary p, .local-summary li { line-height:1.7; margin-bottom:8px; }
.local-summary ul { padding-left:20px; }
.local-legacy { margin-top:32px; padding:20px; border:1px solid var(--border); border-radius:12px; }
.local-legacy > summary { cursor:pointer; font-weight:600; }
.local-legacy > p { color:var(--text2); margin:16px 0; line-height:1.6; }

.local-upload-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
#local-article-results .table-wrap { overflow-x:auto; }
#local-article-results table { min-width:1050px; }
#local-article-results td { vertical-align:top; }
@media (max-width:1100px) { .local-upload-grid { grid-template-columns:1fr; } }

.local-result-detail { margin:18px 0; }
.local-result-detail > summary { cursor:pointer; font-weight:600; padding:14px 0; }
