/**
 * app.css — Styles PWA RAC Audit
 * Mobile-first, optimisé iPhone Safari standalone
 */

/* ── Reset & variables ──────────────────────────────────────────────────────── */

:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --bg: #f8f9fa;
  --surface: #ffffff;
  --text: #202124;
  --text-secondary: #5f6368;
  --border: #e0e0e0;
  --danger: #d32f2f;
  --warning: #ef6c00;
  --success: #2e7d32;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.12);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
  --nav-height: 72px;
  --header-height: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ── Splash screen ──────────────────────────────────────────────────────────── */

.splash {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  z-index: 100;
  transition: opacity 0.4s;
}

.splash.fade-out {
  opacity: 0;
  pointer-events: none;
}

.splash-content {
  text-align: center;
  color: white;
}

.splash-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.splash-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.splash-subtitle {
  font-size: 14px;
  opacity: 0.8;
  margin-top: 4px;
}

/* ── App shell ──────────────────────────────────────────────────────────────── */

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */

.header {
  display: flex;
  align-items: center;
  height: var(--header-height);
  padding: 0 12px;
  padding-top: var(--safe-top);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.header-title {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
}

.header-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  font-size: 20px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-btn:active {
  background: var(--bg);
}

/* ── Contenu principal ──────────────────────────────────────────────────────── */

.main-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
}

.main-content.chat-mode {
  padding: 0;
  padding-bottom: 0;
  overflow: hidden;
}

/* ── Navigation bottom ──────────────────────────────────────────────────────── */

.bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: var(--nav-height);
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: color 0.2s;
  color: var(--text-secondary);
  font-size: 11px;
  position: relative;
}

.nav-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.nav-item.active {
  color: var(--primary);
}

.nav-icon {
  font-size: 22px;
  line-height: 1;
}

.nav-label {
  font-weight: 500;
}

/* ── Page Accueil — Grille agents ───────────────────────────────────────────── */

.page-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
}

.layer-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 16px 0 8px;
}

.layer-title:first-child {
  margin-top: 0;
}

.agents-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.agent-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: transform 0.15s, box-shadow 0.15s;
}

.agent-card:active {
  transform: scale(0.97);
  box-shadow: var(--shadow-lg);
}

.agent-card-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.agent-card-info {
  min-width: 0;
}

.agent-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.agent-card-title {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Page Chat ──────────────────────────────────────────────────────────────── */

.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height) - var(--safe-top) - var(--nav-height) - var(--safe-bottom));
  padding: 0;
  position: relative;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 12px 8px;
}

.chat-bubble {
  max-width: 92%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.4;
  word-break: break-word;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: var(--surface);
  box-shadow: var(--shadow);
  border-bottom-left-radius: 4px;
}

.chat-bubble.assistant .markdown-content h1 {
  font-size: 18px;
  font-weight: 700;
  margin: 12px 0 6px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.chat-bubble.assistant .markdown-content h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 10px 0 4px;
  color: var(--text);
}

.chat-bubble.assistant .markdown-content h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 8px 0 4px;
  color: var(--text-secondary);
}

.chat-bubble.assistant .markdown-content p {
  margin: 6px 0;
  line-height: 1.5;
}

.chat-bubble.assistant .markdown-content li {
  margin: 3px 0;
  line-height: 1.4;
}

.chat-bubble.assistant .markdown-content strong {
  color: var(--text);
}

.chat-bubble.assistant .markdown-content ul,
.chat-bubble.assistant .markdown-content ol {
  padding-left: 20px;
  margin: 4px 0;
}

.chat-bubble.assistant .markdown-content pre {
  background: #f5f5f5;
  padding: 8px 10px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 13px;
  margin: 8px 0;
}

.chat-bubble.assistant .markdown-content code.inline-code {
  background: #f5f5f5;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 13px;
}

.chat-bubble.assistant .markdown-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

.chat-bubble.assistant .markdown-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 8px 0;
}

.chat-bubble.assistant .markdown-content td,
.chat-bubble.assistant .markdown-content th {
  border: 1px solid var(--border);
  padding: 4px 8px;
}

.chat-bubble.typing::after {
  content: '...';
  animation: dots 1.2s infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* Overlay commandes (masqué par défaut) */
.chat-commands-overlay {
  position: absolute;
  bottom: 56px;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
  z-index: 5;
  max-height: 140px;
  overflow-y: auto;
}

.chat-commands-overlay.hidden {
  display: none;
}

.chat-commands-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.command-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--primary);
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.command-chip:active {
  background: var(--primary);
  color: white;
}

.command-chip-trigger {
  font-weight: 700;
  font-size: 12px;
}

/* Bouton toggle commandes */
.cmd-toggle-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--bg);
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cmd-toggle-btn.active {
  background: var(--primary);
  color: white;
}

/* Zone de saisie — collée en bas */
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 12px;
  padding-bottom: 8px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 15px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: var(--primary);
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-send-btn:disabled {
  opacity: 0.4;
}

.chat-capture-btns {
  display: flex;
  gap: 4px;
}

.capture-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--bg);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.capture-btn:active {
  background: var(--border);
}

/* ── Page Audit terrain ─────────────────────────────────────────────────────── */

.audit-header-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.audit-store-name {
  font-size: 18px;
  font-weight: 700;
}

.audit-meta {
  display: flex;
  gap: 16px;
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}

.audit-counters {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.counter-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg);
}

.counter-badge.critical { background: #ffebee; color: var(--danger); }
.counter-badge.high { background: #fff3e0; color: var(--warning); }
.counter-badge.medium { background: #fff9c4; color: #f9a825; }
.counter-badge.low { background: #e8f5e9; color: var(--success); }

.audit-checklist {
  list-style: none;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  box-shadow: var(--shadow);
}

.checklist-check {
  width: 22px;
  height: 22px;
  accent-color: var(--primary);
  flex-shrink: 0;
  margin-top: 2px;
}

.checklist-text {
  font-size: 14px;
  line-height: 1.4;
}

.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  right: 16px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: white;
  font-size: 28px;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab:active {
  transform: scale(0.92);
}

/* ── Page Rapports ──────────────────────────────────────────────────────────── */

.report-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}

.report-title {
  font-size: 15px;
  font-weight: 600;
}

.report-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.report-score {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.score-bar {
  flex: 1;
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}

.score-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.score-fill.green { background: var(--success); }
.score-fill.yellow { background: #f9a825; }
.score-fill.orange { background: var(--warning); }
.score-fill.red { background: var(--danger); }

.score-value {
  font-size: 14px;
  font-weight: 700;
  min-width: 40px;
  text-align: right;
}

/* ── Page Plans d'action ────────────────────────────────────────────────────── */

.pa-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.pa-filter {
  padding: 6px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.pa-filter.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.pa-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  border-left: 4px solid var(--border);
}

.pa-card.critical { border-left-color: var(--danger); }
.pa-card.high { border-left-color: var(--warning); }
.pa-card.medium { border-left-color: #f9a825; }
.pa-card.low { border-left-color: var(--success); }

.pa-title {
  font-size: 14px;
  font-weight: 600;
}

.pa-detail {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.pa-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.pa-deadline {
  font-size: 12px;
  font-weight: 500;
}

.pa-deadline.overdue { color: var(--danger); }
.pa-deadline.at-risk { color: var(--warning); }
.pa-deadline.on-time { color: var(--success); }

.pa-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.pa-status.open { background: #e3f2fd; color: var(--primary); }
.pa-status.in-progress { background: #fff3e0; color: var(--warning); }
.pa-status.overdue { background: #ffebee; color: var(--danger); }
.pa-status.closed { background: #e8f5e9; color: var(--success); }

/* ── État vide ──────────────────────────────────────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 4px;
}

.empty-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.empty-action {
  margin-top: 16px;
  padding: 10px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* ── Capture modal ──────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-sheet {
  width: 100%;
  max-width: 500px;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px;
  padding-bottom: calc(20px + var(--safe-bottom));
  max-height: 80vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

.capture-mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.capture-tab {
  flex: 1;
  padding: 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
}

.capture-tab.active {
  border-color: var(--primary);
  background: #e3f2fd;
  color: var(--primary);
  font-weight: 600;
}

.capture-textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
  outline: none;
}

.capture-textarea:focus {
  border-color: var(--primary);
}

.capture-location {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  margin-top: 10px;
  outline: none;
}

.capture-photo-area {
  margin-top: 10px;
}

.capture-photo-btn {
  width: 100%;
  padding: 14px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
}

.capture-photo-preview {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin-top: 10px;
}

.capture-voice-area {
  text-align: center;
  padding: 20px;
}

.voice-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: none;
  background: var(--danger);
  color: white;
  font-size: 28px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
}

.voice-btn.recording {
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(211, 47, 47, 0.4); }
  50% { box-shadow: 0 0 0 16px rgba(211, 47, 47, 0); }
}

.voice-status {
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

.capture-submit {
  width: 100%;
  padding: 14px;
  margin-top: 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.capture-submit:disabled {
  opacity: 0.4;
}

/* ── Indicateur de connexion ────────────────────────────────────────────────── */

.offline-banner {
  position: fixed;
  top: calc(var(--header-height) + var(--safe-top));
  left: 0;
  right: 0;
  background: var(--warning);
  color: white;
  text-align: center;
  padding: 6px;
  font-size: 13px;
  font-weight: 500;
  z-index: 20;
  display: none;
}

.offline-banner.visible {
  display: block;
}

/* ── Config banner (première utilisation) ───────────────────────────────────── */

.config-banner {
  background: #fff3e0;
  border: 1px solid var(--warning);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
}

.config-banner-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--warning);
}

.config-banner-text {
  font-size: 13px;
  color: var(--text);
  margin-top: 4px;
}

.config-input {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-top: 8px;
  outline: none;
}

.config-save {
  margin-top: 8px;
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ── Dashboard ──────────────────────────────────────────────────────────────── */

.dashboard-greeting {
  margin-bottom: 20px;
}

.greeting-text {
  font-size: 24px;
  font-weight: 700;
}

.greeting-date {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  text-transform: capitalize;
}

/* KPI tuiles */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
  box-shadow: var(--shadow);
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  color: var(--primary);
}

.kpi-card.kpi-warning .kpi-value { color: var(--warning); }
.kpi-card.kpi-danger .kpi-value { color: var(--danger); }
.kpi-card.kpi-success .kpi-value { color: var(--success); }

.kpi-label {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 500;
  line-height: 1.2;
}

/* Sections dashboard */
.dash-section {
  margin-bottom: 20px;
}

.dash-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.dash-section-title {
  font-size: 15px;
  font-weight: 700;
}

.dash-section-count {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.dash-section-action {
  border: none;
  background: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}

/* Items dans les sections */
.dash-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  box-shadow: var(--shadow);
}

.dash-item-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.dash-item-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dash-item-body {
  flex: 1;
  min-width: 0;
}

.dash-item-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-item-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.dash-item-arrow {
  font-size: 18px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.text-danger { color: var(--danger); font-weight: 600; }

.dash-empty {
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  box-shadow: var(--shadow);
}

.dash-empty.dash-ok {
  background: #e8f5e9;
  color: var(--success);
}

/* Score badge dans les items */
.dash-score-badge {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  flex-shrink: 0;
}

.dash-score-badge.green { background: #e8f5e9; color: var(--success); }
.dash-score-badge.yellow { background: #fff9c4; color: #f9a825; }
.dash-score-badge.orange { background: #fff3e0; color: var(--warning); }
.dash-score-badge.red { background: #ffebee; color: var(--danger); }

/* Barre de progression PA */
.pa-progress-bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg);
  margin-bottom: 8px;
}

.pa-progress-segment {
  height: 100%;
  transition: width 0.5s ease;
}

.pa-seg-closed { background: var(--success); }
.pa-seg-progress { background: var(--primary); }
.pa-seg-open { background: #9e9e9e; }
.pa-seg-overdue { background: var(--danger); }

.pa-progress-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 11px;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Actions rapides */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s;
}

.quick-action-btn:active {
  border-color: var(--primary);
  background: #e3f2fd;
}

.qa-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.qa-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* ── Barre de sauvegarde après réponse agent ──────────────────────────────── */

.chat-save-bar {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  margin-top: 4px;
  align-self: flex-start;
  max-width: 92%;
}

.save-data-btn {
  padding: 8px 16px;
  border: 1.5px solid var(--primary);
  border-radius: 20px;
  background: #e3f2fd;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.save-data-btn:active {
  background: var(--primary);
  color: white;
}

.save-dismiss-btn {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
}

.save-confirmation {
  padding: 8px 16px;
  background: #e8f5e9;
  color: var(--success);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.save-error {
  padding: 8px 16px;
  background: #ffebee;
  color: var(--danger);
  border-radius: 20px;
  font-size: 13px;
}
