/* FermePro — interface : sobre, lisible, adaptée PC et tablette (cibles tactiles ≥ 40 px). */
:root {
  --brand: #17734a; --brand-2: #1f9160; --brand-soft: #e6f3ec; --brand-ink: #0d4a2f;
  --bg: #f4f6f4; --surface: #ffffff; --surface-2: #f8faf8; --border: #e2e7e3; --border-strong: #cfd7d1;
  --text: #1b2620; --muted: #66756c; --faint: #94a39a;
  --danger: #c0392b; --danger-soft: #fdecea; --warning: #b7791f; --warning-soft: #fdf3e1;
  --info: #2563a8; --info-soft: #e8f0fa; --ok: #17734a; --ok-soft: #e6f3ec;
  --c1: #17734a; --c2: #d08c2b; --c3: #2f6fb0; --c4: #9b4d96; --c5: #c0503b; --c6: #4f9a94; --c7: #7d8a3a; --c8: #6b6f80;
  --radius: 12px; --radius-sm: 8px; --shadow: 0 1px 2px rgba(16,40,26,.06), 0 4px 16px rgba(16,40,26,.05);
  --sidebar: 252px; --topbar: 60px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #3fb27a; --brand-2: #55c28c; --brand-soft: #173326; --brand-ink: #b9ebcf;
    --bg: #0f1512; --surface: #161e19; --surface-2: #1b241f; --border: #26322b; --border-strong: #34433a;
    --text: #e4ece7; --muted: #9aaba1; --faint: #6d7d73;
    --danger: #f07467; --danger-soft: #3a1c19; --warning: #e7b05a; --warning-soft: #3a2d15;
    --info: #74a9e6; --info-soft: #172a40; --ok: #3fb27a; --ok-soft: #173326;
    --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #3fb27a; --brand-2: #55c28c; --brand-soft: #173326; --brand-ink: #b9ebcf;
  --bg: #0f1512; --surface: #161e19; --surface-2: #1b241f; --border: #26322b; --border-strong: #34433a;
  --text: #e4ece7; --muted: #9aaba1; --faint: #6d7d73;
  --danger: #f07467; --danger-soft: #3a1c19; --warning: #e7b05a; --warning-soft: #3a2d15;
  --info: #74a9e6; --info-soft: #172a40; --ok: #3fb27a; --ok-soft: #173326;
  --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ------------------------------------------------------------ layout */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 14px 10px; gap: 2px; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 16px; }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); display: grid; place-items: center; color: #fff; }
.brand b { font-size: 16px; display: block; }
.brand small { color: var(--muted); font-size: 12px; display: block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 14px 12px 4px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 9px; color: var(--text); font-weight: 500; min-height: 38px; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand-ink); }
.nav a.active svg { color: var(--brand); }
.nav a .count { margin-left: auto; background: var(--danger); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 6px; font-weight: 700; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); display: flex; align-items: center; gap: 10px; padding: 0 24px; border-bottom: 1px solid var(--border); }
.menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 520px; }
.search input { width: 100%; height: 40px; padding: 0 12px 0 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }
.search > svg { position: absolute; left: 11px; top: 11px; color: var(--muted); }
.search-results { position: absolute; top: 46px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); max-height: 70vh; overflow: auto; padding: 6px; display: none; }
.search-results.open { display: block; }
.search-results .grp { font-size: 11px; text-transform: uppercase; color: var(--faint); padding: 8px 10px 2px; font-weight: 600; }
.search-results a { display: block; padding: 7px 10px; border-radius: 8px; color: var(--text); }
.search-results a:hover, .search-results a.sel { background: var(--brand-soft); text-decoration: none; }
.search-results a small { color: var(--muted); display: block; font-size: 12px; }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.content { padding: 22px 24px 60px; max-width: 1500px; width: 100%; }
.page-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .t { flex: 1; min-width: 220px; }
.page-head .sub { color: var(--muted); margin-top: 3px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 4px; }

/* ------------------------------------------------------------ composants */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--surface); cursor: pointer; font-weight: 550; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 7px; }
.btn.icon { width: 40px; padding: 0; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn .badge-dot { position: absolute; }
.iconbtn { position: relative; }
.iconbtn .dot { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--danger); color: #fff;
  font-size: 10.5px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .hd { display: flex; align-items: center; gap: 8px; padding: 14px 16px 6px; }
.card > .hd h2 { flex: 1; }
.card > .bd { padding: 8px 16px 16px; }
.card.pad { padding: 16px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .l { color: var(--muted); font-size: 12.5px; font-weight: 550; }
.kpi .v { font-size: 25px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 13px; color: var(--muted); font-weight: 600; margin-left: 3px; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.accent { border-left: 4px solid var(--brand); }
.kpi.warn { border-left: 4px solid var(--warning); }
.kpi.bad { border-left: 4px solid var(--danger); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge.bad { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.brand { background: var(--brand); color: #fff; border-color: transparent; }

/* tableaux */
.table-wrap { overflow: auto; border-radius: var(--radius); }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; }
table.t th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 650; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; z-index: 1; }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover td { background: var(--brand-soft); }
table.t tr.cancelled td { color: var(--faint); text-decoration: line-through; }
table.t td.actions { text-align: right; white-space: nowrap; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty svg { width: 34px; height: 34px; color: var(--faint); display: block; margin: 0 auto 8px; }

/* filtres */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters input, .filters select { height: 38px; border: 1px solid var(--border-strong); border-radius: 9px; padding: 0 10px; background: var(--surface); min-width: 140px; }
.filters input[type=search] { min-width: 220px; }
.filters input[type=checkbox], .filters input[type=radio] { min-width: 0; height: 18px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 0 12px; height: 36px; cursor: pointer; font-weight: 550; color: var(--muted); }
.seg button.on { background: var(--brand-soft); color: var(--brand-ink); }

/* onglets */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 6px 0 14px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }

/* fiche */
.hero { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.hero .avatar { width: 64px; height: 64px; border-radius: 16px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 30px; overflow: hidden; flex: none; }
.hero .avatar img { width: 100%; height: 100%; object-fit: cover; }
.hero h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px 18px; margin-top: 14px; }
.facts div span { display: block; font-size: 12px; color: var(--muted); }
.facts div b { font-weight: 600; }
.callout { padding: 10px 14px; border-radius: 10px; margin: 10px 0; display: flex; gap: 10px; align-items: flex-start; }
.callout.bad { background: var(--danger-soft); color: var(--danger); }
.callout.warn { background: var(--warning-soft); color: var(--warning); }
.callout.info { background: var(--info-soft); color: var(--info); }
.callout.ok { background: var(--ok-soft); color: var(--ok); }
.actionbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }

/* frise / historique */
.timeline { position: relative; margin: 4px 0; padding-left: 4px; }
.tl-item { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; padding: 9px 0; position: relative; }
.tl-item::before { content: ""; position: absolute; left: 17px; top: 38px; bottom: -8px; width: 2px; background: var(--border); }
.tl-item:last-child::before { display: none; }
.tl-ico { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; font-size: 16px; z-index: 1; }
.tl-item.cancelled { opacity: .55; }
.tl-item.cancelled .tl-title { text-decoration: line-through; }
.tl-title { font-weight: 600; }
.tl-sub { color: var(--muted); font-size: 13px; }
.tl-meta { color: var(--faint); font-size: 12px; text-align: right; white-space: nowrap; }
.tl-day { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 10px 0 2px; }

/* barres & progression */
.bar { height: 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 6px; }
.bar.warn > i { background: var(--warning); }
.bar.bad > i { background: var(--danger); }
.stepper { display: flex; gap: 0; overflow-x: auto; padding: 6px 0 2px; }
.step { flex: 1; min-width: 110px; position: relative; padding-top: 22px; font-size: 12.5px; }
.step::before { content: ""; position: absolute; top: 8px; left: 0; right: 0; height: 3px; background: var(--border); }
.step::after { content: ""; position: absolute; top: 2px; left: 0; width: 15px; height: 15px; border-radius: 50%; background: var(--surface); border: 3px solid var(--border-strong); }
.step.done::before, .step.done::after { background: var(--brand); border-color: var(--brand); }
.step.cur::after { background: var(--surface); border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.step b { display: block; font-weight: 600; padding-right: 6px; }
.step span { color: var(--muted); }

/* listes compactes */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.li:last-child { border-bottom: 0; }
.li .grow { flex: 1; min-width: 0; }
.li .grow b, .li .grow span { display: block; overflow: hidden; text-overflow: ellipsis; }
.li .grow span { color: var(--muted); font-size: 12.5px; }
.lvl { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--info); }
.lvl.danger { background: var(--danger); } .lvl.warning { background: var(--warning); }

/* tâches */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-height: 120px; }
.col h3 { padding: 2px 4px 10px; display: flex; gap: 6px; align-items: center; }
.task { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow); }
.task.overdue { border-left: 4px solid var(--danger); }
.task .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.task .acts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* formulaires & fenêtres */
.modal-bg { position: fixed; inset: 0; background: rgba(10,25,17,.42); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .12s; }
.modal { background: var(--surface); border-radius: 16px; width: min(640px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: min(980px, 100%); }
.modal .mh { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.modal .mh h2 { flex: 1; font-size: 17px; }
.modal .mb { padding: 16px 20px; overflow-y: auto; }
.modal .mf { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > label { font-size: 13px; font-weight: 600; }
.field > label .req { color: var(--danger); }
.field input, .field select, .field textarea { height: 40px; border: 1px solid var(--border-strong); border-radius: 9px; padding: 0 11px; background: var(--surface); width: 100%; }
.field textarea { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .filters input:focus, .filters select:focus, .search input:focus {
  outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 0; border-color: var(--brand); }
.field .help { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12px; color: var(--danger); font-weight: 600; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }
.field.check { flex-direction: row; align-items: center; gap: 9px; }
.field.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.field.hidden { display: none; }
.form-error { grid-column: 1 / -1; }
.lines { display: flex; flex-direction: column; gap: 8px; }
.line { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 8px; align-items: center; }
.line.l5 { grid-template-columns: 1.2fr 2fr 1fr 1fr auto; }
.line select, .line input { height: 38px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 8px; background: var(--surface); min-width: 0; width: 100%; }

/* menus déroulants */
.dropdown { position: relative; }
.menu { position: absolute; right: 0; top: 46px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
  min-width: 250px; padding: 6px; display: none; z-index: 40; max-height: 75vh; overflow: auto; }
.menu.open { display: block; }
.menu a, .menu button.mi { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px; border-radius: 8px; border: 0; background: none;
  color: var(--text); cursor: pointer; text-align: left; font-weight: 500; }
.menu a:hover, .menu button.mi:hover { background: var(--brand-soft); text-decoration: none; }
.menu .sep { border-top: 1px solid var(--border); margin: 6px 0; }
.menu .mh { font-size: 11px; text-transform: uppercase; color: var(--faint); padding: 8px 10px 2px; font-weight: 600; }
.notif { width: 360px; }
.notif .li { padding: 9px 8px; border-radius: 8px; cursor: pointer; }
.notif .li:hover { background: var(--surface-2); }

/* notifications toast */
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--text); color: var(--surface); padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: 420px; animation: fade .15s; }
.toast.bad { background: var(--danger); color: #fff; }
.toast.ok { background: var(--brand); color: #fff; }

/* connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 10% 10%, var(--brand-soft), transparent), var(--bg); }
.login .card { width: min(410px, 100%); padding: 28px; }
.login h1 { margin: 14px 0 4px; }
.login .form { grid-template-columns: 1fr; margin-top: 18px; }

/* graphiques */
.chart { width: 100%; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .gridl { stroke: var(--border); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 40%) 1fr auto; gap: 8px; align-items: center; padding: 4px 0; font-size: 13px; }
.hbar .bar { height: 10px; }
.donut-wrap { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }

.tree-name { display: inline-flex; align-items: center; gap: 6px; }
.perm-table td, .perm-table th { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
.perm-table input { width: 18px; height: 18px; accent-color: var(--brand); }
.dropzone { border: 2px dashed var(--border-strong); border-radius: 12px; padding: 26px; text-align: center; color: var(--muted); }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.chip-link { cursor: pointer; }

/* ------------------------------------------------------------ V2 : marque, plan porcherie, lots */
.credits { margin-top: auto; padding: 14px 12px 4px; font-size: 11.5px; color: var(--faint); line-height: 1.4; border-top: 1px solid var(--border); }
.login .credits { border-top: 0; text-align: center; margin-top: 18px; padding: 0; }
.plan-sector { margin-bottom: 18px; }
.plan-sector > h2 { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.plan-comp { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.plan-comp h3 { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.boxt { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; cursor: pointer; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 6px; min-height: 108px; position: relative; text-decoration: none; color: var(--text); }
.boxt:hover { border-color: var(--brand); text-decoration: none; }
.boxt.empty { background: repeating-linear-gradient(135deg, var(--surface), var(--surface) 8px, var(--surface-2) 8px, var(--surface-2) 16px); }
.boxt.sanitary { border: 2px dashed var(--info); }
.boxt.over { border: 2px solid var(--danger); }
.boxt .bn { font-weight: 700; display: flex; justify-content: space-between; gap: 6px; }
.boxt .chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 11.5px; font-weight: 600; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); }
.chip.F { border-color: color-mix(in srgb, var(--c4) 45%, var(--border)); }
.chip.M { border-color: color-mix(in srgb, var(--c3) 45%, var(--border)); }
.chip.gestante { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.chip.allaitante { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.legend-row { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.lot-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.lot-card { cursor: pointer; }
.lot-card:hover { border-color: var(--brand); }
.lot-card .big { font-size: 26px; font-weight: 750; }
.mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.mini div span { display: block; font-size: 11.5px; color: var(--muted); }
.mini div b { font-variant-numeric: tabular-nums; }
.terrain-sec { margin-bottom: 16px; }
.terrain-bloc { border-top: 1px solid var(--border); padding: 12px 0; }
.rowgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 8px; }
.rowt { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: var(--surface); cursor: pointer; font-size: 13px; }
.rowt:hover { border-color: var(--brand); }
.rowt.libre { background: var(--surface-2); }
.rowt b { display: block; }

/* ------------------------------------------------------------ responsive (tablette / téléphone) */
@media (max-width: 1180px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 25; }
  .topbar { padding: 0 12px; }
  .content { padding: 16px 14px 60px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .board { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .form { grid-template-columns: 1fr; }
  .top-actions .label { display: none; }
  .kpi .v { font-size: 21px; }
  .notif { width: calc(100vw - 24px); }
  .line, .line.l5 { grid-template-columns: 1fr 1fr; }
  .hide-sm { display: none; }
  h1 { font-size: 19px; }
}
@media print { .sidebar, .topbar, .actionbar, .page-head .actions { display: none !important; } .app { display: block; } }
