/* =============================================================================
 * ÉCHAF' BELLEVILLE — Multi-outil Feuilles de calcul — styles.css
 * Design sombre/technique, accent orange ambré. Aucune dépendance externe.
 * ===========================================================================*/

/* --------------------------------------------------------------- TOKENS --- */
:root {
  --bg:        #0a0b0d;
  --bg-grain:  #0d0f12;
  --panel:     #14171c;
  --panel-2:   #181c22;
  --panel-3:   #1e232b;
  --line:      rgba(255,255,255,.08);
  --line-2:    rgba(255,255,255,.14);
  --text:      #e9ebee;
  --muted:     #9aa1ab;
  --muted-2:   #6b727c;

  --accent:    #ff7a18;
  --accent-2:  #ffb02e;
  --accent-grad: linear-gradient(100deg, #ff7a18, #ffb02e);
  --accent-soft: rgba(255,138,35,.14);

  --ok:    #2dc46a;  --ok-soft:   rgba(45,196,106,.14);
  --warn:  #ffb02e;  --warn-soft: rgba(255,176,46,.14);
  --danger:#ff5762;  --danger-soft: rgba(255,87,98,.14);
  --info:  #4aa3ff;  --info-soft: rgba(74,163,255,.14);

  --radius:   14px;
  --radius-sm:10px;
  --radius-xs:8px;
  --shadow:   0 18px 50px -28px rgba(0,0,0,.85);
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", "Consolas", monospace;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  --sidebar-w: 264px;
  --topbar-h: 58px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 78% -10%, rgba(255,138,35,.10), transparent 60%),
    radial-gradient(900px 500px at -5% 8%, rgba(74,163,255,.05), transparent 55%),
    var(--bg);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
/* trame pointillée subtile (rappel du site) */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: radial-gradient(rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 26px 26px; opacity: .7;
}
h1,h2,h3,h4 { margin: 0; font-weight: 700; letter-spacing: .01em; }
a { color: var(--accent-2); text-decoration: none; }
button { font-family: inherit; }

/* ------------------------------------------------------------- LAYOUT ----- */
.eb-app { position: relative; z-index: 1; display: grid;
  grid-template-columns: var(--sidebar-w) 1fr; grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas: "brand top" "side main"; min-height: 100vh; }

.eb-topbar { grid-area: top; display: flex; align-items: center; gap: 16px;
  padding: 0 22px; border-bottom: 1px solid var(--line); background: rgba(12,14,17,.72);
  backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20; }
.eb-brandbar { grid-area: brand; display: flex; align-items: center; gap: 11px;
  padding: 0 18px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
  background: rgba(12,14,17,.72); backdrop-filter: blur(10px); }

.eb-logo { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent-grad); color: #1a1206; font-weight: 900; font-size: 15px;
  box-shadow: 0 0 0 1px rgba(255,176,46,.5), 0 8px 22px -8px rgba(255,138,35,.7); letter-spacing: -1px; }
.eb-logo span { opacity: .55; }
.eb-brandtext b { font-size: 14px; letter-spacing: .06em; display: block; line-height: 1.05; }
.eb-brandtext small { font-size: 10px; color: var(--muted); letter-spacing: .14em; text-transform: uppercase; }

.eb-sidebar { grid-area: side; border-right: 1px solid var(--line); background: rgba(15,17,21,.6);
  overflow-y: auto; padding: 14px 12px 40px; }
.eb-side-group { margin-bottom: 18px; }
.eb-side-group > h4 { font-size: 10.5px; text-transform: uppercase; letter-spacing: .16em;
  color: var(--muted-2); padding: 4px 10px 8px; }
.eb-navitem { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  background: transparent; border: 1px solid transparent; color: var(--muted);
  padding: 9px 11px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13.5px;
  transition: background .14s, color .14s, border-color .14s; margin-bottom: 2px; }
.eb-navitem:hover { background: var(--panel); color: var(--text); }
.eb-navitem.is-active { background: var(--accent-soft); color: #fff; border-color: rgba(255,138,35,.35); }
.eb-navitem .eb-nav-ico { width: 20px; height: 20px; flex: none; display: grid; place-items: center; color: var(--accent-2); }
.eb-navitem.is-active .eb-nav-ico { color: var(--accent-2); }
.eb-navitem .eb-nav-ico svg { width: 18px; height: 18px; }

.eb-main { grid-area: main; overflow-y: auto; padding: 22px clamp(16px, 3vw, 34px) 80px; }
.eb-main-inner { max-width: 1180px; margin: 0 auto; }

/* topbar meta */
.eb-meta-fields { display: flex; gap: 10px; align-items: center; flex: 1; flex-wrap: wrap; }
.eb-meta-fields .eb-mini { display: flex; flex-direction: column; }
.eb-meta-fields .eb-mini label { font-size: 9px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted-2); }
.eb-meta-fields .eb-mini input { background: transparent; border: none; border-bottom: 1px solid var(--line);
  color: var(--text); font-size: 12.5px; padding: 2px 2px; width: 130px; }
.eb-meta-fields .eb-mini input:focus { outline: none; border-color: var(--accent); }
.eb-topbar-actions { display: flex; gap: 8px; margin-left: auto; }

/* --------------------------------------------------------- TOOL HEADER ---- */
.eb-tool-head { margin-bottom: 18px; }
.eb-tool-head .eb-eyebrow { color: var(--accent-2); font-size: 11px; letter-spacing: .18em;
  text-transform: uppercase; font-weight: 700; }
.eb-tool-head h1 { font-size: clamp(22px, 3vw, 30px); margin-top: 4px; }
.eb-tool-head p { color: var(--muted); margin: 6px 0 0; max-width: 70ch; }

/* ------------------------------------------------------------- WORKSPACE -- */
.eb-workspace { display: grid; grid-template-columns: minmax(330px, 420px) 1fr; gap: 18px; align-items: start; }
.eb-ws-inputs { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 14px; }
.eb-ws-results { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ---------------------------------------------------------------- CARD ---- */
.eb-card { background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.eb-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--line); }
.eb-card-head h3 { font-size: 14px; letter-spacing: .03em; }
.eb-card-sub { font-size: 12px; color: var(--muted); margin: 3px 0 0; }
.eb-card-actions { display: flex; gap: 8px; flex: none; }
.eb-card-body { padding: 16px; }

.eb-grid { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0,1fr)); gap: 12px; }

/* --------------------------------------------------------------- FIELDS --- */
.eb-field { display: flex; flex-direction: column; gap: 5px; }
.eb-field--full { grid-column: 1 / -1; }
.eb-field-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.eb-field-label label { font-size: 12px; color: var(--muted); font-weight: 600; }
.eb-input { width: 100%; background: var(--bg-grain); border: 1px solid var(--line-2);
  color: var(--text); border-radius: var(--radius-xs); padding: 9px 11px; font-size: 14px;
  font-variant-numeric: tabular-nums; transition: border-color .14s, box-shadow .14s; }
.eb-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.eb-input { appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 17px, calc(100% - 13px) 17px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.eb-input-unit { display: flex; align-items: stretch; }
.eb-input-unit .eb-input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.eb-unit { display: grid; place-items: center; padding: 0 11px; font-size: 12px; color: var(--muted);
  background: var(--panel-3); border: 1px solid var(--line-2); border-left: none;
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0; font-variant-numeric: tabular-nums; }
.eb-hint { font-size: 11.5px; color: var(--muted-2); margin: 1px 0 0; line-height: 1.35; }

/* toggle */
.eb-toggle { display: inline-flex; align-items: center; cursor: pointer; }
.eb-toggle-cb { position: absolute; opacity: 0; pointer-events: none; }
.eb-toggle-track { width: 40px; height: 23px; border-radius: 99px; background: var(--panel-3);
  border: 1px solid var(--line-2); position: relative; transition: background .16s; }
.eb-toggle-thumb { position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%;
  background: var(--muted); transition: transform .16s, background .16s; }
.eb-toggle-cb:checked + .eb-toggle-track { background: var(--accent-soft); border-color: var(--accent); }
.eb-toggle-cb:checked + .eb-toggle-track .eb-toggle-thumb { transform: translateX(17px); background: var(--accent-2); }
.eb-toggle-cb:focus-visible + .eb-toggle-track { box-shadow: 0 0 0 3px var(--accent-soft); }
.eb-field-inline { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-bottom: 1px dashed var(--line); }
.eb-field-inline:last-child { border-bottom: none; }
.eb-field-inline > span { font-size: 13px; color: var(--text); }

/* --------------------------------------------------------------- BUTTONS -- */
.eb-btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; font-size: 13px;
  font-weight: 600; border-radius: var(--radius-xs); cursor: pointer; transition: all .14s;
  background: var(--panel-3); color: var(--text); border: 1px solid var(--line-2); }
.eb-btn:hover { border-color: var(--line-2); background: #232831; transform: translateY(-1px); }
.eb-btn:active { transform: translateY(0); }
.eb-btn--primary { background: var(--accent-grad); color: #1a1206; border-color: transparent; box-shadow: 0 8px 22px -10px rgba(255,138,35,.8); }
.eb-btn--primary:hover { background: var(--accent-grad); filter: brightness(1.06); }
.eb-btn--ghost { background: transparent; }
.eb-btn--sm { padding: 6px 10px; font-size: 12px; }
.eb-btn-ico { display: grid; place-items: center; }
.eb-btn-ico svg { width: 15px; height: 15px; }

/* ----------------------------------------------------------------- KPI ---- */
.eb-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr)); gap: 12px; }
.eb-kpi { background: var(--bg-grain); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 13px 15px; position: relative; overflow: hidden; }
.eb-kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent-grad); opacity: .8; }
.eb-kpi-val { font-size: 23px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.eb-kpi-unit { font-size: 12px; color: var(--muted); font-weight: 600; }
.eb-kpi-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-top: 3px; }
.eb-kpi--ok::after { background: var(--ok); } .eb-kpi--warn::after { background: var(--warn); }
.eb-kpi--danger::after { background: var(--danger); } .eb-kpi--info::after { background: var(--info); }

/* ------------------------------------------------------------ RESULT ROW -- */
.eb-rrow { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px dashed var(--line); }
.eb-rrow:last-child { border-bottom: none; }
.eb-rrow-l { font-size: 13px; color: var(--muted); }
.eb-rrow-v { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 8px; }
.eb-rrow-u { font-size: 12px; color: var(--muted); font-weight: 500; }
.eb-rrow--ok .eb-rrow-v { color: var(--ok); } .eb-rrow--warn .eb-rrow-v { color: var(--warn); }
.eb-rrow--danger .eb-rrow-v { color: var(--danger); }

/* --------------------------------------------------------------- BADGES --- */
.eb-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700;
  padding: 2px 9px; border-radius: 99px; letter-spacing: .02em; white-space: nowrap; }
.eb-badge--ok { background: var(--ok-soft); color: var(--ok); }
.eb-badge--warn { background: var(--warn-soft); color: var(--warn); }
.eb-badge--danger { background: var(--danger-soft); color: var(--danger); }
.eb-badge--info { background: var(--info-soft); color: var(--info); }
.eb-badge--neutral { background: var(--panel-3); color: var(--muted); }

/* --------------------------------------------------------------- TABLES --- */
.eb-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.eb-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.eb-table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted-2); padding: 9px 12px; background: var(--bg-grain); border-bottom: 1px solid var(--line); position: sticky; top: 0; }
.eb-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.eb-table tr:last-child td { border-bottom: none; }
.eb-table tbody tr:hover { background: rgba(255,255,255,.02); }
.eb-table .ta-right { text-align: right; } .eb-table .ta-center { text-align: center; }
.eb-table tfoot td { font-weight: 800; background: var(--bg-grain); border-top: 2px solid var(--line-2); }
.eb-table .eb-cat-row td { background: var(--panel-3); font-weight: 700; color: var(--accent-2);
  text-transform: uppercase; font-size: 11px; letter-spacing: .06em; }

/* --------------------------------------------------------------- ALERTS --- */
.eb-alert { border-radius: var(--radius-sm); padding: 12px 14px; border: 1px solid var(--line);
  font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.eb-alert-title { font-weight: 700; font-size: 13px; }
.eb-alert-body { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.eb-alert--ok { background: var(--ok-soft); border-color: rgba(45,196,106,.3); }
.eb-alert--ok .eb-alert-title { color: var(--ok); }
.eb-alert--warn { background: var(--warn-soft); border-color: rgba(255,176,46,.3); }
.eb-alert--warn .eb-alert-title { color: var(--warn); }
.eb-alert--danger { background: var(--danger-soft); border-color: rgba(255,87,98,.35); }
.eb-alert--danger .eb-alert-title { color: var(--danger); }
.eb-alert--info { background: var(--info-soft); border-color: rgba(74,163,255,.3); }
.eb-alert--info .eb-alert-title { color: var(--info); }

/* ------------------------------------------------------- HOME / DASHBOARD - */
.eb-hero { background: linear-gradient(120deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 28px; margin-bottom: 20px;
  position: relative; overflow: hidden; box-shadow: var(--shadow); }
.eb-hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(255,138,35,.20), transparent 65%); }
.eb-hero h1 { font-size: clamp(26px, 4vw, 40px); line-height: 1.05; }
.eb-hero h1 .eb-amber { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.eb-hero p { color: var(--muted); max-width: 64ch; margin: 12px 0 0; font-size: 15px; }
.eb-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 14px; }
.eb-tile { text-align: left; background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s; display: flex; flex-direction: column; gap: 9px; }
.eb-tile:hover { transform: translateY(-3px); border-color: rgba(255,138,35,.4); box-shadow: 0 22px 50px -30px rgba(255,138,35,.5); }
.eb-tile-ico { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-2); border: 1px solid rgba(255,138,35,.25); }
.eb-tile-ico svg { width: 22px; height: 22px; }
.eb-tile h3 { font-size: 15px; letter-spacing: .02em; }
.eb-tile p { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.eb-tile .eb-tile-go { margin-top: auto; font-size: 11px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent-2); font-weight: 700; display: flex; align-items: center; gap: 6px; }

/* liens vers les outils existants */
.eb-extlinks { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.eb-extlink { display: flex; align-items: center; gap: 9px; padding: 11px 15px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--panel); color: var(--text); font-size: 13px; transition: border-color .15s; }
.eb-extlink:hover { border-color: var(--line-2); }
.eb-extlink b { font-weight: 700; } .eb-extlink span { color: var(--muted); font-size: 12px; }

.eb-twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* divider / helper text */
.eb-disclaimer { font-size: 11.5px; color: var(--muted-2); line-height: 1.5; border-top: 1px solid var(--line);
  padding-top: 12px; margin-top: 4px; }
.eb-source-tag { font-size: 10.5px; color: var(--muted-2); letter-spacing: .04em; }

/* checklist (R408) */
.eb-check { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.eb-check:last-child { border-bottom: none; }
.eb-check-states { display: flex; gap: 4px; flex: none; }
.eb-check-btn { width: 30px; height: 26px; border-radius: 6px; border: 1px solid var(--line-2);
  background: var(--bg-grain); color: var(--muted-2); font-size: 11px; font-weight: 700; cursor: pointer; }
.eb-check-btn.is-c { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.eb-check-btn.is-nc { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.eb-check-btn.is-na { background: var(--panel-3); color: var(--muted); border-color: var(--line-2); }
.eb-check-label { font-size: 13px; padding-top: 3px; }

/* ----------------------------------------------------------- ASSISTANT ---- */
.eb-assistant { display: flex; flex-direction: column; gap: 16px; max-width: 880px; }
.eb-assistant-ta { width: 100%; resize: vertical; min-height: 96px; line-height: 1.5;
  font-family: inherit; font-size: 14.5px; }
.eb-assistant-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.eb-assistant-actions .eb-hint { margin: 0; }
.eb-assistant-privacy { font-size: 11.5px; line-height: 1.45; color: var(--muted); margin: 12px 0 0;
  padding: 9px 12px; border-radius: var(--radius-xs); background: var(--warn-soft);
  border: 1px solid rgba(255,176,46,.3); }
.eb-assistant-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.eb-chip { text-align: left; font-size: 12px; color: var(--muted); background: var(--bg-grain);
  border: 1px solid var(--line); border-radius: 99px; padding: 6px 13px; cursor: pointer;
  transition: color .14s, border-color .14s, background .14s; max-width: 100%; }
.eb-chip:hover { color: var(--text); border-color: rgba(255,138,35,.4); background: var(--accent-soft); }

.eb-assistant-understood { font-size: 15.5px; color: var(--text); line-height: 1.5; margin: 0; }
.eb-assistant-meta { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }
.eb-assistant-go { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; }

.eb-assistant-loading { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13.5px; }
.eb-spinner { width: 18px; height: 18px; flex: none; border-radius: 50%;
  border: 2px solid var(--line-2); border-top-color: var(--accent); animation: eb-spin .7s linear infinite; }
.eb-btn.is-busy { opacity: .7; pointer-events: none; }
@keyframes eb-spin { to { transform: rotate(360deg); } }

.eb-list { margin: 4px 0 0; padding-left: 18px; }
.eb-list li { margin: 2px 0; }

/* Accueil : assistant en vedette */
.eb-home-hero .eb-eyebrow { color: var(--accent-2); font-size: 11px; letter-spacing: .18em;
  text-transform: uppercase; font-weight: 700; }
.eb-home-hero h1 { margin-top: 6px; }
.eb-home-ask { margin-top: 20px; max-width: 760px; position: relative; z-index: 1; }
.eb-home-ask .eb-askbox .eb-assistant-ta { background: rgba(10,11,13,.6); }
.eb-home-toolshead { margin: 32px 0 14px; }
.eb-home-toolshead h2 { font-size: 16px; letter-spacing: .02em; }
.eb-home-toolshead p { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

/* ------------------------------------------------------------- PRINT ------ */
/* La feuille imprimable : visible normalement, isolée à l'impression. */
.eb-printable { }
.eb-sheet-head { display: none; }

@media print {
  @page { size: A4; margin: 14mm 12mm; }
  body { background: #fff !important; color: #000 !important; font-size: 11pt; }
  body::before { display: none; }
  .eb-app { display: block; }
  .eb-brandbar, .eb-topbar, .eb-sidebar, .eb-ws-inputs, .eb-tool-head .eb-eyebrow,
  .eb-no-print, .eb-btn, .eb-card-actions { display: none !important; }
  .eb-main { overflow: visible; padding: 0; }
  .eb-workspace { display: block; }
  .eb-card { box-shadow: none; border: 1px solid #bbb; break-inside: avoid; background: #fff; }
  .eb-card-head, .eb-table th { background: #f0f0f0 !important; }
  .eb-table .eb-cat-row td { background: #e9e9e9 !important; color: #000 !important; }
  .eb-card-head h3, .eb-table td, .eb-rrow-l, .eb-rrow-v, .eb-kpi-val, h1,h2,h3 { color: #000 !important; }
  .eb-kpi, .eb-input, .eb-table-wrap { background: #fff !important; border-color: #bbb !important; }
  .eb-rrow-v { color: #000 !important; }
  /* Nomenclature éditable : à l'impression, les champs deviennent du texte. */
  .eb-cell-input { border: none !important; background: transparent !important; color: #000 !important;
    padding: 0 !important; width: auto !important; text-align: right; }
  /* En-tête imprimable des feuilles */
  .eb-sheet-head { display: flex !important; align-items: flex-end; justify-content: space-between;
    gap: 12px; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 12px; }
  .eb-sheet-brand { display: flex; align-items: center; gap: 8px; }
  .eb-sheet-logo { width: 28px; height: 28px; border-radius: 6px; background: #ff7a18; color: #000;
    display: grid; place-items: center; font-weight: 900; }
  .eb-sheet-brand strong { display: block; font-size: 12pt; }
  .eb-sheet-tag { font-size: 8pt; color: #444; }
  .eb-sheet-title h2 { font-size: 13pt; } .eb-sheet-title p { font-size: 9pt; color: #444; margin: 2px 0 0; }
  .eb-sheet-meta { font-size: 8.5pt; text-align: right; }
  .eb-meta-line { display: flex; gap: 6px; justify-content: flex-end; }
  .eb-meta-line span { color: #555; }
  .eb-badge { border: 1px solid #999; color: #000 !important; background: #fff !important; }
  .eb-alert { border: 1px solid #999; background: #f7f7f7 !important; }
  .eb-alert-title, .eb-alert-body { color: #000 !important; }
}

/* --------------------------------------------------------- RESPONSIVE ----- */
@media (max-width: 1080px) {
  .eb-workspace { grid-template-columns: 1fr; }
  .eb-ws-inputs { position: static; }
  .eb-twocol { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .eb-app { grid-template-columns: 1fr; grid-template-rows: var(--topbar-h) auto 1fr;
    grid-template-areas: "brand" "top" "main"; }
  .eb-sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 50;
    transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .eb-app.nav-open .eb-sidebar { transform: translateX(0); }
  .eb-brandbar { border-right: none; justify-content: space-between; }
  .eb-nav-toggle { display: inline-grid !important; }
  .eb-meta-fields .eb-mini input { width: 100px; }
  .eb-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 40; }
}
.eb-nav-toggle { display: none; place-items: center; width: 36px; height: 36px; border-radius: 9px;
  background: var(--panel-3); border: 1px solid var(--line-2); color: var(--text); cursor: pointer; }
.eb-nav-toggle svg { width: 18px; height: 18px; }

/* utilities */
.eb-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.eb-spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.eb-mt { margin-top: 14px; } .eb-mut { color: var(--muted); } .eb-small { font-size: 12px; }
.eb-mono { font-family: var(--mono); }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: #2a3039; border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #3a424d; background-clip: padding-box; }

/* ------------------------------------------- Nomenclature éditable (métré) - */
.eb-nom-desc { display: inline-flex; align-items: center; gap: 8px; }
.eb-cell-input { width: 74px; max-width: 100%; padding: 4px 7px; text-align: right;
  font-variant-numeric: tabular-nums; font-size: 13px; }
.eb-cell-input.is-ovr { border-color: rgba(255,176,46,.55); background: var(--accent-soft); color: var(--accent-2); }
.eb-ovr-val { color: var(--accent-2); font-weight: 600; }
.eb-cell-input:focus { border-color: var(--accent); }
.eb-cell-reset { display: inline-grid; place-items: center; width: 26px; height: 26px; cursor: pointer;
  border-radius: 7px; border: 1px solid var(--line-2); background: var(--panel-3); color: var(--muted); }
.eb-cell-reset:hover { color: var(--accent-2); border-color: rgba(255,176,46,.4); }
.eb-cell-reset .eb-btn-ico { display: inline-flex; }
.eb-cell-reset svg { width: 14px; height: 14px; }

/* ------------------------------------------- MODE APERÇU (feuille blanche) - */
/* Affiche la feuille courante sur une page blanche (comme à l'impression),
   sur un fond neutre, avec une barre Imprimer / Fermer. */
body.eb-preview-mode { background: #2b2f36 !important; }
body.eb-preview-mode::before { display: none; }
body.eb-preview-mode .eb-app { display: block; min-height: 0; }
body.eb-preview-mode .eb-brandbar,
body.eb-preview-mode .eb-topbar,
body.eb-preview-mode .eb-sidebar,
body.eb-preview-mode .eb-ws-inputs,
body.eb-preview-mode .eb-tool-head,
body.eb-preview-mode .eb-dock,
body.eb-preview-mode .eb-no-print,
body.eb-preview-mode .eb-card-actions { display: none !important; }
body.eb-preview-mode .eb-main { overflow: visible; padding: 0; display: block; }
body.eb-preview-mode .eb-main-inner { max-width: 860px; margin: 30px auto 90px; background: #fff; color: #000;
  padding: 22mm 16mm; box-shadow: 0 18px 64px rgba(0,0,0,.6); border-radius: 3px; }
body.eb-preview-mode .eb-workspace { display: block; }
body.eb-preview-mode .eb-ws-results { width: auto; }
body.eb-preview-mode .eb-card { box-shadow: none; border: 1px solid #bbb; break-inside: avoid; background: #fff; margin-bottom: 12px; }
body.eb-preview-mode .eb-card-head, body.eb-preview-mode .eb-table th,
body.eb-preview-mode .eb-table .eb-cat-row td { background: #e9e9e9 !important; color: #000 !important; }
body.eb-preview-mode .eb-card-head h3, body.eb-preview-mode .eb-table td,
body.eb-preview-mode .eb-rrow-l, body.eb-preview-mode .eb-rrow-v,
body.eb-preview-mode .eb-kpi-val, body.eb-preview-mode .eb-kpi-label,
body.eb-preview-mode h1, body.eb-preview-mode h2, body.eb-preview-mode h3 { color: #000 !important; }
body.eb-preview-mode .eb-kpi, body.eb-preview-mode .eb-input,
body.eb-preview-mode .eb-table-wrap { background: #fff !important; border-color: #bbb !important; }
body.eb-preview-mode .eb-cell-input { border: none !important; background: transparent !important; color: #000 !important;
  padding: 0 !important; width: auto !important; text-align: right; }
body.eb-preview-mode .eb-ovr-val { color: #000 !important; }
body.eb-preview-mode .eb-sheet-head { display: flex !important; align-items: flex-end; justify-content: space-between;
  gap: 12px; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 14px; }
body.eb-preview-mode .eb-sheet-brand { display: flex; align-items: center; gap: 8px; }
body.eb-preview-mode .eb-sheet-logo { width: 30px; height: 30px; border-radius: 6px; background: #ff7a18; color: #000;
  display: grid; place-items: center; font-weight: 900; }
body.eb-preview-mode .eb-sheet-brand strong { display: block; font-size: 14px; }
body.eb-preview-mode .eb-sheet-tag { font-size: 9px; color: #444; }
body.eb-preview-mode .eb-sheet-title h2 { font-size: 17px; } body.eb-preview-mode .eb-sheet-title p { color: #444; }
body.eb-preview-mode .eb-sheet-meta { font-size: 11px; text-align: right; }
body.eb-preview-mode .eb-meta-line { display: flex; gap: 6px; justify-content: flex-end; }
body.eb-preview-mode .eb-meta-line span { color: #555; }
body.eb-preview-mode .eb-badge { border: 1px solid #999; color: #000 !important; background: #fff !important; }
body.eb-preview-mode .eb-alert { border: 1px solid #999; background: #f7f7f7 !important; }
body.eb-preview-mode .eb-alert-title, body.eb-preview-mode .eb-alert-body { color: #000 !important; }

.eb-preview-bar { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 200;
  display: flex; gap: 8px; align-items: center; background: var(--panel); border: 1px solid var(--line-2);
  padding: 8px 10px; border-radius: 999px; box-shadow: var(--shadow); }
@media print { .eb-preview-bar { display: none !important; } }

/* ---------------------------------------------- ASSISTANT DOCK (persistant) */
.eb-dock { position: fixed; right: 20px; bottom: 20px; z-index: 60; }

.eb-dock-fab { display: inline-flex; align-items: center; gap: 9px; padding: 12px 17px;
  border-radius: 999px; border: 1px solid rgba(255,176,46,.55); cursor: pointer;
  background: var(--accent-grad); color: #1a1206; font-weight: 700; font-size: 13.5px;
  box-shadow: 0 14px 32px -12px rgba(255,138,35,.75); transition: transform .15s, box-shadow .15s; }
.eb-dock-fab:hover { transform: translateY(-1px); box-shadow: 0 18px 40px -12px rgba(255,138,35,.85); }
.eb-dock-fab .eb-btn-ico { display: inline-flex; }
.eb-dock-fab .eb-btn-ico svg { width: 18px; height: 18px; }
.eb-dock.is-open .eb-dock-fab { display: none; }

.eb-dock-panel { position: fixed; right: 20px; bottom: 20px;
  width: 390px; max-width: calc(100vw - 32px); height: min(640px, calc(100vh - 40px));
  display: none; flex-direction: column; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius);
  box-shadow: var(--shadow); }
.eb-dock.is-open .eb-dock-panel { display: flex; }

.eb-dock-head { display: flex; align-items: center; gap: 11px; padding: 13px 14px;
  border-bottom: 1px solid var(--line); background: rgba(20,23,28,.92); }
.eb-dock-ico { width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-2); }
.eb-dock-ico svg { width: 19px; height: 19px; }
.eb-dock-htext b { display: block; font-size: 13.5px; letter-spacing: .02em; }
.eb-dock-htext span { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
.eb-dock-actions { margin-left: auto; display: flex; gap: 6px; }
.eb-dock-iconbtn { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; cursor: pointer;
  background: var(--panel-3); border: 1px solid var(--line-2); color: var(--muted); }
.eb-dock-iconbtn:hover { color: var(--text); }
.eb-dock-iconbtn svg { width: 15px; height: 15px; }

.eb-dock-body { flex: 1; overflow-y: auto; padding: 14px; }
.eb-dock-stream { display: flex; flex-direction: column; gap: 11px; }
.eb-dock-empty { color: var(--muted); font-size: 13px; line-height: 1.5; }
.eb-dock-empty h5 { margin: 0 0 6px; font-size: 13.5px; color: var(--text); }
.eb-dock-empty p { margin: 0; }
.eb-dock-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }

.eb-bubble { max-width: 92%; padding: 10px 12px; border-radius: 13px; font-size: 13px; line-height: 1.5; }
.eb-bubble--user { align-self: flex-end; background: var(--accent-soft);
  border: 1px solid rgba(255,176,46,.28); color: var(--text); border-bottom-right-radius: 4px; }
.eb-bubble--ai { align-self: flex-start; background: var(--panel-2);
  border: 1px solid var(--line); color: var(--text); border-bottom-left-radius: 4px; }
.eb-bubble--err { align-self: flex-start; background: var(--danger-soft);
  border: 1px solid rgba(255,87,98,.32); color: #ffd7da; font-size: 12.5px; }
.eb-bubble-tools { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.eb-bubble-tool { font-size: 11px; color: var(--accent-2); background: var(--accent-soft);
  border: 1px solid rgba(255,176,46,.25); border-radius: 999px; padding: 2px 9px; }
.eb-bubble-notes { margin: 7px 0 0; padding-left: 17px; font-size: 12px; color: var(--muted); }
.eb-bubble-notes li { margin: 2px 0; }
.eb-dock-pending { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; }

.eb-dock-foot { border-top: 1px solid var(--line); padding: 10px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); background: rgba(20,23,28,.6); }
.eb-dock-composer { display: flex; gap: 8px; align-items: flex-end; }
.eb-dock-composer textarea { flex: 1; resize: none; min-height: 42px; max-height: 120px; line-height: 1.45; }
.eb-dock-send { flex: none; padding: 10px 12px; }
.eb-dock-send .eb-btn-ico { display: inline-flex; }
.eb-dock-send .eb-btn-ico svg { width: 18px; height: 18px; }
.eb-dock-hint { font-size: 11px; color: var(--muted-2); line-height: 1.45; margin: 8px 2px 0; }

@media (max-width: 560px) {
  .eb-dock { right: 16px; bottom: 16px; }
  .eb-dock-panel { right: 0; left: 0; bottom: 0; width: 100%; max-width: 100%;
    height: 82vh;                       /* repli si dvh non supporté */
    height: min(82dvh, calc(100dvh - 16px));
    border-radius: var(--radius) var(--radius) 0 0; }
}
/* Sur mobile, le tiroir de navigation passe devant : on masque le bouton flottant
   pour qu'il ne reste pas cliquable par-dessus le tiroir ouvert. */
@media (max-width: 860px) {
  body.eb-nav-open .eb-dock { display: none; }
}
