/* Auto Pièces 31 — Standard (tableau de bord de l'agent vocal)
   Charte : rouge 31 #9b0e1b, anthracite #1e2024, Inter. */

:root {
  --brand: #9b0e1b;
  --brand-hover: #7a0b15;
  --brand-tint: #fbeef0;
  --brand-line: #f1c9ce;

  --bg: #f1f2f4;
  --surface: #ffffff;
  --surface-2: #f7f8f9;
  --line: #e2e5e9;
  --line-2: #d0d4da;

  --ink: #16191e;
  --ink-2: #474e5a;
  --ink-3: #636a76;
  --ink-4: #9aa0aa;           /* icônes et traits seulement, jamais du texte */

  --side: #1e2024;
  --side-2: #16181b;
  --side-ink: #d4d7dc;
  --side-ink-2: #8f949d;
  --side-hover: rgba(255, 255, 255, .06);

  --urgent: #9b0e1b;
  --urgent-bg: #fbeef0;
  --soon: #92400e;
  --soon-bg: #fef3e2;
  --ok: #166534;
  --ok-bg: #e9f7ee;
  --info: #1d4ed8;
  --info-bg: #eaf0fe;

  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(22, 25, 30, .06);
  --shadow-lg: 0 12px 32px rgba(22, 25, 30, .16), 0 2px 6px rgba(22, 25, 30, .08);

  --ease: cubic-bezier(.22, 1, .36, 1);
  --side-w: 224px;
  --drawer-w: 560px;

  --z-sticky: 10;
  --z-nav: 20;
  --z-backdrop: 40;
  --z-drawer: 50;
  --z-toast: 60;

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
[hidden] { display: none !important; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--side); color: var(--side-ink);
}
.sidebar-logo { padding: 22px 20px 18px; background: var(--side-2); }
.sidebar-logo img { display: block; width: 150px; height: auto; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 16px 10px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  text-decoration: none; font-weight: 500; color: var(--side-ink);
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-item:hover { background: var(--side-hover); color: #fff; }
.nav-item[aria-current="page"] { background: var(--brand); color: #fff; }
.nav-count {
  margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px;
  background: #fff; color: var(--brand); font-size: 12px; font-weight: 700; text-align: center;
}
.nav-item:not([aria-current="page"]) .nav-count { background: var(--brand); color: #fff; }

.sidebar-foot { margin-top: auto; padding: 14px 16px 18px; border-top: 1px solid rgba(255,255,255,.07); display: grid; gap: 12px; }
.sync { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--side-ink-2); }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: #d97706; flex: none; }
.sync[data-state="ok"] .sync-dot { background: #22c55e; }
.sync[data-state="off"] .sync-dot { background: #ef4444; }
.me { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.me-name { font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-logout {
  display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--side-ink-2); cursor: pointer;
}
.me-logout:hover { background: var(--side-hover); color: #fff; }

.mobile-bar, .tabbar { display: none; }

.main { min-width: 0; padding: 28px 32px 48px; }
.view { max-width: 1280px; margin: 0 auto; }

/* ---------- En-têtes de vue ---------- */
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.view-title { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.view-sub { color: var(--ink-3); margin-top: 2px; }

.seg { display: inline-flex; padding: 3px; border-radius: var(--radius); background: #e4e6ea; }
.seg button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 6px;
  font-weight: 500; color: var(--ink-2); cursor: pointer; white-space: nowrap;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }

/* ---------- Activité ---------- */
.kpis {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 20px;
}
.kpi { padding: 18px 20px; }
.kpi + .kpi { border-left: 1px solid var(--line); }
.kpi-label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.kpi-value { font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin-top: 6px; }
.kpi-note { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }
.kpi-note.is-alert { color: var(--urgent); font-weight: 600; }
.kpi.is-alert .kpi-value { color: var(--urgent); }

.act-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel + .panel { margin-top: 20px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.panel-title { font-size: 15px; font-weight: 600; }
.panel-meta { font-size: 12.5px; color: var(--ink-3); }
.panel-body { padding: 16px 20px 20px; }
.panel-link { font-size: 13px; font-weight: 600; color: var(--brand); text-decoration: none; }
.panel-link:hover { text-decoration: underline; }

.hours { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; align-items: end; height: 180px; }
.hour { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; }
.hour-bar { width: 100%; max-width: 34px; border-radius: 4px 4px 0 0; background: #cfd3da; min-height: 2px; transition: height .3s var(--ease); }
.hour.is-peak .hour-bar { background: var(--brand); }
.hour-n { font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.hour-n.is-zero { visibility: hidden; }
.hour-h { font-size: 11.5px; color: var(--ink-3); }

.cats { display: grid; gap: 10px; }
.cat-row { display: grid; grid-template-columns: 110px 1fr 36px; align-items: center; gap: 12px; }
.cat-name { font-weight: 500; color: var(--ink-2); }
.cat-track { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.cat-fill { height: 100%; border-radius: 999px; background: #8f96a2; }
.cat-row[data-cat="urgence"] .cat-fill { background: var(--brand); }
.cat-n { text-align: right; font-weight: 600; }

.prio { list-style: none; margin: 0; padding: 4px 0; }
.prio-item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start;
  padding: 12px 20px; cursor: pointer; border-top: 1px solid var(--line);
  transition: background .12s var(--ease);
}
.prio-item:first-child { border-top: 0; }
.prio-item:hover { background: var(--surface-2); }
.prio-name { font-weight: 600; }
.prio-what { color: var(--ink-2); font-size: 13px; margin-top: 1px; }
.prio-when { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }

/* ---------- Pastilles ---------- */
.urg { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.urg::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-4); }
.urg[data-u="urgent"] { color: var(--urgent); }
.urg[data-u="urgent"]::before { background: var(--urgent); }
.urg[data-u="48h"] { color: var(--soon); }
.urg[data-u="48h"]::before { background: #d97706; }
.urg[data-u="flexible"] { color: var(--ink-3); }
.urg-dot { width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--ink-4); }
.urg-dot[data-u="urgent"] { background: var(--urgent); box-shadow: 0 0 0 3px var(--urgent-bg); }
.urg-dot[data-u="48h"] { background: #d97706; }

.tag {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--line); white-space: nowrap;
}
.tag[data-cat="urgence"] { background: var(--urgent-bg); color: var(--urgent); border-color: var(--brand-line); }
.tag[data-cat="devis"] { background: var(--info-bg); color: var(--info); border-color: #cddcfb; }
.tag[data-cat="commande"] { background: var(--ok-bg); color: var(--ok); border-color: #c5e9d2; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.status .ico { width: 15px; height: 15px; }
.status[data-s="todo"] { color: var(--ink); }
.status[data-s="todo"]::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.status[data-s="doing"] { color: var(--soon); }
.status[data-s="done"] { color: var(--ok); }

.plate {
  display: inline-flex; align-items: stretch; border: 1.5px solid #1f2937; border-radius: 4px; overflow: hidden;
  font-weight: 700; letter-spacing: .06em; font-size: 13px; background: #fff; line-height: 1;
}
.plate::before { content: 'F'; display: grid; place-items: center; width: 16px; background: #1d4ed8; color: #fff; font-size: 9px; letter-spacing: 0; }
.plate span { padding: 4px 7px; }

/* ---------- Appels ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search { position: relative; flex: 1 1 280px; max-width: 420px; }
.search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input {
  width: 100%; height: 38px; padding: 0 12px 0 36px; border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--surface);
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.select {
  height: 38px; padding: 0 30px 0 12px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface);
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23636a76' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }

.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-head, .row {
  display: grid; align-items: center; gap: 16px;
  grid-template-columns: 64px minmax(170px, 1.1fr) minmax(220px, 2fr) 110px 96px 120px;
  padding: 0 18px;
}
.list-head {
  height: 38px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 600; color: var(--ink-3);
}
.day { padding: 8px 18px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--surface-2); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: var(--z-sticky); }
.row {
  min-height: 60px; padding-top: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
  cursor: pointer; transition: background .12s var(--ease);
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row[aria-selected="true"] { background: var(--brand-tint); }
.row.is-urgent .row-time { color: var(--urgent); }
.row.is-new { animation: rowIn 1.6s var(--ease); }
@keyframes rowIn { from { background: #fff4d6; } to { background: transparent; } }
.row-time { font-weight: 600; }
.row-who { min-width: 0; }
.row-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-what { min-width: 0; }
.row-piece { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-veh { display: flex; align-items: center; gap: 8px; margin-top: 3px; font-size: 12.5px; color: var(--ink-3); min-width: 0; }
.row-veh .plate { font-size: 11px; }
.row-urg-m { display: none; }
.row-veh .plate span { padding: 2px 5px; }

.empty { padding: 48px 24px; text-align: center; color: var(--ink-2); }
.empty .ico { width: 28px; height: 28px; color: var(--ink-4); margin-bottom: 10px; }
.empty-title { font-weight: 600; color: var(--ink); margin-bottom: 4px; }

.skel { height: 60px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: skel 1.2s linear infinite; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Fiche ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(22, 25, 30, .32); z-index: var(--z-backdrop); animation: fade .2s var(--ease); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(var(--drawer-w), 100vw);
  background: var(--surface); box-shadow: var(--shadow-lg); z-index: var(--z-drawer);
  display: flex; flex-direction: column; animation: slideIn .24s var(--ease);
}
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
.d-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.d-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.d-title { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.d-sub { color: var(--ink-3); margin-top: 2px; }
.d-close { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-2); cursor: pointer; flex: none; }
.d-close:hover { background: var(--surface-2); color: var(--ink); }
.d-tags { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.d-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--line-2);
  background: var(--surface); font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-4); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }

.done-banner {
  display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 12px;
  border-radius: var(--radius); background: var(--ok-bg); color: var(--ok); font-weight: 600;
}
.done-banner .btn { margin-left: auto; height: 32px; }

.d-body { flex: 1; overflow-y: auto; padding: 4px 20px 32px; overscroll-behavior: contain; }
.d-sec { padding: 18px 0; border-bottom: 1px solid var(--line); }
.d-sec:last-child { border-bottom: 0; }
.d-sec-title { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: baseline; }
.d-summary { font-size: 15px; line-height: 1.55; max-width: 65ch; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; margin: 0; }
.fact dt { font-size: 12.5px; color: var(--ink-3); }
.fact dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.fact dd.is-empty { color: var(--ink-4); font-weight: 400; }
.fact-wide { grid-column: 1 / -1; }

.note {
  width: 100%; min-height: 84px; resize: vertical; padding: 10px 12px;
  border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface);
}
.note:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.note-state { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.note-state.is-ok { color: var(--ok); }

.status-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.status-pick button {
  height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface);
  font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer;
}
.status-pick button:hover { border-color: var(--ink-4); color: var(--ink); }
.status-pick button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

audio { width: 100%; height: 40px; }

.transcript { display: grid; gap: 10px; }
.msg { max-width: 86%; }
.msg-who { font-size: 11.5px; font-weight: 600; color: var(--ink-3); margin-bottom: 3px; }
.msg-text { padding: 8px 12px; border-radius: 12px; line-height: 1.45; }
.msg.agent .msg-text { background: var(--surface-2); border: 1px solid var(--line); border-top-left-radius: 4px; }
.msg.client { justify-self: end; text-align: left; }
.msg.client .msg-who { text-align: right; }
.msg.client .msg-text { background: var(--brand-tint); border: 1px solid var(--brand-line); border-top-right-radius: 4px; }
.msg-ts { font-weight: 500; color: var(--ink-4); margin-left: 6px; }

.meta { font-size: 12.5px; color: var(--ink-3); display: grid; gap: 4px; }

/* ---------- Fiche : envois du client, SMS, historique ---------- */
.sent { border: 1px solid var(--brand-line); background: var(--brand-tint); border-radius: var(--radius); padding: 12px 14px; }
.sent + .sent { margin-top: 10px; }
.sent-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; font-weight: 500; }
.sent-live { color: var(--urgent); font-weight: 700; }
.sent .facts { gap: 8px 16px; }
.sent-msg { margin-top: 8px; font-style: italic; color: var(--ink); }
.sent-avant { color: var(--muted, #8a8f98); text-decoration-thickness: 1px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumbs a { display: block; width: 92px; height: 92px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }

.sms-compose { display: grid; gap: 8px; }
.sms-compose textarea { min-height: 76px; }
.sms-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.sms-count { font-size: 12px; color: var(--ink-3); }
.sms-test { font-size: 12.5px; color: var(--soon); background: var(--soon-bg); padding: 6px 10px; border-radius: var(--radius-sm); }
.sms-list { display: grid; gap: 8px; margin-top: 12px; }
.sms-item { font-size: 13px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.sms-item-meta { font-size: 12px; color: var(--ink-3); margin-bottom: 2px; }
.sms-item.is-fail { border-color: var(--brand-line); background: var(--urgent-bg); }

.hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.hist li { display: grid; grid-template-columns: 92px 1fr auto; gap: 10px; align-items: baseline; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.hist li:hover { background: var(--surface-2); }
.hist-date { font-size: 12.5px; color: var(--ink-3); }
.hist-what { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.repeat { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--info-bg); color: var(--info); font-size: 11.5px; font-weight: 700; }
.row-flag { display: inline-flex; align-items: center; gap: 4px; color: var(--brand); font-size: 12px; font-weight: 600; }
.row-flag .ico { width: 14px; height: 14px; }

/* ---------- Équipe ---------- */
.team { width: 100%; border-collapse: collapse; }
.team th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); background: var(--surface-2); padding: 10px 16px; border-bottom: 1px solid var(--line); }
.team td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.team tr:last-child td { border-bottom: 0; }
.team tr.is-off td { color: var(--ink-3); }
.team-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.team-actions .btn { height: 32px; padding: 0 10px; font-size: 13px; }
.role { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.role[data-r="admin"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.add-user { display: grid; grid-template-columns: 1fr 1.3fr 150px auto; gap: 10px; align-items: end; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.add-user label { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.add-user input { height: 38px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--radius); }
.add-user input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.pw-reveal { margin: 16px 20px; padding: 14px 16px; border-radius: var(--radius); background: var(--ok-bg); border: 1px solid #c5e9d2; display: grid; gap: 8px; }
.pw-reveal code { font-size: 17px; font-weight: 700; letter-spacing: .02em; color: var(--ink); }
.pw-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.alerts-row td { padding-top: 0; }
.alerts { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); }
.alerts-phone { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.alerts-phone input { height: 32px; width: 150px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); }
.alerts-phone input::placeholder { color: var(--ink-3); font-style: italic; }
.alerts-phone input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.check:has(input:disabled) { color: var(--ink-4); cursor: not-allowed; }
.alerts-note { padding: 12px 20px 16px; }
.alert-btn { border: 1px solid rgba(255,255,255,.14); background: transparent; color: var(--side-ink); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 12.5px; font-weight: 600; text-align: left; cursor: pointer; }
.alert-btn:hover { background: var(--side-hover); color: #fff; }

/* ---------- Appel en direct ---------- */
.live { position: fixed; top: 16px; right: 24px; z-index: var(--z-toast); display: grid; justify-items: end; gap: 8px; }
.live-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px;
  border: 0; background: var(--ink); color: #fff; font-weight: 600; box-shadow: var(--shadow-lg); cursor: pointer;
}
.live-pill[data-ended="true"] { background: #3b414b; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #ef4444; animation: pulse 1.4s ease-in-out infinite; }
.live-pill[data-ended="true"] .live-dot { background: #9aa0aa; animation: none; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .6); } 50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); } }
.live-panel { width: min(380px, calc(100vw - 32px)); max-height: 50vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 12px; }
.live-lines { display: grid; gap: 8px; font-size: 13px; }
.live-empty { color: var(--ink-3); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: var(--z-toast); display: grid; gap: 8px; justify-items: center; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius);
  background: var(--ink); color: #fff; font-weight: 500; box-shadow: var(--shadow-lg); animation: toastIn .22s var(--ease);
  max-width: min(520px, calc(100vw - 32px));
}
.toast button { border: 0; background: transparent; color: #fca5a5; font-weight: 700; cursor: pointer; padding: 0; }
.toast.is-error { background: var(--brand); }
.toast.is-error button { color: #fff; text-decoration: underline; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .act-grid { grid-template-columns: 1fr; }
  .prio-panel { order: -1; }
  .list-head { display: none; }
  .row {
    grid-template-columns: auto 1fr auto; grid-template-areas: "time who status" "time what what" "time tags tags";
    gap: 4px 14px; align-items: start; padding-top: 12px; padding-bottom: 12px;
  }
  .row-time { grid-area: time; }
  .row-who { grid-area: who; }
  .row-what { grid-area: what; }
  .row-cat { grid-area: tags; display: flex; gap: 10px; align-items: center; }
  .row-urg { display: none; }
  .row-urg-m { display: inline-flex; }
  .row-status { grid-area: status; }
}

@media (max-width: 860px) {
  body { font-size: 15px; }
  .shell { display: block; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .sidebar { display: none; }
  .mobile-bar {
    position: sticky; top: 0; z-index: var(--z-nav);
    display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 12px 0 16px;
    background: var(--side); color: var(--side-ink);
  }
  .mobile-bar img { height: 30px; width: auto; }
  .sync-compact { margin-left: auto; }
  .mobile-bar .me-logout { width: 44px; height: 44px; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-nav);
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .tabbar a {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    height: 60px; text-decoration: none; font-size: 12px; font-weight: 600; color: var(--ink-3);
  }
  .tabbar a[aria-current="page"] { color: var(--brand); }
  .tabbar .ico { width: 22px; height: 22px; }
  .tabbar .nav-count { position: absolute; top: 6px; left: calc(50% + 6px); margin: 0; background: var(--brand); color: #fff; }
  .main { padding: 18px 14px 32px; }
  .view-title { font-size: 20px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
  .kpi { padding: 14px 16px; }
  .kpi-value { font-size: 26px; }
  .panel-head, .panel-body { padding-left: 16px; padding-right: 16px; }
  .prio-item { padding: 12px 16px; }
  .hours { height: 140px; gap: 3px; }
  .hour-n { font-size: 10px; }
  .hour-h { font-size: 10px; }
  .search { max-width: none; flex-basis: 100%; }
  .toolbar .seg { flex: 1 1 auto; }
  .toolbar .seg button { flex: 1; }
  .select { flex: 1 1 140px; height: 44px; }
  .search input { height: 44px; }
  .btn { height: 44px; }
  .drawer { width: 100vw; }
  .d-actions .btn { flex: 1 1 auto; }
  .facts { grid-template-columns: 1fr 1fr; }
  .live { top: 64px; right: 12px; }
  .toasts { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .row { padding-left: 14px; padding-right: 14px; }
  .add-user { grid-template-columns: 1fr; padding: 14px 16px; }
  .team thead { display: none; }
  .team, .team tbody, .team tr, .team td { display: block; }
  .team tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .team td { padding: 2px 0; border: 0; }
  .team-actions { justify-content: flex-start; margin-top: 8px; }
  .hist li { grid-template-columns: 1fr auto; }
  .hist-date { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
