* { box-sizing: border-box; margin: 0; padding: 0; }

/* ------------------------------------------------------------------ */
/* Themes: the chrome colors live in CSS variables; the theme chosen   */
/* in the preferences sets a body class (theme-blue is the default).   */
/* ------------------------------------------------------------------ */
:root {
  /* blue theme (default) */
  --bg: #f4f8fc;
  --text: #222;
  /* secondary text: 4.5:1 at least on every light background of the chrome,
     selected rows included */
  --muted: #595959;
  --muted-2: #616161;
  --panel: #fff;
  --panel-2: #fafbfc;
  --panel-3: #f4f5f7;
  --border: #ddd;
  --border-2: #e5e5e5;
  --border-3: #eee;
  --row-border: #f0f0f0;
  --row-hover: #f4f8fc;
  --accent: #1a4f8b;
  --select-bg: #dbe6f2;
  --select-outline: #9dbbdd;
  --hover: #e8ecf0;
  --sidebar-bg: #e9f1fa;
  --sidebar-border: #d5e2ef;
  --tabbar-bg: #e3edf8;
  --tab-bg: #e2e7ec;
  --tab-border: #d4dae0;
  --tab-hover: #eaeef2;
  --cmdbar-bg: #f0f6fc;
  --input-bg: #fff;
  --input-border: #8c8c8c;   /* 3:1 on white: the field boundary is a component */
  --btn-bg: #1a4f8b;
  --btn-border: #1a4f8b;
  --btn-text: #fff;
  --btn-hover: #163f6f;
  --login-bg: #e8f0fa;
  --danger: #a12626;
  --danger-bg: #f6dcdc;
  --danger-border: #e0b0b0;
}

/* gray/white theme, close to the Windows file explorer */
body.theme-light {
  --bg: #ffffff;
  --row-hover: #f5f5f5;
  --accent: #005fb3;   /* 4.5:1 on the selection background */
  --select-bg: #cce8ff;
  --select-outline: #99d1ff;
  --hover: #e5f3ff;
  --sidebar-bg: #f3f3f3;
  --sidebar-border: #e5e5e5;
  --tabbar-bg: #f0f0f0;
  --tab-bg: #e9e9e9;
  --tab-border: #dcdcdc;
  --tab-hover: #f5f5f5;
  --cmdbar-bg: #fbfbfb;
  --btn-bg: #0067c0;
  --btn-border: #0067c0;
  --btn-hover: #005ba1;
  --login-bg: #f3f3f3;
}

/* dark theme */
body.theme-dark {
  --bg: #202020;
  --text: #e6e6e6;
  --muted: #a5a5a5;
  --muted-2: #ababab;
  --panel: #2b2b2b;
  --panel-2: #262626;
  --panel-3: #2f2f2f;
  --border: #3f3f3f;
  --border-2: #3a3a3a;
  --border-3: #333;
  --row-border: #2e2e2e;
  --row-hover: #2a2a2a;
  --accent: #6cb2f5;
  --select-bg: #1f3a55;
  --select-outline: #35577a;
  --hover: #333;
  --sidebar-bg: #252526;
  --sidebar-border: #333;
  --tabbar-bg: #1a1a1a;
  --tab-bg: #2a2a2a;
  --tab-border: #383838;
  --tab-hover: #303030;
  --cmdbar-bg: #242424;
  --input-bg: #1d1d1d;
  --input-border: #7a7a7a;
  --btn-bg: #0e639c;
  --btn-border: #0e639c;
  --btn-hover: #1177bb;
  --login-bg: #1a1a1a;
  --danger: #ff9d9d;
  --danger-bg: #4b2727;
  --danger-border: #6a3a3a;
}

body { font-family: "Segoe UI", sans-serif; font-size: 13px; color: var(--text); height: 100vh; overflow: hidden; background: var(--bg); }
.hidden { display: none !important; }
/* Headings carry the document structure (screen title, panel titles, section
   titles); their look is set by the class of each place, not by the level. */
h1, h2, h3, h4 { font-size: inherit; font-weight: inherit; }
/* Text for assistive technologies only (table captions, names of icon-only
   controls, legends): rendered outside the visible area, never display:none. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
/* Required fields: a visible marker on the label and an inline error under
   the field, tied to it by aria-describedby. */
.required-mark { color: var(--danger); margin-left: 2px; }
.field-error { color: var(--danger); font-size: 12px; margin-top: 2px; }
.field-legend { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
/* Keyboard: skip link (visible on focus only), focus ring of the custom
   components, per-row actions button as the keyboard and touch alternative
   to the right-click, fieldset of the circuit choice. */
.skip-link { position: absolute; left: -999px; top: 6px; z-index: 100; background: var(--btn-bg); color: var(--btn-text);
  padding: 6px 12px; border-radius: 4px; text-decoration: none; }
.skip-link:focus { left: 8px; }
[role="treeitem"]:focus-visible, [role="tab"]:focus-visible, [role="button"]:focus-visible, [role="link"]:focus-visible,
[role="separator"]:focus-visible, tr[tabindex]:focus-visible, th[data-sort]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.context-menu [role="menuitem"]:focus { background: var(--select-bg); outline: 2px solid var(--accent); outline-offset: -2px; }
/* Presentation (lot 4): one focus ring for every native control, a shape
   beside the colour for the selected row and folder, underlined links in
   running text, preferences of motion and forced colours respected. */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.task-table tbody tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
button.folder-item.selected { background: var(--select-bg); box-shadow: inset 3px 0 0 var(--accent); }
.openq-src a, .interpretation-banner a, .help-content a, .analysis-response a, .ia-reponse a, .ia-resultats a { text-decoration: underline; }
#detail-body a, .groupia-body a, .analysis-body a, .help-content a { color: var(--accent); }   /* no default link blue on the dark theme */
.preview-info { margin-left: 0.8rem; font-size: 0.85em; font-weight: 400; }
/* Reflow (lot 5): below 760 px of width (a phone, or 1280 px zoomed to 200 %)
   the three panes stack — the navigation becomes a drawer opened by the ☰
   button, the details pane covers the content, the bars wrap, the data
   tables keep their first two columns (the rest is in the details pane).
   Widths set inline by the resize handles are overridden here. */
.nav-toggle, .sidebar-close { display: none; }
/* Auto-hide mode of the navigation pane (preference): the pane overlays the
   content, hidden until the pointer reaches the left edge (hot zone) or the
   ☰ button opens it; the keyboard path is the same as the narrow drawer. */
.sidebar-hotzone { display: none; }
.main-row { position: relative; }
body.sidebar-auto .nav-toggle, body.sidebar-auto .sidebar-close { display: inline-block; }
body.sidebar-auto .sidebar-hotzone { display: block; position: absolute; top: 0; bottom: 0; left: 0; width: 10px; z-index: 34; }
body.sidebar-auto .sidebar-hotzone:hover { background: var(--select-outline); opacity: 0.5; }
body.sidebar-auto .sidebar { position: absolute; top: 0; bottom: 0; left: 0; z-index: 35; min-width: 210px; max-width: 85vw;
  transform: translateX(-100%); transition: transform 0.15s; box-shadow: 0 0 24px rgba(0,0,0,0.25); }
body.sidebar-auto .sidebar.open { transform: translateX(0); }
body.sidebar-auto .sidebar-close { align-self: flex-end; margin: 4px 8px 0; }
body.sidebar-auto #resizer-sidebar { display: none; }
@media (max-width: 760px) {
  .nav-toggle { display: inline-block; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 35; width: min(85vw, 300px) !important;
    transform: translateX(-100%); transition: transform 0.15s; box-shadow: 0 0 24px rgba(0,0,0,0.25); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: inline-block; align-self: flex-end; margin: 4px 8px 0; }
  .resizer, .resizer-detail { display: none; }
  .detail-panel { position: fixed; top: 0; bottom: 0; right: 0; left: 0; width: 100% !important; z-index: 34; border-left: none; }
  .command-bar, .toolbar, .status-bar { flex-wrap: wrap; row-gap: 6px; }
  .cmd-divider { display: none; }
  .cmd-sep { flex: 0; }
  .cmd-search { flex: 1 1 100%; order: 10; }
  .cmd-search input, .cmd-search input:focus { width: 100%; }
  .cmd-domain { flex: 1 1 100%; order: 9; }
  .cmd-domain select { max-width: none; width: 100%; }
  .toolbar > span { display: flex; flex-wrap: wrap; gap: 6px; }
  .filter-input { max-width: 100%; }
  .task-table th:nth-child(n+3), .task-table td:nth-child(n+3) { display: none; }
  .task-table th, .task-table td { padding-left: 10px; padding-right: 10px; }
  .newdoc-columns { flex-direction: column; }
  .form { padding: 12px; }
  .login-box { width: min(360px, 92vw); padding: 20px; }
  .prefs-panel { width: min(340px, 94vw); right: 3vw; }
  .modal-box { max-width: min(440px, 94vw); }
  .views-manage-box, .views-editor-box { min-width: min(380px, 94vw); }
  .analysis-prompt { margin-left: 0; }
  .analysis-response { margin-right: 0; }
  .analysis-body, .groupia-body, .validate-body { padding: 10px; }
  .watermark { display: none; }
}
/* text spacing: labels may wrap instead of being cut */
.tree-label { white-space: normal; overflow-wrap: anywhere; }
.groupia-chip { white-space: normal; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) {
  .ia-spinner { animation: none; border-top-color: #6a3fb5; border-style: dotted; }
  .cmd-search input, .upload-bar, .sidebar-title .chevron, .section-toggle .chevron { transition: none; }
}
@media (forced-colors: active) {
  .task-table tbody tr.selected td:first-child { box-shadow: inset 3px 0 0 Highlight; }
  .tree-item.selected, .nav-item.selected, .newdoc-item.selected, .detail-tab.active, .tab.active { outline: 1px solid Highlight; }
  .badge, .scope-badge, .count-badge, .visibility-badge, .editing-banner, .classifying-banner { border: 1px solid CanvasText; }
}
.row-actions { background: none; border: 1px solid transparent; color: var(--muted); padding: 0 6px; margin-left: 6px;
  border-radius: 3px; font-size: 13px; line-height: 1.2; cursor: pointer; opacity: 0; }
tr:hover .row-actions, tr:focus-within .row-actions, tr.selected .row-actions, .row-actions:focus { opacity: 1; }
.row-actions:hover { background: var(--hover); border-color: var(--tab-border); color: var(--text); }
.validate-fieldset { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.muted { color: var(--muted); }
.error { color: #b00020; min-height: 18px; margin-top: 8px; }

/* Connexion */
.login-view { height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--login-bg); }
.login-box { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 28px 32px; width: 360px; }
.login-logo { display: block; max-width: 220px; margin: 0 auto 14px; }
.login-box h1 { font-size: 18px; margin-bottom: 18px; color: var(--accent); }
.login-box label { display: block; margin-bottom: 10px; color: var(--muted); }
.login-box input { width: 100%; padding: 7px 9px; margin-top: 3px; border: 1px solid var(--input-border); border-radius: 4px; background: var(--input-bg); color: var(--text); }
.login-box button { width: 100%; margin-top: 8px; }
.login-box .login-iam { background: var(--panel); color: var(--accent); border: 1px solid var(--accent); }

/* Structure : barres pleine largeur (onglets, commandes, statut), rangée
   centrale arbre | contenu | détails — l'arbre vit dans l'onglet */
.app-view { display: flex; flex-direction: column; height: 100vh; }
.main-row { display: flex; flex: 1; min-height: 0; }
.sidebar { width: 210px; background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border); display: flex; flex-direction: column; padding-top: 6px; overflow-y: auto; flex-shrink: 0; }
.sidebar-title { font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 8px 10px; margin-top: 4px; border-top: 1px solid var(--border-2); cursor: pointer; user-select: none; }
.sidebar-title:hover { color: var(--accent); }
.sidebar-title .chevron { display: inline-block; width: 14px; color: var(--muted-2); transition: transform 0.12s; }
.section-toggle.collapsed .chevron { transform: rotate(-90deg); }
/* the section title is a real button (expanded/collapsed state announced);
   same look as the former title line */
button.section-toggle { flex: 1; display: inline-flex; align-items: center; background: none; border: none;
  padding: 0; color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; text-align: left; }
button.section-toggle:hover { background: none; color: var(--accent); }
.nav-list { list-style: none; margin: 0; padding: 0; }
button.nav-item { display: block; width: 100%; text-align: left; background: none; border: none; border-radius: 0; color: inherit; font: inherit; }
.nav-item { padding: 7px 14px 7px 26px; cursor: pointer; font-size: 13px; }
.nav-item:hover { background: var(--hover); }
.nav-item.selected { background: var(--select-bg); color: var(--accent); font-weight: 600; }
.tree-children { }
.tree-item { display: flex; align-items: center; cursor: pointer; padding: 4px 6px 4px 0; font-size: 13px; }
.tree-item:hover { background: var(--hover); }
.tree-item.selected { background: var(--select-bg); color: var(--accent); font-weight: 600; }
.tree-toggle { width: 16px; flex-shrink: 0; text-align: center; color: var(--muted-2); cursor: pointer; }
.tree-label { flex: 1; min-width: 0; }
/* Barre de statut (façon explorateur Windows) : utilisateur, version, serveur, préférences */
.status-bar { display: flex; align-items: center; gap: 12px; padding: 4px 12px; border-top: 1px solid var(--sidebar-border); background: var(--cmdbar-bg); font-size: 12px; flex-shrink: 0; }
.status-spacer { flex: 1; }
.status-server { color: var(--muted-2); }
.status-bar a { color: var(--accent); text-decoration: none; }
.app-version { color: var(--muted-2); margin-left: 2px; font-size: 11px; }
.update-link { color: var(--accent); font-size: 11px; }
.update-link.ready { font-weight: 700; }
.content { flex: 1; overflow: auto; display: flex; flex-direction: column; min-width: 0; }
/* Filigrane blueDoc : rappel discret et permanent qu'on n'est PAS sur le disque local */
.watermark { position: fixed; right: 22px; bottom: 36px; width: 110px; opacity: 0.08; pointer-events: none; z-index: 5; }
/* Poignées de redimensionnement (glisser pour ajuster la largeur) */
.resizer { width: 5px; flex-shrink: 0; cursor: col-resize; background: transparent; }
.resizer:hover, .resizer.dragging { background: var(--select-outline); }
.detail-panel { position: relative; }
.resizer-detail { position: absolute; left: 0; top: 0; bottom: 0; width: 5px; cursor: col-resize; z-index: 5; }
.resizer-detail:hover, .resizer-detail.dragging { background: var(--select-outline); }
body.resizing { cursor: col-resize; user-select: none; }
/* Vignette au survol de l'icône d'un document */
.doc-icon { cursor: default; }
.thumb-pop { position: fixed; z-index: 40; background: var(--panel); border: 1px solid var(--tab-border); border-radius: 4px;
  padding: 4px; box-shadow: 0 4px 16px rgba(0,0,0,0.18); }   /* hoverable: the pointer may rest on it */
.thumb-pop img { display: block; height: auto; }
.thumb-pop img.thumb-big { width: min(40vw, 560px); max-height: 62vh; object-fit: contain; }
.thumb-pop img.thumb-small { width: auto; max-width: 180px; max-height: 180px; }

/* Barre d'onglets façon explorateur Windows 11 */
.tab-bar { display: flex; align-items: stretch; gap: 2px; padding: 4px 8px 0; background: var(--tabbar-bg); border-bottom: 1px solid var(--sidebar-border); flex-shrink: 0; overflow-x: auto; }
.tab { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--tab-bg); border: 1px solid var(--tab-border); border-bottom: none; border-radius: 6px 6px 0 0; font-size: 12px; color: var(--muted); cursor: pointer; max-width: 220px; white-space: nowrap; }
.tab:hover { background: var(--tab-hover); }
.tab.active { background: var(--panel); color: var(--accent); font-weight: 600; }
.tab-list { display: flex; align-items: stretch; gap: 2px; }
.tab-label { overflow: hidden; text-overflow: ellipsis; }
/* the tab itself is a button (role tab); the close cross stays beside it */
button.tab-label { background: none; border: none; padding: 0; color: inherit; font: inherit; cursor: pointer; white-space: nowrap; max-width: 190px; }
button.tab-label:hover { background: none; }
.tab-close { color: var(--muted-2); border: none; background: none; cursor: pointer; font-size: 12px; padding: 0 2px; border-radius: 3px; }
.tab-close:hover { background: var(--hover); color: var(--danger); }
.tab-new { align-self: center; background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 2px 8px; }
.tab-new:hover { color: var(--accent); }

/* Barre de commandes façon explorateur Windows */
.command-bar { display: flex; align-items: center; gap: 6px; padding: 6px 12px; background: var(--cmdbar-bg); border-bottom: 1px solid var(--sidebar-border); flex-shrink: 0; }
.cmd-btn { background: transparent; color: var(--text); border: 1px solid transparent; border-radius: 4px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.cmd-btn:hover { background: var(--hover); border-color: var(--tab-border); }
.cmd-primary { color: var(--accent); font-weight: 600; }
.cmd-danger:hover { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.cmd-sep { flex: 1; }
.cmd-divider { width: 1px; align-self: stretch; background: var(--tab-border); margin: 2px 4px; }
.cmd-nav { padding: 4px 9px; font-size: 12px; }
.cmd-icon { padding: 5px 9px; font-size: 14px; }
.status-count { color: var(--muted); min-width: 90px; }
.cmd-btn:disabled { opacity: 0.4; cursor: default; }
.cmd-btn:disabled:hover { background: transparent; border-color: transparent; }
.cmd-count { color: var(--accent); font-weight: 600; font-size: 13px; margin-right: 4px; }

/* Barre d'outils et listes */
.toolbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--border-2); font-weight: 600; }
button { padding: 6px 14px; border: 1px solid var(--btn-border); background: var(--btn-bg); color: var(--btn-text); border-radius: 4px; cursor: pointer; }
button:hover { background: var(--btn-hover); }
button.inline { padding: 2px 8px; font-size: 12px; margin-left: 8px; }
.task-table { width: 100%; border-collapse: collapse; }
.task-table th { text-align: left; padding: 6px 16px; font-size: 11px; text-transform: uppercase; color: var(--muted-2); border-bottom: 1px solid var(--border-2); }
.task-table th[data-sort] { cursor: pointer; user-select: none; }
.task-table th[data-sort]:hover { color: var(--accent); }
/* the sort marker is a DOM element (renderDocumentRows), never CSS content */
.task-table th .sort-mark { margin-left: 3px; }
/* Recherche et domaine dans la barre de commandes (en haut à droite) */
.cmd-search { position: relative; display: inline-flex; align-items: center; }
.cmd-search input { width: 230px; padding: 5px 26px 5px 9px; border: 1px solid var(--input-border);
  border-radius: 4px; font-size: 13px; background: var(--input-bg); color: var(--text); transition: width 0.12s; }
.cmd-search input:focus { width: min(46vw, 560px); border-color: var(--accent); }
.cmd-search .help-anchor { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.cmd-domain { display: inline-flex; }
.cmd-domain select { padding: 5px 8px; border: 1px solid var(--input-border); border-radius: 4px;
  font-size: 12px; background: var(--input-bg); color: var(--accent); max-width: 180px; }
.badge-domain { background: #dceefb; color: #175e8c; }
/* Detail section separators — stand out clearly from the content above. */
.detail-section-title, .ia-resultats-titre, .section-title, .validate-docs-titre {
  margin-top: 18px; font-size: 11px; text-transform: uppercase; font-weight: 700;
  letter-spacing: 0.05em; color: var(--text);
  border-top: 1px solid var(--border-2); padding-top: 10px; }
.section-title { margin-bottom: 8px; }

.cmd-btn.cmd-toggled { background: var(--select-bg); border-color: var(--select-outline); color: var(--accent); }
.help-anchor { position: absolute; right: 16px; top: 13px; width: 16px; height: 16px;
  line-height: 16px; text-align: center; border-radius: 50%; background: var(--select-bg);
  color: var(--accent); font-size: 11px; font-weight: 700; text-decoration: none; }
.help-anchor:hover { background: var(--btn-bg); color: var(--btn-text); }
.help-overlay { position: fixed; inset: 0; background: rgba(20, 40, 60, 0.45); z-index: 60;
  display: flex; align-items: center; justify-content: center; }
.help-box { background: var(--panel); border-radius: 8px; width: min(780px, 92vw); height: 88vh;
  display: flex; flex-direction: column; box-shadow: 0 6px 30px rgba(0, 0, 0, 0.3); }
.help-head { display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px; border-bottom: 1px solid var(--border-2); font-weight: 700; color: var(--accent); }
.help-content { overflow: auto; padding: 6px 24px 24px; line-height: 1.5; }
.help-content h2 { font-size: 15px; color: var(--accent); margin: 20px 0 8px;
  border-bottom: 1px solid var(--border-3); padding-bottom: 4px; }
.help-content h3 { font-size: 13px; color: var(--text, inherit); margin: 14px 0 6px; }
.help-content p { margin-bottom: 8px; }
.help-content ul { margin: 0 0 8px 20px; }
.help-content li { margin-bottom: 4px; }
.help-content table { border-collapse: collapse; margin: 8px 0 12px; width: 100%; font-size: 12px; }
.help-content th, .help-content td { border: 1px solid var(--border-2); padding: 5px 8px; text-align: left; vertical-align: top; }
.help-content th { background: var(--panel-3); }
.task-table td { padding: 7px 16px; border-bottom: 1px solid var(--row-border); }
.task-table tbody tr { cursor: pointer; }
.task-table tbody tr:hover { background: var(--row-hover); }
.task-table tbody tr.selected { background: var(--select-bg); outline: 1px solid var(--select-outline); }
.empty { padding: 24px 16px; color: var(--muted-2); }
.interpretation-banner { margin: 6px 16px 0; padding: 6px 10px; background: #f3eefb;
  border: 1px solid #e0d4f0; border-radius: 6px; color: #5b3d8f; font-size: 12px; }
.interpretation-banner a { color: #5b3d8f; margin-left: 8px; }
.interp-line { line-height: 1.5; }
.interp-modes { color: #7a5ba8; font-size: 11px; }
.interp-actions { margin-top: 2px; }
.interp-actions a { margin-left: 0; margin-right: 8px; }

.badge { padding: 1px 8px; border-radius: 8px; font-size: 11px; background: #eee; color: #222; }
.badge-actif { background: #dbe6f2; color: #1a4f8b; }
.badge-valide { background: #d9efd9; color: #22662a; }
.badge-invalide { background: #f6dcdc; color: #a12626; }
.badge-semantique { background: #e8def8; color: #5b3d8f; }
.badge-approximatif { background: #fbecd6; color: #8a5a12; }
.badge-favori { background: transparent; padding: 0 2px; }
.extrait { margin: 3px 0 0 22px; font-size: 12px; color: var(--muted); font-style: italic; }
.ia-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.ia-preset { background: #fff; color: #5b3d8f; border-color: #b9a8dc; padding: 3px 10px; font-size: 12px; }
.ia-preset:hover { background: #e8def8; }
/* Liste déroulante « Questions » du panneau d'analyse — groupes dans
   l'ordre : questions gardées par l'utilisateur (ordre de création),
   partagées par domaine, socle en dernier ; ✕ retire la question gardée
   sélectionnée */
.ia-questions-bar { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.ia-questions-select { flex: 1; min-width: 0; padding: 5px 8px; border: 1px solid var(--input-border);
  border-radius: 4px; background: var(--input-bg); color: var(--text); font-size: 12px; }
.ia-keep:disabled { opacity: 0.35; cursor: default; }
.ia-keep:disabled:hover { color: var(--muted); border-color: var(--input-border); background: none; }
.ia-question .q-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ia-question .q-origin { font-size: 10px; color: var(--muted-2); flex-shrink: 0; }
.ia-question .q-remove { border: none; background: none; color: var(--muted-2); cursor: pointer;
  font-size: 11px; padding: 0 3px; border-radius: 3px; flex-shrink: 0; }
.ia-question .q-remove:hover { color: var(--danger); background: var(--danger-bg); }
.ia-keep { background: none; border: 1px solid var(--input-border); color: var(--muted);
  border-radius: 4px; padding: 5px 9px; font-size: 12px; }
.ia-keep:hover { color: var(--accent); border-color: var(--accent); background: var(--select-bg); }
.ia-bar { display: flex; gap: 6px; margin-top: 6px; align-items: center; }
.ia-bar select { flex: 1; padding: 5px 8px; border: 1px solid var(--input-border); border-radius: 4px; background: var(--input-bg); color: var(--text); }
.ia-reponse { margin-top: 8px; background: #faf8fe; border: 1px solid #e0d4f2; border-radius: 4px; padding: 10px; font-size: 13px; color: #222; }
.ia-texte { white-space: normal; line-height: 1.4; }
.ia-source { margin-top: 6px; font-size: 11px; }
.ia-busy .ia-preset, .ia-busy #ia-submit, .ia-busy #ia-prompt, .ia-busy #ia-fournisseur { opacity: 0.5; cursor: not-allowed; }
.ia-spinner { display: inline-block; width: 13px; height: 13px; vertical-align: middle; margin-right: 6px;
  border: 2px solid #c9b8e8; border-top-color: #6a3fb5; border-radius: 50%; animation: ia-spin 0.8s linear infinite; }
@keyframes ia-spin { to { transform: rotate(360deg); } }
.nav-loading { padding: 12px 10px; font-size: 12px; color: var(--muted-2); }
/* small centered modal (deposit choice…) */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 40;
  display: flex; align-items: center; justify-content: center; }
.modal-box { background: var(--panel); border-radius: 8px; padding: 20px 22px; max-width: 440px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.3); }
.modal-title { font-weight: 600; font-size: 14px; margin-bottom: 8px; color: var(--text); }
.modal-text { font-size: 13px; line-height: 1.5; color: var(--muted); margin-bottom: 16px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.modal-actions button { padding: 7px 12px; font-size: 13px; border-radius: 5px;
  border: 1px solid var(--input-border); background: var(--panel-2); color: var(--text); cursor: pointer; }
.modal-actions button.btn-primary { background: var(--btn-bg); border-color: var(--btn-border); color: var(--btn-text); }
.modal-actions button:disabled { opacity: 0.5; cursor: default; }
/* form fields inside a modal (bulk reclassify) */
.modal-field { display: block; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.modal-field select, .modal-field input { display: block; width: 100%; margin-top: 4px; padding: 6px 8px;
  font-size: 13px; border-radius: 5px; border: 1px solid var(--input-border);
  background: var(--panel-2); color: var(--text); box-sizing: border-box; }
.modal-progress { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
/* directory upload progress (own tab) */
#upload-view { padding: 12px 16px; overflow: auto; }
#upload-cancel { margin-left: auto; }
.upload-progress-wrap { height: 8px; background: var(--panel-3); border-radius: 4px; overflow: hidden; margin: 10px 0; }
.upload-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.2s ease; }
.upload-summary { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.upload-list { font-size: 12px; }
.upload-row { padding: 3px 0; border-bottom: 1px solid var(--row-border); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.upload-ic { display: inline-block; width: 1.2em; text-align: center; }
.upload-done .upload-ic { color: #2e7d32; }
.upload-duplicate .upload-ic { color: var(--muted-2); }
.upload-error .upload-ic, .upload-toolarge .upload-ic { color: var(--danger); }
.upload-pending { color: var(--muted-2); }
.uploads-chip { margin-right: 10px; padding: 1px 8px; border-radius: 10px; background: var(--accent);
  color: #fff; font-size: 11px; text-decoration: none; }
.ia-resultats { margin-top: 6px; background: var(--panel); border: 1px solid #e0d4f2; border-radius: 4px; padding: 10px; font-size: 12px; line-height: 1.4; white-space: pre-wrap; max-height: 320px; overflow: auto; }
.ia-resultats.empty { color: var(--muted-2); font-style: italic; background: none; border: none; padding: 4px 0; white-space: normal; }
/* Documents liés (aide à la documentation) : références du texte + contenus proches */
.related-list { margin-top: 6px; border: 1px solid var(--border-2); border-radius: 4px; background: var(--panel); max-height: 220px; overflow: auto; }
.related-group { padding: 4px 9px; font-size: 10px; text-transform: uppercase; color: var(--muted-2); background: var(--panel-3); border-bottom: 1px solid var(--row-border); }
.related-row { display: flex; align-items: center; gap: 6px; padding: 5px 9px; font-size: 12px; cursor: pointer; border-bottom: 1px solid var(--row-border); }
.related-row:last-child { border-bottom: none; }
.related-row:hover { background: var(--row-hover); }
.related-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.related-badge { font-family: Consolas, monospace; font-size: 10px; color: var(--accent); background: var(--select-bg); border-radius: 3px; padding: 0 5px; flex-shrink: 0; }
/* Questions du document : questions ouvertes avec propositions de réponses sourcées */
.openq-run { background: none; border: 1px solid var(--input-border); color: var(--accent); border-radius: 4px; padding: 5px 10px; font-size: 12px; cursor: pointer; margin-top: 4px; }
.openq-run:hover { background: var(--select-bg); border-color: var(--accent); }
.openq-item { border: 1px solid var(--border-2); border-radius: 4px; background: var(--panel); padding: 7px 9px; margin-top: 6px; font-size: 12px; }
.openq-q { font-weight: 600; }
.openq-a { margin-top: 3px; line-height: 1.4; }
.openq-a.muted { color: var(--muted-2); font-style: italic; }
.openq-src { margin-top: 3px; font-size: 11px; color: var(--muted-2); }
.openq-src a { color: var(--accent); text-decoration: none; }
.openq-src a:hover { text-decoration: underline; }
/* Vérification de cohérence : divergences arbitrées sur les faits typés */
.coh-ok { color: #22662a; background: #d9efd9; border-radius: 5px; padding: 10px 12px; }
.coh-item { border: 1px solid var(--border-2); border-left: 4px solid var(--muted-2);
  border-radius: 5px; background: var(--panel); padding: 8px 10px; margin-bottom: 8px; font-size: 13px; }
.coh-item.coh-bad { border-left-color: #c0392b; }
.coh-item.coh-warn { border-left-color: #e67e22; }
.coh-item.coh-normal { border-left-color: #7f8c8d; opacity: 0.85; }
.coh-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.coh-fact { font-weight: 700; }
.coh-badge { font-size: 11px; border-radius: 8px; padding: 1px 8px; background: var(--panel-3); color: var(--muted); }
.coh-bad .coh-badge { background: #f6dcdc; color: #a12626; }
.coh-warn .coh-badge { background: #fdebd0; color: #9c640c; }
.coh-val { font-size: 12px; padding: 1px 0; }
.coh-doc { color: var(--accent); font-weight: 600; }
.coh-expl { margin-top: 4px; font-size: 12px; color: var(--muted); font-style: italic; }
/* Radar des échéances : retards / ≤30 j / ≤90 j */
.dl-group { margin: 12px 0 4px; font-size: 11px; text-transform: uppercase; font-weight: 700; color: var(--muted-2); }
.dl-group.dl-overdue { color: #c0392b; }
.dl-group.dl-30 { color: #9c640c; }
.dl-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--border-2);
  border-radius: 5px; background: var(--panel); margin-bottom: 4px; font-size: 13px; cursor: pointer; }
.dl-row:hover { background: var(--row-hover); }
.dl-date { font-family: Consolas, monospace; font-size: 12px; color: var(--muted); width: 82px; flex-shrink: 0; }
.dl-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-meta { color: var(--muted-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.dl-days { font-size: 11px; border-radius: 8px; padding: 1px 8px; background: var(--select-bg); color: var(--accent); flex-shrink: 0; }
.dl-days.over { background: #f6dcdc; color: #a12626; font-weight: 700; }
/* Multi-document analysis: centered column, document chips, one card per
   result — readable instead of a cramped top-left block. */
.groupia-body { padding: 24px; overflow: auto; width: 100%; max-width: 860px; margin: 0 auto; }
.groupia-docs-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.groupia-chip { background: var(--panel-3); border: 1px solid var(--border-2); border-radius: 12px;
  padding: 3px 10px; font-size: 12px; color: var(--text); max-width: 260px; }
#groupia-prompt { width: 100%; box-sizing: border-box; font-size: 14px; padding: 10px;
  border: 1px solid var(--input-border); border-radius: 6px; background: var(--input-bg);
  color: var(--text); resize: vertical; min-height: 64px; }
#groupia-overlay .ia-bar { margin-top: 10px; display: flex; gap: 8px; align-items: center; }
#groupia-results { margin-top: 22px; display: flex; flex-direction: column; gap: 14px; }
.groupia-doc { border: 1px solid var(--border-2); border-radius: 8px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06); background: var(--panel); }
.groupia-doc-nom { background: var(--panel-2); padding: 10px 14px; font-weight: 600;
  font-size: 13px; border-bottom: 1px solid var(--border-3); color: var(--text);
  display: flex; align-items: center; gap: 6px; }
.groupia-doc-rep { padding: 14px 16px; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; }
.synthesis-text { white-space: pre-wrap; font-size: 13.5px; line-height: 1.6; }

/* Dialogue « Valider » (circuits prédéfinis) */
.validate-body { padding: 24px 16px; overflow: auto; width: 100%; max-width: 680px; margin: 0 auto; }
.validate-docs { margin: 6px 0 18px; max-height: 140px; overflow: auto; border: 1px solid var(--border-2); border-radius: 6px; background: var(--panel); }
.validate-doc { padding: 6px 12px; font-size: 13px; border-bottom: 1px solid var(--row-border); }
.validate-doc:last-child { border-bottom: none; }
.validate-choice { display: flex; flex-direction: column; gap: 8px; }
.validate-option { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; background: var(--panel); }
.validate-option:hover { background: var(--row-hover); }
.validate-option:has(input:checked) { border-color: var(--accent); background: var(--select-bg); }
.validate-option input { margin-top: 3px; accent-color: var(--accent); }
.validate-params { margin-top: 14px; }
.validate-params label, .validate-note { display: block; margin-top: 12px; font-size: 13px; color: var(--muted); }
.validate-params input, .validate-params textarea, .validate-note input { width: 100%; margin-top: 4px; padding: 7px 9px; border: 1px solid var(--input-border); border-radius: 4px; box-sizing: border-box; background: var(--input-bg); color: var(--text); }
.validate-bar { margin-top: 18px; display: flex; align-items: center; gap: 10px; }

/* Détail */
.detail-panel { width: 420px; flex-shrink: 0; border-left: 1px solid var(--border); background: var(--panel-2); overflow: auto; }
.detail-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border-2); font-weight: 600; }
.detail-header button { background: none; border: none; color: var(--muted); font-size: 14px; }
/* Bouton de fermeture de panneau/overlay : libellé explicite + style « pilule »
   pour ne pas être confondu avec la croix de fermeture de la fenêtre (coin haut-droit). */
.panel-close { background: var(--panel-3); border: 1px solid var(--tab-border); border-radius: 14px;
  color: var(--text); font-size: 12px; font-weight: 600; padding: 3px 12px; cursor: pointer; white-space: nowrap; }
.panel-close:hover { background: #e0344222; border-color: #e03442; color: #b3202c; }
.detail-tabs { display: flex; border-bottom: 1px solid var(--border-2); background: var(--panel-3); }
.detail-tab { flex: 1; text-align: center; padding: 8px 4px; font-size: 12px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; user-select: none; }
button.detail-tab { background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0; font: inherit; font-size: 12px; }
.detail-tab:hover { background: var(--hover); }
.detail-tab.active { color: var(--accent); font-weight: 600; border-bottom-color: var(--accent); background: var(--panel-2); }
.detail-pane.hidden { display: none; }
.journal-entry { padding: 5px 0; border-bottom: 1px dotted var(--border-3); font-size: 12px; line-height: 1.4; }
.journal-entry.cancelled { text-decoration: line-through; color: var(--muted-2); }
.detail-section { padding: 12px 14px; border-bottom: 1px solid var(--border-3); }
.kv { display: flex; margin-bottom: 4px; }
.kv-label { width: 110px; color: var(--muted-2); flex-shrink: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; padding-right: 6px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.action-button { background: var(--panel); color: var(--accent); }
.action-button:hover { background: var(--select-bg); }
#action-note { width: 100%; padding: 6px 8px; border: 1px solid var(--input-border); border-radius: 4px; background: var(--input-bg); color: var(--text); }
.action-next { width: 100%; padding: 6px 8px; margin-top: 6px; border: 1px solid var(--input-border); border-radius: 4px; box-sizing: border-box; background: var(--input-bg); color: var(--text); }
.side-task { padding: 4px 0; }
.side-task-button { padding: 2px 8px; font-size: 12px; margin-left: 8px; }
.history-entry { padding: 3px 0; border-bottom: 1px dotted var(--border-3); }

/* Vues virtuelles */
.breadcrumb { font-weight: 600; }
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.folder-list { padding: 6px 8px; list-style: none; margin: 0; }
.folder-item { padding: 6px 8px; cursor: pointer; border-radius: 4px; }
button.folder-item { display: block; width: 100%; text-align: left; background: none; border: none; color: inherit; font: inherit; }
.folder-item:hover { background: var(--row-hover); }

/* Aperçu */
.preview-overlay { position: fixed; inset: 0; background: var(--panel); z-index: 20; display: flex; flex-direction: column; }
.preview-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--border-2); font-weight: 600; }
.preview-header button { background: none; border: none; color: var(--muted); font-size: 14px; }
.preview-frame { flex: 1; border: none; width: 100%; }
/* find in the preview: the page find must only reach the document, so the
 * rest of the application is hidden (kept in the layout) while the preview
 * is open */
#app-view.preview-open > :not(#preview-overlay) { visibility: hidden; }
.preview-header .preview-find-toggle { margin-left: auto; font-size: 16px; }
.preview-find { display: flex; align-items: center; gap: 4px; margin-left: auto; font-weight: 400; }
.preview-find input { width: 220px; max-width: 40vw; padding: 3px 6px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel-2); color: var(--text); }
.preview-find-count { font-size: 0.85em; min-width: 4em; text-align: center; white-space: nowrap; }
.preview-find + .preview-find-toggle { margin-left: 0; }

/* Assistant nouveau document + menu contextuel + filtre */
.filter-input { padding: 5px 8px; border: 1px solid var(--input-border); border-radius: 4px; margin-right: 6px; font-weight: normal; background: var(--input-bg); color: var(--text); }
.trash-tools { margin-right: 10px; font-weight: normal; }
.trash-range { margin: 0 6px; font-variant-numeric: tabular-nums; }
#trash-empty { margin-left: 10px; color: var(--danger); border-color: var(--danger-border); }
.newdoc-columns { display: flex; gap: 20px; margin-top: 12px; }
.newdoc-columns > div { flex: 1; }
.newdoc-list { border: 1px solid var(--border-3); border-radius: 4px; max-height: 320px; overflow: auto; }
.newdoc-item { padding: 7px 10px; cursor: pointer; border-bottom: 1px solid var(--row-border); }
.newdoc-item:hover { background: var(--row-hover); }
.newdoc-item.selected { background: var(--select-bg); outline: 1px solid var(--select-outline); }
.newdoc-createbar { display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; }
.count-badge { display: inline-block; background: #c0392b; color: #fff; border-radius: 10px; padding: 0 7px; margin-left: 6px; font-size: 11px; font-weight: 700; }
.context-menu { position: fixed; z-index: 50; background: var(--panel); border: 1px solid var(--input-border); border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,0.15); min-width: 180px; }
.context-menu div { padding: 7px 14px; cursor: pointer; }
.context-menu div:hover { background: var(--select-bg); }
.context-menu .ctx-sep { height: 1px; background: var(--border-2); padding: 0; margin: 4px 0; cursor: default; }
.context-menu .ctx-sep:hover { background: var(--border-2); }
.context-menu .ctx-danger { color: var(--danger); }
.context-menu .ctx-danger:hover { background: var(--danger-bg); }

/* Préférences : rangées « libellé à gauche, contrôle à droite » alignées en grille */
.prefs-panel { position: fixed; bottom: 34px; right: 12px; width: 340px; background: var(--panel); border: 1px solid var(--input-border); border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,0.22); z-index: 45; overflow: hidden; }
.prefs-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.pref-item { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 14px; color: var(--text); cursor: pointer; font-size: 13px; line-height: 1.45; }
.pref-item select { min-width: 140px; padding: 5px 8px; border: 1px solid var(--input-border); border-radius: 4px; background: var(--input-bg); color: var(--text); }
.pref-item input[type="checkbox"] { width: 15px; height: 15px; justify-self: end; accent-color: var(--accent); cursor: pointer; }
.pref-sep { height: 1px; background: var(--border-2); margin: 2px 0; }
#prefs-link { text-decoration: none; margin-right: 10px; font-size: 14px; }

/* Toast + zone de dépôt */
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #333; color: #fff; padding: 9px 18px; border-radius: 6px; font-size: 13px; z-index: 40; max-width: 70%; }
.toast.error { background: #a12626; }
/* drag overlay: a DOM element (localized text), shown while dragging over the
   application; pointer-events none so the drag events still reach app-view */
.drop-hint { display: none; position: fixed; inset: 0; background: rgba(26,79,139,0.85); color: #fff; align-items: center; justify-content: center; font-size: 22px; z-index: 30; pointer-events: none; }
.app-view.dropping .drop-hint { display: flex; }
.edit-form { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.edit-form label { color: var(--muted); font-size: 12px; }
.edit-form input, .edit-form select { width: 100%; padding: 6px 8px; margin-top: 2px; border: 1px solid var(--input-border); border-radius: 4px; background: var(--input-bg); color: var(--text); font-family: inherit; }
.edit-form button { align-self: flex-start; }
/* group of properties (fieldset per group label of the type definition) */
.meta-group { border: 1px solid var(--border); border-radius: 4px; padding: 8px 12px 2px; margin: 6px 0 12px; min-width: 0; }
.meta-group legend { font-weight: 600; padding: 0 4px; color: var(--text); }
/* multi-valued property: check boxes on its closed list */
.meta-multi { border: 1px solid var(--border); border-radius: 4px; padding: 4px 10px 6px; margin: 4px 0 8px; display: flex; flex-wrap: wrap; gap: 4px 14px; min-width: 0; }
.meta-multi legend { padding: 0 4px; }
.meta-multi.is-invalid { border-color: var(--danger); }
.meta-multi-choice { display: inline-flex; align-items: center; gap: 4px; font-weight: 400; margin: 0; }
.edit-form .meta-group { display: flex; flex-direction: column; gap: 6px; padding: 6px 8px; }
/* Properties page: summary of the sections, error summary, save bar */
.props-head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.props-head-left h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.props-body { padding: 0 16px 16px; }
/* the generic .form rule caps a form at 720 px: lifted here so the tab row
   uses the whole page (the panels keep their own readable width below) */
.form.props-form { padding: 10px 0 0; max-width: none; }
/* boxed tabs on one scrollable line: a tab keeps its outline when it is
   not selected, the selected one joins the panel below */
.props-tabs { display: flex; flex-wrap: nowrap; gap: 3px; overflow-x: auto; overflow-y: hidden; align-items: flex-end; border-bottom: 1px solid var(--border-2); margin: 6px 0 10px; padding: 2px 0 0; }
.props-tabs [role="tab"] { flex: 0 0 auto; white-space: nowrap; background: var(--panel-3); border: 1px solid var(--border-2); border-bottom: none; border-radius: 6px 6px 0 0; padding: 4px 9px; cursor: pointer; color: var(--text); font: inherit; font-size: 0.8rem; line-height: 1.3; }
.props-tabs [role="tab"]:hover { background: var(--hover); }
.props-tabs [role="tab"][aria-selected="true"] { background: var(--bg); border-color: var(--accent); border-top-width: 2px; font-weight: 600; }
/* the fields keep a readable width, the tab row uses the whole page */
.props-panel, .props-errors { max-width: 960px; }
.props-form textarea.meta-model-prop { resize: vertical; min-height: 4.5em; line-height: 1.4; }
/* composition dialog: sources, related documents, progress line */
.modal-box.compose-box { max-width: min(640px, 94vw); }
.compose-sources { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.compose-related { margin: 4px 0 8px; }
.compose-related-list { margin-top: 6px; max-height: 180px; overflow: auto; }
.compose-related-row { display: block; padding: 2px 0; }
.compose-status { min-height: 1.4em; }
/* narrow window (reflow at 320 px): the tabs wrap instead of scrolling */
@media (max-width: 760px) { .props-tabs { flex-wrap: wrap; overflow-x: visible; } }
.props-tab-badge { display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 5px; border-radius: 9px; background: #c62828; color: #fff; font-size: 0.75rem; font-weight: 600; line-height: 18px; text-align: center; }
.props-panel { padding: 4px 0; }
.props-save-hint { flex-basis: 100%; color: var(--muted); font-size: 0.9rem; }
#props-save.disabled { opacity: 0.55; cursor: not-allowed; }
.props-errors a { color: var(--accent); }
.props-errors { border: 1px solid #c62828; border-left-width: 4px; border-radius: 4px; padding: 8px 12px; margin: 10px 0 0; }
.props-errors h2 { font-weight: 600; }
.props-errors ul { margin: 4px 0 0; padding-left: 18px; }
.props-actions { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--border-2); padding: 10px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.editing-banner { background: #fff6e0; border: 1px solid #e0c060; border-radius: 4px; padding: 8px 10px; margin-bottom: 8px; font-size: 12px; color: #222; }
.visibility-badge { background: #eef4fb; border: 1px solid #b9cee6; border-radius: 4px; padding: 6px 10px; margin-bottom: 8px; font-size: 12px; color: #1a4f8b; }
/* archiving strip: disposition + rule, elapsed-time bar, archiving date */
.retention-strip { border: 1px solid var(--border); border-radius: 4px; padding: 6px 10px; margin-bottom: 8px; font-size: 12px; }
.retention-head { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.retention-bar { height: 5px; background: var(--border-2); border-radius: 3px; margin: 5px 0 3px; overflow: hidden; }
.retention-fill { height: 100%; background: #4a8ad4; }
.retention-when { color: var(--muted); }
.retention-soon .retention-fill { background: #b86a00; }
.retention-soon .retention-when { color: #7a4b00; }
.retention-due .retention-fill { background: #c62828; }
.retention-due .retention-when { color: #c62828; font-weight: 600; }
.version-row { padding: 6px 0; border-bottom: 1px dotted var(--border-3); }
.version-comment { margin: 2px 0; font-style: italic; }
.version-actions button { padding: 2px 8px; font-size: 11px; }

/* Initiation */
.form { padding: 16px; max-width: 720px; }
.form label { display: block; margin-bottom: 12px; color: var(--muted); }
.form input, .form textarea, .form select { width: 100%; padding: 7px 9px; margin-top: 3px; border: 1px solid var(--input-border); border-radius: 4px; font-family: inherit; background: var(--input-bg); color: var(--text); }
.form textarea#init-definition { font-family: Consolas, monospace; font-size: 12px; }
#init-result { margin-top: 10px; min-height: 18px; }

/* reactive classification: in-progress banner + row badge */
.classifying-banner {
  background: #fff7e6;
  border: 1px solid #ffd591;
  color: #7a4b00;
  padding: 6px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
  font-size: 0.9em;
}
.badge-classifying {
  background: #fff7e6;
  color: #7a4b00;
  border: 1px solid #ffd591;
}
.badge-pending {
  background: #fff1f0;
  color: #cf1322;
  border: 1px solid #ffa39e;
}
.badge-validated, .badge-corrected {
  background: #f6ffed;
  color: #2e7d32;
  border: 1px solid #b7eb8f;
}

/* inline rename (F2 / click on name) */
.rename-input { font: inherit; padding: 1px 4px; border: 1px solid var(--select-outline); border-radius: 3px; min-width: 160px; background: var(--input-bg); color: var(--text); }
tr.selected .doc-name { cursor: text; }

/* views manager (sidebar gear): personal selection + admin CRUD */
.sidebar-title { display: flex; align-items: center; }
.section-action { margin-left: auto; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0 2px; }
.section-action:hover { color: var(--accent); }
.views-manage-box { min-width: 380px; }
.views-manage-list { max-height: 50vh; overflow-y: auto; margin-bottom: 14px; }
.views-manage-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px; font-size: 13px; }
.views-manage-row:hover { background: var(--hover); }
.views-manage-check { display: flex; align-items: center; gap: 7px; cursor: pointer; overflow: hidden; }
.views-manage-check span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.views-manage-actions { flex-shrink: 0; }
.views-manage-actions button { background: none; border: none; cursor: pointer; font-size: 13px; color: var(--muted); padding: 0 3px; }
.views-manage-actions button:hover { color: var(--accent); }

/* view editor (admin): simple grouping form + advanced JSON */
.views-editor-box { min-width: 460px; max-width: 540px; }
.view-editor-grid { display: grid; grid-template-columns: auto 1fr; gap: 8px 10px; align-items: center; font-size: 13px; margin-bottom: 10px; }
.view-editor-grid input[type="text"], .view-editor-grid select { padding: 5px 7px; font-size: 13px; border: 1px solid var(--input-border); border-radius: 4px; background: var(--panel-2); color: var(--text); }
.ve-extracted { width: 130px; }
.ve-json-toggle { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); margin-bottom: 8px; cursor: pointer; }
.view-editor-json { width: 100%; min-height: 180px; font-family: Consolas, monospace; font-size: 12px; border: 1px solid var(--input-border); border-radius: 4px; background: var(--panel-2); color: var(--text); margin-bottom: 10px; box-sizing: border-box; }
.ve-warnings { color: #8a5a12; font-size: 12px; line-height: 1.4; margin: 0 0 8px; }
.breadcrumb .crumb-link { color: var(--accent); cursor: pointer; }
.breadcrumb .crumb-link:hover { text-decoration: underline; }
.name-conflicts { max-height: 40vh; overflow-y: auto; margin-bottom: 12px; padding-bottom: 4px; border-bottom: 1px solid var(--border, #ddd); }
.merge-results { max-height: 30vh; overflow-y: auto; margin-bottom: 12px; font-size: 13px; }
.merge-row { display: block; padding: 4px 0; cursor: pointer; }

/* Analysis threads */
.analyses-tools { display: flex; gap: 6px; align-items: center; font-weight: 400; }
.analyses-tools input, .analyses-tools select { padding: 4px 8px; border: 1px solid var(--input-border); border-radius: 4px; background: var(--input-bg); color: var(--text); font-size: 12px; }
.analyses-table .analysis-label { font-weight: 600; }
.analyses-table .analysis-last { font-size: 11px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 520px; }
.analysis-date { font-size: 11px; white-space: nowrap; }
.scope-badge { padding: 1px 8px; border-radius: 8px; font-size: 11px; background: #eee; color: #222; white-space: nowrap; }
.scope-badge.scope-documents { background: #dbe6f2; color: #1a4f8b; }
.scope-badge.scope-corpus { background: #e8def8; color: #5b3d8f; }
.scope-badge.scope-general { background: #fbecd6; color: #8a5a12; }
.analysis-head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
#analysis-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.analysis-title-input { font-size: 14px; font-weight: 600; padding: 3px 6px; min-width: 320px; border: 1px solid var(--input-border); border-radius: 4px; background: var(--input-bg); color: var(--text); }
#analysis-view { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.analysis-body { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 14px 24px; max-width: 900px; width: 100%; margin: 0 auto; box-sizing: border-box; }
.analysis-turns { flex: 1; min-height: 0; overflow: auto; padding-right: 4px; }
.analysis-hint { padding: 12px 0; }
.analysis-turn { margin-bottom: 16px; }
.analysis-turn.pending { opacity: 0.8; }
.analysis-head { font-size: 11px; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.analysis-prompt { background: var(--select-bg); border-radius: 10px 10px 2px 10px; padding: 8px 12px; margin-left: 15%; font-size: 13px; white-space: pre-wrap; }
.analysis-response { background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 10px 10px 10px 2px; padding: 10px 14px; margin-top: 6px; margin-right: 15%; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; }
.analysis-response .coh-item { white-space: normal; }
.analysis-sources { margin-top: 6px; font-size: 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.analysis-skipped { font-size: 11px; margin-top: 4px; }
.analysis-doc { cursor: pointer; }
.analysis-doc.unavailable { opacity: 0.55; text-decoration: line-through; cursor: not-allowed; }
.analysis-docs-actions { font-size: 12px; align-self: center; }
.analysis-composer { border-top: 1px solid var(--border-2); padding-top: 10px; margin-top: 8px; }
.analysis-scope-bar { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; font-size: 12px; }
.analysis-scope-bar select { padding: 4px 8px; border: 1px solid var(--input-border); border-radius: 4px; background: var(--input-bg); color: var(--text); }
.analysis-broaden { display: flex; gap: 4px; align-items: center; cursor: pointer; }
#analysis-prompt { width: 100%; box-sizing: border-box; padding: 6px 8px; border: 1px solid var(--input-border); border-radius: 4px; background: var(--input-bg); color: var(--text); font-size: 13px; resize: vertical; }
.analysis-open { margin-top: 12px; font-size: 12px; }
.ia-thread-row { padding: 2px 0; }
.analysis-row-actions { width: 32px; text-align: right; }
.analysis-row-delete { background: none; border: none; color: var(--muted-2); cursor: pointer; padding: 2px 4px; font-size: 13px; }
.analysis-row-delete:hover { color: var(--danger); background: var(--danger-bg); border-radius: 4px; }
.ia-thread-new { margin-top: 6px; }
