/* SMART SHOP MANAGER — identité visuelle
   Indigo nuit + safran. Archivo (variable, largeur 62–125 %) ; IBM Plex Mono réservé aux codes (IMEI, identifiants). */

@font-face {
  font-family: "Archivo";
  font-style: normal; font-display: swap;
  font-weight: 100 900; font-stretch: 62% 125%;
  src: url("../fonts/archivo-latin-standard-normal.de2f1fe81758.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal; font-display: swap;
  font-weight: 100 900; font-stretch: 62% 125%;
  src: url("../fonts/archivo-latin-ext-standard-normal.589f7bc0fac4.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
/* Arabe : IBM Plex Sans Arabic, utilisé automatiquement pour les caractères arabes (unicode-range) */
@font-face { font-family: "Plex Arabic"; font-style: normal; font-display: swap; font-weight: 400; src: url("../fonts/ibm-plex-sans-arabic-arabic-400-normal.4fa3d81d41ab.woff2") format("woff2"); unicode-range: U+0600-06FF,U+0750-077F,U+0870-08FF,U+200C-200E,U+2010-2011,U+FB50-FDFF,U+FE70-FEFC; }
@font-face { font-family: "Plex Arabic"; font-style: normal; font-display: swap; font-weight: 500; src: url("../fonts/ibm-plex-sans-arabic-arabic-500-normal.106892212ea7.woff2") format("woff2"); unicode-range: U+0600-06FF,U+0750-077F,U+0870-08FF,U+200C-200E,U+2010-2011,U+FB50-FDFF,U+FE70-FEFC; }
@font-face { font-family: "Plex Arabic"; font-style: normal; font-display: swap; font-weight: 600; src: url("../fonts/ibm-plex-sans-arabic-arabic-600-normal.64891a810259.woff2") format("woff2"); unicode-range: U+0600-06FF,U+0750-077F,U+0870-08FF,U+200C-200E,U+2010-2011,U+FB50-FDFF,U+FE70-FEFC; }
@font-face { font-family: "Plex Arabic"; font-style: normal; font-display: swap; font-weight: 700 900; src: url("../fonts/ibm-plex-sans-arabic-arabic-700-normal.a4390abc98c2.woff2") format("woff2"); unicode-range: U+0600-06FF,U+0750-077F,U+0870-08FF,U+200C-200E,U+2010-2011,U+FB50-FDFF,U+FE70-FEFC; }
@font-face {
  font-family: "Plex Mono";
  font-style: normal; font-display: swap; font-weight: 500;
  src: url("../fonts/ibm-plex-mono-latin-500-normal.b1c8a895f5fd.woff2") format("woff2");
}

:root {
  --indigo-nuit: #1b2350;
  --indigo-nuit-2: #252f66;
  --indigo: #3442a8;
  --indigo-clair: #e7e9f7;
  --safran: #f2b33d;
  --safran-fonce: #b97c0d;
  --fond: #f3f4f8;
  --surface: #ffffff;
  --encre: #1a1d29;
  --encre-2: #4a5068;
  --encre-3: #7c8299;
  --trait: #e1e4ee;
  --vert: #1f8a5b;
  --rouge: #c2413a;

  --bs-body-font-family: "Archivo", "Plex Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-body-font-size: .9375rem;
  --bs-body-color: var(--encre);
  --bs-body-bg: var(--fond);
  --bs-primary: var(--indigo);
  --bs-primary-rgb: 52, 66, 168;
  --bs-success-rgb: 31, 138, 91;
  --bs-danger-rgb: 194, 65, 58;
  --bs-warning-rgb: 242, 179, 61;
  --bs-link-color: var(--indigo);
  --bs-link-color-rgb: 52, 66, 168;
  --bs-link-hover-color: var(--indigo-nuit);
  --bs-border-color: var(--trait);
  --bs-border-radius: .375rem;
  --bs-secondary-color: var(--encre-3);
  --bs-focus-ring-color: rgba(52, 66, 168, .28);
}

body { font-feature-settings: "tnum" 1, "lnum" 1; -webkit-font-smoothing: antialiased; letter-spacing: -.003em; }
h1, h2, h3, h4, h5, h6, .h4, .h5, .h6 { font-stretch: 112%; font-weight: 700; letter-spacing: -.012em; color: var(--encre); }
a { text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
.code, code, .font-monospace { font-family: "Plex Mono", ui-monospace, Consolas, monospace; font-size: .92em; color: var(--indigo-nuit); }
.text-secondary { color: var(--encre-3) !important; }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------------ structure */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--indigo-nuit) 248px, var(--fond) 248px); }
[dir="rtl"] .app { background: linear-gradient(to left, var(--indigo-nuit) 248px, var(--fond) 248px); }
.sidebar {
  background: var(--indigo-nuit); color: #c9cfea;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; padding: 18px 12px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; }
.brand:hover { text-decoration: none; color: #fff; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--safran); color: var(--indigo-nuit);
  display: grid; place-items: center; font-size: 1.05rem; flex: none;
}
.brand-name { font-stretch: 118%; font-weight: 800; font-size: 1.02rem; line-height: 1.05; letter-spacing: -.01em; }
.brand-name small { display: block; font-stretch: 100%; font-weight: 500; font-size: .72rem; color: #9aa3cf; letter-spacing: 0; }

.nav-group { margin-top: 14px; }
.nav-group-title { font-size: .76rem; color: #8790c2; padding: 0 10px 4px; font-weight: 500; }
.sidebar .nav-link {
  display: flex; align-items: center; gap: 10px; width: 100%;
  color: #c9cfea; padding: 7px 10px; border-radius: 7px; font-size: .9rem; position: relative;
  background: none; border: 0; text-align: start;
}
.sidebar .nav-link i { font-size: 1rem; width: 18px; color: #8f98cc; }
.sidebar .nav-link:hover { background: var(--indigo-nuit-2); color: #fff; text-decoration: none; }
.sidebar .nav-link:hover i { color: #fff; }
.sidebar .nav-link.active { background: var(--indigo-nuit-2); color: #fff; font-weight: 600; }
.sidebar .nav-link.active::before {
  content: ""; position: absolute; inset-inline-start: -12px; top: 7px; bottom: 7px; width: 4px; border-start-end-radius: 3px; border-end-end-radius: 3px; background: var(--safran);
}
.sidebar .nav-link.active i { color: var(--safran); }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; color: #fff; font-size: .88rem; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--indigo); color: #fff; font-weight: 700;
  display: grid; place-items: center; font-size: .8rem; text-transform: uppercase; flex: none;
}
.sidebar-user small { display: block; color: #8790c2; font-size: .75rem; }

.main { min-width: 0; padding: 26px 32px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 1.65rem; font-stretch: 118%; font-weight: 800; margin: 0; letter-spacing: -.02em; }
.page-sub { color: var(--encre-3); font-size: .88rem; margin-top: 2px; }

.topbar { display: none; }
@media (max-width: 991.98px) {
  .app, [dir="rtl"] .app { grid-template-columns: 1fr; background: var(--fond); }
  .sidebar { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: 270px; z-index: 1040; transform: translateX(-100%); transition: transform .2s ease; }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  [dir="rtl"] .sidebar.open { transform: none; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(15, 18, 40, .45); }
  .topbar { display: flex; align-items: center; justify-content: space-between; background: var(--indigo-nuit); color: #fff; padding: 10px 14px; position: sticky; top: 0; z-index: 1030; }
  .topbar .brand { padding: 0; }
  .main { padding: 18px 14px 40px; }
  .page-title { font-size: 1.35rem; }
}

/* ------------------------------------------------------------------ surfaces */
.card, .panel { background: var(--surface); border: 1px solid var(--trait); border-radius: 10px; box-shadow: none; }
.card h6, .panel h6, .panel-title { font-size: .98rem; font-stretch: 108%; font-weight: 700; margin-bottom: .75rem; display: flex; align-items: center; gap: 8px; }
.card h6 i, .panel-title i { color: var(--indigo); }

/* Bande de chiffres : un seul bloc divisé, pas quatre cartes identiques */
.figures { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--trait); border-radius: 10px; margin-bottom: 18px; }
.figure { padding: 16px 20px; border-inline-start: 1px solid var(--trait); min-width: 0; }
.figure:first-child { border-inline-start: 0; }
.figure-label { color: var(--encre-2); font-size: .84rem; }
.figure-value { font-stretch: 116%; font-weight: 750; font-size: 1.6rem; letter-spacing: -.02em; line-height: 1.15; margin: 4px 0 2px; white-space: nowrap; }
.figure-value small { font-size: .55em; font-weight: 600; color: var(--encre-3); margin-inline-start: .3em; }
.figure-note { color: var(--encre-3); font-size: .8rem; }
.figure.lead-figure { background: var(--indigo-nuit); color: #fff; border-start-start-radius: 9px; border-end-start-radius: 9px; }
.figure.lead-figure .figure-label, .figure.lead-figure .figure-note { color: #aeb5dc; }
.figure.lead-figure .figure-value small { color: var(--safran); }
@media (max-width: 991.98px) {
  .figures { grid-template-columns: repeat(2, 1fr); }
  .figure:nth-child(3) { border-inline-start: 0; }
  .figure:nth-child(n+3) { border-top: 1px solid var(--trait); }
  .figure.lead-figure { border-end-start-radius: 0; }
}
@media (max-width: 575.98px) {
  .figure { padding: 12px 14px; }
  .figure-value { font-size: 1.22rem; white-space: normal; }
  .figure-label, .figure-note { font-size: .76rem; }
}
.topbar #menuBtn { border: 0; color: #fff; background: transparent; padding: 4px 8px; }
.topbar #menuBtn:hover, .topbar #menuBtn[aria-expanded="true"] { background: var(--indigo-nuit-2); }
.kpi small { color: var(--encre-2); font-size: .84rem; }
.kpi h3, .kpi h4, .kpi h5 { font-stretch: 116%; font-weight: 750; letter-spacing: -.02em; margin: 2px 0; }

/* ------------------------------------------------------------------ tableaux */
.table { --bs-table-bg: transparent; --bs-table-hover-bg: #f6f7fb; margin-bottom: .25rem; font-size: .9rem; }
.table > :not(caption) > * > * { padding: .55rem .6rem; border-bottom-color: var(--trait); }
.table th, .table thead th, .table tr:first-child > th {
  color: var(--encre-2); font-weight: 600; font-size: .8rem; background: #f8f9fc; border-bottom: 1px solid var(--trait);
}
.table td, .table th { white-space: nowrap; vertical-align: middle; }
.table tfoot th, .table tfoot tr:first-child > th { background: transparent; color: var(--encre); font-size: .9rem; font-weight: 700; border-top: 2px solid var(--trait); }
.num { text-align: end; font-variant-numeric: tabular-nums; }
.table td.num { font-weight: 500; }
.table-responsive { border-radius: 8px; }

/* ------------------------------------------------------------------ badges de statut */
.badge { font-weight: 600; font-size: .74rem; padding: .32em .62em; border-radius: 99px; letter-spacing: 0; }
.text-bg-success { background: #e3f3ea !important; color: #17693f !important; }
.text-bg-danger { background: #fbe7e5 !important; color: #9c2c26 !important; }
.text-bg-warning { background: #fdf0d3 !important; color: #8a5a06 !important; }
.text-bg-secondary { background: #eceef4 !important; color: var(--encre-2) !important; }
.text-bg-primary { background: var(--indigo-clair) !important; color: var(--indigo) !important; }
.text-bg-light { background: #f1f2f6 !important; color: var(--encre-2) !important; }
.sidebar .badge.text-bg-danger { background: var(--rouge) !important; color: #fff !important; }

/* ------------------------------------------------------------------ boutons & champs */
.btn { font-weight: 600; border-radius: 7px; padding: .45rem .95rem; font-size: .9rem; }
.btn-sm { padding: .28rem .62rem; font-size: .8rem; border-radius: 6px; }
.btn-primary { --bs-btn-bg: var(--indigo); --bs-btn-border-color: var(--indigo); --bs-btn-hover-bg: var(--indigo-nuit); --bs-btn-hover-border-color: var(--indigo-nuit); --bs-btn-active-bg: var(--indigo-nuit); }
.btn-success { --bs-btn-bg: var(--vert); --bs-btn-border-color: var(--vert); --bs-btn-hover-bg: #176b46; --bs-btn-hover-border-color: #176b46; }
.btn-warning { --bs-btn-bg: var(--safran); --bs-btn-border-color: var(--safran); --bs-btn-color: var(--indigo-nuit); --bs-btn-hover-bg: #e3a128; --bs-btn-hover-border-color: #e3a128; }
.btn-outline-primary { --bs-btn-color: var(--indigo); --bs-btn-border-color: #c5cae9; --bs-btn-hover-bg: var(--indigo); --bs-btn-hover-border-color: var(--indigo); }
.btn-outline-secondary { --bs-btn-color: var(--encre-2); --bs-btn-border-color: var(--trait); --bs-btn-hover-bg: #eef0f6; --bs-btn-hover-color: var(--encre); --bs-btn-hover-border-color: #cfd3e1; }
.btn-outline-danger { --bs-btn-border-color: #ecc4c1; }
.btn-outline-success { --bs-btn-border-color: #bfe0cf; }
.form-control, .form-select { border-color: #d6dae6; border-radius: 7px; padding: .5rem .75rem; font-size: .92rem; background-color: #fff; }
.form-control-sm, .form-select-sm { padding: .3rem .6rem; font-size: .84rem; }
.form-control:focus, .form-select:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(52, 66, 168, .16); }
.form-label, form label { font-weight: 600; font-size: .84rem; color: var(--encre-2); margin-bottom: 4px; }
.form-check-input:checked { background-color: var(--indigo); border-color: var(--indigo); }
.helptext { display: block; color: var(--encre-3); font-size: .78rem; margin-top: 3px; }
.errorlist { color: var(--rouge); list-style: none; padding: 0; margin: 4px 0 0; font-size: .84rem; }
.errorlist.nonfield { background: #fbe7e5; border-radius: 7px; padding: 8px 12px; margin-bottom: 12px; }

.alert { border: 0; border-radius: 9px; font-size: .9rem; border-inline-start: 4px solid currentColor; }
.alert-success { background: #e8f5ee; color: #17693f; }
.alert-danger { background: #fcecea; color: #9c2c26; }
.alert-warning { background: #fdf3dc; color: #7d5205; }
.alert-info { background: var(--indigo-clair); color: var(--indigo); }
.alert-light { background: #f6f7fb; color: var(--encre-2); border-inline-start-color: var(--trait); }

.pagination { --bs-pagination-color: var(--indigo); --bs-pagination-border-color: var(--trait); }

/* ------------------------------------------------------------------ connexion */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, .9fr); background: var(--surface); }
.login-art {
  position: relative; overflow: hidden; background: var(--indigo-nuit); color: #fff;
  padding: 44px 56px; display: flex; flex-direction: column; justify-content: space-between;
}
.login-art::after { /* trame fine, comme un tissu indigo */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.025) 0 2px, transparent 2px 9px);
}
.login-art > * { position: relative; z-index: 1; }
.login-headline { color: #fff; font-stretch: 125%; font-weight: 800; font-size: clamp(2.3rem, 4.2vw, 3.6rem); line-height: .98; letter-spacing: -.035em; margin: 0; max-width: 13ch; }
.login-lede { color: #b8bfe3; font-size: 1.02rem; line-height: 1.55; max-width: 44ch; margin-top: 18px; }
.login-foot { color: #8790c2; font-size: .82rem; }

/* L'étiquette de boîte de téléphone */
.box-label {
  width: min(360px, 100%); background: #fbfaf6; color: var(--encre); border-radius: 6px;
  padding: 16px 18px 14px; transform: rotate(-4deg); margin: 34px 0 10px 6px;
  box-shadow: 0 18px 40px rgba(6, 9, 30, .45), 0 2px 0 rgba(0,0,0,.08);
  border-top: 10px solid var(--safran);
  animation: label-in .7s cubic-bezier(.2, .9, .25, 1.15) both .1s;
}
@keyframes label-in { from { transform: rotate(-11deg) translateY(28px); opacity: 0; } to { transform: rotate(-4deg); opacity: 1; } }
.box-label-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.box-label-model { font-stretch: 112%; font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em; }
.box-label-spec { color: var(--encre-2); font-size: .8rem; }
.barcode {
  height: 58px; margin: 12px 0 6px;
  background:
    repeating-linear-gradient(90deg,
      #111 0 2px, transparent 2px 4px, #111 4px 5px, transparent 5px 8px, #111 8px 11px, transparent 11px 12px,
      #111 12px 13px, transparent 13px 16px, #111 16px 18px, transparent 18px 19px, #111 19px 20px, transparent 20px 23px);
  background-size: 23px 100%;
}
.box-label-imei { font-family: "Plex Mono", ui-monospace, monospace; font-size: .86rem; display: flex; justify-content: space-between; color: var(--encre); }
.box-label-imei span:first-child { color: var(--encre-3); }

.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 28px; }
.login-form { width: 100%; max-width: 360px; }
.login-shop-logo { display: block; max-width: 150px; max-height: 96px; object-fit: contain; margin-bottom: 20px; }
.login-form h1 { font-size: 1.6rem; font-stretch: 116%; font-weight: 800; letter-spacing: -.02em; margin-bottom: 4px; }
.login-form .sub { color: var(--encre-3); margin-bottom: 28px; }
.login-form .form-control { padding: .7rem .85rem; font-size: 1rem; }
.login-form .btn { padding: .72rem 1rem; font-size: 1rem; }
.pw-field { position: relative; }
.pw-toggle { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--encre-3); padding: 6px 8px; border-radius: 6px; }
.pw-toggle:hover { color: var(--indigo); background: var(--indigo-clair); }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 26px 24px 30px; }
  .login-headline { font-size: 2.1rem; max-width: none; }
  .box-label { display: none; }
  .login-foot { display: none; }
}

/* ------------------------------------------------------------------ impression */
@media print {
  .app { display: block; }
  .sidebar, .topbar, .no-print { display: none !important; }
  .main { padding: 0; }
  .card, .panel, .figures { border-color: #ccc; }
}

/* ------------------------------------------------------------------ arabe / droite à gauche */
[dir="rtl"] body, [dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4, [dir="rtl"] h5, [dir="rtl"] h6,
[dir="rtl"] .page-title, [dir="rtl"] .login-headline, [dir="rtl"] .brand-name { letter-spacing: 0; }
[dir="rtl"] body { font-size: 1rem; line-height: 1.65; }
[dir="rtl"] .login-headline { line-height: 1.25; font-weight: 700; max-width: 16ch; }
[dir="rtl"] .page-title { font-weight: 700; }
[dir="rtl"] .box-label { transform: rotate(4deg); direction: ltr; text-align: left; animation-name: label-in-rtl; }
@keyframes label-in-rtl { from { transform: rotate(11deg) translateY(28px); opacity: 0; } to { transform: rotate(4deg); opacity: 1; } }
[dir="rtl"] .code, [dir="rtl"] code, [dir="rtl"] input[type=number], [dir="rtl"] .ltr { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .bi-box-arrow-right, [dir="rtl"] .bi-arrow-left-right { transform: scaleX(-1); }

.lang-switch { display: flex; gap: 4px; padding: 4px; background: rgba(255,255,255,.06); border-radius: 8px; margin: 4px 0 8px; }
.lang-switch button { flex: 1; border: 0; background: transparent; color: #c9cfea; font-size: .84rem; padding: 5px 6px; border-radius: 6px; font-weight: 600; }
.lang-switch button:hover { color: #fff; background: var(--indigo-nuit-2); }
.lang-switch button[aria-pressed="true"] { background: var(--safran); color: var(--indigo-nuit); }
.login-lang { position: absolute; top: 22px; inset-inline-end: 24px; z-index: 2; }
.login-lang .lang-switch { background: #f1f2f7; margin: 0; }
.login-lang .lang-switch button { color: var(--encre-2); }
.login-lang .lang-switch button:hover { background: #e4e6ef; color: var(--encre); }
.login-form-wrap { position: relative; }

/* ------------------------------------------------------------------ mise en service */
.stepper { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 16px; flex-wrap: wrap; counter-reset: s; }
.stepper li { flex: 1; min-width: 130px; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 9px; background: var(--surface); border: 1px solid var(--trait); color: var(--encre-3); font-size: .88rem; }
.stepper li a { display: flex; align-items: center; gap: 8px; color: inherit; }
.stepper .dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #eceef4; font-weight: 700; font-size: .78rem; flex: none; }
.stepper li.current { border-color: var(--indigo); color: var(--encre); font-weight: 600; box-shadow: inset 0 -3px 0 var(--safran); }
.stepper li.current .dot { background: var(--indigo); color: #fff; }
.stepper li.done { color: var(--encre-2); }
.stepper li.done .dot { background: #e3f3ea; color: var(--vert); }
.setup-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--trait); }
.invoice-preview { border: 1px dashed #cfd3e1; border-radius: 10px; padding: 16px; background: #fbfbfd; }
.preview-logo { max-height: 64px; max-width: 160px; object-fit: contain; }
.action-tile { display: flex; gap: 14px; padding: 16px; border: 1px solid var(--trait); border-radius: 10px; height: 100%; }
.action-tile > i { font-size: 1.6rem; color: var(--indigo); }
.done-mark { width: 64px; height: 64px; border-radius: 50%; background: var(--safran); color: var(--indigo-nuit); display: grid; place-items: center; font-size: 2rem; margin: 0 auto; }
.invoice-logo { max-height: 70px; max-width: 180px; object-fit: contain; }
.brand-logo { width: 34px; height: 34px; border-radius: 9px; object-fit: contain; background: #fff; flex: none; }

/* ------------------------------------------------------------------ scan */
.scan-box { scroll-margin-top: 76px; display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 0 0 14px; border: 2px dashed #c5cae9; border-radius: 10px; background: #f8f9fe; }
.scan-box:focus-within { border-color: var(--indigo); border-style: solid; background: #fff; box-shadow: 0 0 0 4px rgba(52,66,168,.1); }
.scan-box > i { font-size: 1.6rem; color: var(--indigo); }
.scan-box .form-control { font-size: 1.05rem; font-family: "Plex Mono", ui-monospace, monospace; border: 0; background: transparent; box-shadow: none; }
.scan-box .form-control:focus { box-shadow: none; }
.scan-live { font-size: .85rem; }
.result-ok { color: var(--vert); } .result-bad { color: var(--rouge); } .result-info { color: var(--encre-3); }
.big-count { font-stretch: 116%; font-weight: 800; font-size: 2.2rem; line-height: 1; }
.verdict { display: flex; gap: 14px; align-items: center; padding: 18px; border-radius: 12px; }
.verdict i { font-size: 2.2rem; }
.verdict.ok { background: #e8f5ee; color: #17693f; } .verdict.bad { background: #fcecea; color: #9c2c26; } .verdict.warn { background: #fdf3dc; color: #7d5205; }

/* ---------- scan caméra ---------- */
.cam-btn { white-space: nowrap; }
.scan-box .cam-btn { padding-inline: .9rem; }
body.cam-open { overflow: hidden; }
.cam-overlay { position: fixed; inset: 0; z-index: 2000; background: #0b0f26; color: #f5f5fa; display: flex; flex-direction: column; align-items: center; }
.cam-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-frame { position: relative; margin-top: 22vh; width: min(86vw, 560px); height: min(30vw, 170px); border: 3px solid var(--safran, #f2b33d); border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(8, 12, 38, .55); pointer-events: none; }
.cam-status { position: relative; margin: 18px 16px 0; max-width: 560px; text-align: center; font-size: 1.05rem; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.cam-list { position: relative; margin: 10px 16px 0; padding: 8px 14px 8px 2.2em; max-height: 22vh; overflow: auto; width: min(86vw, 560px); background: rgba(11,15,38,.75); border-radius: 10px; font-family: "Plex Mono", monospace; direction: ltr; }
.cam-list:empty { display: none; }
.cam-actions { position: absolute; bottom: max(24px, env(safe-area-inset-bottom)); display: flex; gap: 12px; }
.cam-actions .btn { min-width: 130px; padding: .7rem 1.2rem; font-weight: 700; }
.cam-torch.active { background: var(--safran, #f2b33d); color: #1b2350; }

/* Sur téléphone, la caméra devient le moyen de scan principal */
.cam-label { display: none; }
@media (max-width: 575.98px) {
  .scan-box { flex-wrap: wrap; }
  .scan-box > .bi { display: none; }
  .scan-box .form-control { flex: 1 1 100%; min-width: 0; }
  .scan-box .cam-btn, .scan-box > .btn:not(.cam-btn) { flex: 1 1 0; padding-block: .65rem; font-weight: 700; }
  .scan-box .cam-btn { order: 2; background: var(--safran, #f2b33d); border-color: var(--safran, #f2b33d); color: #1b2350; }
  .scan-box > .btn:not(.cam-btn) { order: 3; }
  .scan-box .cam-label { display: inline; margin-inline-start: .4rem; }
}

/* ---------- réception rapide ---------- */
.rec-msg { min-height: 1.6em; margin: -4px 0 12px; font-weight: 600; }
.rec-msg.ok { color: var(--vert, #1e7b4c); }
.rec-msg.bad { color: var(--rouge, #b42318); }
.rec-pending { border-inline-start: 6px solid var(--safran, #f2b33d); }
.cam-list li.bad { color: #ffb4a8; }
.rec-msg.warn { color: #8a5a00; }

/* ================================================================== TÉLÉPHONE (refonte 1.7.1) */
/* Barre d'onglets en bas : actions les plus fréquentes à portée de pouce */
.tabbar { display: none; }
@media (max-width: 991.98px) {
  .topbar { padding-top: calc(10px + env(safe-area-inset-top)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); align-items: end;
    position: fixed; inset-inline: 0; bottom: 0; z-index: 1035;
    background: var(--surface); border-top: 1px solid var(--trait);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 24px rgba(27, 35, 80, .08);
  }
  .tabbar a, .tabbar button {
    display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 48px; justify-content: center;
    color: var(--encre-2); text-decoration: none; font-size: .7rem; font-weight: 600; background: none; border: 0; border-radius: 10px;
  }
  .tabbar i { font-size: 1.3rem; line-height: 1; }
  .tabbar a.active { color: var(--indigo); }
  .tabbar a.active i { color: var(--indigo); }
  .tabbar .tab-main i {
    width: 52px; height: 52px; margin-top: -26px; border-radius: 16px; display: grid; place-items: center;
    background: var(--safran); color: var(--indigo-nuit); font-size: 1.5rem; box-shadow: 0 6px 16px rgba(242, 179, 61, .45);
  }
  .tabbar .tab-main { color: var(--indigo-nuit); }
  .main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .sidebar { padding-bottom: env(safe-area-inset-bottom); overflow-y: auto; }
  body.cam-open .tabbar { display: none; }
}

@media (max-width: 575.98px) {
  /* Champs : 16 px minimum (sinon l'iPhone zoome à chaque saisie), cibles tactiles confortables */
  .form-control, .form-select, .form-control-sm, .form-select-sm { font-size: 16px; min-height: 44px; }
  textarea.form-control { min-height: 88px; }
  .btn { min-height: 40px; }
  .btn-sm { min-height: 36px; }

  /* En-tête de page : titre puis actions pleine largeur */
  .page-head { align-items: stretch; flex-direction: column; gap: 10px; margin-bottom: 14px; }
  .page-head > div:last-child { width: 100%; }
  .page-head > div:last-child > .btn, .page-head > div:last-child > a.btn, .page-head > div:last-child > form { flex: 1 1 auto; }
  .page-head > div:last-child > form .btn { width: 100%; }

  /* Bandeau de licence compact ; l'essai (simple information) ne s'affiche qu'au tableau de bord */
  .lic-banner { font-size: .8rem; padding: .45rem .7rem !important; gap: 8px !important; }
  .lic-banner .btn { min-height: 30px; padding: .15rem .5rem; font-size: .75rem; white-space: nowrap; }
  .lic-quiet { display: none !important; }

  /* Barres de filtres : un champ par ligne, bouton pleine largeur */
  .main form.d-flex { flex-wrap: wrap; }
  .main form.d-flex > .form-control, .main form.d-flex > .form-select { flex: 1 1 100%; width: 100% !important; }
  .main form.d-flex > .btn { flex: 1 1 auto; }
  .main form.d-flex.ms-auto { margin-inline-start: 0 !important; width: 100%; }

  /* Rangées de filtres (Tous / Disponible / Vendu…) : défilement horizontal au doigt */
  .btn-group { display: flex; overflow-x: auto; max-width: 100%; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .btn-group::-webkit-scrollbar { display: none; }
  .btn-group > .btn { flex: 0 0 auto; white-space: nowrap; }

  /* Tableaux de données → cartes */
  .table-responsive { overflow-x: visible; }
  table.table-cards, table.table-cards tbody, table.table-cards tr, table.table-cards td { display: block; width: 100%; }
  table.table-cards thead { display: none; }
  table.table-cards tr {
    background: var(--surface); border: 1px solid var(--trait); border-radius: 12px;
    padding: 10px 14px; margin-bottom: 10px;
  }
  table.table-cards tr.table-active, table.table-cards tr:hover { background: var(--surface); }
  table.table-cards tr.row-head { display: none; }
  /* Intitulé de colonne à gauche (à droite en arabe), valeur alignée de l'autre côté */
  table.table-cards td {
    padding: 4px 0 !important; border: 0 !important; text-align: end !important; min-height: 0;
    overflow-wrap: anywhere; line-height: 1.35;
  }
  table.table-cards td::after { content: ""; display: block; clear: both; }
  table.table-cards td::before {
    content: attr(data-label); float: inline-start; margin-inline-end: 12px; max-width: 45%; text-align: start;
    color: var(--encre-3); font-size: .78rem; font-weight: 600; line-height: 1.6;
  }
  table.table-cards td:first-child { font-weight: 700; font-size: 1rem; text-align: start !important; padding-bottom: 6px !important; }
  table.table-cards td:first-child::before { display: none; }
  table.table-cards td.cell-empty, table.table-cards td.cell-full::before { display: none; }
  table.table-cards td.cell-full { text-align: start !important; }
  table.table-cards td:last-child:not(:first-child) .btn { margin-top: 4px; }
  table.table-cards td > * { max-width: 100%; }
  table.table-cards td .text-truncate { white-space: normal; }
  table.table-cards tfoot, table.table-cards tfoot tr, table.table-cards tfoot td, table.table-cards tfoot th { display: block; }
  table.table-cards tfoot tr { display: flex; justify-content: space-between; border: 0; padding: 6px 4px; font-weight: 700; }
  .card > .table-responsive, .panel > .table-responsive { margin: 0; }
  .card:has(> .table-responsive > table.table-cards), .card:has(> table.table-cards) { background: transparent; border: 0; padding: 0 !important; }
}
@media (max-width: 575.98px) {
  table.table-cards td * { white-space: normal !important; }
  .form-select, .form-control { max-width: 100%; min-width: 0; }
  .main { overflow-x: clip; }
}
@media (max-width: 575.98px) {
  table.table-cards td { white-space: normal !important; }
  table.table-cards tr.has-title { display: flex; flex-direction: column; }
  table.table-cards tr.has-title td.cell-title { order: -1; font-weight: 700; font-size: 1rem; text-align: start !important; padding-bottom: 6px !important; }
  table.table-cards tr.has-title td.cell-title::before { display: none; }
  table.table-cards tr.has-title td:first-child:not(.cell-title) { font-weight: 400; font-size: inherit; text-align: end !important; padding-bottom: 4px !important; }
  table.table-cards tr.has-title td:first-child:not(.cell-title)::before { display: block; }
  .card > .d-flex.justify-content-between, .panel > .d-flex.justify-content-between { flex-wrap: wrap; gap: 10px; }
  .card h5 { font-size: 1.15rem; }
}
@media (max-width: 575.98px) {
  table.table-cards td .text-truncate, table.table-cards td [style*="max-width"] { display: inline !important; max-width: none !important; overflow: visible; }
}
@media (max-width: 575.98px) {
  table.table-cards td.text-truncate, table.table-cards td[style*="max-width"] { max-width: none !important; overflow: visible; text-overflow: clip; }
}

/* Prix modifiable pendant la vente */
.price-edit { display: inline-flex; gap: 4px; align-items: center; justify-content: flex-end; }
.price-edit input { width: 7.5rem; text-align: end; font-variant-numeric: tabular-nums; }
.price-edit button { padding: .2rem .45rem; }
