/* -- Design tokens -------------------------------------------------------- */
:root {
  --bg:          #ffffff;
  --surface:     rgba(0,0,0,0.02);
  --border:      rgba(0,0,0,0.08);
  --border-hover:rgba(0,0,0,0.14);
  --border-focus:rgba(0,0,0,0.28);
  --text:        #0a0a0a;
  --text-muted:  #737373;
  --text-dim:    #737373;
  --ring:        rgba(0,0,0,0.08);
  --radius:      12px;
  --radius-sm:   8px;
  --radius-xs:   6px;
}

/* -- Reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 3rem 1.5rem 5rem;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* -- App root (full-screen fixed, shown after auth) ----------------------- */
#app-root {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* -- Cards ---------------------------------------------------------------- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 0.75rem;
  background: var(--surface);
  transition: border-color 0.15s;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}
.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

/* -- Form elements -------------------------------------------------------- */
.field { margin-bottom: 0.875rem; }
.field:last-child { margin-bottom: 0; }
.field-row { display: flex; gap: 0.75rem; }
.field-row .field { flex: 1; margin-bottom: 0; }

label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select {
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0 12px;
  height: 36px;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
input[type="number"] { width: 80px; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--ring);
}
input::placeholder { color: var(--text-dim); }
select option { background: #fff; color: var(--text); }

/* -- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-xs);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
  white-space: nowrap;
  user-select: none;
}
.btn:disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

/* Default -- dark */
.btn-default { background: var(--text); color: #fff; }
.btn-default:hover { background: #262626; }

/* Outline / secondary */
.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--border-hover); color: var(--text); }

/* Accent / primary */
.btn-accent {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}
.btn-accent:hover { background: #262626; border-color: #262626; }

/* Ghost */
.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: rgba(0,0,0,0.05); color: var(--text); }

/* -- File input area ------------------------------------------------------ */
.file-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.file-name-display {
  flex: 1;
  height: 36px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 13px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
}
.file-name-display.has-value { color: var(--text); border-color: var(--border-hover); }

/* -- Response area -------------------------------------------------------- */
.response { margin-top: 1rem; }

.status-line {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.status-line .method {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0,0,0,0.06);
  color: var(--text);
}
.status-line .code { font-weight: 600; }
.status-line.ok    .code { color: #86efac; }
.status-line.err   .code { color: #fca5a5; }
.status-line.running { color: #fcd34d; }

pre {
  background: rgba(0,0,0,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.875rem 1rem;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #525252;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}

/* -- Progress bar --------------------------------------------------------- */
.progress-container {
  margin-top: 0.75rem;
}
.progress-bar-outer {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar-inner {
  height: 100%;
  background: #22c55e;
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}
.progress-bar-inner.indeterminate {
  width: 30%;
  animation: indeterminate 1.5s ease-in-out infinite;
}
.progress-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* -- Process result ------------------------------------------------------- */
.result-card {
  border: 1px solid rgba(34,197,94,0.2);
  background: rgba(34,197,94,0.04);
  border-radius: var(--radius-xs);
  padding: 0.875rem 1rem;
}
.result-card .count {
  font-size: 14px;
  font-weight: 600;
  color: #86efac;
  margin-bottom: 0.25rem;
}
.result-card .meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 0.625rem;
}

.btn-row { display: flex; gap: 0.5rem; align-items: center; }

/* -- Login screen --------------------------------------------------------- */
.login-screen {
  max-width: 360px;
  margin: 0 auto;
  padding-top: 4rem;
}
.login-screen .card { padding: 2rem; }
.login-screen .card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 1.5rem;
  text-align: center;
}
.login-error {
  font-size: 12px;
  color: #ef4444;
  margin-top: 0.5rem;
  min-height: 1.2em;
}

/* -- Utilities ------------------------------------------------------------ */
.hidden { display: none !important; }
#eval-banner:not(.hidden) { display: flex; }
#vote-modal:not(.hidden) { display: flex; }
.divider { height: 1px; background: var(--border); margin: 1.5rem 0; }

/* -- Main app header (results header) ------------------------------------- */
.results-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.25rem;
  height: 40px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.results-header .logo-img {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  flex-shrink: 0;
}
.results-header .logo {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}
.results-header .spacer { flex: 1; }

/* Zone toggle icon buttons */
.zone-toggles {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
}
.zone-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 24px;
  border: none;
  background: transparent;
  border-radius: calc(var(--radius) - 2px);
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.zone-toggle-btn:hover { background: var(--border); color: var(--text); }
.zone-toggle-btn.active { background: var(--bg); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

/* -- Info counter --------------------------------------------------------- */
.info-counter {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.info-counter strong {
  color: var(--text);
  font-weight: 600;
}

.account-menu {
  font-size: 12px;
  color: var(--text-muted);
}

/* -- Results body --------------------------------------------------------- */
.results-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Left panel -- document text */
.panel-text {
  width: 44%;
  overflow-y: auto;
  padding: 1.75rem 1.5rem;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-text-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}
.doc-para {
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-muted);
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-xs);
  margin-bottom: 0.375rem;
  border-left: 2px solid var(--border);
  cursor: default;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}
.doc-para.highlighted {
  color: var(--text);
  background: #f0f0f0;
  border-left-color: transparent;
}

/* Document block (multi-document aggregated view) */
.doc-block {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.doc-block:last-child {
  border-bottom: none;
  margin-bottom: 0;
}
.doc-block-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  padding: 0.5rem 0.875rem;
  margin-bottom: 0.5rem;
  background: var(--surface, #f8f9fa);
  border-radius: var(--radius-xs);
  border-left: 3px solid var(--primary, #3b82f6);
  letter-spacing: 0.02em;
}
.doc-block-flash {
  animation: doc-block-flash-anim 1.5s ease-out;
}
@keyframes doc-block-flash-anim {
  0% { background: rgba(250, 204, 21, 0.25); }
  100% { background: transparent; }
}

/* Middle panel -- informations */
.panel-infos {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panel-infos-header {
  padding: 1.75rem 1.5rem 0.875rem;
  flex-shrink: 0;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}
.panel-infos-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.panel-infos-filters {
  padding: 0 1.5rem 0.75rem;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.panel-infos-filters.hidden { display: none; }
.filter-keyword {
  width: 100%;
  height: 28px;
  font-family: inherit;
  font-size: 12px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0 8px;
  transition: border-color 0.15s;
}
.filter-keyword:focus { outline: none; border-color: var(--border-focus); }
.filter-keyword::placeholder { color: var(--text-dim); }
.label-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.label-chip {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 2px 8px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  user-select: none;
}
.label-chip:hover { border-color: var(--border-hover); color: var(--text); }
.label-chip.active {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}
.panel-infos-cards {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1.5rem 1.75rem;
}
.info-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.75rem 1rem;
  margin-bottom: 0.375rem;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.info-card:hover { border-color: var(--border-hover); }
.info-card.active {
  background: #f0f0f0;
  border-color: transparent;
}
.info-card.chat-highlight {
  border-color: var(--text);
  background: #f5f5f5;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.08);
}
.info-card .info-title {
  font-size: 13px;
  line-height: 1.5;
  font-weight: 700;
  color: var(--text);
}
.info-card .info-comment {
  margin-top: 0.35rem;
  font-size: 12px;
  line-height: 1.55;
  font-style: italic;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
}
.info-card .info-footer {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.info-card .info-type {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 1px 7px;
  letter-spacing: 0.04em;
}
.info-card .info-src {
  font-size: 11px;
  color: var(--text-dim);
  white-space: normal;
  word-break: break-word;
  flex: 1;
}

/* -- Label chips on cards ------------------------------------------------- */
.card-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.5rem;
}
.card-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2em;
  font-size: 10px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text-dim);
  white-space: nowrap;
}
.card-chip.chip-type {
  background: #f0f4ff;
  border-color: #c7d4f7;
  color: #3b5bdb;
}
.card-chip.chip-subtype {
  background: #f3f0ff;
  border-color: #d0c4f7;
  color: #6c5ce7;
  cursor: pointer;
  user-select: none;
}
.card-chip.chip-subtype-none {
  color: var(--text-dim);
  background: var(--surface);
  border-color: var(--border);
}

/* Enrichment chips */
.chip-actor { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.chip-location { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.chip-timeframe { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* -- Subtype chip dropdown ----------------------------------------------- */
.subtype-wrapper {
  position: relative;
  display: inline-flex;
}
.subtype-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 200;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  box-shadow: 0 4px 14px rgba(0,0,0,0.1);
  min-width: 160px;
  overflow: hidden;
}
.subtype-opt {
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.subtype-opt:hover {
  background: var(--surface-hover);
}

/* -- Importance chip + dropdown ------------------------------------------ */
.importance-wrapper {
  position: relative;
  display: inline-flex;
}
.chip-importance {
  cursor: pointer;
  user-select: none;
}
.chip-importance-none { color: var(--text-dim); background: var(--surface); border-color: var(--border); }
.chip-importance-high   { background: #fff1f2; border-color: #fecdd3; color: #e11d48; }
.chip-importance-medium { background: #fffbeb; border-color: #fde68a; color: #d97706; }
.chip-importance-low    { background: #f0fdf4; border-color: #bbf7d0; color: #16a34a; }
.chip-importance-critical { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }
.importance-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 200;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  box-shadow: 0 4px 14px rgba(0,0,0,0.1);
  min-width: 110px;
  overflow: hidden;
}
.importance-opt {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text-muted);
  transition: background 0.1s, color 0.1s;
}
.importance-opt:hover { background: var(--surface); color: var(--text); }

/* -- Validation chip + dropdown ------------------------------------------ */
.validation-wrapper {
  position: relative;
  display: inline-flex;
}
.chip-validation {
  cursor: pointer;
  user-select: none;
}
.chip-validation-ai        { color: var(--text-dim); }
.chip-validation-validated  { background: #f0fdf4; border-color: #bbf7d0; color: #16a34a; }
.chip-validation-deleted    { background: #fff1f2; border-color: #fecdd3; color: #e11d48; }
.validation-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 200;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  box-shadow: 0 4px 14px rgba(0,0,0,0.1);
  min-width: 120px;
  overflow: hidden;
}
.validation-opt {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text-muted);
  transition: background 0.1s, color 0.1s;
}
.validation-opt:hover { background: var(--surface); color: var(--text); }

/* Editable info fields (contenteditable) */
.info-card .info-title[contenteditable="true"],
.info-card .info-comment[contenteditable="true"] {
  outline: none;
  border-radius: var(--radius-xs);
  transition: background 0.15s;
}
.info-card .info-title[contenteditable="true"]:focus,
.info-card .info-comment[contenteditable="true"]:focus {
  background: var(--surface-hover);
  box-shadow: 0 0 0 1px var(--border-hover);
}
.info-card .info-title[contenteditable="true"]:hover,
.info-card .info-comment[contenteditable="true"]:hover {
  background: var(--surface-hover);
}

/* Deleted card styling (greyed out) */
.info-card-deleted {
  opacity: 0.45;
  text-decoration: line-through;
}
.info-card-deleted.fade-out {
  transition: opacity 0.4s ease, max-height 0.4s ease, margin 0.4s ease, padding 0.4s ease;
  opacity: 0;
  max-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
}

/* -- Validation counter --------------------------------------------------- */
.validation-counter {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 8px;
}

/* -- Chat panel (now in zone-right) --------------------------------------- */

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.chat-msg {
  font-size: 13px;
  line-height: 1.55;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-xs);
  max-width: 95%;
  word-break: break-word;
}
.chat-msg.user {
  background: #f0f0f0;
  align-self: flex-end;
  color: var(--text);
  white-space: pre-wrap;
}
.chat-msg.assistant {
  background: var(--surface);
  border: 1px solid var(--border);
  align-self: flex-start;
  color: var(--text);
}
.chat-msg.assistant p { margin: 0 0 0.5em; }
.chat-msg.assistant p:last-child { margin-bottom: 0; }
.chat-msg.assistant ul, .chat-msg.assistant ol { margin: 0.25em 0 0.5em 1.25em; }
.chat-msg.assistant li { margin-bottom: 0.15em; }
.chat-msg.assistant strong { font-weight: 600; }
.chat-msg.assistant em { font-style: italic; }
.chat-msg.assistant code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 11px; background: rgba(0,0,0,0.06); padding: 1px 4px; border-radius: 3px; }
.chat-msg.assistant pre { margin: 0.4em 0; max-height: none; }
.chat-msg.assistant pre code { background: none; padding: 0; }
.chat-msg.thinking {
  color: var(--text-dim);
  font-style: italic;
  align-self: flex-start;
}
.chat-msg.proactive {
  border-left: 3px solid rgba(59,130,246,0.4);
  background: rgba(59,130,246,0.04);
}

/* Chat notifications (success/warning/error routed through chatbot) */
.chat-notification {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.5;
  font-weight: 500;
  max-width: 95%;
  align-self: flex-start;
}
.chat-notification-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  margin-top: 1px;
}
.chat-notification-success {
  background: rgba(34,197,94,0.06);
  border: 1px solid rgba(34,197,94,0.2);
  color: #15803d;
}
.chat-notification-success .chat-notification-icon {
  background: rgba(34,197,94,0.15);
  color: #16a34a;
}
.chat-notification-warning {
  background: rgba(245,158,11,0.06);
  border: 1px solid rgba(245,158,11,0.2);
  color: #92400e;
}
.chat-notification-warning .chat-notification-icon {
  background: rgba(245,158,11,0.15);
  color: #d97706;
}
.chat-notification-error {
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.2);
  color: #991b1b;
}
.chat-notification-error .chat-notification-icon {
  background: rgba(239,68,68,0.15);
  color: #dc2626;
}

/* Guide cards (help agent — zone highlighting pills) */
.guide-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.guide-card-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}
.guide-card-pill:hover {
  background: #e8e8e8;
  border-color: var(--text);
}
.guide-card-pill svg {
  flex-shrink: 0;
  opacity: 0.6;
}

.chat-input-area {
  padding: 0.625rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
}
.chat-input {
  resize: none;
  height: 64px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 7px 10px;
  transition: border-color 0.15s;
  width: 100%;
}
.chat-input:focus { outline: none; border-color: var(--border-focus); }
.chat-input-row { display: flex; justify-content: flex-end; }

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
}
.chat-suggestion-btn {
  background: var(--bg-card, #f8f8f8);
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 16px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text-dim, #666);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.chat-suggestion-btn:hover {
  background: var(--bg-hover, #f0f0f0);
  border-color: var(--border-focus, #bbb);
  color: var(--text-default, #333);
}

/* -- Panel resizers ------------------------------------------------------- */
.panel-resizer {
  width: 5px;
  flex-shrink: 0;
  cursor: col-resize;
  background: transparent;
  transition: background 0.12s;
  user-select: none;
}
.panel-resizer:hover { background: rgba(0,0,0,0.07); }
.panel-resizer.dragging { background: rgba(0,0,0,0.12); }

/* -- Drawer (removed — content migrated to zone-left) -------------------- */

.example-card {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.example-card:hover {
  border-color: var(--border-hover);
  background: var(--surface);
}

/* -- Disabled card overlay ------------------------------------------------ */
.card-disabled {
  position: relative;
  opacity: 0.45;
  pointer-events: none;
  user-select: none;
}
.card-disabled-wrapper {
  position: relative;
}
.card-disabled-wrapper .card-disabled-tooltip {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--text);
  color: var(--bg);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}
.card-disabled-wrapper:hover .card-disabled-tooltip {
  display: block;
}

/* -- Example thumbnail ---------------------------------------------------- */
.example-thumbnail-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.example-thumbnail {
  width: 80px;
  height: 110px;
  object-fit: cover;
  object-position: top;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.example-thumbnail:hover {
  border-color: var(--border-hover);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.example-info {
  flex: 1;
  min-width: 0;
}
.example-info .example-name {
  font-weight: 500;
  font-size: 13px;
  margin-bottom: 2px;
}
.example-info .example-meta {
  font-size: 11px;
  color: var(--text-muted);
}

/* -- PDF Preview Modal ---------------------------------------------------- */
.pdf-preview-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.pdf-preview-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.pdf-preview-dialog {
  background: var(--bg);
  border-radius: var(--radius);
  width: 90vw;
  max-width: 800px;
  height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.25);
}
.pdf-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pdf-preview-header span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}
.pdf-preview-body {
  flex: 1;
  overflow: hidden;
}
.pdf-preview-body embed {
  width: 100%;
  height: 100%;
  border: none;
}
.pdf-preview-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* -- Fake progress bar ---------------------------------------------------- */
.fake-progress-container {
  margin-top: 1rem;
}
.fake-progress-container .progress-bar-outer {
  height: 6px;
  border-radius: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
}
.fake-progress-container .progress-bar-inner {
  height: 100%;
  width: 0%;
  background: var(--text);
  border-radius: 3px;
  transition: width 0.3s ease;
}
/* ── Mission hover menu ─────────────────────────────────────────────── */
.mission-menu {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
}
.mission-menu-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding: 4px 14px;
  cursor: pointer;
  letter-spacing: 0.01em;
}
.mission-menu-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 280px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 100;
  padding: 6px 0;
}
.mission-menu:hover .mission-menu-dropdown {
  display: block;
}
.mission-menu-dropdown.open {
  display: block;
}
.mission-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text);
}
.mission-menu-item:hover {
  background: var(--bg-hover, #f1f3f5);
}
.mission-menu-item .btn-play {
  margin-left: 12px;
}

/* -- Mission analysis preview/edit toggle --------------------------------- */
.mission-preview {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: Inter, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  background: var(--bg-secondary);
  cursor: pointer;
  min-height: 36px;
  transition: border-color 0.15s;
}
.mission-preview:hover {
  border-color: var(--text-secondary);
}
.mission-preview:empty::before {
  content: 'Cliquer pour éditer…';
  color: var(--text-tertiary, #999);
  font-style: italic;
}
.mission-preview p { margin: 0 0 6px 0; }
.mission-preview p:last-child { margin-bottom: 0; }
.mission-preview ul, .mission-preview ol { margin: 4px 0; padding-left: 20px; }
.mission-preview strong { font-weight: 600; }

.mission-textarea {
  width: 100%;
  resize: vertical;
  padding: 8px;
  border: 1px solid var(--accent, #3b82f6);
  border-radius: 6px;
  font-family: Inter, sans-serif;
  font-size: 13px;
  background: var(--bg-secondary);
  overflow: hidden;
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.mission-comment {
  margin-top: 6px;
  padding: 6px 10px;
  border-left: 2px solid var(--border);
  background: var(--bg-dim, #f8f9fa);
  border-radius: 0 4px 4px 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-tertiary, #888);
  font-style: italic;
}
.mission-comment:empty {
  display: none;
}
.mission-comment::before {
  content: 'Raisonnement : ';
  font-weight: 600;
  font-style: normal;
  color: var(--text-secondary);
  margin-right: 4px;
}

.mission-sources {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-height: 0;
}
.mission-source-chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 8px;
  background: var(--bg-dim, #f3f4f6);
  font-size: 10px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* -- Play buttons (manual pipeline launch in header) ---------------------- */
.btn-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  padding: 0;
  margin-left: 2px;
  flex-shrink: 0;
}
.btn-play:hover:not(:disabled) {
  color: var(--primary, #3b82f6);
  border-color: var(--primary, #3b82f6);
  background: color-mix(in srgb, var(--primary, #3b82f6) 8%, transparent);
}
.btn-play:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.btn-play.running {
  color: var(--primary, #3b82f6);
  border-color: var(--primary, #3b82f6);
  animation: stepper-pulse 1s infinite;
}
.btn-play.done {
  color: var(--success, #22c55e);
  border-color: var(--success, #22c55e);
}
.btn-play.error {
  color: var(--destructive, #ef4444);
  border-color: var(--destructive, #ef4444);
}

/* -- Inline progress (compact status in header bar) ----------------------- */
.inline-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 8px;
  white-space: nowrap;
  overflow: hidden;
}
.inline-progress:empty,
.inline-progress.hidden { display: none; }
.inline-progress-icon {
  display: inline-flex;
  width: 14px;
  height: 14px;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}
.inline-progress-icon.running::after {
  content: "\25CF";
  color: var(--primary, #3b82f6);
  animation: stepper-pulse 1s infinite;
}
.inline-progress-icon.done::after {
  content: "\2713";
  color: var(--success, #22c55e);
}
.inline-progress-icon.error::after {
  content: "\2717";
  color: var(--destructive, #ef4444);
}
@keyframes stepper-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* -- Multi-file stepper --------------------------------------------------- */
.multi-file-stepper {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.multi-file-stepper.hidden { display: none; }
.multi-file-stepper-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.multi-file-stepper-name {
  min-width: 120px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: var(--text);
}
.multi-file-stepper-step {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-raised, var(--surface));
  color: var(--text-dim);
  font-size: 11px;
}
.multi-file-stepper-step[data-status="running"] {
  color: var(--primary);
  background: var(--primary-bg, rgba(59,130,246,0.1));
  animation: stepper-pulse 1s infinite;
}
.multi-file-stepper-step[data-status="done"] {
  color: var(--success, #22c55e);
}
.multi-file-stepper-step[data-status="error"] {
  color: var(--destructive, #ef4444);
}
.multi-file-stepper-arrow {
  color: var(--text-dim);
  font-size: 10px;
}

/* -- Grouping (cards now in panel-infos, table in zone-bottom) ------------ */

/* Groups table (in zone-bottom) */
.panel-groups-table {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem;
}

/* Group cluster (left panel) */
.group-cluster {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 1rem;
  position: relative;
}
.group-cluster-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.group-cluster-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  flex: 1;
}
.group-cluster-count {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}
.group-cluster-comment {
  font-size: 11px;
  color: var(--text-muted, #6b7280);
  font-style: italic;
  line-height: 1.4;
  margin-bottom: 0.5rem;
  padding: 0.25rem 0;
  outline: none;
  border-radius: 4px;
  min-height: 1.4em;
}
.group-cluster-comment:hover { background: var(--bg-subtle, #f8fafc); }
.group-cluster-comment:focus { background: var(--bg-subtle, #f8fafc); box-shadow: 0 0 0 1px var(--border); }
.group-cluster-comment:empty::before {
  content: attr(data-placeholder);
  color: var(--text-dim);
  font-style: italic;
}
.group-cluster-name[contenteditable] {
  outline: none;
  border-radius: 4px;
  padding: 1px 4px;
  margin: -1px -4px;
}
.group-cluster-name[contenteditable]:hover { background: var(--bg-subtle, #f8fafc); }
.group-cluster-name[contenteditable]:focus { background: var(--bg-subtle, #f8fafc); box-shadow: 0 0 0 1px var(--border); }
.group-cluster-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

/* Group card inside cluster */
.group-info-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.25rem;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  transition: border-color 0.12s, background 0.12s, opacity 0.12s;
}
.group-info-card:hover { border-color: var(--border-hover); }
.group-info-card.dragging { opacity: 0.4; }
.dragging-active .group-info-card:not(.dragging) { pointer-events: none; }
.dragging-active .group-cluster-header { pointer-events: none; }
.group-info-card.unvalidated {
  opacity: 0.4;
  border-style: dashed;
}
.group-card-summary {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
}
.group-card-summary strong { flex: 1; }
.group-card-toggle {
  font-size: 10px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.group-card-detail {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
}
.group-card-comment { margin-bottom: 0.25rem; }
.info-comment.collapsed { display: none; }
.comment-toggle {
  cursor: pointer;
  font-size: 10px;
  color: var(--text-dim);
  user-select: none;
  padding: 0 4px;
  display: inline-block;
}
.comment-toggle:hover { color: var(--text); }
.group-card-labels { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.25rem; }

/* Drag target indicators */
.drag-over { background: rgba(0,0,0,0.04); border-color: var(--text) !important; }
.drop-zone-new-group,
.drop-zone-ungrouped {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  min-height: 40px;
  padding: 0.5rem 1rem;
  background: var(--surface);
  opacity: 0;
  pointer-events: none;
  max-height: 0;
  min-height: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
  transition: opacity 0.15s, max-height 0.2s, min-height 0.2s, padding 0.2s, margin 0.2s, border-color 0.15s, background 0.15s;
}
.drop-zone-new-group {
  position: sticky;
  top: 0;
  z-index: 10;
}
.drop-zone-new-group.visible,
.drop-zone-ungrouped.visible {
  opacity: 1;
  pointer-events: auto;
  max-height: 80px;
  min-height: 64px;
  padding: 0.5rem 1rem;
  margin-bottom: 0.75rem;
  border-color: var(--text-dim);
}
.drop-zone-new-group.drag-over,
.drop-zone-ungrouped.drag-over {
  border-color: var(--text);
  background: rgba(0,0,0,0.06);
  color: var(--text);
}

/* Groups table (right panel) */
.groups-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}
.groups-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
}
.groups-table th:last-child { width: 32px; }
.groups-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.45;
}
.groups-table tr:hover td { background: var(--surface); }
.groups-table tr.group-row-active td { background: #f0f0f0; }

.group-name-cell {
  font-weight: 600;
  color: var(--text);
  overflow: visible;
  width: 25%;
}
.group-name-editable {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  width: 100%;
  padding: 2px 4px;
  border-radius: 3px;
  resize: vertical;
  min-height: 28px;
  field-sizing: content;
}
.group-name-editable:focus {
  outline: none;
  background: rgba(0,0,0,0.03);
}

.linked-info-cell { color: var(--text-muted); overflow: visible; }
.linked-info-cell .info-card {
  margin-bottom: 0.4rem;
  cursor: default;
}
.linked-info-cell .info-card:last-of-type { margin-bottom: 0; }
.conclusion-item .info-card { flex: 1; min-width: 0; margin-bottom: 0; }
.linked-info-editable {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-muted);
  width: 100%;
  padding: 2px 4px;
  border-radius: 3px;
  resize: vertical;
  min-height: 24px;
  field-sizing: content;
}
.linked-info-editable:focus {
  outline: none;
  background: rgba(0,0,0,0.03);
  color: var(--text);
}

.conclusion-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 100px;
  background: #f0f4ff;
  border: 1px solid #c7d4f7;
  color: #3b5bdb;
  margin-right: 4px;
  margin-bottom: 2px;
}

.conclusion-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 0.4rem;
}
.conclusion-item:last-child { margin-bottom: 0; }
.conclusion-item .subtype-hashtag-wrapper { flex-shrink: 0; margin-top: 2px; }
.conclusion-item .linked-info-editable { flex: 1; min-width: 0; }

.conclusion-subtype-select {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 4px;
  border-radius: 100px;
  background: #f0f4ff;
  border: 1px solid #c7d4f7;
  color: #3b5bdb;
  margin-bottom: 4px;
  cursor: pointer;
  outline: none;
}
.conclusion-subtype-select:focus {
  border-color: #3b5bdb;
}

.derived-type-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 100px;
  background: #eef6ee;
  border: 1px solid #b5d8b5;
  color: #2d7a2d;
  margin-bottom: 4px;
  letter-spacing: 0.3px;
}
.derived-info-cell .info-card {
  position: relative;
  margin-bottom: 0.5rem;
}

.btn-add-linked {
  display: block;
  margin-top: 4px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text-dim);
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
}
.btn-add-linked:hover { color: var(--text); border-color: var(--text-dim); }

.btn-delete-group {
  padding: 2px 6px;
  font-size: 14px;
  color: var(--text-dim);
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-xs);
}
.btn-delete-group:hover { color: #dc2626; background: #fef2f2; }

.group-actions-cell { width: 32px; text-align: center; }

.btn-add-group-row {
  margin-top: 0.5rem;
  padding: 0.3rem 1rem;
  font-size: 12px;
  color: var(--text-dim);
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  width: 100%;
}
.btn-add-group-row:hover { color: var(--text); border-color: var(--text-dim); }

/* Banner / overlay for grouping */
.grouping-banner {
  padding: 0.5rem 1rem;
  font-size: 12px;
  color: #92400e;
  background: #fef3c7;
  border-bottom: 1px solid #fde68a;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.grouping-banner.hidden { display: none; }

.grouping-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  border-radius: var(--radius);
}
.grouping-overlay-msg {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  max-width: 360px;
  line-height: 1.6;
}

.grouping-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.grouping-toolbar .spacer { flex: 1; }

/* Grouping progress bar */
.grouping-progress {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}
.grouping-progress.visible { display: flex; }
.grouping-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.grouping-progress-bar-inner {
  height: 100%;
  background: var(--text);
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s ease;
}
.grouping-progress-bar-inner.indeterminate {
  width: 30%;
  animation: indeterminate 1.5s ease-in-out infinite;
}
@keyframes indeterminate {
  0% { margin-left: 0; width: 30%; }
  50% { margin-left: 35%; width: 30%; }
  100% { margin-left: 70%; width: 30%; }
}

/* Drag handle */
.drag-handle {
  display: inline-flex;
  align-items: center;
  cursor: grab;
  color: var(--text-dim);
  flex-shrink: 0;
  padding: 2px;
  margin-right: 4px;
  opacity: 0.4;
  transition: opacity 0.12s;
}
.group-info-card:hover .drag-handle { opacity: 1; }

/* Subtype hashtag input */
.subtype-hashtag-wrapper {
  position: relative;
  display: inline-block;
}
.subtype-hashtag-input {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 100px;
  background: #f0f4ff;
  border: 1px solid #c7d4f7;
  color: #3b5bdb;
  outline: none;
  width: auto;
  min-width: 60px;
  max-width: 180px;
  font-family: inherit;
  cursor: text;
}
.subtype-hashtag-input:focus {
  border-color: #3b5bdb;
}
.subtype-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  min-width: 160px;
  max-height: 180px;
  overflow-y: auto;
  display: none;
}
.subtype-suggestions.visible { display: block; }
.subtype-suggestion-item {
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  color: var(--text);
}
.subtype-suggestion-item:hover,
.subtype-suggestion-item.active { background: var(--surface); color: var(--text); }

/* Importance chip in card summary */
.group-card-importance {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 100px;
  margin-left: 6px;
  flex-shrink: 0;
  border: 1px solid transparent;
  line-height: 1.4;
}

/* -- Toast notifications ------------------------------------------------ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  opacity: 0;
  transform: translateY(8px);
  animation: toast-in 0.25s ease forwards;
  max-width: 380px;
}
.toast.toast-out {
  animation: toast-out 0.2s ease forwards;
}
.toast-success { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.toast-error   { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.toast-info    { border-color: var(--border); background: var(--surface); color: var(--text); }
.toast-message { flex: 1; }
.toast-close {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  flex-shrink: 0;
}
.toast-close:hover { opacity: 1; }
@keyframes toast-in {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(8px); }
}

/* -- 4-zone layout -------------------------------------------------------- */
.app-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.zone-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.zone-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* Accueil / graph container */
.accueil-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  min-height: 0;
}
.accueil-body.hidden { display: none; }

/* Zone panels (left, right, bottom) */
.zone-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  transition: width 0.18s ease, height 0.18s ease;
}

.zone-left {
  width: 300px;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}

.zone-right {
  width: 320px;
  border-left: 1px solid var(--border);
  flex-shrink: 0;
}

.zone-bottom {
  height: 240px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.zone-panel.collapsed {
  width: 0 !important;
  height: 0 !important;
  border: none !important;
  overflow: hidden;
}

.zone-panel-header {
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  height: 32px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.zone-panel-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
}

/* Fixed panel title (left/right zones) */
.zone-panel-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Artifact chip bar (main + bottom zones) */
.artifact-chip-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 0.5rem;
  height: 32px;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.artifact-chip-bar::-webkit-scrollbar { display: none; }
/* Border only on main zone chip bar (top of main zone) */
#artifact-chip-bar-main {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.artifact-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  line-height: 1;
}
.artifact-chip:hover {
  color: var(--text);
  background: var(--surface-hover);
}
.artifact-chip.active {
  color: var(--text);
  background: var(--surface-hover);
  border-color: var(--border);
}
.artifact-chip svg,
.artifact-chip .chip-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.zone-close-btn {
  height: 24px !important;
  width: 24px !important;
  padding: 0 !important;
  font-size: 14px !important;
  flex-shrink: 0;
}

.zone-panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
/* Right panel needs overflow:hidden so the chatbot flex layout works
   (chat-messages scrolls, chat-input-area stays pinned at the bottom) */
#zone-right-content {
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
}


/* Zone resizers */
.zone-resizer-v {
  width: 5px;
  flex-shrink: 0;
  cursor: col-resize;
  background: transparent;
  transition: background 0.12s;
  user-select: none;
}

.zone-resizer-h {
  height: 5px;
  flex-shrink: 0;
  cursor: row-resize;
  background: transparent;
  transition: background 0.12s;
  user-select: none;
}

.zone-resizer-v:hover,
.zone-resizer-h:hover {
  background: rgba(0,0,0,0.07);
}

.zone-resizer-v.dragging,
.zone-resizer-h.dragging {
  background: rgba(0,0,0,0.12);
}

.zone-resizer-v.collapsed,
.zone-resizer-h.collapsed {
  width: 0;
  height: 0;
  overflow: hidden;
}

/* -- Infos view toggle (linear/grouped) ----------------------------------- */
#infos-linear-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

#infos-grouped-view {
  flex: 1;
  overflow: hidden;
}

/* -- Knowledge Graph artifact --------------------------------------------- */

/* Container: fills available space with toolbar on top */
#accueil-body[data-artifact="graph"],
[data-zone-artifact="graph"] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Toolbar */
.kg-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  flex-wrap: wrap;
  min-height: 38px;
}

.kg-toolbar-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.kg-toolbar-group + .kg-toolbar-group {
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

.kg-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 8px;
  font-size: 11px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}

.kg-btn:hover:not(:disabled) {
  background: var(--bg);
  border-color: var(--border-hover);
}

.kg-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.kg-btn span {
  pointer-events: none;
}

.kg-btn-danger:hover:not(:disabled) {
  border-color: #ef4444;
  color: #ef4444;
}

/* Graph area */
.kg-graph-area {
  flex: 1;
  min-height: 200px;
  position: relative;
  height: 0;
}

/* Legend */
.kg-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--text-muted);
  margin-left: auto;
}

.kg-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.kg-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* NER status badge */
.kg-ner-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.kg-ner-pending {
  background: var(--warning-bg, rgba(234,179,8,0.12));
  color: var(--warning, #eab308);
}

.kg-ner-running {
  background: var(--info-bg, rgba(59,130,246,0.12));
  color: var(--info, #3b82f6);
  animation: ner-pulse 1.5s ease-in-out infinite;
}

.kg-ner-completed {
  background: var(--success-bg, rgba(34,197,94,0.12));
  color: var(--success, #22c55e);
}

.kg-ner-failed {
  background: var(--destructive-bg, rgba(239,68,68,0.12));
  color: var(--destructive, #ef4444);
  cursor: help;
}

@keyframes ner-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Mode indicator (e.g. "click source node") */
.kg-mode-indicator {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  z-index: 10;
  pointer-events: none;
}

/* Detail panel (floating inside graph container) */
.kg-detail-panel {
  position: absolute;
  top: 44px;
  right: 8px;
  width: 260px;
  max-height: calc(100% - 52px);
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  z-index: 20;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  font-size: 13px;
}

.kg-detail-panel.hidden {
  display: none;
}

.kg-detail-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.kg-detail-title {
  font-weight: 600;
  font-size: 14px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kg-detail-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.kg-detail-img {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: var(--radius-xs);
  margin-bottom: 8px;
}

.kg-detail-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 6px;
}

.kg-detail-wiki-link {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 8px;
}

.kg-detail-wiki-link:hover {
  text-decoration: underline;
}

.kg-detail-attrs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.kg-detail-attr {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.kg-detail-attr-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kg-detail-attr-value {
  font-size: 12px;
  color: var(--text);
}

/* Tooltip (for node/edge hover) */
.kg-tooltip {
  position: absolute;
  z-index: 100;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  max-width: 280px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  pointer-events: none;
}

.kg-tooltip-inner {
  display: flex;
  gap: 10px;
}

.kg-tooltip-img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
}

.kg-tooltip-content {
  flex: 1;
  min-width: 0;
}

.kg-tooltip-name {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
}

.kg-tooltip-type {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  color: white;
  padding: 1px 6px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.kg-tooltip-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* NER tooltip (Wikipedia-style popup on document text) */
.ner-tooltip {
  position: fixed;
  z-index: 9999;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  max-width: 300px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  pointer-events: none;
  animation: kg-fade-in 0.15s ease;
}

@keyframes kg-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* NER entity highlighting in document text */
.ner-entity {
  transition: background 0.12s;
}

.ner-entity:hover {
  background: rgba(249, 115, 22, 0.1);
}

/* Modal overlay */
.kg-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: kg-fade-in 0.15s ease;
}

.kg-modal {
  background: var(--bg);
  border-radius: var(--radius);
  max-width: 440px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

.kg-modal-header {
  padding: 16px 20px 12px;
  font-size: 15px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.kg-modal-body {
  padding: 16px 20px;
}

.kg-modal-body .field {
  margin-bottom: 12px;
}

.kg-modal-body .field:last-child {
  margin-bottom: 0;
}

.kg-modal-body .field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.kg-modal-body .field input,
.kg-modal-body .field select,
.kg-modal-body .field textarea {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg);
  color: var(--text);
}

.kg-modal-body .field textarea {
  resize: vertical;
}

.kg-modal-footer {
  padding: 12px 20px 16px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

/* -- Responsive header ---------------------------------------------------- */
@media (max-width: 1400px) {
  .results-header .btn-ghost { font-size: 11px; padding: 0 6px; }
  .results-header .logo { display: none; }
  .user-email { max-width: 100px; }
}
@media (max-width: 1100px) {
  .results-header .btn-ghost { font-size: 10px; padding: 0 4px; }
}
@media (max-width: 900px) {
  .results-header { flex-wrap: wrap; height: auto; min-height: 40px; }
}

/* -- Validation index bar ------------------------------------------------- */
.validation-index-bar {
  margin-top: 6px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: visible;
  cursor: help;
  position: relative;
}
.validation-index-bar::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}
.validation-index-bar:hover::before {
  opacity: 1;
}
.validation-index-bar::after {
  content: '';
  position: absolute;
  top: -6px;
  bottom: -6px;
  left: 0;
  right: 0;
}
.validation-index-bar > div {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}

/* -- Document table rows -------------------------------------------------- */
.doc-table-row:hover { background: var(--surface); }
.doc-table-row[data-selected] { background: rgba(59, 130, 246, 0.04); }

/* -- Information table (artifact) ----------------------------------------- */
/* ── Tabulator theme overrides ─────────────────────────────────────────── */
.tabulator {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  border: none;
  background: var(--bg);
}
.tabulator .tabulator-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.tabulator .tabulator-header .tabulator-col {
  background: var(--bg);
  border-right: 1px solid var(--border);
}
.tabulator .tabulator-header .tabulator-col .tabulator-col-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input,
.tabulator .tabulator-header .tabulator-col .tabulator-header-filter select {
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 2px 6px;
  background: var(--bg);
  color: var(--text);
}
.tabulator .tabulator-tableholder .tabulator-table .tabulator-row {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.tabulator .tabulator-tableholder .tabulator-table .tabulator-row:hover {
  background: var(--surface);
}
.tabulator .tabulator-tableholder .tabulator-table .tabulator-row .tabulator-cell {
  border-right: 1px solid var(--border);
  padding: 6px 10px;
  vertical-align: middle;
}
/* Multi-line cells */
.tabulator .tabulator-row .tabulator-cell {
  white-space: normal !important;
  overflow: hidden !important;
  line-height: 1.45;
}
/* Editing state */
.tabulator .tabulator-row .tabulator-cell .tabulator-editing {
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: 3px;
  padding: 4px 6px;
}

/* Dropdown menus for table cells */
.info-table-dropdown {
  position: absolute;
  z-index: 1000;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  padding: 4px 0;
  min-width: 160px;
  max-height: 280px;
  overflow-y: auto;
  font-size: 12px;
}
.info-table-dropdown-item {
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.1s;
}
.info-table-dropdown-item:hover { background: var(--surface); }
.info-table-dropdown-item.active { background: rgba(59, 130, 246, 0.08); font-weight: 500; }
.info-table-dropdown-header {
  padding: 6px 12px 2px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.info-table-label-dropdown {
  min-width: 200px;
}

/* Deleted row: strikethrough then fade out */
.info-table-row-deleted {
  text-decoration: line-through;
  opacity: 0.45;
}
/* Grouped rows: indent */
.info-table-row-grouped > .tabulator-cell:first-child {
  padding-left: 28px !important;
}
/* Group header row styling */
.tabulator .tabulator-row.tabulator-group {
  background: var(--surface, #f8f9fa);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tabulator .tabulator-row.tabulator-group:hover {
  background: var(--surface-hover, #f0f1f3);
}
.info-table-group-arrow {
  font-size: 10px;
  color: var(--text-muted);
  width: 14px;
  display: inline-block;
  text-align: center;
}
.info-table-group-count {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 8px;
  font-weight: 400;
}
.info-table-group-deduction {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 400;
  font-style: italic;
  margin-left: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 400px;
}

/* Enrichment filter dropdowns */
.enrichment-filter-section { margin: 4px 0; }
.enrichment-filter-section summary { cursor: pointer; font-size: 12px; color: var(--text-muted); }
.enrichment-filter-item { display: block; font-size: 12px; padding: 2px 4px; cursor: pointer; }
.enrichment-filter-item:hover { background: var(--surface-hover); }
.enrichment-filter-item input { margin-right: 4px; }

/* ── Map artifact ──────────────────────────────────────────────────────── */
.map-custom-tooltip {
  background: var(--bg) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  padding: 0 !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
  max-width: 320px;
  max-height: 300px;
  overflow-y: auto;
}
.map-custom-tooltip::before {
  border-top-color: var(--border) !important;
}
.map-tooltip {
  padding: 10px 12px;
  font-family: 'Inter', sans-serif;
}
.map-tooltip-location {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.map-tooltip-card {
  padding: 6px 0;
}
.map-tooltip-card + .map-tooltip-card {
  border-top: 1px solid var(--border);
}
.map-tooltip-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}
.map-tooltip-comment {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Map popup (click-to-open, stays visible) */
.map-custom-popup .leaflet-popup-content-wrapper {
  background: var(--bg) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18) !important;
  padding: 0 !important;
}
.map-custom-popup .leaflet-popup-content {
  margin: 0 !important;
  max-height: 350px;
  overflow-y: auto;
}
.map-custom-popup .leaflet-popup-tip {
  background: var(--bg) !important;
  border: 1px solid var(--border) !important;
}
.map-popup {
  padding: 10px 14px;
  font-family: 'Inter', sans-serif;
}
.map-popup-location {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.map-popup-card {
  padding: 6px 0;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s;
}
.map-popup-card:hover {
  background: var(--bg-dim, #f3f4f6);
}
.map-popup-card + .map-popup-card {
  border-top: 1px solid var(--border);
}
.map-popup-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}
.map-popup-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Map side panel (articles list on marker click) */
.map-side-panel {
  width: 320px;
  min-width: 280px;
  max-width: 380px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--bg);
  overflow: hidden;
}
.map-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.map-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.map-panel-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-dim);
  padding: 0;
  line-height: 1;
}
.map-panel-close:hover {
  color: var(--text);
}
.map-panel-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.map-panel-card {
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.map-panel-card:hover {
  background: var(--bg-dim, #f3f4f6);
}
.map-panel-card + .map-panel-card {
  border-top: 1px solid var(--border);
}
.map-panel-card-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}
.map-panel-card-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Fix Leaflet z-index conflicts with artifact panels */
.leaflet-pane { z-index: 1 !important; }
.leaflet-top, .leaflet-bottom { z-index: 2 !important; }

/* ── Knowledge matrix (CDGVCEF × PMESII) ────────────────────────────── */
.knowledge-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  line-height: 1.4;
  margin-top: 8px;
}
.knowledge-matrix th,
.knowledge-matrix td {
  border: 1px solid var(--border, #e2e8f0);
  padding: 6px 8px;
  vertical-align: top;
  text-align: left;
}
.knowledge-matrix thead th {
  background: var(--bg-hover, #f1f3f5);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-dim);
  text-align: center;
  white-space: nowrap;
}
.knowledge-matrix tbody th {
  background: var(--bg-card, #fff);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  min-width: 120px;
  color: var(--text);
}
.knowledge-matrix tbody td {
  font-size: 11px;
  color: var(--text);
  min-width: 100px;
}
.knowledge-matrix tbody td ul {
  margin: 0;
  padding-left: 14px;
}
.knowledge-matrix tbody td ul li {
  margin-bottom: 2px;
}

/* ── Actor Cards — master-detail layout ─────────────────────────────────── */
.actor-cards-list {
  width: 240px;
  min-width: 200px;
  max-width: 300px;
  flex-shrink: 0;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--bg-card, #fff);
}
.actor-cards-detail {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

/* List items */
.actor-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light, #f1f3f5);
  transition: background 0.12s;
}
.actor-list-item:hover {
  background: var(--bg-hover, #f8f9fa);
}
.actor-list-item.active {
  background: var(--primary-light, #eff6ff);
  border-left: 3px solid var(--primary, #3b82f6);
  padding-left: 9px;
}
.actor-list-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  object-fit: cover;
}
.actor-list-info {
  flex: 1;
  min-width: 0;
}
.actor-list-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.actor-list-meta {
  font-size: 10px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}
.actor-list-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
}
.actor-list-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Detail panel */
.actor-detail-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.actor-detail-section {
  margin-bottom: 16px;
}
.actor-detail-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

/* -- Inbox filters -------------------------------------------------------- */
.inbox-filter-chip {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.inbox-filter-chip:hover {
  border-color: var(--border-hover);
  background: var(--surface);
}
.inbox-filter-chip.active {
  background: var(--primary, #3b82f6);
  color: #fff;
  border-color: var(--primary, #3b82f6);
}
.inbox-filter-select {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

/* -- Actor inline editing ------------------------------------------------- */
.actor-editable {
  cursor: pointer;
  border-radius: 4px;
  transition: outline 0.15s;
}
.actor-editable:hover {
  outline: 1px dashed var(--border-hover, rgba(0,0,0,0.2));
  outline-offset: 2px;
}
.actor-inline-input {
  width: 100%;
  font: inherit;
  font-size: inherit;
  color: inherit;
  background: var(--surface, #f9fafb);
  border: 1px solid var(--border-hover, rgba(0,0,0,0.15));
  border-radius: 4px;
  padding: 4px 6px;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
}
.actor-inline-input:focus {
  border-color: var(--primary, #3b82f6);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}
.knowledge-matrix td.actor-editable:hover {
  outline: 1px dashed var(--border-hover, rgba(0,0,0,0.2));
  outline-offset: -1px;
}

/* -- Inbox article cards -------------------------------------------------- */
.inbox-article {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light, #f1f3f5);
  transition: background 0.12s;
}
.inbox-article:hover {
  background: var(--bg-hover, #f8f9fa);
}
.inbox-article-img {
  width: 80px;
  height: 56px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-dim, #e5e7eb);
}
.inbox-article-body {
  flex: 1;
  min-width: 0;
}
.inbox-article-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
}
.inbox-article-title a {
  color: var(--text);
  text-decoration: none;
}
.inbox-article-title a:hover {
  color: var(--primary, #3b82f6);
}
.inbox-article-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}
.inbox-article-meta {
  font-size: 10px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Article impact analysis — columnar layout */
.inbox-impact-score {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  padding-top: 2px;
}
.inbox-impact-explanation {
  flex-shrink: 0;
  width: 240px;
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.4;
  align-self: center;
}
.impact-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.impact-score-n3 { background: #991b1b; color: white; }
.impact-score-n2 { background: #dc2626; color: white; }
.impact-score-n1 { background: #f97316; color: white; }
.impact-score-0  { background: var(--bg-dim, #e5e7eb); color: var(--text-muted); }
.impact-score-p1 { background: #86efac; color: #14532d; }
.impact-score-p2 { background: #22c55e; color: white; }
.impact-score-p3 { background: #15803d; color: white; }

/* Interest score badge (distance informations-acteurs) */
.interest-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  white-space: nowrap;
  letter-spacing: 0.02em;
  vertical-align: middle;
}
.interest-badge--high {
  background: #dcfce7;
  color: #166534;
}
.interest-badge--medium {
  background: #fef3c7;
  color: #92400e;
}
.interest-badge--low {
  background: var(--bg-dim, #e5e7eb);
  color: var(--text-dim, #9ca3af);
}

/* Inbox Tabulator overrides */
[data-role="inbox-list"] .tabulator {
  border: none;
  background: transparent;
  font-size: 12px;
}
[data-role="inbox-list"] .tabulator-header {
  background: var(--surface) !important;
  border-bottom: 2px solid var(--border) !important;
  min-height: 32px !important;
}
[data-role="inbox-list"] .tabulator-header .tabulator-col {
  background: var(--surface) !important;
  border-right: 1px solid var(--border);
}
[data-role="inbox-list"] .tabulator-col-title {
  font-size: 11px !important;
  font-weight: 700 !important;
  color: var(--text) !important;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 6px 0 !important;
}
[data-role="inbox-list"] .tabulator-col-content {
  padding: 4px 6px;
}
[data-role="inbox-list"] .tabulator-row {
  border-bottom: 1px solid var(--border);
  min-height: auto !important;
}
[data-role="inbox-list"] .tabulator-row .tabulator-cell {
  max-height: 120px;
  overflow: hidden !important;
}
[data-role="inbox-list"] .tabulator-cell {
  padding: 6px 8px;
  vertical-align: top;
  overflow: hidden !important;
  white-space: normal !important;
  text-overflow: ellipsis;
}
[data-role="inbox-list"] .tabulator-cell > * {
  white-space: normal !important;
}
[data-role="inbox-list"] .tabulator-cell[tabulator-field="actors_text"],
[data-role="inbox-list"] .tabulator-cell[tabulator-field="locations_text"] {
  overflow: visible !important;
}
[data-role="inbox-list"] .tabulator-header-filter input,
[data-role="inbox-list"] .tabulator-header-filter select {
  font-size: 11px;
  padding: 2px 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 100%;
}
[data-role="inbox-list"] .tabulator-footer,
[data-role="saved-articles-list"] .tabulator-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 11px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
[data-role="inbox-list"] .tabulator-footer .tabulator-page,
[data-role="saved-articles-list"] .tabulator-footer .tabulator-page {
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  cursor: pointer;
  min-width: 28px;
  text-align: center;
}
[data-role="inbox-list"] .tabulator-footer .tabulator-page:hover,
[data-role="saved-articles-list"] .tabulator-footer .tabulator-page:hover {
  background: var(--bg-dim, #f3f4f6);
}
[data-role="inbox-list"] .tabulator-footer .tabulator-page.active,
[data-role="saved-articles-list"] .tabulator-footer .tabulator-page.active {
  background: var(--text);
  color: var(--bg);
}
[data-role="inbox-list"] .tabulator-footer .tabulator-page.disabled,
[data-role="saved-articles-list"] .tabulator-footer .tabulator-page.disabled {
  opacity: 0.3;
  cursor: default;
}
[data-role="inbox-list"] .tabulator-page-size,
[data-role="saved-articles-list"] .tabulator-page-size {
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 6px;
  max-width: 70px;
}
[data-role="inbox-list"] .tabulator-paginator,
[data-role="saved-articles-list"] .tabulator-paginator {
  display: flex;
  align-items: center;
  gap: 2px;
}
[data-role="inbox-list"] .tabulator-footer .tabulator-footer-contents,
[data-role="saved-articles-list"] .tabulator-footer .tabulator-footer-contents {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
[data-role="inbox-list"] .tabulator-page-counter,
[data-role="saved-articles-list"] .tabulator-page-counter {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}
.inbox-actor-chip {
  display: block;
  position: relative;
  cursor: default;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inbox-actor-chip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 0;
  bottom: 100%;
  margin-bottom: 2px;
  background: var(--text);
  color: var(--bg);
  font-size: 10px;
  font-style: italic;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
}
.inbox-location-chip {
  display: block;
  position: relative;
  cursor: default;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inbox-location-chip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 0;
  bottom: 100%;
  margin-bottom: 2px;
  background: var(--text);
  color: var(--bg);
  font-size: 10px;
  font-style: italic;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
}
.inbox-location-main {
  font-weight: 700 !important;
  background: #a7f3d0 !important;
}

/* Language badge on article titles */
.lang-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-dim, #e5e7eb);
  color: var(--text-muted);
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Original title shown below French translation */
.inbox-article-title-original {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.3;
  margin-bottom: 4px;
  font-style: italic;
}

/* Language checkbox labels in settings modal */
.lang-checkbox-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs, 6px);
  transition: border-color 0.12s, background 0.12s;
}
.lang-checkbox-label:hover {
  border-color: var(--border-hover);
  background: var(--surface);
}
.lang-checkbox-label input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

/* Bookmark (flag) button on article cards */
.inbox-bookmark-btn {
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim, #9ca3af);
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.inbox-bookmark-btn:hover {
  background: var(--bg-hover, #f3f4f6);
  color: var(--primary, #3b82f6);
}
.inbox-bookmark-btn.flagged {
  color: var(--primary, #3b82f6);
}
.inbox-bookmark-btn.flagged:hover {
  color: var(--danger, #ef4444);
}
.inbox-bookmark-btn:disabled {
  opacity: 0.4;
  cursor: wait;
}

/* Pulse animation for post-upload guidance */
@keyframes menu-label-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5); }
  50%  { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}
.mission-menu-label.pulse-guide {
  animation: menu-label-pulse 0.8s ease-in-out 3;
  border-radius: 6px;
}
