:root {
  font-family: "DM Sans", "Segoe UI", sans-serif;
  color: #20283a;
  background: #f5f7fb;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --muted: #8b93a5;
  --line: #edf0f5;
  --purple: #6654e8;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.sidebar { position: fixed; inset: 0 auto 0 0; width: 244px; background: #fff; border-right: 1px solid #edf0f5; padding: 29px 17px; display: flex; flex-direction: column; z-index: 3; }
.brand { display: flex; align-items: center; gap: 11px; color: #20283a; text-decoration: none; font: 800 20px Manrope, sans-serif; letter-spacing: -.7px; padding: 0 7px; }
.brand small { display: block; margin-top: 3px; color: #9da4b2; font: 700 8px "DM Sans", sans-serif; letter-spacing: 1.35px; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: white; background: linear-gradient(140deg, #7a68fa, #5645dc); font: 800 19px Manrope, sans-serif; }
.nav-caption { margin: 51px 9px 13px; font-size: 10px; font-weight: 700; letter-spacing: 1.2px; color: #a4aaba; }
.sidebar nav { display: grid; gap: 7px; }
.nav-link { min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border-radius: 8px; text-decoration: none; color: #737d90; font-size: 13px; font-weight: 600; }
.nav-link > span:first-child { width: 19px; font-size: 17px; text-align: center; }
.nav-link.active { background: #f0efff; color: #5c4cdb; }
.nav-count { margin-left: auto; font-size: 11px; color: #959db0; }
.sidebar-bottom { margin-top: auto; padding: 16px 9px 3px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; font-size: 11px; }
.sidebar-bottom strong, .sidebar-bottom small { display: block; }
.sidebar-bottom strong { font-size: 11px; }
.sidebar-bottom small { margin-top: 3px; color: #9aa2b1; }
.connection-dot { width: 8px; height: 8px; background: #3abf89; border-radius: 50%; box-shadow: 0 0 0 4px #e7f8f1; }

.main { margin-left: 244px; min-height: 100vh; }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 42px; background: #fff; border-bottom: 1px solid #edf0f5; }
.breadcrumb { color: #9aa1b0; font-size: 12px; }
.breadcrumb span { margin: 0 9px; color: #c3c8d2; }
.breadcrumb strong { color: #4a5365; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.today { color: #80899b; font-size: 11px; text-transform: capitalize; }
.avatar { width: 33px; height: 33px; border: 1px solid #e8e7ff; border-radius: 50%; display: grid; place-items: center; background: #f2f0ff; color: #6654e8; font: 700 13px Manrope, sans-serif; }
.mobile-brand { display: none; }
.page-content { max-width: 1440px; margin: 0 auto; padding: 34px 42px 55px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 8px; color: #9389e9; font-size: 9px; font-weight: 700; letter-spacing: 1.35px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 5px; font: 700 24px Manrope, sans-serif; letter-spacing: -.65px; }
.subheading { margin-bottom: 0; color: #8c94a4; font-size: 12px; }
.button { min-height: 39px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border: 1px solid transparent; border-radius: 7px; font-size: 11px; font-weight: 700; transition: .15s ease; }
.button-primary { background: #6654e8; color: white; box-shadow: 0 5px 13px #6654e82b; }
.button-primary:hover { background: #5746d6; }
.button-light { border-color: #e7eaf0; background: white; color: #687286; }
.button-light:hover { background: #f8f9fc; }
.button:disabled { opacity: .45; cursor: default; }
.button-small { min-height: 31px; padding: 0 11px; font-size: 10px; }

.date-filter { display: flex; align-items: flex-end; gap: 12px; margin: -7px 0 17px; padding: 14px 17px; border: 1px solid #edf0f5; border-radius: 9px; background: white; }
.date-filter-title { display: grid; align-self: center; gap: 4px; margin-right: auto; }
.date-filter-title strong { color: #424b5d; font-size: 11px; }
.date-filter-title span { color: #9aa2b1; font-size: 9px; }
.date-filter label { display: grid; gap: 5px; color: #818a9b; font-size: 9px; font-weight: 600; }
.date-filter input { min-width: 137px; height: 32px; padding: 0 8px; border: 1px solid #e8ebf1; border-radius: 6px; outline: 0; color: #596275; font-size: 10px; }
.date-filter input:focus { border-color: #a69bee; }
.date-filter select { min-width: 150px; height: 32px; padding: 0 8px; border: 1px solid #e8ebf1; border-radius: 6px; outline: 0; background: white; color: #404a5c; font-size: 11px; font-weight: 600; }
.date-filter select:focus { border-color: #a69bee; }
.date-filter select:disabled { opacity: .5; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.stat-card, .panel { background: white; border: 1px solid #edf0f5; border-radius: 10px; box-shadow: 0 3px 14px #25304a05; }
.stat-card { min-height: 132px; padding: 18px 18px 16px; }
.stat-label { min-height: 24px; display: flex; justify-content: space-between; align-items: flex-start; gap: 5px; color: #858da0; font-size: 10px; font-weight: 600; }
.stat-icon { width: 27px; height: 27px; flex: 0 0 27px; display: grid; place-items: center; border-radius: 8px; font-size: 14px; font-weight: 700; }
.stat-icon.purple { background: #f0eeff; color: #7162e9; }
.stat-icon.green { background: #e9f8f1; color: #2eae79; }
.stat-icon.orange { background: #fff5e8; color: #eea34d; }
.stat-icon.blue { background: #ebf4ff; color: #6a9de9; }
.stat-value { margin: 8px 0 7px; overflow: hidden; color: #252d3e; font: 700 22px Manrope, sans-serif; letter-spacing: -.6px; text-overflow: ellipsis; white-space: nowrap; }
.stat-foot { color: #a3a9b5; font-size: 10px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(240px, 1fr); gap: 16px; margin-top: 17px; }
.panel { overflow: hidden; }
.chart-panel, .status-panel { min-height: 275px; padding: 21px 22px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.panel-heading h2, .modal-heading h2 { margin: 0; color: #293244; font: 700 14px Manrope, sans-serif; }
.panel-heading p { margin: 5px 0 0; color: #a0a6b3; font-size: 10px; }
.legend { color: #9299a8; font-size: 10px; }
.legend i { width: 7px; height: 7px; display: inline-block; margin-right: 6px; border-radius: 2px; background: #7463eb; }
.chart { height: 176px; margin: 17px 5px 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: end; gap: 12px; }
.annual-chart { grid-template-columns: repeat(var(--year-count, 6), minmax(26px, 1fr)); overflow-x: auto; }
.chart-column { min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 7px; color: #a0a7b5; font-size: 9px; text-transform: capitalize; }
.chart-value { width: 100%; overflow: hidden; color: #81899a; font-size: 8px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.chart-track { width: min(100%, 31px); height: 112px; display: flex; align-items: flex-end; justify-content: center; border-radius: 5px 5px 0 0; background: #f7f6ff; }
.chart-track i { width: 100%; min-height: 3px; border-radius: 5px 5px 0 0; background: linear-gradient(180deg, #8b7df4, #6654e8); }
.status-list { display: grid; gap: 15px; margin: 21px 0 17px; }
.status-row-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.status-row-top strong { color: #687286; font-size: 10px; }
.badge { min-width: 65px; display: inline-flex; align-items: center; justify-content: center; padding: 4px 8px; border-radius: 20px; font-size: 9px; font-weight: 600; }
.badge.confirmed { background: #e8f7f0; color: #279a6c; }
.badge.sent { background: #edf3ff; color: #5f83cb; }
.badge.draft { background: #fff5e9; color: #c88732; }
.badge.cancelled { background: #fff0f0; color: #d17373; }
.progress { height: 4px; overflow: hidden; border-radius: 5px; background: #f0f2f6; }
.progress i { height: 100%; display: block; border-radius: inherit; }
.progress i.confirmed { background: #47bf8c; }
.progress i.sent { background: #7c9ee1; }
.progress i.draft { background: #ebb35f; }
.progress i.cancelled { background: #de8888; }
.text-button { padding: 0; border: 0; background: none; color: #6c5ce7; font-size: 10px; font-weight: 700; }
.text-button:hover { color: #4d3bd0; }
.recent-panel { margin-top: 17px; }
.recent-panel > .panel-heading { min-height: 72px; padding: 0 22px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 11px 17px; border-top: 1px solid #f1f3f6; border-bottom: 1px solid #f1f3f6; background: #fbfcfe; color: #a0a6b2; font-size: 8px; font-weight: 700; letter-spacing: .65px; white-space: nowrap; }
td { padding: 12px 17px; border-bottom: 1px solid #f1f3f6; color: #747d8e; font-size: 10px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td strong { color: #343c4e; font-size: 10px; }
.align-right { text-align: right; }
.amount { color: #333c4e; font-weight: 600; }
.clickable-row { cursor: pointer; }
.clickable-row:hover, tbody tr:hover { background: #fbfbff; }
.orders-panel { margin-top: 2px; }
.filters { display: flex; justify-content: space-between; gap: 12px; padding: 17px 19px; }
.search-box { width: min(390px, 100%); height: 36px; display: flex; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid #e9ecf2; border-radius: 6px; color: #a5abba; }
.search-box > span { font-size: 20px; line-height: 1; }
.search-box input { width: 100%; border: 0; outline: 0; color: #4a5364; font-size: 10px; }
.search-box input::placeholder { color: #a5abba; }
.select-label select { min-width: 140px; height: 36px; padding: 0 10px; border: 1px solid #e9ecf2; border-radius: 6px; outline: 0; background: white; color: #70798a; font-size: 10px; }
.order-link { padding: 0; border: 0; background: none; color: #5f50d7; font-weight: 700; }
.order-link:hover { text-decoration: underline; }
.icon-button { width: 29px; height: 29px; display: inline-grid; place-items: center; border: 1px solid #edf0f5; border-radius: 7px; background: white; color: #838b9b; font-size: 17px; }
.icon-button:hover { background: #f6f5ff; color: #6253dc; }
.row-action { font-size: 21px; }
.empty-cell { padding: 34px; color: #9da4b1; text-align: center; }
.pagination { min-height: 55px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 19px; border-top: 1px solid #f1f3f6; color: #9ba2b0; font-size: 10px; }
.pagination > div { display: flex; gap: 7px; }

.modal { width: min(660px, calc(100vw - 28px)); max-height: min(86vh, 780px); padding: 25px; border: 1px solid #edf0f5; border-radius: 12px; box-shadow: 0 20px 70px #20283a2e; color: #30394c; }
.modal::backdrop { background: #20283a75; backdrop-filter: blur(2px); }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.modal-heading .eyebrow { margin-bottom: 5px; }
.modal-heading h2 { font-size: 18px; }
.detail-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; padding: 17px; border-radius: 8px; background: #fafbfe; }
.detail-meta > div > span { display: block; margin-bottom: 6px; color: #969eae; font-size: 9px; }
.detail-meta strong { color: #444d5e; font-size: 11px; }
.detail-table { margin-top: 16px; }
.detail-table th, .detail-table td { padding-left: 10px; padding-right: 10px; }
.detail-total { display: flex; align-items: center; justify-content: space-between; padding: 18px 5px; color: #7d8697; font-size: 11px; }
.detail-total strong { color: #282f40; font: 700 17px Manrope, sans-serif; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.source-note { margin: 16px 0 0; color: #a6acb8; font-size: 9px; }
.create-modal { width: min(540px, calc(100vw - 28px)); }
.create-modal form { display: grid; gap: 15px; }
.form-field { display: grid; gap: 7px; color: #788193; font-size: 10px; font-weight: 600; }
.form-field select, .new-line select, .new-line input { min-width: 0; height: 37px; padding: 0 10px; border: 1px solid #e8ebf1; border-radius: 6px; outline: 0; background: white; color: #505a6b; font-size: 10px; }
.form-field select:focus, .new-line select:focus, .new-line input:focus { border-color: #a69bee; }
.line-header { display: flex; align-items: center; justify-content: space-between; color: #6d7688; font-size: 11px; }
.new-lines { display: grid; gap: 8px; }
.new-line { display: grid; grid-template-columns: minmax(0, 1fr) 76px 29px; gap: 7px; }
.product-picker { display: grid; gap: 6px; }
.product-picker .line-search { height: 32px; padding: 0 9px; border: 1px solid #e8ebf1; border-radius: 6px; outline: 0; color: #505a6b; font-size: 9px; }
.product-picker .line-search:focus { border-color: #a69bee; }
.new-line input { text-align: center; }
.remove-line { width: 37px; height: 37px; }
.form-total { display: flex; justify-content: space-between; padding: 14px 0 0; border-top: 1px solid #eff1f5; color: #7d8696; font-size: 11px; }
.form-total strong { color: #2b3344; font-size: 15px; }
.form-note { margin: 0; color: #9ba2af; font-size: 9px; line-height: 1.5; }
.form-error { margin: 0; color: #be4848; font-size: 10px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 10; max-width: min(420px, calc(100vw - 30px)); padding: 12px 17px; border-radius: 8px; background: #263248; color: white; box-shadow: 0 7px 25px #20283a33; font-size: 11px; }
.toast-error { background: #a93636; }

.section-title { margin: 26px 0 12px; color: #424b5d; font: 700 13px Manrope, sans-serif; }
.clickable-card { cursor: pointer; transition: .15s ease; }
.clickable-card:hover { border-color: #d9d4ff; box-shadow: 0 5px 18px #6654e814; }
.warning-card .stat-value { color: #b56f1d; }
.margin-panel { margin-top: 17px; }
.margin-panel > .panel-heading { min-height: 72px; padding: 0 22px; }
.truncate { max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.rate { display: inline-block; padding: 3px 7px; border-radius: 12px; background: #e8f7f0; color: #279a6c; font-size: 9px; font-weight: 700; }
.rate-low { background: #fff0f0; color: #c35f5f; }
.muted { color: #a3a9b5; }
.bucket-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 15px; }
.bucket-card { display: grid; gap: 5px; padding: 14px 15px; border: 1px solid #edf0f5; border-radius: 9px; background: white; color: #858da0; font-size: 10px; text-align: left; }
.bucket-card strong { color: #252d3e; font: 700 17px Manrope, sans-serif; }
.bucket-card small { color: #a3a9b5; font-size: 9px; }
.bucket-card.bucket-old strong { color: #b56f1d; }
.bucket-card.active { border-color: #a69bee; background: #f6f5ff; box-shadow: 0 0 0 3px #6654e814; }
.quote-filters { flex-wrap: wrap; }
.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.check-label { display: flex; align-items: center; gap: 6px; color: #70798a; font-size: 10px; font-weight: 600; }
.bulk-bar { display: flex; align-items: center; gap: 10px; padding: 10px 19px; border-top: 1px solid #f1f3f6; background: #fff8ee; color: #8a5a1c; font-size: 10px; font-weight: 600; }
.bulk-bar span { margin-right: auto; }
.age { font-weight: 600; }
.age-old { color: #c4782a; }
.flag { display: inline-block; margin-left: 4px; padding: 2px 6px; border-radius: 10px; font-size: 8px; font-weight: 700; }
.flag-danger { background: #fff0f0; color: #c35f5f; }
.flag-warning { background: #fff5e9; color: #c88732; }
.detail-meta { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.detail-meta small, .followups p.muted, .lost-form small { font-size: 9px; }
.followups p.muted { margin: 0; }
.detail-sums { display: grid; gap: 6px; padding: 14px 5px 0; color: #7d8697; font-size: 11px; }
.detail-sums > div, .form-totals > div { display: flex; justify-content: space-between; }
.form-totals { display: grid; gap: 6px; padding-top: 12px; border-top: 1px solid #eff1f5; color: #7d8696; font-size: 11px; }
.form-totals .form-total { padding-top: 6px; border-top: 0; }
.followups, .followup-form, .lost-form { margin-top: 18px; padding-top: 16px; border-top: 1px solid #eff1f5; }
.followups h3, .followup-form h3 { margin: 0 0 10px; color: #343c4e; font: 700 12px Manrope, sans-serif; }
.timeline { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; color: #6d7688; font-size: 10px; }
.timeline li { padding: 9px 11px; border-radius: 7px; background: #fafbfe; }
.timeline p { margin: 5px 0 0; color: #59627a; }
.followup-form { display: grid; gap: 10px; }
.followup-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.followup-form select, .followup-form input, .followup-form textarea, .lost-form select { min-width: 0; height: 37px; padding: 0 10px; border: 1px solid #e8ebf1; border-radius: 6px; outline: 0; background: white; color: #505a6b; font-size: 10px; }
.followup-form textarea { height: auto; padding: 8px 10px; resize: vertical; }
.lost-form { display: flex; align-items: flex-end; gap: 10px; }
.lost-form .form-field { flex: 1; }
.section-title small { margin-left: 6px; color: #a3a9b5; font: 500 10px "DM Sans", sans-serif; }
.warning-text { color: #b56f1d; }
#customer-modal { width: min(760px, calc(100vw - 28px)); }
.payments-list li { padding: 7px 11px; }
.positive-text { color: #279a6c; }
.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid #e8ebf1; }
.tab { margin-bottom: -1px; padding: 10px 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: #7d8697; font-size: 11px; font-weight: 700; }
.tab:hover { color: #4d3bd0; }
.tab.active { border-bottom-color: #6654e8; color: #4d3bd0; }
.year-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; font-size: 10px; }
.year-bar .select-label { display: flex; align-items: center; gap: 8px; color: #6d7688; font-weight: 700; }
.year-bar select { min-width: 90px; }
.performance-panel { margin-top: 17px; }
.legend .legend-previous { background: #d9dcef; margin-left: 10px; }
.legend .legend-target { width: 12px; height: 2px; margin-left: 10px; background: #e2963b; }
.month-chart { height: 200px; margin-top: 18px; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: end; gap: 8px; }
.month-column { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 7px; color: #a0a7b5; font-size: 9px; }
.month-bars { position: relative; width: 100%; height: 160px; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.month-bars i { width: min(40%, 16px); border-radius: 4px 4px 0 0; }
.bar-previous { background: #e1e3f2; }
.bar-current { background: linear-gradient(180deg, #8b7df4, #6654e8); }
.bar-current.reached { background: linear-gradient(180deg, #5fd0a0, #2eae79); }
.target-line { position: absolute; left: 8%; right: 8%; height: 2px; border-radius: 2px; background: #e2963b; }
.target-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.target-tools input, .target-input { height: 30px; padding: 0 8px; border: 1px solid #e8ebf1; border-radius: 6px; outline: 0; color: #505a6b; font-size: 10px; }
.target-tools input { width: 58px; }
.target-input { width: 130px; text-align: right; }
.target-input:focus, .target-tools input:focus { border-color: #a69bee; }
.stat-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.selected-card { border-color: #a69bee; box-shadow: 0 0 0 3px #6654e814; }
.risk-panel { margin-top: 17px; }
.abc-badge { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-size: 10px; font-weight: 800; }
.abc-a { background: #f0eeff; color: #5c4cdb; }
.abc-b { background: #ebf4ff; color: #4f7fca; }
.abc-c { background: #f2f3f7; color: #8b93a5; }
body[data-role="commercial"] .direction-only, body[data-role="direction"] .commercial-only { display: none !important; }
.user-chip { display: flex; align-items: center; gap: 9px; }
.user-meta strong, .user-meta small { display: block; }
.user-meta strong { color: #3a4356; font-size: 11px; }
.user-meta small { margin-top: 2px; color: #9aa2b1; font-size: 9px; }
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(400px, 100%); padding: 32px 30px; border: 1px solid #edf0f5; border-radius: 14px; background: white; box-shadow: 0 20px 60px #20283a14; }
.login-brand { margin-bottom: 28px; padding: 0; }
.login-card h1 { margin-bottom: 6px; }
.login-form { display: grid; gap: 14px; margin-top: 22px; }
.login-form input, .user-form input, .user-form select, .user-role { min-width: 0; height: 38px; padding: 0 10px; border: 1px solid #e8ebf1; border-radius: 6px; outline: 0; background: white; color: #404a5c; font-size: 11px; }
.user-role { height: 30px; font-size: 10px; }
.login-form input:focus, .user-form input:focus, .user-form select:focus { border-color: #a69bee; }
.login-form .button { min-height: 42px; font-size: 12px; }
.setup-note { margin-top: 18px; padding: 16px; border-radius: 9px; background: #fff8ee; color: #6b5a3c; font-size: 11px; line-height: 1.5; }
.setup-note p { margin: 0 0 8px; }
.setup-note code { display: block; margin: 8px 0; padding: 9px; border-radius: 6px; background: #20283a; color: #e7e9ff; font-size: 10px; white-space: pre-wrap; word-break: break-all; }
.user-form { display: grid; gap: 10px; padding: 18px 22px; border-top: 1px solid #f1f3f6; }
.user-form h3 { margin: 0; color: #343c4e; font: 700 12px Manrope, sans-serif; }
.user-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-grid .panel-heading { min-height: 72px; padding: 0 22px; }
.audit-wrap { max-height: 420px; overflow-y: auto; }
.period-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 15px; padding: 12px 16px; border: 1px solid #edf0f5; border-radius: 9px; background: white; font-size: 10px; }
.period-bar .select-label { display: flex; align-items: center; gap: 8px; color: #6d7688; font-weight: 700; }
.kpi-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi-card { min-height: 128px; }
.kpi-card .stat-value { font-size: 19px; }
.kpi-previous { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-bottom: 6px; color: #8b93a5; font-size: 9px; }
.delta { padding: 2px 6px; border-radius: 10px; font-size: 8px; font-weight: 700; white-space: nowrap; }
.delta.up { background: #e8f7f0; color: #279a6c; }
.delta.down { background: #fff0f0; color: #c35f5f; }
.delta.neutral { background: #f2f3f7; color: #8b93a5; }
.delta-inline { font-size: 8px; font-weight: 600; }
.delta-inline.up { color: #279a6c; }
.delta-inline.down { color: #c35f5f; }
.delta-inline.neutral { color: #a3a9b5; }
.kpi-table td, .kpi-table th { padding-left: 11px; padding-right: 11px; }
.kpi-table td:first-child { position: sticky; left: 0; z-index: 1; background: white; }
.kpi-table th:first-child { position: sticky; left: 0; z-index: 1; }
.kpi-column { cursor: pointer; }
.kpi-column:hover { color: #5c4cdb; }
.kpi-table .selected { background: #f6f5ff; }
.kpi-table th.selected { color: #5c4cdb; }
.kpi-table .total-column { border-left: 1px solid #e8ebf1; font-weight: 600; }
.nav-sub { display: grid; gap: 2px; margin: -3px 0 4px 18px; padding-left: 10px; border-left: 1px solid #edf0f5; }
.nav-sublink { min-height: 32px; font-size: 12px; }
.nav-sublink > span:first-child { flex: none; width: 19px; font-size: 13px; line-height: 1; }
.nav-sublink { line-height: 1.25; padding-top: 4px; padding-bottom: 4px; }
.quote-heading .eyebrow a { color: inherit; text-decoration: none; }
.quote-heading .eyebrow a:hover { text-decoration: underline; }
.quote-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.quote-actions .button { white-space: nowrap; }
.quote-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -12px 0 14px; }
.quote-toolbar .button { text-decoration: none; }
.stage-bar { display: flex; margin: 0 0 0 auto; padding: 0; list-style: none; border: 1px solid #e8ebf1; border-radius: 7px; overflow: hidden; background: white; }
.stage-bar li { padding: 7px 13px; color: #9aa2b1; font-size: 10px; font-weight: 700; }
.stage-bar li + li { border-left: 1px solid #e8ebf1; }
.stage-bar li.current { background: #f0efff; color: #5c4cdb; }
.quote-form { padding: 22px; overflow: visible; }
.quote-header { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px; margin-bottom: 18px; }
.quote-col { display: grid; align-content: start; gap: 10px; }
.quote-form input, .quote-form select, .quote-form textarea { min-width: 0; height: 36px; padding: 0 9px; border: 1px solid #e8ebf1; border-radius: 6px; outline: 0; background: white; color: #404a5c; font-size: 11px; }
.quote-form textarea { height: auto; padding: 7px 9px; resize: vertical; font-family: inherit; }
.quote-form input:focus, .quote-form select:focus, .quote-form textarea:focus { border-color: #a69bee; }
.inline-field { display: grid; grid-template-columns: 170px minmax(0, 1fr); align-items: center; gap: 10px; }
.readonly-field { color: #788193; font-size: 10px; font-weight: 600; }
.readonly-field strong { color: #343c4e; font-size: 12px; }
.customer-card { display: grid; gap: 2px; padding: 10px 12px; border-radius: 7px; background: #fafbfe; color: #59627a; font-size: 10px; line-height: 1.4; }
.quote-tabs { margin-bottom: 0; }
.quote-tabs .tab { cursor: default; }
.quote-lines th { white-space: nowrap; }
.quote-lines td { padding: 8px 6px; vertical-align: top; white-space: normal; }
.quote-lines .product-picker { display: grid; gap: 5px; }
.quote-lines .quote-product-search { height: 30px; font-size: 10px; }
.col-product { min-width: 220px; }
.col-description { min-width: 200px; }
.col-description textarea { width: 100%; }
.col-qty, .col-discount { width: 80px; }
.col-price { width: 110px; }
.col-cost { width: 100px; padding-top: 16px !important; color: #8b93a5; }
.col-tax { min-width: 150px; }
.col-tax select { width: 100%; }
.col-subtotal { width: 120px; padding-top: 16px !important; white-space: nowrap !important; }
.num-input { width: 100%; text-align: right; }
.add-line-button { margin: 12px 4px 0; }
.quote-footer { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(240px, 1fr); gap: 30px; margin-top: 22px; padding-top: 18px; border-top: 1px solid #eff1f5; }
.quote-note textarea { width: 100%; }
.quote-totals { display: grid; gap: 7px; align-content: start; margin: 0; }
.quote-totals > div { display: flex; justify-content: space-between; gap: 16px; color: #6d7688; font-size: 11px; }
.quote-totals dt { font-weight: 600; }
.quote-totals dd { margin: 0; color: #343c4e; font-weight: 600; white-space: nowrap; }
.quote-totals .grand { padding-top: 9px; border-top: 1px solid #e3e6ee; }
.quote-totals .grand dd { font: 700 17px Manrope, sans-serif; color: #20283a; }
.quote-totals .margin-line dd { color: #279a6c; }
.quote-totals .margin-line dt small { color: #a3a9b5; font-size: 9px; font-weight: 500; }
.col-margin { width: 110px; padding-top: 16px !important; white-space: nowrap !important; color: #279a6c; font-weight: 600; }
.col-margin small { font-weight: 500; }
.negative-margin, .col-margin.negative-margin { color: #c35f5f !important; }
.quote-form .form-error { margin-top: 14px; }
a.user-chip { color: inherit; text-decoration: none; padding: 4px 8px 4px 4px; border-radius: 22px; }
a.user-chip:hover { background: #f6f5ff; }
.mfa-hint { margin: 0; color: #59627a; font-size: 12px; line-height: 1.5; }
.mfa-small { margin: -4px 0 0; font-size: 10px; }
#mfa-code { font-size: 18px; letter-spacing: 3px; text-align: center; }
.notice { margin-bottom: 15px; padding: 12px 15px; border-radius: 9px; font-size: 11px; font-weight: 600; }
.warning-notice { background: #fff5e9; color: #9a6420; border: 1px solid #f6dfbd; }
.account-panel { margin-bottom: 17px; }
.account-panel > .panel-heading { min-height: 72px; padding: 0 22px; }
.account-body { padding: 0 22px 20px; color: #59627a; font-size: 11px; line-height: 1.5; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mfa-setup { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; margin-top: 16px; }
.mfa-qr { width: 200px; height: 200px; padding: 8px; border: 1px solid #edf0f5; border-radius: 10px; background: white; }
.mfa-qr svg { width: 100%; height: 100%; }
.mfa-steps { flex: 1; min-width: 240px; }
.mfa-steps ol { margin: 0 0 14px; padding-left: 18px; }
.mfa-steps li { margin-bottom: 6px; }
.mfa-steps code, .recovery-codes code { padding: 2px 6px; border-radius: 5px; background: #f2f3f7; color: #343c4e; font-size: 11px; letter-spacing: 1px; }
.mfa-confirm { display: flex; gap: 8px; }
.mfa-confirm input { width: 140px; height: 38px; padding: 0 10px; border: 1px solid #e8ebf1; border-radius: 6px; font-size: 16px; letter-spacing: 3px; text-align: center; }
.recovery-box { margin: 0 22px 20px; padding: 14px 16px; border-radius: 9px; background: #fff8ee; }
.recovery-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 10px 0 12px; padding: 0; list-style: none; }
.password-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.password-form .modal-actions { grid-column: 1 / -1; }
.password-form input { height: 36px; padding: 0 10px; border: 1px solid #e8ebf1; border-radius: 6px; outline: 0; }
.setting-toggle { margin: 0 22px 12px; }
.quote-period { margin-top: -8px; }
.sequence-grid { align-items: end; }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick-grid select, #article-quick-form select { min-width: 0; height: 38px; padding: 0 10px; border: 1px solid #e8ebf1; border-radius: 6px; background: white; color: #404a5c; font-size: 11px; }
.quick-hint { margin: -4px 0 2px; font-size: 10px; }
.new-article-link { justify-self: start; font-size: 9px; }
.article-avatar { font-size: 40px; color: #b5bcd0; background: #eef0f6; }
.article-flags { display: grid; gap: 6px; align-content: start; }
.field-caption { color: #343c4e; font-size: 11px; font-weight: 700; }
.money-input { position: relative; display: block; }
.money-input input { width: 100%; padding-right: 34px !important; text-align: right; }
.currency-suffix { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: #8b93a5; font-size: 10px; }
.sequence-check { padding-bottom: 10px; }
.sequence-preview { margin: 0; color: #59627a; font-size: 11px; }
.sequence-preview strong { color: #4d3bd0; font-size: 13px; }
.sequence-mode { flex-wrap: wrap; font-size: 11px; font-weight: 600; }
.smtp-test-to { min-width: 220px; height: 38px; padding: 0 10px; border: 1px solid #e8ebf1; border-radius: 6px; font-size: 11px; }
.user-form textarea { min-width: 0; padding: 8px 10px; border: 1px solid #e8ebf1; border-radius: 6px; font-family: inherit; font-size: 11px; }
.email-modal { width: min(680px, calc(100vw - 28px)); }
.email-form { display: grid; gap: 11px; }
.email-form input, .email-form textarea { min-width: 0; height: 38px; padding: 0 10px; border: 1px solid #e8ebf1; border-radius: 6px; outline: 0; color: #404a5c; font-family: inherit; font-size: 11px; }
.email-form textarea { height: auto; padding: 9px 10px; resize: vertical; line-height: 1.5; }
.email-form input:focus, .email-form textarea:focus { border-color: #a69bee; }
.email-attachment { padding: 9px 11px; border-radius: 7px; background: #f6f5ff; font-size: 11px; }
.email-attachment a { color: #4d3bd0; font-weight: 700; }
.email-history { color: #6d7688; font-size: 10px; }
.email-history ul { margin: 6px 0 0; padding-left: 16px; }
.email-history li { margin-bottom: 4px; }
.client-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: -8px 0 14px; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border: 1px solid #e3e6ee; border-radius: 16px; background: white; color: #59627a; font-size: 10px; font-weight: 700; }
.filter-chip span { color: #9aa2b1; font-weight: 600; }
.filter-chip.active { border-color: #a69bee; background: #f0efff; color: #4d3bd0; }
.client-kanban { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding: 4px 19px 19px; }
.client-card { display: flex; gap: 12px; min-height: 92px; padding: 10px; border: 1px solid #e8ebf1; border-radius: 8px; background: white; text-align: left; }
.client-card:hover { border-color: #c8c1f5; box-shadow: 0 4px 14px #6654e814; }
.client-card-avatar { width: 64px; height: 64px; flex: 0 0 64px; display: grid; place-items: center; border-radius: 6px; color: white; font: 700 20px Manrope, sans-serif; }
.client-card-avatar.company { font-size: 26px; }
.client-card-body { min-width: 0; display: grid; align-content: start; gap: 3px; }
.client-card-body strong { overflow: hidden; color: #2b3344; font-size: 12px; text-overflow: ellipsis; }
.client-card-body small { overflow: hidden; color: #6d7688; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.client-card-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.pill { display: inline-block; padding: 2px 7px; border-radius: 10px; background: #7b74b8; color: white; font-size: 9px; font-weight: 700; }
.pill-warning { background: #e2963b; }
.pill-new { background: #2eae79; }
.client-top { display: grid; grid-template-columns: 100px minmax(0, 1fr) auto; gap: 16px; align-items: start; margin-bottom: 20px; }
.client-avatar { width: 100px; height: 100px; display: grid; place-items: center; border-radius: 8px; background: #d9dcef; color: white; font: 700 32px Manrope, sans-serif; }
.client-identity { display: grid; gap: 8px; }
.radio-row { display: flex; gap: 18px; color: #343c4e; font-size: 12px; font-weight: 700; }
.radio-row label { display: flex; align-items: center; gap: 6px; }
.radio-row input { height: auto !important; }
.client-form .client-name { height: 46px; font: 700 22px Manrope, sans-serif; background: #f6f5ff; }
.parent-picker { display: grid; gap: 5px; max-width: 420px; }
.parent-picker input { height: 30px !important; font-size: 10px !important; }
.smart-buttons { display: grid; grid-template-columns: repeat(3, minmax(96px, 1fr)); border: 1px solid #e8ebf1; border-radius: 8px; overflow: hidden; }
.smart-button { display: grid; gap: 2px; padding: 9px 12px; border: 0; border-right: 1px solid #e8ebf1; border-bottom: 1px solid #e8ebf1; background: white; color: #6d7688; font-size: 10px; text-align: left; }
.smart-button b { color: #4d3bd0; font-size: 13px; }
.smart-button.warning b { color: #b56f1d; }
.smart-button:hover { background: #f8f7ff; }
.client-fields .inline-field { grid-template-columns: 150px minmax(0, 1fr); }
.address-field > span { align-self: start; padding-top: 9px; color: #788193; font-size: 10px; font-weight: 600; }
.address-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.address-grid input:nth-child(1), .address-grid input:nth-child(2) { grid-column: 1 / -1; }
.address-grid input:nth-child(6) { grid-column: 1 / -1; }
.check-field input { width: 18px; height: 18px !important; justify-self: start; }
.client-tabs { margin-top: 10px; }
.client-tab-panel { padding: 6px 2px 8px; font-size: 11px; }
.client-tab-panel p { font-size: 11px; }
.client-tab-panel textarea { width: 100%; }
.client-tab-panel .inline-field { max-width: 560px; margin-bottom: 10px; }
.contact-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-bottom: 12px; }
.contact-card { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid #e8ebf1; border-radius: 8px; background: #fafbfe; text-align: left; font-size: 10px; color: #6d7688; }
.contact-card strong { color: #2b3344; font-size: 11px; }
.client-orders-head { display: flex; justify-content: space-between; align-items: center; margin: 10px 0 8px; font-size: 11px; }
.billing-totals { max-width: 420px; margin-bottom: 12px; }
.client-duplicates { margin-top: 14px; padding: 12px 14px; border-radius: 8px; background: #fff5e9; color: #7a5420; font-size: 11px; }
.client-duplicates ul { margin: 8px 0 10px; padding-left: 18px; }
#quote-new-client { justify-self: start; }
.filter-chip.spam-chip { border-color: #f3d4a8; color: #9a6420; }
.filter-chip.spam-chip.active { background: #fff5e9; border-color: #e2963b; }
.spam-review { padding: 0 19px 12px; }
.spam-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; padding: 12px 14px; border-radius: 8px; background: #fff8ee; color: #6b5a3c; font-size: 11px; }
.spam-banner p { margin: 4px 0 0; line-height: 1.45; }
.spam-name { max-width: 480px; }
.revenue-matrix-panel { margin-top: 17px; }
.revenue-matrix-panel > .panel-heading { flex-wrap: wrap; min-height: 72px; padding: 14px 22px; }
.segmented-group { display: flex; flex-wrap: wrap; gap: 8px; }
.segmented { display: inline-flex; overflow: hidden; border: 1px solid #e3e6ee; border-radius: 7px; background: white; }
.segment { padding: 6px 12px; border: 0; background: none; color: #7d8697; font-size: 10px; font-weight: 700; }
.segment + .segment { border-left: 1px solid #e3e6ee; }
.segment.active { background: #f0efff; color: #4d3bd0; }
.matrix-table th, .matrix-table td { padding: 8px 12px; }
.matrix-table tbody td:first-child { position: sticky; left: 0; z-index: 1; background: white; }
.matrix-cell { position: relative; cursor: pointer; background: linear-gradient(90deg, transparent calc(100% - var(--heat)), #6654e81a calc(100% - var(--heat))); }
.matrix-cell:hover, .matrix-cell:focus { outline: 0; box-shadow: inset 0 0 0 2px #a69bee; }
.matrix-amount { display: block; color: #343c4e; font-weight: 600; }
.matrix-cell .delta-inline { display: block; margin-top: 1px; }
.matrix-cell.current-month .matrix-amount::after { content: " •"; color: #e2963b; }
.matrix-cell.best-month { box-shadow: inset 0 0 0 2px #2eae7966; }
.matrix-table tfoot th { padding: 9px 12px; border-top: 1px solid #e8ebf1; background: #fbfcfe; color: #59627a; font-size: 9px; text-align: left; }
.matrix-table tfoot td { border-top: 1px solid #e8ebf1; font-size: 10px; }
.matrix-total td { color: #20283a; font-weight: 700; }
.matrix-note { color: #8b93a5; font-size: 9px !important; white-space: normal !important; }
.matrix-chart-wrap { padding: 4px 22px 18px; }
.matrix-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.legend-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border: 1px solid #e3e6ee; border-radius: 14px; background: white; color: #4a5365; font-size: 10px; font-weight: 700; }
.legend-chip i { width: 10px; height: 10px; border-radius: 3px; }
.legend-chip.off { opacity: .4; }
.matrix-chart { height: 220px; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: end; gap: 8px; }
.matrix-month { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; color: #a0a7b5; font-size: 9px; }
.matrix-bars { width: 100%; height: 190px; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.matrix-bars i { flex: 1; max-width: 14px; border-radius: 3px 3px 0 0; }
.button.danger { border-color: #f3d4d4; color: #b54848; }
.button.danger:hover { background: #fff5f5; }

@media (max-width: 1050px) {
  .sidebar { width: 205px; }
  .main { margin-left: 205px; }
  .page-content { padding-right: 25px; padding-left: 25px; }
  .topbar { padding-right: 25px; padding-left: 25px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .today { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inline-field { grid-template-columns: 1fr; gap: 5px; }
  .client-top { grid-template-columns: 80px minmax(0, 1fr); }
  .client-avatar { width: 80px; height: 80px; }
  .smart-buttons { grid-column: 1 / -1; }
  .client-fields .inline-field { grid-template-columns: 1fr; }
  .address-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-grid { grid-template-columns: 1fr; }
  .user-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .main { margin-left: 0; }
  .topbar { height: 56px; padding: 0 16px; }
  .mobile-brand { display: flex; align-items: center; gap: 7px; color: #293244; font: 800 14px Manrope, sans-serif; }
  .mobile-brand .brand-mark { width: 27px; height: 27px; border-radius: 8px; font-size: 14px; }
  .breadcrumb { display: none; }
  .today { font-size: 9px; }
  .topbar-right { gap: 9px; }
  .avatar { width: 29px; height: 29px; }
  .page-content { padding: 24px 15px 40px; }
  .page-heading { align-items: flex-start; margin-bottom: 20px; }
  .page-heading .button { min-height: 35px; padding: 0 10px; font-size: 9px; white-space: nowrap; }
  .date-filter { flex-wrap: wrap; gap: 10px; margin-top: -6px; padding: 12px; }
  .date-filter-title { width: 100%; }
  .date-filter label { flex: 1; min-width: 125px; }
  .date-filter input { width: 100%; min-width: 0; }
  h1 { font-size: 20px; }
  .subheading { max-width: 240px; line-height: 1.5; font-size: 10px; }
  .stat-grid { gap: 9px; }
  .stat-card { min-height: 119px; padding: 13px 12px; }
  .stat-label { font-size: 9px; }
  .stat-icon { width: 23px; height: 23px; flex-basis: 23px; }
  .stat-value { font-size: clamp(16px, 5vw, 21px); }
  .stat-foot { font-size: 8px; }
  .dashboard-grid { grid-template-columns: 1fr; gap: 10px; margin-top: 10px; }
  .chart-panel, .status-panel { min-height: auto; padding: 17px 14px; }
  .chart { gap: 6px; }
  .chart-value { font-size: 7px; }
  .recent-panel { margin-top: 10px; }
  .recent-panel > .panel-heading { min-height: 65px; padding: 0 14px; }
  .panel-heading h2 { font-size: 12px; }
  .panel-heading p { font-size: 9px; }
  th { padding: 10px 11px; font-size: 7px; }
  td { padding: 11px; font-size: 9px; }
  .filters { padding: 13px 12px; }
  .search-box { min-width: 0; }
  .search-box input { font-size: 9px; }
  .select-label select { min-width: 115px; padding: 0 7px; font-size: 9px; }
  .pagination { padding: 0 12px; }
  .modal { padding: 19px 15px; }
  .detail-meta, .followup-grid { grid-template-columns: 1fr 1fr; }
  .lost-form { flex-direction: column; align-items: stretch; }
  .bulk-bar { flex-wrap: wrap; padding: 10px 12px; }
  .margin-panel > .panel-heading { flex-wrap: wrap; min-height: 0; padding: 14px; }
  .stat-grid.three { grid-template-columns: 1fr; }
  .user-grid, .admin-grid { grid-template-columns: 1fr; }
  .user-meta { display: none; }
  .password-form { grid-template-columns: 1fr; }
  .mfa-qr { width: 170px; height: 170px; }
  .quote-header, .quote-footer { grid-template-columns: 1fr; }
  .inline-field { grid-template-columns: 1fr; gap: 5px; }
  .quote-form { padding: 14px; }
  .stage-bar { margin-left: 0; }
  .month-chart { gap: 3px; }
  .tabs { overflow-x: auto; }
  .tab { white-space: nowrap; }
}

/* Facturation clients */
.invoice-stats { margin-bottom: 18px; }
.badge.paid { background: #e8f7f0; color: #279a6c; }
.badge.open { background: #edf3ff; color: #5f83cb; }
.badge.overdue { background: #fff0f0; color: #c35f5f; }
.badge.cancel { background: #f2f3f6; color: #8a91a3; }
.invoice-modal-lines td small { display: block; }
.field-hint { font-weight: 400; font-size: 10px; }

/* Documents liés à une commande (bon de commande, bons de livraison, factures) */
.doc-list { display: grid; gap: 6px; margin: 0 0 10px; padding: 0; list-style: none; }
.doc-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid #eceef4; border-radius: 8px; font-size: 11px; }
.doc-kind { min-width: 110px; color: #8a91a3; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.doc-actions { display: inline-flex; gap: 10px; margin-left: auto; }
.doc-actions a { color: #5b4bd8; font-weight: 600; }
.sequence-help { margin: -4px 0 12px; font-size: 10px; }

/* Menu latéral : défilement et sous-menus repliables (écrans larges ; sur mobile le menu est une barre horizontale) */
@media (min-width: 701px) {
  .sidebar { height: 100vh; }
  .sidebar .nav-caption { margin-top: 32px; }
  .sidebar nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; align-content: start; grid-auto-rows: max-content; margin: 0 -8px; padding: 0 8px 12px; scrollbar-width: thin; scrollbar-color: #d9dcf3 transparent; }
  .sidebar nav::-webkit-scrollbar { width: 6px; }
  .sidebar nav::-webkit-scrollbar-thumb { background: #d9dcf3; border-radius: 6px; }
  .sidebar nav::-webkit-scrollbar-thumb:hover { background: #b9b2f2; }
  .sidebar .sidebar-bottom { flex: none; }
  .nav-sub { overflow: hidden; max-height: 420px; transition: max-height .25s ease, opacity .2s ease, margin .25s ease; }
  .nav-sub.collapsed { max-height: 0; opacity: 0; margin-top: -7px; margin-bottom: 0; pointer-events: none; }
}
.nav-toggle { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 22px; height: 22px; margin-left: auto; border-radius: 6px; color: #9aa2b1; font-size: 12px; transition: transform .2s ease, background .15s; }
.nav-link .nav-count + .nav-toggle { margin-left: 4px; }
.nav-toggle:hover, .nav-toggle:focus-visible { background: #e7e5fb; color: #5c4cdb; outline: none; }
.nav-toggle[aria-expanded="false"] { transform: rotate(-90deg); }
.doc-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.invoice-draft-note { margin: 4px 0 0; font-size: 10px; }
.badge.closed { background: #eceaff; color: #5c4cdb; }

.version-banner { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 40px); padding: 12px 14px 12px 18px; border: 1px solid #d9d4ff; border-radius: 12px; background: #fff; box-shadow: 0 12px 30px rgba(40, 33, 110, .16); font-size: 12px; font-weight: 600; color: #3b3270; }
/* Bons de livraison : sélection pour le transfert en bon de commande */
.check-cell { width: 34px; text-align: center; }
.check-cell input { width: 15px; height: 15px; cursor: pointer; accent-color: #5c4cdb; }
.delivery-selection { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 10px; padding: 10px 12px; border: 1px solid #d9d4ff; border-radius: 10px; background: #f6f5ff; font-size: 12px; font-weight: 600; color: #3b3270; }
.delivery-selection span { flex: 1 1 260px; }

/* Écrans peu hauts (portable à 100 %, 1080p avec mise à l'échelle Windows) : menu plus compact, tout reste lisible. */
@media (min-width: 701px) and (max-height: 960px) {
  .sidebar { padding-top: 20px; padding-bottom: 14px; }
  .sidebar .nav-caption { margin: 20px 9px 8px; }
  .sidebar nav { gap: 3px; }
  .nav-link { min-height: 38px; }
  .nav-sublink { min-height: 30px; }
  .nav-sub { margin: 0 0 2px 18px; }
  .sidebar-bottom { padding-top: 10px; }
}
@media (min-width: 701px) and (max-height: 760px) {
  .sidebar .brand { font-size: 18px; }
  .sidebar .nav-caption { display: none; }
  .nav-link { min-height: 34px; font-size: 12.5px; }
  .nav-sublink { min-height: 27px; font-size: 11.5px; }
}

.pill-exempt { margin-top: 4px; background: #fff5e9; color: #b6741f; }

/* Articles : modification rapide dans la liste */
.quick-input { width: 100%; min-width: 70px; padding: 5px 7px; border: 1px solid #e1e4ec; border-radius: 6px; background: #fff; font: inherit; font-size: 11px; color: #2c3346; transition: border-color .15s, background .3s; }
.quick-input:focus { border-color: #8d80f0; outline: none; box-shadow: 0 0 0 3px #efedff; }
.quick-number { text-align: right; max-width: 110px; }
select.quick-input { max-width: 110px; margin-top: 4px; }
.quick-input.quick-saved { border-color: #5cc39a; background: #eefaf4; }
.quick-input.quick-error { border-color: #e28b8b; background: #fff3f3; }
.quick-row td { vertical-align: top; }
.edit-lines-button { margin: 2px 0 10px; font-size: 11px; }
.lines-editor td { vertical-align: top; }
.lines-editor .editor-product { min-width: 190px; }
.lines-editor .editor-create { display: block; margin-top: 4px; }
.field-with-link { position: relative; display: grid; }
.field-with-link .text-button { position: absolute; top: 0; right: 0; font-size: 11px; line-height: 1.3; }
.supplier-quick-modal { width: min(720px, calc(100vw - 32px)); }
.supplier-quick-modal .muted { margin: 0; font-size: 11px; }
.create-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -4px 0 10px; padding: 8px 12px; border-radius: 8px; background: #fff7e6; color: #7a5a12; font-size: 11px; }
.lines-editor .editor-name { min-width: 170px; }
.edit-block { align-self: center; font-size: 11px; }
.quick-row [data-quick-field="name"] { min-width: 230px; }
.quick-row [data-quick-field="sku"] { min-width: 110px; }
.row-actions { white-space: nowrap; }
.row-actions .button { margin-right: 6px; vertical-align: middle; }

.badge.proforma { background: #fff3e0; color: #c27413; }

/* Administration › Sauvegardes */
.backup-schedule { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 0 0 8px; padding: 10px 12px; border: 1px solid #eceef4; border-radius: 10px; background: #fafbff; font-size: 12px; }
.backup-schedule .inline-field { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.backup-schedule select, .backup-schedule .backup-keep { width: auto; min-width: 70px; padding: 5px 8px; }
.backup-status { margin: 0 0 10px; font-size: 11px; color: #6b7386; }
.forgot-link { justify-self: center; margin-top: 2px; font-size: 12px; }
.form-success { margin: 0; padding: 9px 11px; border-radius: 8px; background: #eefaf4; color: #237a55; font-size: 12px; }

.backup-directory-form { align-items: flex-end; }
.backup-path { flex: 1 1 320px; margin: 0; }
.backup-path-help { flex-basis: 100%; margin: 0; font-size: 10px; }
.restore-form { display: grid; gap: 12px; max-width: 760px; }
.restore-warning { padding: 10px 12px; border: 1px solid #f3d4a8; border-radius: 10px; background: #fff8ee; color: #7a4d12; font-size: 12px; line-height: 1.5; }
.danger-button { background: #c34b4b; border-color: #c34b4b; }
.danger-button:disabled { opacity: .45; cursor: not-allowed; }

/* Sauvegardes : copie SFTP */
.sftp-form { margin: 4px 0 14px; padding: 12px; border: 1px solid #eceef4; border-radius: 10px; background: #fafbff; }
.sftp-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.sftp-heading h3 { margin: 0; font-size: 13px; }
.sftp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.sftp-form code { font-size: 10px; word-break: break-all; }

/* Administration : double authentification par utilisateur */
.user-mfa-required { width: 16px; height: 16px; cursor: pointer; accent-color: #5c4cdb; }
.user-mfa-qr { display: flex; justify-content: center; margin: 12px 0; }
.user-mfa-qr svg { width: 210px; height: 210px; padding: 8px; border: 1px solid #eceef4; border-radius: 10px; background: #fff; }
.user-mfa-secret code { font-size: 11px; letter-spacing: .5px; word-break: break-all; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 0; list-style: none; }
.recovery-codes code { display: block; padding: 6px 8px; border-radius: 6px; background: #f4f5fa; font-size: 12px; text-align: center; }

/* Restauration : marges et étapes */
.restore-panel .restore-form { max-width: none; padding: 0 22px 22px; }
.restore-step { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; align-items: start; }
.restore-step > div { display: grid; gap: 10px; }
.restore-number { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-top: 18px; border-radius: 50%; background: #eceaff; color: #5c4cdb; font-size: 12px; font-weight: 700; }
.restore-hint { margin: 0; font-size: 11px; }
.restore-panel .restore-warning { margin-left: 38px; }
/* Champs des formulaires Sauvegardes / SFTP / Restauration, comme les autres formulaires */
.restore-form input, .sftp-form input, .backup-directory-form input, .backup-schedule input[type="number"] { min-width: 0; height: 38px; padding: 0 10px; border: 1px solid #e8ebf1; border-radius: 6px; outline: 0; background: white; color: #404a5c; font-size: 11px; }
.restore-form input:focus, .sftp-form input:focus, .backup-directory-form input:focus, .backup-schedule input[type="number"]:focus { border-color: #a69bee; }
.sftp-form input:disabled { background: #f6f7fb; color: #8a91a3; }

/* Fiche article › Facturation (TVA vente et achat, comme Odoo) */
.billing-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.billing-columns h3 { margin: 0 0 10px; color: #6b5ed6; font-size: 15px; }
.billing-help { margin: 6px 0 0; font-size: 10px; }
/* Comptabilité › Plan comptable */
.account-total-row td { border-top: 2px solid #e1e4ec; background: #fafbff; }
.muted-row td { color: #9aa2b1; }

/* Achats */
.purchase-edit-modal { width: min(1100px, calc(100vw - 32px)); }
.badge.rfq { background: #fff5e9; color: #c88732; }

.user-active-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.user-active-toggle input { width: 16px; height: 16px; }

/* Accès aux modules par utilisateur */
#users-table tr[data-user-row] td { border-bottom: 0; }
.user-modules-row td { padding-top: 0; }
.user-modules { position: sticky; left: 0; max-width: calc(100vw - 360px); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 2px 0 10px; font-size: 12px; }
.user-modules-label { color: var(--muted, #8a8fa3); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.user-module { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.user-module input { width: 15px; height: 15px; }

/* Paiements : paiements en circulation sur une facture, en-tête de section, montant à lettrer. */
.payment-outstanding { margin: 14px 0 0; padding: 12px 14px; border: 1px solid #cfe6f3; border-radius: 9px; background: #eef8fd; color: #2c5a72; font-size: 11px; }
.payment-outstanding p { margin: 0 0 8px; }
.payment-outstanding ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.payment-outstanding li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.payment-outstanding li span { flex: 1; min-width: 180px; }
.payment-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.payment-section-heading h3 { margin: 0; }
.allocate-amount { width: 110px; height: 30px; padding: 0 8px; border: 1px solid #e8ebf1; border-radius: 6px; text-align: right; font-size: 11px; }
.payment-form-note { margin: 0; font-size: 11px; line-height: 1.45; }
.payment-cell { max-width: 150px; font-size: 11px; line-height: 1.3; }
.payment-cell small { display: block; margin-top: 2px; font-size: 10px; }
/* Retenue à la source sur une facture. */
.withholding-box { display: grid; gap: 6px; margin: 10px 0; padding: 12px 14px; border: 1px solid #f1e3b4; border-radius: 9px; background: #fffbea; font-size: 11px; }
.withholding-box > div { display: flex; justify-content: space-between; gap: 10px; }
.withholding-box .withholding-net { padding-top: 6px; border-top: 1px dashed #e6d48f; font-size: 13px; }
.withholding-box .withholding-net strong { color: #c0392b; }
.withholding-box p { margin: 0; }
.withholding-box .button { justify-self: start; }
#withholdings-list small { display: block; font-size: 10px; }
/* Indicateurs en dinars complets : taille adaptée à la largeur de la carte, retour à la ligne si besoin. */
.stat-card { container-type: inline-size; }
.stat-value { font-size: clamp(13px, 9.5cqi, 22px); white-space: normal; overflow-wrap: anywhere; text-overflow: clip; }
.warning-text { margin: 0; color: #b4570a; font-size: 11px; font-weight: 600; }
td.warning-text { padding-top: 0; }
.detail-meta small { display: block; margin-top: 3px; font-size: 10px; }
#withholding-lines select { height: 30px; padding: 0 6px; border: 1px solid #e8ebf1; border-radius: 6px; font-size: 11px; }
#withholding-lines small { display: block; }
.tax-id-panel { margin-top: 16px; padding: 14px 16px; }
.tax-id-panel summary { cursor: pointer; font-size: 12px; font-weight: 700; color: #3b3270; }
.tax-id-panel h3 { margin: 16px 0 8px; font-size: 12px; }
/* Grand livre et retenue par défaut (contacts). */
.ledger-modal { width: min(980px, calc(100vw - 28px)); }
.ledger-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 14px; margin-bottom: 12px; }
.ledger-controls .form-field input { height: 34px; padding: 0 8px; border: 1px solid #e8ebf1; border-radius: 6px; font-size: 11px; }
.ledger-presets { display: flex; gap: 10px; padding-bottom: 8px; }
.segmented { display: inline-flex; border: 1px solid #e0dcff; border-radius: 8px; overflow: hidden; }
.segmented button { padding: 8px 14px; border: 0; background: #fff; color: #5b5f72; font-size: 11px; font-weight: 600; cursor: pointer; }
.segmented button.active { background: #5c4cdb; color: #fff; }
.segmented button:disabled { color: #c3c6d1; cursor: not-allowed; }
.ledger-table-wrap { max-height: 52vh; overflow: auto; }
.ledger-table-wrap tr.ledger-opening td, .ledger-table-wrap tfoot td { font-weight: 700; background: #f6f6fa; }
.withholding-cell small { display: block; font-size: 10px; }
/* Nouvelle facture / nouvel avoir. */
.document-modal { width: min(980px, calc(100vw - 28px)); }
#document-lines { margin-top: 6px; }
/* Comptabilité générale. */
.accounting-filters { flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.compact-field { margin: 0; font-size: 12px; min-width: 0; }
.compact-field input { min-height: 36px; padding: 6px 8px; }
.acc-account-field { flex: 1 1 280px; }
.acc-account-picker { display: flex; gap: 4px; align-items: center; }
.acc-account-picker input { flex: 1; min-width: 0; }
.accounting-alerts { border: 1px solid #f1d9a6; background: #fff8e8; color: #7a5410; border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; font-size: 13px; }
.accounting-alerts ul { margin: 6px 0 0; padding-left: 18px; max-height: 140px; overflow: auto; }
.accounting-lock { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin-top: 16px; padding: 16px 18px; }
.accounting-lock > div { flex: 1 1 320px; }
.accounting-lock p { margin: 4px 0 0; font-size: 12px; }
.acc-table td, .acc-table th { white-space: nowrap; }
.acc-table td.wrap { white-space: normal; min-width: 180px; }
.acc-table tr.acc-opening td { background: #f7f7fb; font-weight: 600; }
.acc-table tr.acc-subtotal td { font-weight: 700; border-top: 1px solid #d8d9e3; background: #fafafd; }
.acc-table tr.acc-total td { font-weight: 800; background: #eef0f8; border-top: 2px solid #b9bccd; }
.acc-table .acc-side { color: #8a8da0; font-size: 11px; margin-left: 3px; }
.acc-ledger-head { display: flex; flex-wrap: wrap; gap: 8px 26px; padding: 12px 18px; border-bottom: 1px solid #eceef4; }
.acc-ledger-head strong { display: block; font-size: 15px; }
.acc-ledger-head span { font-size: 12px; color: #7b7f93; }
.acc-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; padding: 16px 18px; }
.acc-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; padding: 0 18px 18px; }
.acc-columns h3 { font-size: 14px; margin: 14px 0 8px; }
.acc-check { font-size: 12px; padding: 0 18px 14px; }
.acc-check.ok { color: #2f8a57; }
.acc-check.ko { color: #c35f5f; }
.move-modal { width: min(980px, calc(100vw - 28px)); }
.move-meta { display: flex; flex-wrap: wrap; gap: 6px 26px; margin-bottom: 12px; font-size: 13px; }
.move-meta strong { display: block; }
.move-form-head { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.move-form-table input { width: 100%; min-height: 34px; padding: 5px 7px; }
.move-form-table td { padding: 4px; }
.move-form-table .amount-input { text-align: right; max-width: 130px; }
#move-form-gap.ko { color: #c35f5f; font-weight: 600; }
#move-form-gap.ok { color: #2f8a57; }
@media (max-width: 700px) { .move-form-head { grid-template-columns: 1fr; } }
/* Ressources humaines. */
.hr-modal { width: min(1020px, calc(100vw - 28px)); }
.hr-form h3 { font-size: 13px; margin: 16px 0 6px; color: #5b5f75; text-transform: uppercase; letter-spacing: .04em; }
.hr-grid-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 12px; }
.hr-grid-form .form-field { margin: 0; }
.hr-span-2 { grid-column: span 2; }
.hr-check { align-self: end; padding-bottom: 8px; }
.hr-tabs { margin: 0 0 12px; flex-wrap: wrap; }
.hr-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.hr-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; margin-bottom: 16px; }
.hr-two .panel, .hr-panel { padding: 16px 18px; }
.hr-panel h3, .hr-two h3 { margin: 0 0 10px; font-size: 15px; }
.hr-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.hr-list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid #eef0f5; }
.hr-run-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid #eceef4; }
.hr-params { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 8px 16px; }
.hr-brackets td input { width: 110px; min-height: 32px; padding: 4px 6px; }
.hr-preview { margin-top: 12px; }
.hr-preview dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 6px 18px; margin: 0; font-size: 13px; }
.hr-preview dl div { display: flex; justify-content: space-between; border-bottom: 1px dashed #e3e5ee; padding: 4px 0; }
.hr-preview dl div.strong { font-weight: 800; }
.hr-doc-buttons { display: flex; flex-wrap: wrap; gap: 10px; padding: 8px 0; }
@media (max-width: 760px) { .hr-grid-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Rapports PDF */
.pdf-reports { display: grid; grid-template-columns: minmax(200px, 250px) 1fr; min-height: 420px; }
.pdf-list { display: flex; flex-direction: column; border-right: 1px solid #eceef4; padding: 10px 0; background: #fafafd; }
.pdf-item { text-align: left; border: 0; background: transparent; padding: 9px 18px; font: inherit; font-size: 13.5px; color: #333; cursor: pointer; border-left: 3px solid transparent; }
.pdf-item:hover { background: #f0f1f8; }
.pdf-item.active { background: #fff; border-left-color: var(--accent, #6b4ce6); font-weight: 700; color: #222; }
.pdf-form { padding: 18px 24px; }
.pdf-form h2 { margin: 0 0 4px; font-size: 18px; }
.pdf-form > p { margin: 0 0 16px; font-size: 13px; }
.pdf-fields { display: grid; gap: 12px; max-width: 460px; }
.pdf-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pdf-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 20px; font-size: 12px; }
@media (max-width: 760px) {
  .pdf-reports { grid-template-columns: 1fr; }
  .pdf-list { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid #eceef4; }
}

/* Facturation avancée */
.billing-modal { width: min(820px, calc(100vw - 28px)); }
.billing-modal form { display: grid; gap: 12px; }
.billing-modal textarea { width: 100%; font: inherit; }
.billing-warnings { border: 1px solid #f1d9a6; background: #fff8e8; color: #7a5410; border-radius: 10px; padding: 9px 12px; margin-bottom: 12px; font-size: 13px; }
.billing-extras { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 22px; margin-top: 14px; padding-top: 12px; border-top: 1px solid #eceef4; font-size: 13px; }
.billing-extras h3 { font-size: 13px; margin: 0 0 6px; }
.billing-extras ul { margin: 0 0 6px; padding-left: 16px; }
.billing-extras li { margin: 3px 0; }
.refund-qty { width: 90px; text-align: right; }
.exemption-fields { display: grid; gap: 6px; padding: 8px 10px; border-left: 3px solid #e8d9a8; background: #fffcf2; border-radius: 6px; }
#exemptions-panel { margin-top: 16px; }
.row-actions { white-space: nowrap; font-size: 12px; }

/* Trésorerie : chèques et traites */
.tr-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; background: var(--surface-muted, #f4f6fb); }
.tr-totals { margin: 4px 0 10px; }
.acc-table .check-cell { width: 34px; text-align: center; }
.acc-table tr.clickable { cursor: pointer; }
.acc-table .amount.negative { color: #b42318; }

.traite-protest { display: flex; flex-wrap: wrap; gap: 6px 18px; border: 0; padding: 0; margin: 4px 0 8px; }
.traite-protest legend { font-weight: 600; margin-bottom: 4px; }

/* Scan des devis et factures fournisseurs */
.scan-modal { width: min(1180px, 96vw); }
.scan-h { margin: 14px 0 6px; font-size: 14px; }
.scan-parties { display: grid; gap: 8px; margin-bottom: 10px; }
.scan-party { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid #e3e5ee; border-radius: 10px; }
.scan-party input[type=radio] { margin-top: 4px; }
.scan-table td { vertical-align: top; }
.scan-table .scan-in { width: 100%; min-width: 60px; padding: 4px 6px; border: 1px solid #d9dce6; border-radius: 6px; font: inherit; font-size: 12.5px; }
.scan-table textarea.scan-in { min-width: 220px; resize: vertical; }
.scan-table .scan-in.num { width: 90px; text-align: right; }
.scan-table [data-k="reference"] { min-width: 120px; }
.scan-table select.scan-in { min-width: 170px; }
.scan-table .scan-type { margin-top: 4px; }
.scan-totals { margin: 10px 0; }
.scan-target { border: 0; padding: 0; margin: 8px 0; display: grid; gap: 4px; }
.scan-target legend { font-weight: 600; margin-bottom: 4px; }
#scan-step-file ~ #scan-review-actions #scan-back, #scan-step-file ~ #scan-review-actions #scan-apply { display: none; }
#scan-step-file.hidden ~ #scan-review-actions #scan-back, #scan-step-file.hidden ~ #scan-review-actions #scan-apply { display: inline-flex; }
.scan-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px; padding: 8px 12px;
             border-radius: 10px; background: #f4f3ff; color: #4b3fd1; font-size: 13px; }

/* Lignes « Payé le … » sous le total d'une facture */
.paid-lines .paid-line span { font-style: italic; color: var(--muted, #667085); }
/* Message (toast) affiché en popover au-dessus des fenêtres ouvertes */
.toast[popover] { inset: auto 24px 24px auto; margin: 0; border: 0; overflow: visible; }
.toast[popover]:not(:popover-open) { display: none; }

/* Base de test : bandeau permanent et rappel sur la page de connexion */
.test-base-banner { position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 60; padding: 4px 16px; border-radius: 0 0 8px 8px; background: #c2410c; color: #fff; font: 700 11px Manrope, sans-serif; letter-spacing: .04em; box-shadow: 0 3px 10px #c2410c40; pointer-events: none; white-space: nowrap; }
.test-base-note { margin: 0; padding: 8px 11px; border-radius: 8px; background: #fff4e5; color: #9a3412; font-size: 11px; }

/* Scan : création d'un nouveau fournisseur */
.scan-new-supplier { flex: 1; }
.scan-new-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.scan-new-grid input { min-width: 0; }
#scan-supplier-add { margin-left: 8px; }
@media (max-width: 640px) { .scan-new-grid { grid-template-columns: 1fr; } }

/* Fiche client : rôles Client / Fournisseur */
.client-roles { display: flex; flex-wrap: wrap; gap: 4px 18px; }

/* Circuit d'achat : étapes demande de prix → commande → facture */
.doc-steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; padding: 0; list-style: none; counter-reset: step; }
.doc-steps li { position: relative; flex: 1 1 150px; padding: 8px 12px 8px 30px; border: 1px solid #e3e5ee; border-radius: 9px; background: #f8f9fc; color: #69728a; font-size: 11px; font-weight: 600; counter-increment: step; }
.doc-steps li::before { content: counter(step); position: absolute; left: 9px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: #d8dbe6; color: #fff; font-size: 9px; }
.doc-steps li.step-done { border-color: #bfe6d3; background: #eefaf4; color: #237a55; }
.doc-steps li.step-done::before { content: "✓"; background: #2f9e6e; }
.doc-steps li.step-current { border-color: #b9b0ff; background: #f3f1ff; color: #4b3fc4; }
.doc-steps li.step-current::before { background: #6654e8; }
.doc-steps li.step-cancel { border-color: #f1c4c4; background: #fff3f3; color: #b23b3b; }
.doc-steps li.step-cancel::before { content: "×"; background: #c54848; }

/* Envoi groupé de devis par e-mail : un bloc par client */
.batch-email-group { display: grid; gap: 8px; margin: 0 0 14px; padding: 12px 14px; border: 1px solid #e3e5ee; border-radius: 10px; }
.batch-email-group legend { padding: 0 6px; font-weight: 700; color: #263248; }

/* Administration › Société : logo, cachet et signature */
.company-images { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-bottom: 14px; }
.company-image { display: grid; gap: 8px; align-content: start; padding: 12px; border: 1px solid #e3e5ee; border-radius: 10px; }
.company-preview { display: grid; place-items: center; min-height: 110px; padding: 8px; border: 1px dashed #d4d8e4; border-radius: 8px; background: #fbfbfd; }
.company-preview img { max-width: 100%; max-height: 140px; object-fit: contain; }
.company-image-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.company-image-actions label { cursor: pointer; }
.company-hint { margin: 0; font-size: 11px; }
.tr-toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
/* Comparaison trésorerie / banque */
.bankreco-form { display: grid; gap: 14px; padding: 20px 22px; }
.bankreco-grid { display: grid; grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(140px, 1fr)); gap: 14px; align-items: start; }
.bankreco-file input[type="file"] { padding: 9px; border: 1px dashed #c9c3f5; border-radius: 8px; background: #faf9ff; }
.bankreco-sources { display: grid; gap: 6px; margin: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
.bankreco-sources legend { padding: 0 6px; font-size: 11px; font-weight: 700; color: #737d90; }
.bankreco-sources .check-line { display: flex; gap: 8px; align-items: center; }
.bankreco-warnings { margin: 14px 0 0; padding: 10px 14px; border-radius: 8px; background: #fff7e6; color: #7a5a12; font-size: 12px; }
.bankreco-warnings li + li { margin-top: 4px; }
.bankreco-section { margin-top: 17px; }
.bankreco-section > .panel-heading h2 .count { margin-left: 6px; color: #959db0; font-weight: 600; }
.bankreco-section.ok > .panel-heading h2::before { content: "✓ "; color: #2f9e6b; }
.bankreco-section.errors > .panel-heading h2::before { content: "! "; color: #c0582f; }
.bankreco-matched summary { cursor: pointer; padding: 14px 22px; font-weight: 700; font-size: 13px; }
@media (max-width: 900px) { .bankreco-grid { grid-template-columns: 1fr 1fr; } .bankreco-file { grid-column: 1 / -1; } }
@media print {
  body.printing-bankreco .sidebar, body.printing-bankreco .topbar, body.printing-bankreco #bankreco-form,
  body.printing-bankreco #bankreco-actions, body.printing-bankreco .toast { display: none !important; }
  body.printing-bankreco .bankreco-matched:not([open]) { display: none; }
}
/* Validation des écarts banque */
.bankreview-progress { display: flex; align-items: center; gap: 14px; margin: 0 0 14px; font-size: 12px; color: #737d90; }
.bankreview-progress .bar { flex: 1; height: 8px; border-radius: 99px; background: #edf0f5; overflow: hidden; }
.bankreview-progress .bar span { display: block; height: 100%; background: #2f9e6b; }
.bankreview-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 22px; border-bottom: 1px solid var(--line); font-size: 12px; }
.bankreview-table td { vertical-align: top; }
.bankreview-table .note-input { width: 100%; min-width: 150px; }
.bankreview-table .row-actions { display: flex; gap: 4px; white-space: nowrap; }
.bankreview-table tr.status-validated td { background: #f3fbf6; }
.bankreview-table tr.status-ignored td { color: #9aa2b1; }
.badge.review-todo { background: #fff4e5; color: #b0611a; }
.badge.review-validated { background: #e6f6ee; color: #2f7d55; }
.badge.review-ignored { background: #eef0f4; color: #737d90; }
.badge.review-fee { background: #eef3ff; color: #3d5aa8; }
.bankreview-table tr.status-fee td { color: #6c7a99; }
/* Trésorerie : sous-menus Chèques / Traites / Virements, factures réglées par un document */
.nav-subsublink { margin-left: 14px; min-height: 26px; font-size: 11.5px; }
.treasury-invoices { margin-top: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfd; }
.treasury-invoices h3 { margin: 0 0 6px; font-size: 12.5px; }
.treasury-invoices table { width: 100%; font-size: 12px; }
.treasury-invoices td, .treasury-invoices th { padding: 5px 6px; }

.treasury-invoices p { margin: 0 0 8px; font-size: 11.5px; }

/* Téléphone (Android, iPhone) : menu complet dans un tiroir à gauche (bouton ☰) et raccourcis en bas de l'écran */
.menu-button, .drawer-close, .drawer-backdrop, .mobile-tabbar { display: none; }
@media (max-width: 700px) {
  .sidebar { position: fixed; z-index: 60; top: 0; left: 0; bottom: 0; width: min(86vw, 320px); height: 100vh; height: 100dvh;
             padding: 16px 14px 0; flex-direction: column; align-items: stretch; justify-content: flex-start; background: #fff;
             border-right: 1px solid #edf0f5; border-bottom: 0; box-shadow: 0 0 40px #20283a40; transform: translateX(-105%);
             transition: transform .22s ease, visibility .22s; overflow: hidden; visibility: hidden; }
  body.nav-open .sidebar { transform: none; visibility: visible; }
  body.nav-open { overflow: hidden; }
  .sidebar .brand { display: flex; }
  .sidebar .nav-caption { margin: 18px 9px 8px; }
  .sidebar-bottom { display: none; }
  .sidebar nav { display: grid; gap: 2px; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; align-content: start;
                 grid-auto-rows: max-content; margin: 0 -6px; padding: 0 6px 28px; }
  .sidebar .nav-link { min-height: 46px; gap: 12px; padding: 0 12px; font-size: 14px; }
  .sidebar .nav-link > span:first-child { font-size: 18px; }
  .sidebar .nav-sublink { min-height: 40px; font-size: 13px; }
  .sidebar .nav-subsublink { min-height: 36px; font-size: 12.5px; }
  .sidebar .nav-count { display: inline; }
  .nav-sub { display: grid; }
  .nav-sub.collapsed { display: none; }
  .nav-toggle { display: inline-flex; width: 38px; height: 38px; font-size: 15px; }
  .drawer-close { display: grid; place-items: center; position: absolute; top: 14px; right: 12px; width: 40px; height: 40px;
                  border: 0; border-radius: 10px; background: #f3f4f8; color: #4a5468; font-size: 22px; }
  body.nav-open .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: #1d243366; }
  .menu-button { display: grid; place-items: center; flex: none; width: 42px; height: 42px; margin: 0 2px 0 -8px; border: 0;
                 border-radius: 10px; background: none; color: #293244; font-size: 23px; }
  .menu-button:active, .drawer-close:active { background: #ecebfb; }
  .topbar { position: sticky; top: 0; z-index: 40; background: #fff; border-bottom: 1px solid #edf0f5; }
  .main { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .mobile-tabbar { display: flex; gap: 2px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
                   padding: 5px 6px calc(5px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid #edf0f5;
                   box-shadow: 0 -4px 18px #20283a14; }
  .mobile-tabbar .tabbar-link { display: flex; flex: 1 1 0; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
                                min-width: 0; min-height: 54px; padding: 0; border: 0; border-radius: 12px; background: none; color: #737d90;
                                font: 700 11px "DM Sans", sans-serif; text-decoration: none; }
  .mobile-tabbar .tabbar-link > span:first-child { width: auto; font-size: 20px; line-height: 1; }
  .mobile-tabbar .tabbar-link.active { background: #f0efff; color: #5c4cdb; }
  .mobile-tabbar .tabbar-link.hidden { display: none; }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
}


/* Téléphone : textes lisibles, en-têtes empilés, filtres pleine largeur, fenêtres plein écran */
@media (max-width: 700px) {
  html, body { overflow-x: clip; }
  body { -webkit-text-size-adjust: 100%; }
  .page-content { padding: 18px 14px 28px; }
  h1 { font-size: 22px; }
  .eyebrow { font-size: 10.5px; }
  .subheading { max-width: none; font-size: 12.5px; line-height: 1.5; }
  .page-heading { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 16px; }
  .page-heading > div:not(:first-child), .page-heading .quote-actions { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 8px; }
  .page-heading .button { flex: 1 1 auto; min-height: 42px; padding: 0 14px; font-size: 13px; }
  .page-heading .select-label { flex: 1 1 150px; }
  .page-heading .select-label select { width: 100%; }
  .button { min-height: 42px; font-size: 13px; }
  .button-small { min-height: 36px; font-size: 12px; }
  .topbar #logout { min-height: 34px; padding: 0 10px; font-size: 12px; }
  .today { display: none; }
  .stat-grid, .stat-grid.three { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-grid.three > :first-child { grid-column: 1 / -1; }
  .stat-card { min-height: 0; padding: 14px; }
  .stat-label { font-size: 11.5px; }
  .stat-value { font-size: clamp(17px, 5.4vw, 22px); }
  .stat-foot { font-size: 10.5px; line-height: 1.4; }
  .client-filters { flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px 14px; padding: 0 14px 4px; scrollbar-width: none; }
  .client-filters::-webkit-scrollbar { display: none; }
  .filter-chip { flex: none; padding: 8px 13px; font-size: 12.5px; white-space: nowrap; }
  .filters { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px; }
  .filters > * { max-width: 100%; }
  .search-box { width: 100%; height: 44px; }
  .search-box input { font-size: 15px; }
  .select-label select { width: 100%; height: 44px; font-size: 14px; }
  .form-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .form-field select, .form-field textarea { min-height: 44px; font-size: 15px; }
  .quick-input { font-size: 14px; min-height: 38px; }
  th { padding: 10px 12px; font-size: 10px; }
  td { padding: 12px; font-size: 12.5px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .panel-heading h2 { font-size: 15px; }
  .panel-heading p { font-size: 12px; }
  .pagination { flex-wrap: wrap; gap: 8px; padding: 12px 14px; font-size: 12px; }
  .modal { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
           border: 0; border-radius: 0; }
  .modal-heading { margin-bottom: 16px; }
  .modal-heading h2 { font-size: 19px; }
  .modal-heading .icon-button { flex: none; width: 40px; height: 40px; }
  .modal-actions { position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); z-index: 2; flex-wrap: wrap; margin: 14px -16px 0;
                   padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid #edf0f5; }
  .modal-actions .button { flex: 1 1 auto; }
  .followup-grid { grid-template-columns: 1fr; }
}
/* Trésorerie : règlements en double */
.treasury-dups-modal { width: min(980px, calc(100vw - 28px)); }
.dups-group { margin-top: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fcfcfe; }
.dups-group h3 { margin: 0 0 8px; font-size: 13px; }
.dups-group .row-actions { display: flex; gap: 4px; white-space: nowrap; }
.dups-ok { margin: 6px 0; padding: 12px 14px; border-radius: 8px; background: #e8f7f0; color: #2f7d55; font-size: 13px; }
.pill-warn { background: #fff0e0; color: #b0611a; }
/* Tri des tableaux (clic sur un en-tête, comme dans l'Explorateur Windows) */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: #5c4cdb; background: #f4f3ff; }
th.sortable:focus-visible { outline: 2px solid #b9b2f2; outline-offset: -2px; }
th.sortable::after { content: "⇅"; display: inline-block; margin-left: 5px; font-size: 9px; color: #c3c8d4; vertical-align: 1px; }
th.sortable[data-sorted="asc"]::after { content: "▲"; color: #5c4cdb; }
th.sortable[data-sorted="desc"]::after { content: "▼"; color: #5c4cdb; }
th.sortable[data-sorted] { color: #5c4cdb; }
/* Case « Avec cachet » à côté des boutons Imprimer / PDF */
.stamp-choice { display: inline-flex; align-items: center; gap: 6px; padding: 0 6px; color: #59627a; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.stamp-choice input { width: 16px; height: 16px; accent-color: #6c5ce7; }
/* Boutons de filtre déplaçables par glisser-déposer */
.client-filters > .filter-chip[draggable="true"] { cursor: grab; }
.client-filters > .filter-chip.chip-dragging { opacity: .45; cursor: grabbing; outline: 2px dashed #b9b2f2; }
/* Administration : rubriques repliables (+ / −) */
.panel-heading-toggle h2 { cursor: pointer; }
.panel-toggle { display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; margin-left: 10px; border: 1px solid #e1e4ec;
                border-radius: 8px; background: #fff; color: #5c4cdb; font-size: 20px; font-weight: 700; line-height: 1; cursor: pointer; }
.panel-toggle:hover { background: #f0efff; border-color: #c9c3f5; }
.panel.panel-collapsed > :not(.panel-heading) { display: none !important; }
.panel.panel-collapsed > .panel-heading { border-bottom: 0; }
/* Utilisateurs : période d'accès */
.user-period { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 8px; font-size: 12px; }
.user-period label { display: inline-flex; align-items: center; gap: 6px; }
.user-period input[type="date"] { width: auto; min-width: 140px; }
.danger-text { color: #c0392b !important; }
.audit-filters { margin: 12px 22px 0; }
.audit-retention { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 12px 22px 0; font-size: 12px; }
.audit-retention label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.audit-retention input { width: 80px; }
.rate-input { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.rate-input input { width: 76px; text-align: right; }
.bankreco-card-actions { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; }
.print-frame { position: fixed; right: 0; bottom: 0; width: 0; height: 0; border: 0; visibility: hidden; }


/* Export TEJ */
#tej-form > p.muted { font-size: 12px; line-height: 1.5; margin: 6px 0 12px; }
#tej-form .form-field input { min-width: 0; height: 37px; padding: 0 10px; border: 1px solid #e8ebf1; border-radius: 6px; outline: 0; background: white; color: #505a6b; font-size: 11px; }
#tej-form .form-field input:focus { border-color: #a69bee; }
@media (max-width: 700px) { #tej-form .form-field input { height: 44px; font-size: 15px; } }

/* Agenda des licences : calendrier mensuel des dates d'expiration. */
.license-calendar-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.license-calendar-head h2 { margin: 0 6px; min-width: 150px; font-size: 16px; text-align: center; }
.license-legend { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.license-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-left: 8px; }
.license-dot.scheduled, .license-event.scheduled, .license-event.sending { --license-color: #5f83cb; }
.license-dot.sent, .license-event.sent { --license-color: #279a6c; }
.license-dot.error, .license-event.error { --license-color: #c35f5f; }
.license-dot { background: var(--license-color); }
.license-calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.license-weekday { padding: 6px 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fafbfd; }
.license-day { min-height: 92px; padding: 5px; display: flex; flex-direction: column; gap: 3px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.license-day.other-month { background: #fafbfd; }
.license-day.other-month .license-day-number { color: #c3c8d2; }
.license-day-number { font-size: 12px; font-weight: 700; color: #4a5365; align-self: flex-end; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; }
.license-day.today .license-day-number { background: var(--purple); color: #fff; }
.license-event { display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--license-color); border-radius: 5px; padding: 3px 6px; background: color-mix(in srgb, var(--license-color) 10%, #fff); font-size: 11px; line-height: 1.3; color: #20283a; }
.license-event strong, .license-event span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.license-event span { color: #5d6678; }
.license-event:hover { background: color-mix(in srgb, var(--license-color) 18%, #fff); }
.license-months { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 10px; font-size: 12px; }
@media (max-width: 700px) {
  .license-day { min-height: 58px; padding: 3px; }
  .license-event span { display: none; }
  .license-legend { margin-left: 0; }
}
.license-dot.none, .license-event.none { --license-color: #9aa2b1; }
.license-filters { align-items: center; padding: 0 0 12px; }
.license-filters .search-box { min-width: 280px; }
.license-import-table { max-height: 320px; overflow: auto; margin-bottom: 8px; }
