/* nallium-support-frontend — design tokens et classes "chrome" (orbes,
 * panel, boutons, formulaires, badges) repris tels quels du système de
 * design partagé des apps Nallium (voir nallium-idm-frontend/css/
 * style.css pour la source) — même raisonnement : rester visuellement
 * cohérent avec le reste de l'écosystème plutôt que de réinventer une
 * palette. Les vues liste/détail de tickets sont spécifiques à cette app. */

:root {
  --text: #172033;
  --muted: #64748b;
  --blue: #3b82f6;
  --green: #22c55e;
  --amber: #f59e0b;
  --pink: #ec4899;
  --violet: #8b5cf6;
  --red: #ef4444;
  --cyan: #06b6d4;
  --bg: #f7f9ff;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-solid: #ffffff;
  --border: rgba(30, 41, 59, 0.12);
  --shadow: 0 24px 80px rgba(30, 41, 59, 0.12);
  --shadow-soft: 0 14px 38px rgba(30, 41, 59, 0.09);
  --radius: 26px;
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 4%, rgba(59, 130, 246, 0.18), transparent 28%),
    radial-gradient(circle at 90% 12%, rgba(236, 72, 153, 0.14), transparent 24%),
    radial-gradient(circle at 72% 88%, rgba(34, 197, 94, 0.15), transparent 26%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
  cursor: pointer;
}

a {
  color: var(--blue);
}

/* --- Écran de connexion (même identité visuelle que le reste de la suite,
 * voir nallium-idm-frontend/css/style.css::.auth-shell) --- */

.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-shell > div {
  width: min(440px, 100%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
  margin-bottom: 22px;
}

.brand-logo {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  padding: 2px;
  background: conic-gradient(from 180deg, var(--blue), var(--green), var(--amber), var(--pink), var(--violet), var(--blue));
  box-shadow: 0 16px 42px rgba(59, 130, 246, 0.22);
}

.brand-logo span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  background: #ffffff;
  font-weight: 950;
  font-size: 22px;
  color: #111827;
}

.brand-title {
  font-weight: 900;
  font-size: 20px;
  letter-spacing: -0.03em;
  color: #0f172a;
  line-height: 1.1;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
}

.auth-card {
  width: min(440px, 100%);
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
}

.auth-card h1 {
  font-size: 24px;
  font-weight: 950;
  letter-spacing: -0.04em;
  margin: 0 0 8px;
  color: #0f172a;
}

.auth-card .subtitle {
  color: var(--muted);
  margin: 0 0 22px;
}

/* --- Boutons / formulaires --- */

.btn {
  border-radius: 14px;
  font-weight: 850;
  border: 0;
  padding: 11px 20px;
  font-size: 14px;
}

.btn-primary {
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--violet) 50%, var(--pink));
  box-shadow: 0 16px 40px rgba(139, 92, 246, 0.2);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-soft {
  border: 1px solid var(--border);
  color: #334155;
  background: rgba(255, 255, 255, 0.82);
}

.btn-soft:hover {
  background: #fff;
  color: #0f172a;
  box-shadow: var(--shadow-soft);
}

.btn-danger-soft {
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--red);
  background: rgba(239, 68, 68, 0.08);
}

.form-label {
  display: block;
  font-size: 12px;
  color: #334155;
  font-weight: 850;
  margin: 0 0 6px;
}

.form-control,
.form-select,
textarea.form-control {
  width: 100%;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(30, 41, 59, 0.16);
  color: #0f172a;
  border-radius: 14px;
  padding: 10px 12px;
  font: inherit;
}

.form-control::placeholder {
  color: #94a3b8;
}

.form-row {
  margin-bottom: 16px;
}

/* --- Coquille applicative (une fois connecté) --- */

.app-shell {
  min-height: 100vh;
  display: flex;
}

.app-sidebar {
  width: 240px;
  flex: none;
  padding: 22px 16px;
  border-right: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.app-sidebar .brand {
  justify-content: flex-start;
  margin-bottom: 4px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: #334155;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  border: 0;
  background: transparent;
  text-align: left;
  width: 100%;
}

.nav-item:hover {
  background: rgba(59, 130, 246, 0.08);
}

.nav-item.active {
  background: rgba(59, 130, 246, 0.12);
  color: var(--blue);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-main {
  flex: 1;
  min-width: 0;
  padding: 28px 32px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-head h1 {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin: 0;
}

.panel {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 20px;
}

/* --- Liste de tickets --- */

.request-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.request-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.request-row:hover {
  box-shadow: var(--shadow-soft);
  border-color: rgba(59, 130, 246, 0.3);
}

.request-row .subject {
  font-weight: 800;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-row .meta {
  color: var(--muted);
  font-size: 12px;
  flex: none;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
}

/* --- Badges d'état --- */

.state-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  flex: none;
}

.state-open {
  background: rgba(59, 130, 246, 0.12);
  color: var(--blue);
}

.state-in_progress {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

.state-pending_user {
  background: rgba(236, 72, 153, 0.14);
  color: #be185d;
}

.state-resolved {
  background: rgba(34, 197, 94, 0.14);
  color: #15803d;
}

.state-evaluation {
  background: rgba(139, 92, 246, 0.14);
  color: #6d28d9;
}

.state-closed {
  background: rgba(100, 116, 139, 0.14);
  color: #475569;
}

/* --- Détail / fil de discussion --- */

.request-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.request-meta-grid .metric {
  background: rgba(59, 130, 246, 0.05);
  border-radius: 14px;
  padding: 12px 14px;
}

.request-meta-grid .metric .label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.request-meta-grid .metric .value {
  font-size: 16px;
  font-weight: 800;
  margin-top: 2px;
}

.thread {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 20px 0;
}

.thread-message {
  border-radius: 16px;
  padding: 14px 16px;
  max-width: 72%;
  border: 1px solid var(--border);
}

.thread-message.from-user {
  background: #fff;
  align-self: flex-start;
}

.thread-message.from-tech,
.thread-message.from-ai {
  background: rgba(59, 130, 246, 0.07);
  align-self: flex-end;
}

.thread-message.from-system {
  background: transparent;
  border: 0;
  align-self: center;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  max-width: 100%;
  text-align: center;
}

.thread-message .author {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 4px;
}

.thread-message .body {
  white-space: pre-wrap;
  word-break: break-word;
}

.thread-message .attachments {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(30, 41, 59, 0.06);
  border: 0;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  text-decoration: none;
  color: var(--text);
}

.composer {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.composer textarea {
  min-height: 90px;
  resize: vertical;
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #334155;
}

.action-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.survey-score {
  display: flex;
  gap: 6px;
  margin: 8px 0 16px;
}

.survey-score button {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-weight: 800;
}

.survey-score button.selected {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #fff;
  padding: 12px 18px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  font-size: 14px;
  z-index: 100;
}

.toast.error {
  background: var(--red);
}

@media (max-width: 760px) {
  .app-shell {
    flex-direction: column;
  }

  .app-sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }

  .app-main {
    padding: 20px;
  }

  .thread-message {
    max-width: 100%;
  }
}

/* ===========================================================================
 * Ajouts spécifiques à Nallium Intelligence (chat, conversations, projets,
 * tâches planifiées, artifacts, connecteurs, mémoire) — le socle ci-dessus
 * (boutons/formulaires/coquille/toasts) est repris tel quel du système de
 * design partagé, voir en-tête de fichier.
 * ========================================================================= */

.chat-shell {
  display: flex;
  height: calc(100vh - 56px);
  gap: 0;
  margin: -28px -32px;
}

.conv-sidebar {
  width: 260px;
  flex: none;
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.conv-row {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  border: 0;
  background: transparent;
  text-align: left;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-row:hover {
  background: rgba(59, 130, 246, 0.08);
}

.conv-row.active {
  background: rgba(59, 130, 246, 0.14);
  color: var(--blue);
}

.chat-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 20px 28px;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.chat-header input.conv-title {
  border: 0;
  background: transparent;
  font-size: 18px;
  font-weight: 900;
  color: #0f172a;
  flex: 1;
  min-width: 120px;
}

.tier-select {
  font-size: 12px;
  font-weight: 800;
  border-radius: 999px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: #fff;
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 18px 2px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-message {
  max-width: 78%;
  border-radius: 16px;
  padding: 12px 16px;
}

.chat-message.role-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--blue), var(--violet) 80%);
  color: #fff;
}

.chat-message.role-assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--border);
}

.chat-message.role-system_notice {
  align-self: center;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #92400e;
  font-size: 13px;
  max-width: 92%;
}

.chat-message .meta {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 6px;
}

.chat-message .md-body p:first-child {
  margin-top: 0;
}

.chat-message .md-body pre {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  overflow-x: auto;
}

.chat-message .md-body code {
  font-family: SFMono-Regular, Consolas, Menlo, monospace;
  font-size: 13px;
}

.chat-message .md-body table {
  border-collapse: collapse;
  width: 100%;
}

.chat-message .md-body th,
.chat-message .md-body td {
  border: 1px solid var(--border);
  padding: 6px 10px;
}

.attachment-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pending-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}

.pending-attachment-chip button {
  border: 0;
  background: transparent;
  color: var(--red);
  font-weight: 900;
  cursor: pointer;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.entity-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.entity-card .title {
  font-weight: 850;
  font-size: 15px;
}

.entity-card .excerpt {
  color: var(--muted);
  font-size: 13px;
}

.entity-card .card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  flex: none;
}

.badge-on {
  background: rgba(34, 197, 94, 0.14);
  color: #15803d;
}

.badge-off {
  background: rgba(100, 116, 139, 0.14);
  color: #475569;
}

.settings-section {
  margin-bottom: 28px;
}

.settings-section h2 {
  font-size: 16px;
  font-weight: 900;
  margin: 0 0 12px;
}

.memory-list,
.connector-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.memory-item,
.connector-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  font-size: 13px;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-result-row {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.search-result-row .kind {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--blue);
  font-weight: 800;
}

@media (max-width: 760px) {
  .chat-shell {
    flex-direction: column;
    height: auto;
    margin: -20px;
  }

  .conv-sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
  }

  .chat-message {
    max-width: 92%;
  }
}
