/* GREEN DIAMONDS — feuille de style (inspirée de la mise en page TOUTICI, déclinée en vert pépinière) */
:root {
  --bg: #f2f5f3;
  --surface: #ffffff;
  --line: #e3e9e5;
  --text: #33413a;
  --head: #183b2a;
  --muted: #8a9a91;
  --primary: #1f7a4d;
  --primary-d: #176140;
  --primary-l: #e5f3eb;
  --green: #5fae3c;
  --green-d: #4e962f;
  --gold: #d4a72c;
  --gold-d: #bf9320;
  --blue: #3b9fc4;
  --orange: #e8693f;
  --purple: #6b63d6;
  --ok: #2f9a52;
  --ko: #d9472b;
  --warn: #d48a12;
  --radius: 14px;
  --shadow: 0 6px 18px rgba(24, 59, 42, .07);
  --sidebar-w: 248px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.45; font-size: 14px; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { color: var(--head); margin: 0 0 .6em; line-height: 1.25; }
h2 { font-size: 20px; } h3 { font-size: 16px; } h4 { font-size: 14px; }
input, select, textarea, button { font: inherit; color: inherit; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: 12px; } .ko { color: var(--ko); } .ok { color: var(--ok); } .warn { color: var(--warn); }
.pre { white-space: pre-line; } .nowrap { white-space: nowrap; } .grow { flex: 1; } .right { text-align: right; } .center { text-align: center; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .hidden { display: none !important; }
.link { color: var(--primary); font-weight: 600; cursor: pointer; } .link:hover { text-decoration: underline; }
.mono { font-family: Consolas, "Courier New", monospace; }

/* ----- authentification */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #d9f0e2, transparent 50%), linear-gradient(135deg, #e4f1e9, #f2f5f3); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px 28px; box-shadow: var(--shadow); text-align: center; }
.auth-card .left { text-align: left; }
.auth-logo { font-weight: 800; letter-spacing: 2px; color: var(--head); font-size: 22px; }
.auth-sub { color: var(--muted); font-size: 12px; margin-bottom: 18px; }
.auth-card h1 { font-size: 17px; margin: 0 0 14px; font-weight: 600; }
.auth-card label { display: block; text-align: left; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.auth-card label.chk { color: var(--text); font-size: 13px; display: flex; gap: 8px; align-items: flex-start; margin: 14px 0; }
.auth-card input:not([type=checkbox]) { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.auth-card .btn-block { margin-top: 18px; }
.gem { color: var(--green); }
.boot-error { padding: 40px; color: var(--ko); }

/* ----- boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 10px; padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: 13px; background: #eef2ef; color: var(--text); transition: background .15s, transform .05s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; } .btn-primary:hover { background: var(--primary-d); }
.btn-green { background: var(--green); color: #fff; } .btn-green:hover { background: var(--green-d); }
.btn-gold { background: var(--gold); color: #fff; } .btn-gold:hover { background: var(--gold-d); }
.btn-danger { background: var(--ko); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--line); } .btn-ghost:hover { background: #f4f7f5; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 13px 20px; font-size: 16px; }
.btn-block { width: 100%; }
.icon-btn { border: 0; background: transparent; cursor: pointer; padding: 6px 8px; border-radius: 8px; font-size: 16px; color: var(--muted); }
.icon-btn:hover { background: #eef2ef; color: var(--text); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ----- structure */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 30; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.brand .gem { font-size: 26px; }
.brand-logo { width: 38px; height: 38px; object-fit: contain; border-radius: 8px; }
.company-name { font-weight: 800; letter-spacing: 1px; color: var(--head); font-size: 15px; }
.brand-sub { font-size: 11px; color: var(--muted); }
.nav { flex: 1; overflow-y: auto; padding: 10px 10px 20px; }
.nav a, .grp-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 10px; color: var(--text); font-weight: 500; border: 0; background: none; cursor: pointer; text-align: left; }
.nav a:hover, .grp-btn:hover { background: #f1f6f3; }
.nav a.active { background: var(--primary-l); color: var(--primary); font-weight: 700; }
.nav a.accent { background: linear-gradient(135deg, #2c8f5c, #1f7a4d); color: #fff; margin: 4px 0 8px; box-shadow: 0 4px 12px rgba(31, 122, 77, .25); }
.nav a.accent .ico { stroke: #fff; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; opacity: .85; }
.grp .chev { margin-left: auto; font-style: normal; transition: transform .2s; color: var(--muted); }
.grp.open .chev { transform: rotate(90deg); }
.submenu { display: none; padding: 2px 0 6px 28px; }
.grp.open .submenu { display: block; }
.submenu a { padding: 6px 12px; font-size: 13px; }
.side-foot { border-top: 1px solid var(--line); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.whoami-link { display: flex; flex-direction: column; } .whoami-link b { color: var(--head); }
.role-badge { font-size: 11px; color: var(--primary); }
.logout { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px; cursor: pointer; color: var(--muted); }
.logout:hover { color: var(--ko); border-color: var(--ko); }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 12px 24px; background: rgba(255, 255, 255, .85); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.breadcrumb { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; min-width: 0; overflow: hidden; white-space: nowrap; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb b { color: var(--head); font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.gsearch { margin-left: auto; position: relative; width: min(380px, 40vw); }
.gsearch input { width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f6f8f7; }
.menu-btn { display: none; }
.content { padding: 22px 24px 60px; max-width: 1500px; width: 100%; }
.backdrop { display: none; }

/* ----- panneaux, cartes */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.panel-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2, .panel-head h3 { margin: 0; }
.panel-head .actions { margin-left: auto; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h2 { margin: 0; }
.page-head .actions { margin-left: auto; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-21 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { border-radius: var(--radius); padding: 16px 18px; color: #fff; box-shadow: var(--shadow); min-height: 96px; position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; right: -24px; top: -24px; width: 90px; height: 90px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.stat-l { font-size: 12px; opacity: .92; display: flex; gap: 6px; align-items: center; }
.stat-v { font-size: 22px; font-weight: 800; margin-top: 4px; letter-spacing: .3px; }
.stat-s { font-size: 12px; opacity: .9; margin-top: 2px; }
.g-green { background: linear-gradient(135deg, #43a364, #1f7a4d); }
.g-gold { background: linear-gradient(135deg, #e6bd45, #c6941f); }
.g-blue { background: linear-gradient(135deg, #5bbcd1, #2f86b5); }
.g-teal { background: linear-gradient(135deg, #3cb8a2, #17806f); }
.g-gray { background: linear-gradient(135deg, #8e9ca5, #5d6b74); }
.g-orange { background: linear-gradient(135deg, #f08a5d, #d9572f); }
.g-purple { background: linear-gradient(135deg, #8d86e8, #5a52c8); }
.g-red { background: linear-gradient(135deg, #e86a5a, #c0392b); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; }
.mini-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.mini { background: #f6f9f7; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; min-width: 120px; }
.mini small { display: block; color: var(--muted); font-size: 11px; }
.mini b { font-size: 15px; color: var(--head); }
.alert { border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; border: 1px solid; }
.alert-warn { background: #fff8e6; border-color: #f2d58c; color: #7a5a06; }
.alert-ko { background: #fdecea; border-color: #f3b4aa; color: #8c2615; }
.alert-ok { background: #e9f7ee; border-color: #a9dcbc; color: #1d6b3c; }
.alert-info { background: #e8f4fa; border-color: #b0d9ec; color: #1d5c78; }

/* ----- onglets */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.tabs a { padding: 9px 14px; border-radius: 10px 10px 0 0; color: var(--muted); font-weight: 600; white-space: nowrap; margin-bottom: -2px; border-bottom: 2px solid transparent; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ----- tableaux */
.table-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.search { padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; min-width: 240px; background: #fff; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th { background: #f5f8f6; text-align: left; font-size: 12px; color: #5f7068; font-weight: 700; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.table th.sortable { cursor: pointer; user-select: none; }
.table td { padding: 8px 10px; border-bottom: 1px solid #eef2ef; vertical-align: middle; }
.table.compact td { padding: 5px 8px; }
.table tbody tr:hover { background: #f8fbf9; }
.table tr.clickable { cursor: pointer; }
.table tfoot td { font-weight: 800; background: #f5f8f6; border-top: 2px solid var(--line); }
.table .a-r { text-align: right; white-space: nowrap; } .table .a-c { text-align: center; }
.table td.empty { text-align: center; color: var(--muted); padding: 30px; }
.table tr.row-ko td { background: #fff5f3; } .table tr.row-warn td { background: #fffaf0; } .table tr.row-mute td { color: var(--muted); text-decoration: line-through; }
.table input { width: 100%; padding: 5px 7px; border: 1px solid var(--line); border-radius: 7px; }
.table input.num { text-align: right; }
.pager { display: flex; gap: 10px; justify-content: center; align-items: center; margin-top: 10px; color: var(--muted); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.b-ok { background: #e3f5e9; color: #1f7a42; } .b-ko { background: #fde7e3; color: #b13a22; } .b-warn { background: #fff1d6; color: #9a6608; }
.b-info { background: #e1f1f8; color: #236b8c; } .b-mute { background: #eceff1; color: #6d7a80; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 11px; background: #eef4f0; color: #3c5a4a; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* ----- formulaires */
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 12px; color: #5f7068; font-weight: 600; }
.field input, .field select, .field textarea, .filters input, .filters select, .inp { padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; width: 100%; min-width: 0; }
.field input:focus, .field select:focus, .field textarea:focus, .search:focus, .inp:focus, .table input:focus { outline: 2px solid #b9e2c9; border-color: var(--primary); }
.field.full, .grid-form .full { grid-column: 1 / -1; }
.req { color: var(--ko); margin-left: 2px; }
.chk { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--primary); }
.form-section { grid-column: 1 / -1; margin: 8px 0 0; padding-top: 10px; border-top: 1px dashed var(--line); color: var(--primary); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.filters label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.filters input, .filters select { width: auto; min-width: 140px; }
.filters .quick { display: flex; gap: 4px; flex-wrap: wrap; }

/* ----- modales */
.modal-wrap { position: fixed; inset: 0; background: rgba(15, 35, 25, .45); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: 16px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.modal.wide { width: min(900px, 100%); }
.modal.xl { width: min(1200px, 100%); }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; flex: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { padding: 11px 16px; border-radius: 10px; color: #fff; box-shadow: var(--shadow); max-width: 420px; transition: opacity .4s, transform .4s; font-weight: 500; }
.toast.out { opacity: 0; transform: translateY(8px); }
.t-ok { background: #1f7a4d; } .t-ko { background: #c0392b; } .t-warn { background: #c88a0e; } .t-info { background: #2f86b5; }

/* ----- auto-complétion */
.ac-box { position: absolute; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 340px; overflow-y: auto; z-index: 50; margin-top: 4px; min-width: 320px; }
.ac-item { display: flex; gap: 6px; align-items: center; padding: 8px 12px; cursor: pointer; border-bottom: 1px solid #f0f3f1; font-size: 13px; }
.ac-item:hover, .ac-item.on { background: var(--primary-l); }
.ac-right { margin-left: auto; white-space: nowrap; color: var(--muted); font-size: 12px; }

/* ----- graphiques */
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #e7ece9; stroke-width: 1; }
.chart .ax { font-size: 11px; fill: #8a9a91; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i, .donut-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.donut-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.donut { border-radius: 50%; display: grid; place-items: center; position: relative; flex: none; }
.donut::before { content: ""; position: absolute; inset: 22%; background: #fff; border-radius: 50%; }
.donut span { position: relative; font-weight: 800; color: var(--head); }
.donut-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 200px; font-size: 12px; }
.donut-legend li { display: grid; grid-template-columns: 16px 1fr auto 52px; gap: 6px; padding: 3px 0; align-items: center; }
.donut-legend em { color: var(--muted); font-style: normal; text-align: right; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 1fr) 2fr auto; gap: 10px; align-items: center; padding: 4px 0; font-size: 13px; }
.bar { height: 10px; background: #eef2ef; border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--green); border-radius: 6px; }

/* ----- caisse enregistreuse (POS) */
.page-pos { max-width: none; padding: 14px 16px 30px; }
.pos-grid { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 14px; align-items: start; }
.pos-main { min-width: 0; }
.pos-search { display: flex; gap: 8px; margin-bottom: 10px; position: relative; }
.pos-search input { flex: 1; padding: 12px 14px; font-size: 15px; border: 2px solid var(--line); border-radius: 12px; }
.pos-search input:focus { border-color: var(--primary); outline: none; }
.pos-fams { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
.pos-fams button { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 6px 12px; cursor: pointer; white-space: nowrap; font-size: 12px; font-weight: 600; }
.pos-fams button.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.pos-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; align-content: start; }
@media (min-width: 961px) { .pos-items { max-height: calc(100vh - 200px); overflow-y: auto; padding-right: 4px; } }
.pos-item { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 11px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; min-height: 104px; border-left: 4px solid var(--c, var(--green)); transition: box-shadow .15s, transform .05s; text-align: left; }
.pos-item:hover { box-shadow: var(--shadow); }
.pos-item:active { transform: scale(.98); }
.pos-item .nm { font-weight: 700; font-size: 12.5px; color: var(--head); line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pos-item .sz { font-size: 11px; color: var(--muted); }
.pos-item .pr { margin-top: auto; display: flex; justify-content: space-between; align-items: baseline; }
.pos-item .pr b { color: var(--primary); font-size: 14px; }
.pos-item .pr span { font-size: 11px; color: var(--muted); }
.pos-item.out .pr span { color: var(--ko); font-weight: 700; }
.pos-side { position: sticky; top: 70px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; max-height: calc(100vh - 90px); }
.pos-side-head { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.pos-cart { flex: 1; overflow-y: auto; padding: 4px 8px; min-height: 160px; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; padding: 8px 6px; border-bottom: 1px solid #f0f3f1; }
.cart-line .ln { font-weight: 600; font-size: 13px; line-height: 1.25; }
.cart-line .ln small { display: block; color: var(--muted); font-weight: 400; }
.cart-line .lt { font-weight: 800; text-align: right; white-space: nowrap; }
.cart-line .ctrl { grid-column: 1 / -1; display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.cart-line .ctrl input { width: 54px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 7px; text-align: right; }
.cart-line .ctrl input.px { width: 88px; }
.pos-cart { overflow-x: hidden; }
.qbtn { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: #f6f8f7; cursor: pointer; font-weight: 800; }
.pos-total { padding: 12px 14px; border-top: 1px solid var(--line); background: #f8fbf9; border-radius: 0 0 var(--radius) var(--radius); }
.pos-total .row { display: flex; justify-content: space-between; padding: 2px 0; }
.pos-total .big { font-size: 26px; font-weight: 900; color: var(--primary); }
.pos-empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.pay-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.pay-mode { border: 2px solid var(--line); border-radius: 12px; padding: 12px 8px; cursor: pointer; text-align: center; font-weight: 700; background: #fff; }
.pay-mode.on { border-color: var(--primary); background: var(--primary-l); color: var(--primary); }
.keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.keypad button { padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: #f8faf9; cursor: pointer; font-weight: 700; }
.rendu { font-size: 20px; font-weight: 900; }

/* ----- documents */
.doc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.doc-preview { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 32px; max-width: 900px; }
.lines-table td { vertical-align: top; }
.lines-table td:nth-child(2) input { min-width: 220px; }
.lines-table .ac-cell { position: relative; }
.totals-box { margin-left: auto; width: min(360px, 100%); }
.totals-box .row { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.totals-box .row.tot { font-size: 18px; font-weight: 900; color: var(--primary); border-bottom: 0; }
.care { background: #f3faf5; border: 1px solid #cfe9d8; border-radius: 10px; padding: 10px 12px; font-size: 12px; }
.billets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.billets label { display: flex; align-items: center; gap: 6px; background: #f6f9f7; border: 1px solid var(--line); border-radius: 9px; padding: 6px 8px; font-weight: 600; }
.billets input { width: 64px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; text-align: right; margin-left: auto; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 6px 0 6px 14px; border-left: 2px solid var(--line); position: relative; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 11px; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }

/* ----- impression */
#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block; color: #000; font-size: 12px; }
  body { background: #fff; }
}
.doc { font-family: "Segoe UI", Arial, sans-serif; color: #111; font-size: 12px; }
.doc-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; border-bottom: 3px solid #1f7a4d; padding-bottom: 12px; margin-bottom: 16px; }
.doc-soc { display: flex; gap: 12px; align-items: flex-start; }
.doc-logo-img { max-width: 90px; max-height: 70px; object-fit: contain; }
.doc-soc h1 { font-size: 20px; margin: 0; color: #1f7a4d; letter-spacing: 1px; }
.doc-activite { color: #555; font-size: 11px; }
.doc-meta { text-align: right; }
.doc-meta h2 { font-size: 20px; margin: 0 0 4px; color: #183b2a; text-transform: uppercase; letter-spacing: 1px; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 14px; }
.doc-box { border: 1px solid #cfd8d3; border-radius: 8px; padding: 8px 10px; }
.doc-box h4 { margin: 0 0 4px; font-size: 10px; text-transform: uppercase; color: #1f7a4d; letter-spacing: .5px; }
.doc table.dt { width: 100%; border-collapse: collapse; margin: 8px 0; }
.doc table.dt th { background: #1f7a4d; color: #fff; padding: 6px; font-size: 11px; text-align: left; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc table.dt td { padding: 5px 6px; border-bottom: 1px solid #dde3df; }
.doc table.dt .r { text-align: right; white-space: nowrap; } .doc table.dt .c { text-align: center; }
.doc .tot-table { margin-left: auto; width: 300px; border-collapse: collapse; }
.doc .tot-table td { padding: 4px 8px; border-bottom: 1px solid #e1e6e3; }
.doc .tot-table tr.grand td { font-size: 15px; font-weight: 900; background: #e5f3eb; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc .lettres { margin: 12px 0; font-style: italic; }
.doc-foot { margin-top: 18px; border-top: 1px solid #cfd8d3; padding-top: 8px; font-size: 10px; color: #555; text-align: center; }
.doc-legal { font-size: 10px; color: #555; }
.signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 26px; }
.signatures div { border-top: 1px solid #999; padding-top: 4px; text-align: center; font-size: 11px; min-height: 60px; }
.doc .care-print { margin-top: 10px; border: 1px dashed #8fc5a3; border-radius: 6px; padding: 6px 8px; font-size: 10.5px; }
.doc .care-print b { color: #1f7a4d; }
.stamp { display: inline-block; border: 2px solid; padding: 2px 10px; border-radius: 6px; font-weight: 800; transform: rotate(-4deg); }
.ticket { font-family: "Consolas", "Courier New", monospace; font-size: 11px; color: #000; }
.ticket .c { text-align: center; } .ticket .r { text-align: right; }
.ticket h1 { font-size: 15px; margin: 0; text-align: center; }
.ticket hr { border: 0; border-top: 1px dashed #000; margin: 5px 0; }
.ticket table { width: 100%; border-collapse: collapse; }
.ticket td { vertical-align: top; padding: 1px 0; }
.ticket .big { font-size: 15px; font-weight: 900; }

/* ----- responsive */
.doc-preview { overflow-x: auto; }
@media (max-width: 1180px) {
  .pos-grid { grid-template-columns: minmax(0, 1fr) 360px; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-21 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .3); z-index: 25; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-block; }
  .grid-2, .grid-21, .grid-3 { grid-template-columns: 1fr; }
  .pos-grid { grid-template-columns: 1fr; }
  .pos-side { position: static; max-height: none; order: -1; }
  .pos-cart { min-height: 0; max-height: 40vh; }
  .pos-empty { padding: 14px 10px; }
  .pos-items { max-height: 62vh; overflow-y: auto; }
  .hide-sm { display: none !important; }
}
@media (max-width: 640px) {
  .content { padding: 14px 12px 50px; }
  .topbar { padding: 10px 12px; gap: 8px; }
  .breadcrumb { display: none; }
  .gsearch { width: 100%; }
  .grid-form { grid-template-columns: 1fr; }
  .search { min-width: 0; width: 100%; }
  .stat-v { font-size: 19px; }
  .doc-preview { padding: 14px; }
  .doc-parties { grid-template-columns: 1fr; }
}
