/* Karacter Logistics — styles de l'application
   Couleurs et typographies reprises de karacter.ch */
:root {
  --orange: #EF8903;
  --orange-dark: #C96F00;
  --orange-soft: #FDF3E6;
  --grey: #54565A;
  --grey-dark: #3A3B3E;
  --ink: #1F2023;
  --text: #333;
  --muted: #7A7C80;
  --line: #E6E6E6;
  --line-soft: #F0F0F0;
  --bg: #F5F5F5;
  --card: #FFFFFF;
  --ok: #2E8B57;
  --ok-soft: #E7F4EC;
  --warn: #B86E00;
  --warn-soft: #FDF0DC;
  --danger: #C0392B;
  --danger-soft: #FBEAE8;
  --info: #2F6DB5;
  --info-soft: #E8F0FA;
  --radius: 4px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  --topbar: 64px;
  --sidebar: 236px;
  --font: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-head: "Raleway", "Lato", sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--orange-dark); text-decoration: none; }
a:hover { color: var(--orange); }
h1, h2, h3 { font-family: var(--font-head); color: var(--grey-dark); margin: 0; }
h1 { font-size: 1.45rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; line-height: 1.2; }
h2 { font-size: 1rem; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; }
h3 { font-size: .95rem; font-weight: 700; }
p { margin: 0 0 .6em; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small, .small-note { font-size: .85rem; }
.small-note { margin: 0 0 10px; }
.pad { padding: 18px 20px; margin: 0; }
.pad-x { padding: 0 20px; }
.mt { margin-top: 12px; }
.req { color: var(--danger); }
.late { color: var(--danger); font-weight: 700; }

.icon { width: 18px; height: 18px; flex: none; vertical-align: -3px; }

/* ---------- Barre du haut ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  height: calc(var(--topbar) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 16px 0;
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-bottom: 1px solid var(--line);
}
.brand img { display: block; height: 44px; width: auto; }
.topbar-title { flex: 1; min-width: 0; font-family: var(--font-head); font-weight: 800; text-transform: uppercase; letter-spacing: .8px; font-size: .9rem; color: var(--grey-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: transparent; color: var(--grey); cursor: pointer; position: relative; padding: 0;
  font-size: 1.1rem; line-height: 1;
}
.icon-btn:hover { background: var(--line-soft); color: var(--orange); }
.icon-btn .icon { width: 22px; height: 22px; }
.icon-btn.small { width: 32px; height: 32px; }
.icon-btn.small .icon { width: 17px; height: 17px; }
.bell .dot {
  position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: var(--orange); color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--grey); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 800; font-size: .85rem; letter-spacing: .5px;
}
.avatar:hover { background: var(--orange); color: #fff; }

/* ---------- Structure ---------- */
.shell { padding-top: calc(var(--topbar) + env(safe-area-inset-top, 0px)); min-height: 100vh; }
.main { padding: 22px 16px calc(90px + var(--safe-bottom)); max-width: 1280px; margin: 0 auto; }

.sidebar {
  position: fixed; z-index: 60; top: 0; bottom: 0; left: 0; width: 280px; max-width: 86vw;
  background: #fff; border-right: 1px solid var(--line);
  padding: env(safe-area-inset-top, 0px) 0 calc(20px + var(--safe-bottom));
  overflow-y: auto; transform: translateX(-100%); transition: transform .22s ease;
}
.sidebar.open { transform: none; box-shadow: 4px 0 30px rgba(0,0,0,.15); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 4px 18px; }
.sidebar-head img { height: 44px; width: auto; }
.sidebar-user { padding: 12px 22px 14px; border-bottom: 1px solid var(--line-soft); margin-bottom: 8px; }
.sidebar-user strong { display: block; color: var(--grey-dark); }
.sidebar-user span { font-size: .85rem; color: var(--muted); }
.nav-link {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 22px; border: 0; background: none; cursor: pointer; text-align: left;
  font-family: var(--font-head); font-weight: 800; font-size: .8rem; letter-spacing: 1px; text-transform: uppercase;
  color: var(--grey);
}
.nav-link .icon { color: var(--orange); }
.nav-link:hover { color: var(--orange); background: var(--orange-soft); }
.nav-link.active { background: var(--orange); color: #fff; }
.nav-link.active .icon { color: #fff; }
.nav-form { margin: 0; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }

.bottombar {
  position: fixed; z-index: 45; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: #fff; border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
}
.bottombar a, .bottombar button {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 2px 7px; border: 0; background: none; cursor: pointer;
  color: var(--muted); font: 700 10.5px/1.2 var(--font); letter-spacing: .2px;
}
.bottombar .icon { width: 22px; height: 22px; }
.bottombar .active { color: var(--orange); }
.bottombar .active::before { content: ""; position: absolute; }

@media (min-width: 1024px) {
  .only-mobile { display: none !important; }
  .bottombar { display: none; }
  .topbar { padding-left: 24px; }
  .shell { display: grid; grid-template-columns: var(--sidebar) 1fr; }
  .sidebar {
    position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar));
    transform: none; width: auto; max-width: none; padding-top: 10px; z-index: 1;
  }
  .drawer-backdrop { display: none; }
  .main { padding: 28px 32px 48px; width: 100%; }
}

/* ---------- En-tête de page ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.page-head-text { min-width: 0; }
.page-head h1 { word-break: break-word; }
.subtitle { margin: 6px 0 0; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.back-link { display: inline-flex; align-items: center; gap: 2px; font-size: .85rem; font-weight: 700; margin-bottom: 6px; color: var(--muted); }
.back-link .icon { width: 16px; height: 16px; }
.page-sub { margin: 4px 0 16px; }
.page-sub h2 { font-size: 1.15rem; margin-top: 4px; display: flex; align-items: center; gap: 8px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 9px 18px; border: 2px solid var(--orange); border-radius: var(--radius);
  background: var(--orange); color: #fff; cursor: pointer;
  font-family: var(--font-head); font-weight: 800; font-size: .78rem; letter-spacing: 1px; text-transform: uppercase;
  white-space: nowrap; transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--orange-dark); border-color: var(--orange-dark); color: #fff; }
.btn .icon { width: 17px; height: 17px; }
.btn-secondary { background: #fff; color: var(--grey-dark); border-color: var(--grey); }
.btn-secondary:hover { background: var(--grey); border-color: var(--grey); color: #fff; }
.btn-ghost { background: transparent; color: var(--grey); border-color: transparent; }
.btn-ghost:hover { background: var(--line-soft); color: var(--orange-dark); border-color: transparent; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: var(--danger-soft); }
.btn-danger-ghost:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
@media (max-width: 480px) { .btn { white-space: normal; text-align: center; } }
.btn-sm { min-height: 34px; padding: 5px 12px; font-size: .72rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-col { display: flex; flex-direction: column; align-items: stretch; gap: 2px; }
.btn-col .btn { justify-content: flex-start; white-space: normal; text-align: left; }
.inline-form { display: inline; margin: 0; }
.card > .inline-form { display: block; margin: 0 20px 20px; }
.btn { max-width: 100%; }
.link { font-weight: 700; font-size: .85rem; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 20px; }

/* ---------- Cartes ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.card > .card-title, .card > form, .card > .dl, .card > .prose, .card > .btn-row, .card > .btn-col, .card > .photo-grid, .card > .table, .card > p, .card > .push-status, .card > .ios-help, .card > .totals, .card > .field, .card > h3, .card > .choices { margin-left: 20px; margin-right: 20px; }
.card > :first-child:not(.rows):not(.card-head):not(.table):not(.empty) { margin-top: 18px; }
.card > :last-child:not(.rows):not(.table):not(.empty) { margin-bottom: 20px; }
.card > .table { width: calc(100% - 40px); }
.card-title { margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.card-accent { border-top: 3px solid var(--orange); }
.stack > .card:last-child { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack > .card { margin-bottom: 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.grid-2 > *, .stack > * { min-width: 0; }
select { max-width: 100%; text-overflow: ellipsis; }
.grid-2 > .card { margin-bottom: 0; }
@media (min-width: 900px) {
  .grid-2 { grid-template-columns: 1fr 1fr; align-items: start; }
  .grid-wide { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
}
.hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 20px; border-left: 4px solid var(--orange); }
.hero h2 { font-size: 1.15rem; margin-bottom: 4px; }
.hero p { margin: 0; }

/* ---------- Statistiques ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); border-left: 4px solid var(--orange); color: var(--text); box-shadow: var(--shadow); }
a.stat:hover { border-color: var(--orange); color: var(--text); }
.stat-num { font-family: var(--font-head); font-weight: 900; font-size: 1.8rem; color: var(--grey-dark); line-height: 1.1; }
.stat-label { font-size: .82rem; color: var(--muted); }
.stat-alert { border-left-color: var(--danger); }
.stat-alert .stat-num { color: var(--danger); }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-top: 16px; margin-bottom: 8px; }
.totals > div { background: var(--orange-soft); border-left: 3px solid var(--orange); padding: 10px 12px; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
.totals span { display: block; font-family: var(--font-head); font-size: 1.25rem; font-weight: 900; color: var(--grey-dark); text-transform: none; letter-spacing: 0; }

/* ---------- Listes ---------- */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); color: var(--text); }
.row:last-child { border-bottom: 0; }
a.row:hover { background: #FCFAF7; color: var(--text); }
.row-main { flex: 1; min-width: 0; }
.row-main strong { color: var(--ink); }
.row-side { display: flex; align-items: center; gap: 6px; flex: none; }
.row-people { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; font-size: .84rem; color: var(--muted); margin-top: 2px; }
.meta .icon { width: 14px; height: 14px; margin-right: 4px; color: var(--orange); }
.meta .sep::before { content: "·"; margin: 0 8px; color: #bbb; }
.kind { display: inline-block; font-family: var(--font-head); font-size: .68rem; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--orange-dark); margin-right: 6px; }
.row .kind { display: block; margin-bottom: 1px; }
.qty { font-family: var(--font-head); font-weight: 900; color: var(--grey-dark); }
.notif.unread { background: #FFFBF5; }
.notif.unread strong::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); margin-right: 8px; vertical-align: 1px; }
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty-icon { width: 40px; height: 40px; color: #ccc; margin-bottom: 8px; }
.empty p { margin-bottom: 14px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 10px 0 20px; }
.row-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row-form input[name="name"] { flex: 1; min-width: 160px; }
.input-xs { width: 70px !important; }

/* ---------- Badges et puces ---------- */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: .72rem; font-weight: 700; letter-spacing: .3px; white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: var(--line-soft); color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 2px; border-radius: 20px; background: var(--line-soft); min-height: 26px; }
.chip-ini { width: 22px; height: 22px; border-radius: 50%; background: var(--grey); color: #fff; display: inline-flex; align-items: center; justify-content: center; font: 800 .62rem/1 var(--font-head); letter-spacing: .3px; }
.chip-name { font-size: .8rem; font-weight: 700; color: var(--grey-dark); }
.cat-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.cat-dot.big { width: 14px; height: 14px; }
.chip-cat { display: inline-flex; align-items: center; font-size: .85rem; font-weight: 700; color: var(--grey); }

/* ---------- Définitions ---------- */
.dl { display: grid; grid-template-columns: 1fr; gap: 2px 18px; margin: 0; }
.dl dt { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-top: 10px; }
.dl dt:first-child { margin-top: 0; }
.dl dd { margin: 0; color: var(--ink); word-break: break-word; }
@media (min-width: 560px) {
  .dl { grid-template-columns: 150px 1fr; }
  .dl dt, .dl dt:first-child { margin-top: 0; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
  .dl dd { padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
  .dl dt:last-of-type, .dl dd:last-of-type { border-bottom: 0; }
}
.dl-compact dd { font-size: .9rem; }
.prose { color: var(--ink); white-space: normal; margin-top: 14px; }
.section-title { font-family: var(--font-head); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--orange-dark); margin: 16px 0 6px; }

/* ---------- Formulaires ---------- */
.form { max-width: 860px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.label { font-size: .78rem; font-weight: 700; letter-spacing: .4px; color: var(--grey-dark); text-transform: uppercase; }
.help { font-size: .84rem; color: var(--muted); margin: 0 0 12px; }
.field .help { margin: 0; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  padding: 10px 12px; border: 1px solid #D5D5D5; border-radius: var(--radius); background: #fff;
  min-height: 44px; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(239,137,3,.15); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--orange); flex: none; }
input[type="color"] { width: 46px; padding: 3px; flex: none; }
input[type="file"] { padding: 8px; font-size: 14px; }
.grid-form { display: grid; gap: 0 14px; }
@media (min-width: 560px) { .grid-form { grid-template-columns: 1fr 1fr; } }
.grid-form.tight { grid-template-columns: 1fr 1fr; }
.choices { display: flex; flex-direction: column; gap: 6px; }
.choices-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; }
.choice { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; color: var(--ink); }
.choice-single { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.field-section { border: 1px solid var(--line); padding: 0 20px 6px; }
.field-section legend { font-family: var(--font-head); font-weight: 800; text-transform: uppercase; letter-spacing: .8px; font-size: 1rem; color: var(--grey-dark); padding: 0 6px; margin-left: -6px; transform: translateY(14px); background: #fff; }
.field-section > :first-of-type { margin-top: 28px; }
.field-info { padding: 12px 14px; background: var(--orange-soft); border-left: 3px solid var(--orange); }
.field-info p { margin: 4px 0 0; color: var(--text); }
.form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.sticky-actions { position: sticky; bottom: calc(64px + var(--safe-bottom)); z-index: 5; background: rgba(245,245,245,.92); backdrop-filter: blur(6px); padding: 12px 0; margin-bottom: 10px; }
@media (min-width: 1024px) { .sticky-actions { bottom: 0; } }
.inline-field { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); white-space: nowrap; }
.inline-field input { width: auto; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px; }
.filters > * { margin: 0 !important; }
.filters select, .filters input[type="search"] { width: auto; flex: 1 1 170px; min-width: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; flex: none; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; font-size: .82rem; font-weight: 700; color: var(--grey); background: #fff; border-right: 1px solid var(--line); white-space: nowrap; }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--grey); color: #fff; }
.seg input:focus-visible + span { box-shadow: inset 0 0 0 2px var(--orange); }
.seg-sm span { padding: 7px 11px; }
.seg .icon { width: 15px; height: 15px; }

.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 18px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; font-family: var(--font-head); font-weight: 800; font-size: .78rem; letter-spacing: 1px; text-transform: uppercase; color: var(--grey); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs a.active { color: var(--orange-dark); border-bottom-color: var(--orange); }

/* ---------- Messages ---------- */
.flash { position: relative; padding: 12px 40px 12px 16px; border-radius: var(--radius); margin-bottom: 14px; font-weight: 700; border-left: 4px solid; }
.flash-success { background: var(--ok-soft); border-color: var(--ok); color: #1E6B41; }
.flash-error { background: var(--danger-soft); border-color: var(--danger); color: #922B21; }
.flash-warning { background: var(--warn-soft); border-color: var(--warn); color: #8A5300; }
.flash-close { position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 1.3rem; cursor: pointer; color: inherit; opacity: .6; }
.push-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-left: 4px solid var(--orange); }
.push-banner > div { display: flex; gap: 12px; align-items: flex-start; flex: 1 1 240px; }
.push-banner .icon { color: var(--orange); width: 24px; height: 24px; margin-top: 2px; }
.push-banner p { margin: 0; font-size: .88rem; }
.ios-help { background: var(--orange-soft); padding: 12px 16px; border-radius: var(--radius); }
.ios-help ol { margin: 6px 0 0; padding-left: 20px; }

/* ---------- Tableaux ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 10px 8px; border-bottom: 2px solid var(--line); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table .num { text-align: right; white-space: nowrap; }
@media (max-width: 640px) {
  .table-rows thead { display: none; }
  .table-rows, .table-rows tbody, .table-rows tr, .table-rows td { display: block; width: 100%; }
  .table-rows tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .table-rows td { border: 0; padding: 3px 0; text-align: left !important; }
  .table-rows td[data-label]::before { content: attr(data-label) " : "; color: var(--muted); font-size: .8rem; }
}

/* ---------- Stock ---------- */
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.item-tile { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--text); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.item-tile:hover { border-color: var(--orange); color: var(--text); transform: translateY(-1px); }
.item-tile.inactive { opacity: .55; }
.item-tile-img { aspect-ratio: 16 / 10; background: var(--line-soft); display: flex; align-items: center; justify-content: center; color: #bbb; }
.item-tile-img img { width: 100%; height: 100%; object-fit: cover; }
.item-tile-img .icon { width: 42px; height: 42px; }
.item-tile-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.item-tile-body strong { color: var(--ink); }
.gauge { height: 6px; border-radius: 3px; background: var(--line-soft); overflow: hidden; margin-top: 6px; }
.gauge span { display: block; height: 100%; background: var(--orange); }
.avail-line { font-size: .85rem; color: var(--muted); }
.avail-line strong { color: var(--grey-dark); font-size: 1rem; }
.item-photo { width: 100%; max-height: 320px; object-fit: cover; display: block; border-radius: var(--radius) var(--radius) 0 0; }
.item-card > .item-photo:first-child, .item-card > a:first-child { margin: 0; }
.item-card > a:first-child img { border-radius: var(--radius) var(--radius) 0 0; }
.avail-result { font-weight: 700; }
.thumb-lg { max-width: 220px; border-radius: var(--radius); display: block; }

.item-picker { display: flex; flex-direction: column; }
.pick { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line-soft); }
.pick:last-child { border-bottom: 0; }
.pick.selected { background: var(--orange-soft); }
.pick.unavailable .pick-info strong { color: var(--muted); }
.pick-img { width: 56px; height: 56px; border-radius: var(--radius); background: var(--line-soft); display: flex; align-items: center; justify-content: center; color: #bbb; overflow: hidden; }
.pick-img img { width: 100%; height: 100%; object-fit: cover; }
.pick-info { display: flex; flex-direction: column; min-width: 0; }
.pick-info .meta { margin: 0; }
.avail { font-size: .82rem; font-weight: 700; color: var(--grey); }
.avail.ok { color: var(--ok); }
.avail.none { color: var(--danger); }
.stepper { display: inline-flex; align-items: center; border: 1px solid #D5D5D5; border-radius: var(--radius); overflow: hidden; }
.stepper button { width: 38px; height: 42px; border: 0; background: #fff; font-size: 1.3rem; font-weight: 700; color: var(--grey); cursor: pointer; }
.stepper button:hover { background: var(--orange); color: #fff; }
.stepper input { width: 52px; min-height: 42px; border: 0; border-left: 1px solid #D5D5D5; border-right: 1px solid #D5D5D5; border-radius: 0; text-align: center; padding: 0; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:disabled { background: var(--line-soft); }
@media (max-width: 480px) {
  .pick { grid-template-columns: 44px 1fr; padding: 12px 16px; }
  .pick-img { width: 44px; height: 44px; }
  .stepper { grid-column: 2; justify-self: start; }
}

.image-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.image-choice { position: relative; display: flex; flex-direction: column; border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; background: #fff; }
.image-choice input { position: absolute; top: 8px; left: 8px; z-index: 1; }
.image-choice img, .image-choice .noimg { aspect-ratio: 4 / 3; width: 100%; object-fit: cover; background: var(--line-soft); display: flex; align-items: center; justify-content: center; color: #bbb; }
.image-choice span:last-child { padding: 8px 10px; font-size: .88rem; font-weight: 700; color: var(--ink); }
.image-choice:has(input:checked) { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(239,137,3,.15); }
.choice-editor { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.choice-row { display: grid; grid-template-columns: 48px 1fr auto auto; gap: 8px; align-items: center; }
.choice-img { width: 48px; height: 48px; border-radius: var(--radius); background: var(--line-soft); overflow: hidden; display: flex; align-items: center; justify-content: center; color: #bbb; }
.choice-img img { width: 100%; height: 100%; object-fit: cover; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.preview { pointer-events: none; padding: 0 20px 10px; }
.preview .field-section { box-shadow: none; }

/* ---------- Photos et fichiers ---------- */
.upload-zone { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 18px; border: 2px dashed #D0D0D0; border-radius: var(--radius); background: #FAFAFA; color: var(--grey); font-weight: 700; cursor: pointer; text-align: center; }
.upload-zone:hover { border-color: var(--orange); color: var(--orange-dark); background: var(--orange-soft); }
.upload-zone .icon { width: 24px; height: 24px; color: var(--orange); }
.upload-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-zone.small { padding: 12px; }
.upload-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.upload-preview:empty { display: none; }
.upload-preview img, .upload-preview .doc-prev { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); background: var(--line-soft); }
.upload-preview .doc-prev { display: flex; align-items: center; justify-content: center; font-size: .7rem; padding: 4px; text-align: center; word-break: break-all; }
.upload-status { font-size: .82rem; color: var(--muted); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 10px; }
.photo { position: relative; margin: 0; }
.photo img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); display: block; background: var(--line-soft); }
.photo .doc { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; aspect-ratio: 1; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); font-size: .75rem; text-align: center; word-break: break-all; color: var(--grey-dark); }
.photo .doc .icon { width: 28px; height: 28px; color: var(--orange); }
.photo .inline-form { position: absolute; top: 4px; right: 4px; }
.photo-del { width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.photo-del .icon { width: 14px; height: 14px; }
.photo-del span { display: none; }
.thumb { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius); }
.file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 20px; font-size: .85rem; margin: 2px 4px 2px 0; }
.file-list { display: flex; flex-wrap: wrap; }
.inline-upload { margin-top: 12px; }

/* ---------- Rapport journalier ---------- */
.day { padding: 4px 20px 6px; }
.day-title { font-family: var(--font-head); font-size: .8rem; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--orange-dark); padding: 14px 0 6px; border-top: 1px solid var(--line-soft); }
.day:first-of-type .day-title { border-top: 0; }
.day-entry { padding: 10px 12px; background: #FAFAFA; border-radius: var(--radius); margin-bottom: 8px; }
.day-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.day-head .meta { margin: 0; }
.day-actions { margin-left: auto; display: flex; }
.day-entry p { margin: 6px 0 0; color: var(--ink); }
.final-notes { margin: 8px 20px 20px; padding: 12px 14px; border-left: 3px solid var(--orange); background: var(--orange-soft); }
.final-notes h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .8px; margin-bottom: 4px; }

/* ---------- Dossiers (rapports) ---------- */
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 18px; }
.folder { --cat: var(--orange); display: flex; flex-direction: column; gap: 4px; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); border-top: 3px solid var(--cat); color: var(--text); box-shadow: var(--shadow); }
.folder:hover { border-color: var(--cat); color: var(--text); }
.folder-icon { width: 26px; height: 26px; color: var(--cat); }
.folder strong { color: var(--ink); }
.folder .muted { font-size: .82rem; }

/* ---------- Menus déroulants ---------- */
.menu { position: relative; }
.menu summary { list-style: none; font-size: 1.2rem; font-weight: 700; }
.menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: 100%; z-index: 20; min-width: 250px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0,0,0,.12); padding: 6px; }
.menu-item { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none; cursor: pointer; font: inherit; font-size: .9rem; border-radius: var(--radius); color: var(--ink); }
.menu-item:hover { background: var(--line-soft); }
.menu-item.danger { color: var(--danger); }
.menu-pop .inline-form { display: block; }
.menu-form { display: flex; gap: 6px; padding: 6px; margin: 0; }
.menu-form input { min-height: 34px; padding: 6px 8px; font-size: 14px; }
.add-login { padding: 14px 20px 20px; border-top: 1px solid var(--line-soft); }
.add-login summary { list-style: none; display: inline-flex; }
.add-login summary::-webkit-details-marker { display: none; }
.add-login[open] summary { margin-bottom: 14px; }

/* ---------- Calendrier ---------- */
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.cal-nav { display: flex; align-items: center; gap: 4px; flex: 1 1 auto; min-width: 0; }
.cal-title { min-width: 0; text-align: center; font-size: 1.15rem; white-space: nowrap; }
@media (min-width: 700px) { .cal-nav { flex: 0 1 auto; } .cal-title { min-width: 180px; } }
@media (max-width: 420px) { .cal-title { flex: 1 1 auto; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; } .cal-nav .btn { padding: 5px 8px; font-size: .65rem; letter-spacing: .5px; } .cal-nav .icon-btn { width: 34px; flex: none; } }
.cal-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cal-tools select { width: auto; min-height: 38px; padding: 6px 10px; font-size: 14px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; font-size: .85rem; color: var(--grey); }
.cal-legend label, .lg-note { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.lg-res { background: var(--orange); }
.lg-iv { background: var(--grey); }
.lg-task { background: linear-gradient(135deg, #2F80ED 50%, #27AE60 50%); }
.lg-alert { background: #fff; border: 2px solid var(--danger); }
.cal-body { overflow: hidden; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { padding: 8px 6px; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); text-align: center; border-bottom: 1px solid var(--line); font-family: var(--font-head); }
.cal-day { min-height: 112px; padding: 4px 4px 6px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 3px; cursor: default; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.other { background: #FBFBFB; }
.cal-day.other .cal-num { color: #C4C4C4; }
.cal-day.weekend { background: #FCFCFC; }
.cal-day.today .cal-num { background: var(--orange); color: #fff; }
.cal-day.can-add { cursor: pointer; }
.cal-day.can-add:hover { background: var(--orange-soft); }
.cal-num { align-self: flex-end; width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; color: var(--grey-dark); }
.ev { display: block; width: 100%; text-align: left; border: 0; border-radius: 3px; padding: 2px 6px; font: 700 .72rem/1.35 var(--font); color: var(--t, #fff); background-color: var(--c, var(--grey)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.ev.pending { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.35) 0 6px, transparent 6px 12px); }
.ev-iv.done { filter: saturate(.4); }
.ev.done, .ev.completed { opacity: .7; }
.ev.unassigned { box-shadow: inset 0 0 0 2px var(--danger); }
.ev .t { opacity: .85; font-weight: 400; margin-right: 3px; }
.ev-more { font-size: .7rem; color: var(--muted); font-weight: 700; padding: 0 4px; border: 0; background: none; text-align: left; cursor: pointer; }
@media (max-width: 700px) {
  .cal-day { min-height: 64px; padding: 2px; }
  .cal-day .ev { font-size: 0; height: 6px; padding: 0; border-radius: 3px; }
  .cal-day .ev .t { display: none; }
  .cal-num { width: 22px; height: 22px; font-size: .72rem; align-self: center; }
  .cal-dow { font-size: .62rem; padding: 6px 2px; letter-spacing: 0; }
  .ev-more { font-size: .62rem; text-align: center; }
}
.cal-list { display: flex; flex-direction: column; }
.cal-list-day { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.cal-list-day.today { background: var(--orange-soft); }
.cal-list-date { text-align: center; }
.cal-list-date strong { display: block; font-family: var(--font-head); font-size: 1.5rem; font-weight: 900; color: var(--grey-dark); line-height: 1; }
.cal-list-date span { font-size: .72rem; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; }
.cal-list-events { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cal-item { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; padding: 8px 10px; border: 1px solid var(--line); border-left: 4px solid var(--c, var(--grey)); border-radius: var(--radius); background: #fff; cursor: pointer; font: inherit; color: var(--text); }
.cal-item:hover { border-color: var(--c, var(--grey)); }
.cal-item.unassigned { border-color: var(--danger); border-left-color: var(--danger); }
.cal-item-main { min-width: 0; flex: 1; }
.cal-item strong { display: block; color: var(--ink); font-size: .92rem; }
.cal-item .meta { font-size: .8rem; }

/* ---------- Fenêtres ---------- */
dialog { border: 0; padding: 0; }
dialog::backdrop { background: rgba(20,20,20,.45); }
.modal { width: min(520px, calc(100vw - 24px)); border-radius: 6px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-inner { margin: 0; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 18px 20px 10px; border-top: 4px solid var(--orange); }
.modal-head h2 { font-size: 1.05rem; text-transform: none; letter-spacing: 0; font-weight: 800; }
.modal-body { padding: 0 20px 10px; }
.modal-body .dl { grid-template-columns: 110px 1fr; }
.modal-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 12px 20px 18px; border-top: 1px solid var(--line-soft); }
.modal-foot:empty { display: none; }
.assign-box { margin-top: 12px; padding: 12px; background: #FAFAFA; border-radius: var(--radius); }
.assign-box .label { display: block; margin-bottom: 6px; }
.assign-box .choices { max-height: 200px; overflow: auto; }
.day-menu { display: flex; flex-direction: column; gap: 8px; padding: 6px 0 12px; }
.lightbox { background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox::backdrop { background: rgba(0,0,0,.88); }
.lightbox img { max-width: 96vw; max-height: 90vh; object-fit: contain; }
.lightbox-close { position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px; background: rgba(255,255,255,.15); color: #fff; }

/* ---------- Connexion ---------- */
body.auth { background: var(--grey-dark) linear-gradient(160deg, #54565A 0%, #2E2F32 100%); min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 6px; padding: 30px 28px 26px; border-top: 5px solid var(--orange); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.auth-logo { display: block; margin: 0 auto 18px; height: 90px; width: auto; }
.auth-title { text-align: center; margin-bottom: 18px; font-size: 1.2rem; }
.auth-card .muted { text-align: center; }
.auth-links { text-align: center; margin: 16px 0 0; font-size: .9rem; }

/* ---------- Impression ---------- */
@media print {
  .topbar, .sidebar, .bottombar, .page-actions, .btn, form, .push-banner { display: none !important; }
  .shell { padding: 0; display: block; }
  .main { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---------- Couleurs ---------- */
.lg-client { display: inline-flex; align-items: center; gap: 6px; }
.lg-edit { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
.lg-edit .icon { width: 14px; height: 14px; }
.color-list { display: flex; flex-direction: column; gap: 8px; }
.color-row { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.color-row input[type="color"] { width: 46px; height: 40px; min-height: 0; padding: 2px; }
.color-preview { flex: 1; min-width: 0; padding: 8px 12px; border-radius: var(--radius); font-weight: 700; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.form-wide { max-width: none; }

/* ---------- Catalogue ---------- */
.price { font-family: var(--font-head); font-weight: 800; color: var(--grey-dark); white-space: nowrap; }
.price-input { width: 120px !important; text-align: right; }
.table td .price-input { min-height: 38px; padding: 6px 10px; }
.cat-group td { background: var(--orange-soft); font-family: var(--font-head); font-weight: 800; font-size: .75rem; text-transform: uppercase; letter-spacing: .8px; color: var(--orange-dark); }
.table-scroll { overflow-x: auto; margin: 0 20px 20px; }
.table-scroll .table { min-width: 520px; }
@media (max-width: 560px) {
  .row-wrap { flex-wrap: wrap; }
  .row-wrap .row-side { width: 100%; flex-wrap: wrap; }
}
