/* ============================================================================
   EMD Support - Theme (calque sur la charte EMDWeb-CRISE)
   Sombre par defaut, theme jour optionnel, lisibilite maximale (operateurs 50+).
   ========================================================================== */

:root {
  /* Couleurs de marque EMD */
  --emd-red:    #e53e3e;
  --emd-blue:   #3182ce;
  --emd-green:  #38a169;
  --emd-orange: #dd6b20;
  --emd-purple: #805ad5;
  --emd-yellow: #d69e2e;

  /* Fonds (sombre) */
  --primary-bg:   #0f1419;
  --secondary-bg: #1a1f2e;
  --tertiary-bg:  #252d3d;
  --accent-bg:    #2d3748;

  --text-primary:   #ffffff;
  --text-secondary: #cbd5e0;
  --text-muted:     #8a96a8;

  --border-color:  #2d3748;
  --border-accent: #4a5568;

  --success: #48bb78;
  --warning: #ed8936;
  --danger:  #f56565;
  --info:    #4299e1;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.25);
  --shadow-md: 0 4px 12px rgba(0,0,0,.30);
  --shadow-lg: 0 8px 25px rgba(0,0,0,.40);

  --radius:    10px;
  --radius-sm: 7px;
  --radius-lg: 16px;

  --sidebar-w: 264px;
  --topbar-h:  60px;

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

/* Theme jour */
html[data-theme="light"] {
  --primary-bg:   #eef2f9;
  --secondary-bg: #ffffff;
  --tertiary-bg:  #e8eef7;
  --accent-bg:    #dbe4f1;
  --text-primary:   #161a25;
  --text-secondary: #38415a;
  --text-muted:     #5b6884;
  --border-color:  #cdd8ea;
  --border-accent: #aebfda;
  --shadow-sm: 0 1px 3px rgba(20,30,60,.10);
  --shadow-md: 0 4px 12px rgba(20,30,60,.14);
  --shadow-lg: 0 8px 25px rgba(20,30,60,.20);
}

/* Tailles de police (accessibilite) : 1=0.9 / 2=1 / 3=1.12 / 4=1.25 */
html[data-fsize="1"] { font-size: 14.5px; }
html[data-fsize="2"] { font-size: 16px; }
html[data-fsize="3"] { font-size: 18px; }
html[data-fsize="4"] { font-size: 20px; }

/* ----------------------------------------------------------------- Base */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--primary-bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5rem; font-weight: 650; color: var(--text-primary); }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }

p { margin: 0 0 .75rem; }

/* Curseur main sur TOUS les elements cliquables (regle EMD) */
button, .btn, .nav-link, .pill, .tab, .chip, .clickable,
select, summary, [role="button"], .ticket-row, .kpi-card.clickable,
.notif-item, .filter-pill, .csat-face, .star {
  cursor: pointer;
}
button:disabled, .btn:disabled { cursor: not-allowed; opacity: .55; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-accent); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ----------------------------------------------------------------- Layout */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--secondary-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: .6rem;
  padding: 1rem 1.1rem;
  font-size: 1.2rem; font-weight: 750;
  border-bottom: 1px solid var(--border-color);
}
.sidebar-brand .logo-badge {
  width: 52px; height: 34px;
  object-fit: contain; object-position: left center;
}
.sidebar-brand small { display: block; font-size: .72rem; color: var(--text-muted); font-weight: 500; }

.nav-menu { padding: .6rem; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: .7rem;
  padding: .7rem .85rem; margin-bottom: .2rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary); font-weight: 550;
  border: none; background: none; width: 100%; text-align: left;
  font-size: 1rem;
}
.nav-link i { font-size: 1.15rem; width: 1.4rem; text-align: center; }
.nav-link:hover { background: var(--tertiary-bg); color: var(--text-primary); text-decoration: none; }
.nav-link.active { background: var(--emd-red); color: #fff; }
.nav-link .badge-count {
  margin-left: auto; background: var(--emd-red); color: #fff;
  border-radius: 20px; padding: 0 .5rem; font-size: .78rem; font-weight: 700;
}
.nav-link.active .badge-count { background: rgba(255,255,255,.25); }
.nav-section { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); padding: .9rem .9rem .35rem; font-weight: 700; }

.sidebar-footer { padding: .8rem; border-top: 1px solid var(--border-color); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.3rem;
  background: var(--secondary-bg);
  border-bottom: 1px solid var(--border-color);
  position: sticky; top: 0; z-index: 30;
}
.topbar .page-title { font-size: 1.15rem; font-weight: 700; }
.topbar .spacer { flex: 1; }

.content { padding: 1.4rem; max-width: 1400px; width: 100%; }

/* ----------------------------------------------------------------- Boutons */

.btn {
  display: inline-flex; align-items: center; gap: .5rem; justify-content: center;
  padding: .6rem 1.05rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 1rem; font-weight: 600; font-family: inherit;
  background: var(--tertiary-bg); color: var(--text-primary);
  transition: filter .12s, background .12s, transform .04s;
}
.btn i { font-size: 1.05em; }
.btn:hover { filter: brightness(1.12); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary  { background: var(--emd-red); color: #fff; }
.btn-blue     { background: var(--emd-blue); color: #fff; }
.btn-secondary{ background: var(--accent-bg); color: var(--text-primary); border-color: var(--border-accent); }
.btn-success  { background: var(--success); color: #06210f; }
.btn-danger   { background: var(--danger); color: #2a0606; }
.btn-ghost    { background: transparent; color: var(--text-secondary); border-color: var(--border-color); }
.btn-ghost:hover { background: var(--tertiary-bg); }
.btn-lg { padding: .85rem 1.5rem; font-size: 1.12rem; }
.btn-sm { padding: .4rem .7rem; font-size: .88rem; }
.btn-block { width: 100%; }
.btn-icon { padding: .5rem .6rem; }

/* ----------------------------------------------------------------- Cartes */

.card {
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-head {
  padding: .9rem 1.1rem; border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; gap: .6rem;
  font-weight: 700; font-size: 1.05rem;
}
.card-head .spacer { flex: 1; }
.card-body { padding: 1.1rem; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px)  { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* KPI */
.kpi-card {
  background: var(--secondary-bg); border: 1px solid var(--border-color);
  border-radius: var(--radius); padding: 1.1rem 1.2rem;
  display: flex; flex-direction: column; gap: .25rem;
}
.kpi-card .kpi-value { font-size: 2rem; font-weight: 800; line-height: 1; }
.kpi-card .kpi-label { color: var(--text-muted); font-size: .9rem; font-weight: 600; }
.kpi-card .kpi-icon { font-size: 1.3rem; opacity: .8; }
.kpi-card.accent-red .kpi-value { color: var(--emd-red); }
.kpi-card.accent-blue .kpi-value { color: var(--emd-blue); }
.kpi-card.accent-green .kpi-value { color: var(--success); }
.kpi-card.accent-orange .kpi-value { color: var(--warning); }

/* ----------------------------------------------------------------- Badges */

.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .6rem; border-radius: 20px;
  font-size: .8rem; font-weight: 700; line-height: 1.4;
}
.badge-info    { background: rgba(66,153,225,.18); color: #63b3ed; }
.badge-primary { background: rgba(49,130,206,.20); color: #63b3ed; }
.badge-warning { background: rgba(237,137,54,.18); color: #f6ad55; }
.badge-success { background: rgba(72,187,120,.18); color: #68d391; }
.badge-muted   { background: rgba(138,150,168,.18); color: #a0aec0; }
.badge-danger  { background: rgba(245,101,101,.18); color: #fc8181; }

/* Priorites */
.prio { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; font-size: .85rem; }
.prio::before { content: ''; width: .7rem; height: .7rem; border-radius: 50%; }
.prio-1 { color: #fc8181; } .prio-1::before { background: #f56565; }
.prio-2 { color: #f6ad55; } .prio-2::before { background: #ed8936; }
.prio-3 { color: #63b3ed; } .prio-3::before { background: #4299e1; }
.prio-4 { color: #a0aec0; } .prio-4::before { background: #718096; }
.prio-5 { color: #8a96a8; } .prio-5::before { background: #4a5568; }

.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  background: var(--tertiary-bg); border: 1px solid var(--border-color);
  padding: .15rem .55rem; border-radius: 20px; font-size: .8rem; color: var(--text-secondary);
}

/* ----------------------------------------------------------------- Formulaires */

.field { margin-bottom: 1rem; }
.field label { display: block; margin-bottom: .35rem; font-weight: 600; font-size: .92rem; color: var(--text-secondary); }
.field .hint { font-size: .82rem; color: var(--text-muted); margin-top: .25rem; }

.input, .textarea, .select, input[type="text"], input[type="password"],
input[type="email"], input[type="number"], input[type="date"], textarea, select {
  width: 100%;
  padding: .65rem .8rem;
  background: var(--primary-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1rem; font-family: inherit;
}
.input:focus, .textarea:focus, .select:focus,
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--emd-blue);
  box-shadow: 0 0 0 3px rgba(49,130,206,.25);
}
textarea { resize: vertical; min-height: 96px; }
.input-row { display: flex; gap: .8rem; flex-wrap: wrap; }
.input-row > * { flex: 1; min-width: 180px; }

.required::after { content: ' *'; color: var(--emd-red); }

/* ----------------------------------------------------------------- Tableaux */

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .7rem .8rem; text-align: left; border-bottom: 1px solid var(--border-color); }
.table th { color: var(--text-muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; font-weight: 700; }
.table tbody tr:hover { background: var(--tertiary-bg); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Liste de tickets */
.ticket-row { display: grid; grid-template-columns: auto 1fr auto; gap: .9rem; align-items: center;
  padding: .85rem 1rem; border-bottom: 1px solid var(--border-color); }
.ticket-row:hover { background: var(--tertiary-bg); }
.ticket-row .ref { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: .85rem; font-weight: 600; }
.ticket-row .subject { font-weight: 600; }
.ticket-row .meta { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .25rem; }

/* ============================================================================
   BLOC TEMPS PASSE - le coeur du produit, mis en avant et tres lisible
   ========================================================================== */

.time-panel {
  background: linear-gradient(160deg, var(--secondary-bg), var(--tertiary-bg));
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.time-panel-head {
  display: flex; align-items: center; gap: .7rem;
  padding: 1rem 1.2rem; border-bottom: 1px solid var(--border-color);
  font-weight: 750; font-size: 1.1rem;
}
.time-panel-head i { color: var(--emd-red); font-size: 1.3rem; }
.time-total {
  text-align: center; padding: 1.4rem 1rem;
}
.time-total .big {
  font-size: 2.8rem; font-weight: 850; line-height: 1;
  color: #fff; font-variant-numeric: tabular-nums;
}
.time-total .label { color: var(--text-muted); font-weight: 600; margin-top: .35rem; }
.time-note {
  background: rgba(49,130,206,.10); border-top: 1px solid var(--border-color);
  padding: .8rem 1.2rem; font-size: .9rem; color: var(--text-secondary);
  display: flex; gap: .6rem; align-items: flex-start;
}
.time-note i { color: var(--emd-blue); margin-top: .15rem; }

.time-entries { list-style: none; margin: 0; padding: 0; }
.time-entry {
  display: grid; grid-template-columns: auto 1fr auto; gap: .8rem; align-items: start;
  padding: .8rem 1.2rem; border-top: 1px solid var(--border-color);
}
.time-entry .te-date { color: var(--text-muted); font-size: .85rem; min-width: 92px; }
.time-entry .te-desc { font-size: .95rem; }
.time-entry .te-who { color: var(--text-secondary); font-size: .82rem; margin-top: .2rem; }
.time-entry .te-dur { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 1.05rem; }
.te-billable { font-size: .72rem; font-weight: 700; padding: .1rem .45rem; border-radius: 6px; }
.te-billable.inc { background: rgba(72,187,120,.18); color: #68d391; }
.te-billable.bill { background: rgba(237,137,54,.18); color: #f6ad55; }
.te-internal { background: rgba(128,90,213,.12); }

/* Chronometre (cote agent) */
.timer-box { display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem;
  background: var(--primary-bg); border: 1px dashed var(--border-accent); border-radius: var(--radius); }
.timer-display { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--emd-green); }
.timer-running .timer-display { color: var(--emd-red); }

/* ----------------------------------------------------------------- Timeline / fil */

.thread { display: flex; flex-direction: column; gap: 1rem; }
.message {
  border: 1px solid var(--border-color); border-radius: var(--radius);
  background: var(--secondary-bg); overflow: hidden;
}
.message.from-emd { border-left: 3px solid var(--emd-red); }
.message.from-client { border-left: 3px solid var(--emd-blue); }
.message.internal { border-left: 3px solid var(--emd-purple); background: rgba(128,90,213,.07); }
.message-head { display: flex; align-items: center; gap: .6rem; padding: .65rem .9rem;
  border-bottom: 1px solid var(--border-color); font-size: .9rem; }
.message-head .who { font-weight: 700; }
.message-head .when { color: var(--text-muted); margin-left: auto; font-size: .82rem; }
.message-body { padding: .9rem; white-space: pre-wrap; }
.internal-tag { background: var(--emd-purple); color: #fff; font-size: .7rem; font-weight: 700;
  padding: .1rem .45rem; border-radius: 6px; }

.event-line { display: flex; gap: .6rem; align-items: center; color: var(--text-muted);
  font-size: .85rem; padding: .35rem 0; }
.event-line i { color: var(--border-accent); }

.attachment {
  display: inline-flex; align-items: center; gap: .45rem;
  background: var(--tertiary-bg); border: 1px solid var(--border-color);
  padding: .4rem .7rem; border-radius: var(--radius-sm); font-size: .88rem; margin: .2rem .3rem .2rem 0;
}

/* ----------------------------------------------------------------- Filtres */

.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filter-pill {
  padding: .4rem .85rem; border-radius: 20px; font-weight: 600; font-size: .9rem;
  background: var(--secondary-bg); border: 1px solid var(--border-color); color: var(--text-secondary);
}
.filter-pill.active { background: var(--emd-red); color: #fff; border-color: var(--emd-red); }
.search-box { position: relative; flex: 1; min-width: 220px; max-width: 380px; }
.search-box i { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-box input { padding-left: 2.2rem; }

/* ----------------------------------------------------------------- Cloche notifs */

.notif-bell { position: relative; }
.notif-bell .dot {
  position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px;
  background: var(--emd-red); color: #fff; border-radius: 10px; font-size: .7rem; font-weight: 800;
  display: grid; place-items: center; padding: 0 4px;
}
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: 360px; max-height: 460px; overflow-y: auto;
  background: var(--secondary-bg); border: 1px solid var(--border-accent); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); z-index: 50;
}
.notif-item { padding: .75rem .9rem; border-bottom: 1px solid var(--border-color); display: flex; gap: .6rem; }
.notif-item:hover { background: var(--tertiary-bg); }
.notif-item.unread { background: rgba(229,62,62,.07); }
.notif-item .nt-msg { font-size: .9rem; }
.notif-item .nt-when { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; }

/* ----------------------------------------------------------------- User pill */

.user-pill { display: flex; align-items: center; gap: .55rem; padding: .35rem .6rem; border-radius: 20px; background: var(--tertiary-bg); }
.user-pill .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--emd-blue); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.user-pill .uname { font-weight: 650; font-size: .9rem; }
.user-pill .urole { font-size: .75rem; color: var(--text-muted); }

/* ----------------------------------------------------------------- Selecteur de langue */

.lang-select { position: relative; }
.lang-select .lang-btn,
.lang-select .lang-btn * { cursor: pointer; }
.lang-select .lang-btn {
  display: flex; align-items: center; gap: .4rem; padding: .35rem .6rem;
  font-weight: 650; font-size: .85rem; letter-spacing: .02em;
}
.lang-select .flag {
  width: 21px; height: 14px; object-fit: cover; border-radius: 2px;
  border: 1px solid var(--border-accent); flex: none;
}
.lang-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 190px; max-height: 70vh; overflow-y: auto; padding: .3rem;
  background: var(--secondary-bg); border: 1px solid var(--border-accent);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 60;
}
.lang-select.open .lang-menu { display: block; }
.lang-menu a,
.lang-menu a * { cursor: pointer; }
.lang-menu a {
  display: flex; align-items: center; gap: .6rem; padding: .5rem .65rem;
  border-radius: var(--radius); color: var(--text-secondary);
  text-decoration: none; font-size: .92rem;
}
.lang-menu a:hover { background: var(--tertiary-bg); color: var(--text-primary); }
.lang-menu a.active { color: var(--text-primary); font-weight: 700; background: var(--tertiary-bg); }

/* Sens d'ecriture inverse (arabe, hebreu) : le menu s'ouvre a gauche. */
[dir="rtl"] .lang-menu { right: auto; left: 0; }

/* ----------------------------------------------------------------- Modales */

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: grid; place-items: center; z-index: 1000; padding: 1rem;
  opacity: 0; transition: opacity .18s;
}
.modal-overlay.show { opacity: 1; }
.modal-box {
  background: var(--secondary-bg); border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg); width: 100%; max-width: 560px; max-height: 88vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  transform: translateY(8px) scale(.99); transition: transform .18s;
}
.modal-overlay.show .modal-box { transform: none; }
.modal-box.wide { max-width: 820px; }
.modal-head { display: flex; align-items: center; padding: 1rem 1.2rem; border-bottom: 1px solid var(--border-color); }
.modal-head h3 { margin: 0; flex: 1; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.6rem; line-height: 1; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 1.2rem; overflow-y: auto; }
.modal-foot { padding: .9rem 1.2rem; border-top: 1px solid var(--border-color); display: flex; gap: .6rem; justify-content: flex-end; }

/* ----------------------------------------------------------------- Toasts */

.toast-host { position: fixed; bottom: 1.2rem; right: 1.2rem; display: flex; flex-direction: column; gap: .6rem; z-index: 2000; }
.toast {
  min-width: 260px; max-width: 380px; padding: .85rem 1.1rem; border-radius: var(--radius);
  background: var(--accent-bg); color: var(--text-primary); box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--info); font-weight: 550;
  opacity: 0; transform: translateX(20px); transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: none; }
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-info { border-left-color: var(--info); }

/* ----------------------------------------------------------------- CSAT */

.csat { display: flex; gap: .6rem; justify-content: center; }
.csat-face {
  font-size: 2.2rem; background: none; border: 2px solid transparent; border-radius: 50%;
  width: 56px; height: 56px; display: grid; place-items: center; filter: grayscale(.6); opacity: .7;
  transition: transform .1s, filter .1s, opacity .1s;
}
.csat-face:hover, .csat-face.selected { filter: none; opacity: 1; transform: scale(1.12); border-color: var(--emd-red); }

.stars { display: inline-flex; gap: .15rem; }
.star { color: var(--border-accent); font-size: 1.1rem; }
.star.on { color: var(--emd-yellow); }

/* ----------------------------------------------------------------- Divers */

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 2.6rem; display: block; margin-bottom: .6rem; opacity: .6; }

.muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap { gap: .6rem; }
.spacer { flex: 1; }
.mt { margin-top: 1rem; } .mb { margin-bottom: 1rem; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }

.spinner {
  width: 36px; height: 36px; border: 3px solid var(--border-color);
  border-top-color: var(--emd-red); border-radius: 50%; animation: spin .8s linear infinite; margin: 2rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive : sidebar repliable */
.menu-toggle { display: none; }
@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 100; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-flex; }
}

/* ============================================================================
   Parc technique du client (sites -> murs -> machines)
   Fiches en paires libelle / valeur : lisibilite avant densite.
   ========================================================================== */

.parc-totals {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .8rem; margin-top: .9rem;
}
.parc-total {
  display: flex; align-items: center; gap: .7rem;
  background: var(--tertiary-bg); border: 1px solid var(--border-color);
  border-radius: var(--radius); padding: .8rem 1rem;
}
.parc-total i { font-size: 1.5rem; color: var(--emd-blue); }
.parc-total-n { font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.parc-total-l { font-size: .85rem; color: var(--text-muted); }

.parc-site-name { font-weight: 700; }
.parc-site-infos { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.parc-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  background: var(--tertiary-bg); border: 1px solid var(--border-color);
  border-radius: 999px; padding: .3rem .8rem; font-size: .9rem; color: var(--text-secondary);
}
.parc-chip i { color: var(--text-muted); }

.parc-section-title {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 700; margin: 1.1rem 0 .6rem; padding-top: .8rem;
  border-top: 1px solid var(--border-color);
}
.parc-section-title i { color: var(--emd-blue); }

.parc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: .8rem; }
.parc-item {
  background: var(--tertiary-bg); border: 1px solid var(--border-color);
  border-radius: var(--radius); padding: .9rem 1rem;
}
.parc-item-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.parc-item-head i { color: var(--emd-blue); }
.parc-item-head .spacer { flex: 1; }
.parc-item-actions { display: inline-flex; gap: .35rem; }

.parc-pairs { display: flex; flex-direction: column; gap: .35rem; }
.parc-pair { display: flex; gap: .6rem; align-items: baseline; }
.parc-pair-k { color: var(--text-muted); min-width: 8.5rem; flex-shrink: 0; font-size: .9rem; }
.parc-pair-v { color: var(--text-primary); font-weight: 600; word-break: break-word; }

.parc-none { color: var(--text-muted); font-style: italic; padding: .3rem 0 .2rem; }

/* Formulaires du parc (modales) */
.parc-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.parc-form-sep {
  font-weight: 700; color: var(--emd-blue); margin: 1rem 0 .5rem;
  padding-top: .8rem; border-top: 1px solid var(--border-color);
}

@media (max-width: 700px) {
  .parc-form-row { grid-template-columns: 1fr; }
  .parc-pair { flex-direction: column; gap: 0; }
  .parc-pair-k { min-width: 0; }
}

/* Fiche technique de la machine concernee par un ticket (parc client) */
.asset-card {
  background: var(--tertiary-bg); border: 1px solid var(--border-color);
  border-radius: var(--radius); padding: .8rem 1rem;
}
.asset-card-head {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  font-weight: 700; margin-bottom: .6rem;
  padding-bottom: .5rem; border-bottom: 1px solid var(--border-color);
}
.asset-card-head i { color: var(--emd-blue); }
.asset-card .info-grid { margin: 0; }

/* Invitation a renseigner le parc (tableau de bord client, referent seulement) */
.parc-banner {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--secondary-bg); border: 1px solid var(--border-accent);
  border-left: 4px solid var(--emd-blue);
  border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1rem;
}
.parc-banner > i { font-size: 1.8rem; color: var(--emd-blue); }
.parc-banner-txt { flex: 1; min-width: 220px; }
.parc-banner-txt strong { font-size: 1.05rem; }
.parc-banner-txt div { color: var(--text-muted); margin-top: .2rem; }

/* Astuce d'import du releve EMDWallAgent dans le parc */
.parc-tip {
  display: flex; align-items: flex-start; gap: .5rem;
  background: var(--tertiary-bg); border: 1px dashed var(--border-accent);
  border-radius: var(--radius); padding: .6rem .9rem; margin: .6rem 0 0;
  color: var(--text-secondary); font-size: .92rem;
}
.parc-tip i { color: var(--emd-yellow); margin-top: .15rem; }
