/* Chrome (RC1.3, BIMCheck-QC identity): sidebar brand, vertical nav, topbar, project column,
   context banner, sub-tabs. The sidebar carries the brand and 8 destinations; the topbar is
   a thin bar in the content area with search, save, and theme toggle only. */

/* ── Sidebar: brand + vertical nav ────────────────────────────────────────── */
.sidebar-brand { display: flex; align-items: center; padding: 14px 18px 10px; }
.sidebar-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-mark { flex: none; }
.sidebar-brand-name { color: var(--text-1); font-size: 19px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.sidebar-brand-name b { font-weight: 500; color: var(--text-2); }
.sidebar-rail { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 8px; }
.sidebar-nav-inner { display: contents; }
.sidebar-items { display: flex; flex-direction: column; gap: 2px; padding: 0; margin: 0; list-style: none; }
.sidebar-entry { flex: none; }
.sidebar-item { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; height: 40px; padding: 0 14px; border: 0; border-radius: var(--r-1); background: transparent; color: var(--text-3); font-size: 13px; font-weight: 700; white-space: nowrap; cursor: pointer; transition: background-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease); }
.sidebar-item:hover { background: var(--bg-3); color: var(--text-1); }
.sidebar-item[aria-current="page"] { color: var(--text-1); background: color-mix(in srgb, var(--brand-a) 9%, transparent); box-shadow: inset 3px 0 0 var(--brand-a); }
.sidebar-item .icon { width: 18px; height: 18px; flex: none; }
.sidebar-item[aria-current="page"] .icon { color: var(--accent); }
.sidebar-label { overflow: hidden; text-overflow: ellipsis; }
.sidebar-question { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ── Topbar: thin content-area bar ────────────────────────────────────────── */
.topbar { display: flex; align-items: center; gap: var(--s-4); min-width: 0; padding: 0 18px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg-1) 90%, transparent); backdrop-filter: blur(10px); }
.sidebar-toggle { display: none; flex: none; }
.topbar-project { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); font-size: var(--t-xs); font-weight: var(--w-semibold); }
.topbar-tools { display: flex; align-items: center; gap: var(--s-2); margin-left: auto; flex: none; }
.save-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-2); color: var(--text-2); font-size: var(--t-xs); font-weight: var(--w-semibold); }
.save-chip:hover { background: var(--bg-3); color: var(--text-1); }
.save-chip[data-save-status="dirty"] { border-color: var(--sev-review); color: var(--sev-review); background: var(--sev-review-bg); }
.save-chip[data-save-status="saving"] { color: var(--accent); }
.save-chip[data-save-status="error"] { border-color: var(--sev-blocking); color: var(--sev-blocking); background: var(--sev-blocking-bg); }

/* Global locale switcher (fr | en | de) — topbar group */
.lang-switch { display: inline-flex; align-items: center; gap: 2px; height: 28px; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-2); }
.lang-switch-btn { height: 22px; min-width: 28px; padding: 0 6px; border: 0; border-radius: 999px; background: transparent; color: var(--text-3); font-size: 11px; font-weight: var(--w-semibold); letter-spacing: .02em; cursor: pointer; }
.lang-switch-btn:hover { color: var(--text-1); background: var(--bg-3); }
.lang-switch-btn.active { background: var(--accent-strong); color: var(--on-accent); }
.search-trigger { display: inline-flex; align-items: center; gap: var(--s-2); height: 34px; min-width: 190px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--bg-1); color: var(--text-3); font-size: var(--t-xs); }
.search-trigger:hover { border-color: var(--line-2); color: var(--text-1); }
.search-label { flex: 1 1 auto; text-align: left; }
.save-file { height: 34px; }

/* ── (Tab bar removed — navigation now lives in the sidebar) ──────────────── */

/* ── Project column (inside sidebar) ──────────────────────────────────────── */
.sidebar-project { display: grid; align-content: start; gap: var(--s-4); min-height: 0; overflow-y: auto; padding: 16px; border-top: 1px solid var(--line); }
.side-card { display: grid; gap: var(--s-3); padding: 14px; border: 1px solid var(--line); border-radius: var(--r-3); background: var(--bg-1); box-shadow: var(--shadow-1); }
.side-drop { justify-items: center; text-align: center; padding: 22px 16px; }
.side-drop-mark { color: var(--brand-a); }
.side-drop strong { font-size: var(--t-body-strong); }
.side-drop p { color: var(--text-3); font-size: var(--t-xs); }
.side-add { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); height: 40px; border: 1px dashed var(--line-2); border-radius: var(--r-2); background: var(--bg-1); color: var(--accent); font-weight: var(--w-semibold); font-size: var(--t-xs); }
.side-add:hover { border-color: var(--brand-a); background: color-mix(in srgb, var(--brand-a) 6%, var(--bg-1)); }
.side-title { display: flex; align-items: center; justify-content: space-between; color: var(--text-3); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.side-count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; background: color-mix(in srgb, var(--brand-a) 14%, transparent); color: var(--accent); font-size: 11px; letter-spacing: 0; }
.side-models { display: grid; gap: var(--s-2); }
.side-model { display: grid; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--bg-2); }
.side-model-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-1); font-size: var(--t-xs); font-weight: var(--w-semibold); }
.side-model-meta { color: var(--text-3); font-size: 11.5px; }
.side-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
.side-kpi { display: grid; gap: 2px; padding: 12px 8px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--bg-2); text-align: center; }
.side-kpi strong { font-family: var(--font-mono); font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.side-kpi span { color: var(--text-3); font-size: 11.5px; }
.side-file { gap: 2px; padding: 6px; }
.side-link { height: 34px; padding: 0 10px; border: 0; border-radius: var(--r-1); background: transparent; color: var(--text-2); font-size: var(--t-xs); font-weight: var(--w-semibold); text-align: left; }
.side-link:hover { background: var(--bg-3); color: var(--text-1); }

/* ── Context banner: where am I, what next ────────────────────────────────── */
.head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); min-width: 0; padding: 12px 16px 12px 18px; border: 1px solid var(--line); border-left: 4px solid var(--brand-a); border-radius: var(--r-3); background: linear-gradient(100deg, color-mix(in srgb, var(--brand-a) 6%, var(--bg-1)), var(--bg-1) 55%); box-shadow: var(--shadow-1); }
.head-text { min-width: 0; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.head h1 { margin-top: 2px; color: var(--text-1); font-size: var(--t-body-strong); font-weight: 700; line-height: 1.25; }
.mission-status { margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: var(--t-xs); }
.head-actions { display: flex; align-items: center; gap: var(--s-2); flex: none; }
.primary-action { height: 40px; padding: 0 20px; border: 1px solid #0891b23d; border-radius: var(--r-2); background: linear-gradient(135deg, var(--brand-a), var(--brand-b)); color: var(--on-accent); font-size: var(--t-body); font-weight: 800; box-shadow: 0 14px 34px -22px #2f80ed; transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), filter var(--dur-1) var(--ease); }
.primary-action:hover { transform: translateY(-1px); filter: brightness(1.05); }
.primary-action:active { transform: scale(.98); }
.inspector-toggle { height: 40px; }
.inspector-toggle .icon { margin-left: 6px; }

/* ── Sub-tabs ─────────────────────────────────────────────────────────────── */
.subtabs:empty { display: none; }
.subtab-row { display: flex; align-items: center; gap: 4px; padding: 6px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-3); background: var(--bg-1); box-shadow: var(--shadow-1); scrollbar-width: none; }
.subtab { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border: 0; border-radius: var(--r-1); background: transparent; color: var(--text-3); font-size: 13px; font-weight: 700; white-space: nowrap; transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.subtab:hover { background: var(--bg-3); color: var(--text-1); }
.subtab[aria-selected="true"] { background: var(--text-1); color: var(--text-inverse); }
.subtab .icon { width: 15px; height: 15px; }

/* ── Notices ──────────────────────────────────────────────────────────────── */
.activity-bar { position: fixed; left: 18px; bottom: 14px; z-index: 40; max-width: 262px; }
.activity-bar:has(.status-notice:empty) { display: none; }
.status-notice { display: block; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--bg-1); color: var(--text-1); font-size: var(--t-xs); font-weight: var(--w-semibold); box-shadow: var(--shadow-2); }
.status-progress { display: flex; align-items: center; gap: var(--s-2); }
.status-progress:empty, .status-stats:empty { display: none; }
.status-stats { position: absolute; right: 14px; bottom: 14px; z-index: 6; display: flex; align-items: center; gap: var(--s-3); min-width: 0; padding: 4px 10px; border: 1px solid var(--stage-chrome-line); border-radius: 999px; background: var(--stage-chrome); color: var(--stage-text-2); font-size: 11.5px; pointer-events: none; }
.stat + .stat { padding-left: var(--s-3); border-left: 1px solid var(--line); }


/* Command palette */
.palette-layer { display: none; }
.shell[data-palette="true"] .palette-layer { position: fixed; inset: 0; z-index: 60; display: block; }
.palette-backdrop { position: absolute; inset: 0; background: #05070acc; }
.palette {
  position: absolute;
  top: 12vh;
  left: 50%;
  display: flex;
  flex-direction: column;
  width: min(640px, calc(100vw - 24px));
  max-height: 70vh;
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: var(--r-3);
  background: var(--bg-1);
  box-shadow: var(--shadow-2);
  transform: translateX(-50%);
}
.palette-input { display: flex; align-items: center; gap: var(--s-2); height: 46px; flex: none; padding: 0 var(--s-3); border-bottom: 1px solid var(--line); color: var(--text-3); }
.palette-input .field { height: 44px; padding: 0; border: 0; background: transparent; font-size: var(--t-lg); }
.palette-input .field:focus-visible { outline: none; }
.palette-results { flex: 1 1 auto; overflow-y: auto; padding: var(--s-1) 0 var(--s-2); }
.palette-group { padding: 10px var(--s-3) var(--s-1); color: var(--text-3); font-size: var(--t-micro); font-weight: var(--w-semibold); letter-spacing: .07em; text-transform: uppercase; }
.palette-item { display: flex; align-items: center; gap: 10px; height: 32px; margin: 0 6px; padding: 0 var(--s-2); border-radius: var(--r-2); color: var(--text-2); font-size: var(--t-md); cursor: pointer; }
.palette-item .icon { color: var(--text-3); }
.palette-item.is-active { background: var(--bg-3); color: var(--text-1); box-shadow: inset 2px 0 0 var(--sel-line); }
.palette-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-hint { flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: var(--t-xs); }
.palette-empty { padding: var(--s-4) var(--s-3); color: var(--text-3); }

/* Drag & drop overlay */
.drop-overlay { display: none; }
.shell[data-drop="true"] .drop-overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: #05070ab3; pointer-events: none; }
.drop-card { display: grid; justify-items: center; gap: var(--s-2); padding: var(--s-8) var(--s-10); border: 1.5px dashed #c9d2de; border-radius: var(--r-3); background: var(--stage-chrome); color: var(--stage-text); }
.drop-card span { color: var(--stage-text-2); font-size: var(--t-sm); }

.stat-hover { max-width: 320px; overflow: hidden; text-overflow: ellipsis; color: var(--stage-text); }
.subtab-row { justify-content: space-between; }
.subtab-tabs { display: flex; flex: none; align-items: center; gap: 4px; } /* the row scrolls; tabs never shrink under the tool */
.subtab-tool { margin-left: var(--s-3); border: 1px solid var(--line); background: var(--bg-2); }
.subtab-tool[aria-pressed="true"] { border-color: var(--brand-a); color: var(--accent); }

@media (max-width: 1180px) { .sidebar-toggle { display: flex; } }
@media (max-width: 1560px) { .search-trigger { min-width: 150px; } }
/* Phone width (390 px): every topbar control stays on screen. Labels that only repeat an icon
   stay readable for assistive technology (visually hidden, not removed); the project file
   action stays reachable from the project column (« Enregistrer le projet »). */
@media (max-width: 600px) {
  .topbar { gap: var(--s-2); padding: 0 8px; }
  .topbar-project { flex: 1 1 0; min-width: 0; }
  .topbar-tools { flex: 0 0 auto; gap: 4px; }
  .search-trigger { min-width: 0; width: 34px; padding: 0; justify-content: center; }
  .search-trigger .search-label, .search-trigger .kbd, .save-file > span {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .save-file { display: none; }
  .save-chip { min-width: 0; max-width: 112px; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; line-height: 26px; }
  .lang-switch-btn { min-width: 24px; padding: 0 4px; }
}

/* Menu compte (D-S1-05) : disclosure native <details>, panneau ancré sous le bouton. La barre
   passe au-dessus de l'espace de travail tant que le menu est ouvert. */
.topbar:has(.account-menu[open]) { position: relative; z-index: 50; }
.account-menu { position: relative; flex: none; }
.account-menu > summary { list-style: none; cursor: pointer; font-weight: var(--w-semibold); }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-trigger span { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(135deg, var(--brand-a), var(--brand-b)); color: #fff; font-size: 12px; }
.account-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; display: grid; gap: 2px; min-width: 240px; max-width: min(320px, calc(100vw - 16px)); padding: 8px; border: 1px solid var(--line-2); border-radius: var(--r-2); background: var(--bg-2); box-shadow: 0 18px 40px -20px #000a; }
.account-who { display: grid; gap: 2px; margin: 0 0 6px; padding: 6px 8px 8px; border-bottom: 1px solid var(--line); font-size: var(--t-xs); color: var(--text-2); }
.account-who b { color: var(--text-1); font-weight: var(--w-semibold); overflow-wrap: anywhere; }
.account-panel form { margin: 0; }
.account-item { display: flex; align-items: center; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-radius: var(--r-1); background: transparent; color: var(--text-1); font: inherit; font-size: var(--t-xs); text-align: left; text-decoration: none; cursor: pointer; }
.account-item:hover, .account-item:focus-visible { background: var(--bg-3); }
