:root {
  --bg: #f5f7fb;
  --card: rgba(255, 255, 255, 0.9);
  --card-strong: #ffffff;
  --border: #e5e7eb;
  --text: #1f2350;
  --text-strong: #191d45;
  --muted: #6b7280;
  --brand-blue: #1e90ff;
  --brand-indigo: #4f46e5;
  --brand-purple: #9333ea;
  --brand-gradient: linear-gradient(135deg, #1e90ff 0%, #4f46e5 48%, #9333ea 100%);
  --danger-bg: #fee2e2;
  --danger-text: #991b1b;
  --success-bg: #dcfce7;
  --success-text: #166534;
  --shadow-lg: 0 24px 70px rgba(79, 70, 229, 0.1);
  --shadow-md: 0 14px 34px rgba(79, 70, 229, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  position: relative;
  background:
    radial-gradient(circle at top left, rgba(30, 144, 255, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(147, 51, 234, 0.12), transparent 24%),
    linear-gradient(180deg, #f7f9ff 0%, #f4f6fb 100%);
  color: var(--text);
  font-family: Inter, Arial, Helvetica, sans-serif;
}

.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 22%, rgba(79, 70, 229, 0.08), transparent 16%),
    radial-gradient(circle at 82% 16%, rgba(30, 144, 255, 0.08), transparent 14%),
    radial-gradient(circle at 75% 78%, rgba(147, 51, 234, 0.06), transparent 18%);
}

code {
  background: rgba(79, 70, 229, 0.08);
  color: var(--text-strong);
  padding: 3px 7px;
  border-radius: 8px;
  font-size: 0.92em;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  padding: 24px;
  align-items: start;
}

.glass-card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(14px);
}

.sidebar {
  border-radius: 30px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 24px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--brand-gradient);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.6rem;
  box-shadow: 0 14px 30px rgba(79, 70, 229, 0.22);
}

.brand-block h1,
.topbar h2,
.panel h2,
.chat-card-header h3 {
  margin: 0;
  color: var(--text-strong);
}

.brand-block h1 {
  font-size: 2rem;
  line-height: 1;
}

.brand-block p,
.topbar p,
.panel p,
.panel li,
.muted,
.status-card,
.listing-select-help {
  color: var(--muted);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand-blue);
  background: rgba(30, 144, 255, 0.1);
  margin-bottom: 12px;
}

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

.panel.compact h2 {
  font-size: 1rem;
  margin-bottom: 12px;
}

.gradient-panel {
  background:
    linear-gradient(180deg, rgba(79, 70, 229, 0.06), rgba(147, 51, 234, 0.03)),
    #ffffff;
}

.preview-panel {
  min-height: 220px;
}

.panel ul {
  margin: 0;
  padding-left: 18px;
}

.panel li {
  margin-bottom: 10px;
  line-height: 1.5;
}

.sample-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sample-chip {
  border: 1px solid rgba(79, 70, 229, 0.14);
  background: rgba(79, 70, 229, 0.05);
  color: var(--text-strong);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.sample-chip:hover,
.mode-btn:hover,
.primary-btn:hover,
.secondary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(79, 70, 229, 0.12);
}

.sample-chip:hover {
  border-color: rgba(79, 70, 229, 0.28);
}

.listing-preview {
  line-height: 1.7;
  font-size: 0.98rem;
}

.main-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.topbar {
  border-radius: 30px;
  padding: 28px 28px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.topbar h2 {
  font-size: 2.15rem;
  margin-bottom: 8px;
}

.topbar p {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.5;
}

.mode-switch {
  display: inline-flex;
  background: rgba(79, 70, 229, 0.06);
  border: 1px solid rgba(79, 70, 229, 0.1);
  border-radius: 18px;
  padding: 6px;
  gap: 6px;
  align-self: center;
}

.mode-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 13px 18px;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 800;
  transition: all 0.2s ease;
}

.mode-btn.active {
  background: var(--brand-gradient);
  color: #fff;
}

.status-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
}

.status-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.status-card {
  width: 100%;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(79, 70, 229, 0.08);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: var(--shadow-md);
  font-size: 1rem;
}

.listing-select-box {
  position: relative;
  width: 100%;
  background: var(--brand-gradient);
  border-radius: 24px;
  padding: 18px 18px 16px;
  box-shadow:
    0 18px 34px rgba(79, 70, 229, 0.18),
    inset 0 1px 0 rgba(255,255,255,0.15);
  overflow: hidden;
}

.listing-select-box::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.12), transparent 22%),
    radial-gradient(circle at 85% 70%, rgba(255,255,255,0.1), transparent 20%);
  pointer-events: none;
}

.listing-select-label,
.listing-select-help,
.listing-select {
  position: relative;
  z-index: 1;
}

.listing-select-label {
  display: block;
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 6px;
}

.listing-select-help {
  font-size: 0.95rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: 14px;
}

.listing-select-box::after {
  content: "⌄";
  position: absolute;
  right: 22px;
  bottom: 26px;
  color: rgba(255,255,255,0.9);
  font-size: 18px;
  pointer-events: none;
  z-index: 2;
}

.listing-select {
  width: 100%;
  padding: 16px 52px 16px 18px;
  border-radius: 18px;
  border: none !important;
  background: rgba(255, 255, 255, 0.18) !important;
  backdrop-filter: blur(10px);
  color: #ffffff !important;
  font: inherit;
  font-size: 1.02rem;
  font-weight: 800;
  outline: none;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.28),
    0 8px 22px rgba(0,0,0,0.06);
  transition: all 0.25s ease;
  cursor: pointer;
}

.listing-select:hover {
  background: rgba(255, 255, 255, 0.24) !important;
}

.listing-select:focus {
  background: rgba(255, 255, 255, 0.3) !important;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.4),
    0 0 0 4px rgba(255,255,255,0.14);
}

.listing-select option {
  color: var(--text-strong);
  background: #ffffff;
}

.server-pill {
  border-radius: 999px;
  padding: 12px 16px;
  font-size: 0.92rem;
  font-weight: 800;
  background: rgba(79, 70, 229, 0.06);
  color: var(--text-strong);
  border: 1px solid rgba(79, 70, 229, 0.12);
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  align-self: start;
}

.server-pill.ok {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: rgba(22, 101, 52, 0.15);
}

.server-pill.error {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: rgba(153, 27, 27, 0.15);
}

.chat-card {
  border-radius: 30px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  min-height: 640px;
}

.chat-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.chat-card-header h3 {
  font-size: 2rem;
}

.mode-pill {
  background: var(--brand-gradient);
  color: #fff;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 0.92rem;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(79, 70, 229, 0.16);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 10px 2px 12px;
  scroll-behavior: smooth;
  min-height: 280px;
}

.message {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 74%;
}

.message.user {
  align-self: flex-end;
}

.message.bot {
  align-self: flex-start;
}

.message-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--muted);
}

.message.user .message-label {
  text-align: right;
}

.message-bubble {
  border-radius: 22px;
  padding: 15px 18px;
  line-height: 1.65;
  white-space: pre-wrap;
  box-shadow: var(--shadow-md);
  font-size: 1rem;
}

.message.bot .message-bubble {
  background: #f3f4f6;
  color: var(--text-strong);
}

.message.user .message-bubble {
  background: var(--brand-gradient);
  color: #fff;
}

.message-bubble.error {
  background: var(--danger-bg) !important;
  color: var(--danger-text) !important;
}

.message-bubble.success {
  background: var(--success-bg) !important;
  color: var(--success-text) !important;
}

.message-bubble.loading {
  background: rgba(79, 70, 229, 0.08) !important;
  color: var(--text-strong) !important;
}

.message-section + .message-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.message-section-title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-bottom: 6px;
}

.message-section-body {
  white-space: pre-wrap;
}

.chat-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}

.chat-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 96px;
  border: 1px solid rgba(79, 70, 229, 0.14);
  border-radius: 20px;
  padding: 18px;
  font: inherit;
  color: var(--text-strong);
  background: rgba(255, 255, 255, 0.95);
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

.chat-form textarea:focus {
  border-color: rgba(79, 70, 229, 0.4);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.chat-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.primary-btn,
.secondary-btn {
  border: none;
  border-radius: 14px;
  padding: 13px 20px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
}

.primary-btn {
  background: var(--brand-gradient);
  color: #fff;
}

.secondary-btn {
  background: rgba(79, 70, 229, 0.08);
  color: var(--text-strong);
}

.primary-btn:disabled,
.secondary-btn:disabled,
.mode-btn:disabled,
.listing-select:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

@media (max-width: 1200px) {
  .message {
    max-width: 82%;
  }
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .status-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 14px;
    gap: 14px;
  }

  .sidebar,
  .topbar,
  .chat-card {
    border-radius: 22px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    padding: 22px;
  }

  .topbar h2 {
    font-size: 1.8rem;
  }

  .chat-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .chat-card-header h3 {
    font-size: 1.6rem;
  }

  .mode-switch {
    width: 100%;
    flex-wrap: wrap;
  }

  .mode-btn {
    flex: 1 1 100%;
  }

  .message {
    max-width: 100%;
  }

  .server-pill {
    align-self: flex-start;
  }

  .listing-select-label {
    font-size: 1rem;
  }

  .listing-select-help {
    font-size: 0.9rem;
  }

  .listing-select {
    font-size: 0.98rem;
  }
}
/* ===== HIDE SELECT IN TRANSLATOR MODE (CSS OVERRIDE) ===== */

/* Quand le bouton Traducteur est actif → cacher la box */
body:has(.mode-btn[data-mode="translator"].active) #listingSelectBox {
  display: none !important;
}

/* Quand mode immeuble → forcer visible */
body:has(.mode-btn[data-mode="listing"].active) #listingSelectBox {
  display: block !important;
}
.candidate-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.candidate-form input,
.candidate-form select,
.candidate-form textarea {
  width: 100%;
  border: 1px solid rgba(79, 70, 229, 0.14);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: var(--text-strong);
  background: rgba(255, 255, 255, 0.96);
  outline: none;
}

.candidate-form input:focus,
.candidate-form select:focus,
.candidate-form textarea:focus {
  border-color: rgba(79, 70, 229, 0.4);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.10);
}

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

.candidate-submit-btn {
  width: 100%;
}

.candidate-status {
  display: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 700;
}

.candidate-status.success {
  display: block;
  background: var(--success-bg);
  color: var(--success-text);
}

.candidate-status.error {
  display: block;
  background: var(--danger-bg);
  color: var(--danger-text);
}

.candidate-helper {
  margin-top: -4px;
  margin-bottom: 2px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.candidate-helper.error {
  color: var(--danger-text);
}

.listing-selector-card {
  width: 100%;
  background: var(--brand-gradient);
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow-lg);
}

.listing-selector-title {
  color: white;
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.listing-selector-subtitle {
  color: rgba(255,255,255,0.9);
  margin-bottom: 14px;
  line-height: 1.4;
}

.listing-selector-card .listing-select {
  background: rgba(255,255,255,0.22);
  color: white;
  border: 2px solid rgba(255,255,255,0.55);
  box-shadow: none;
}

.listing-selector-card .listing-select option {
  color: #111827;
}

.workspace-nav {
  display: grid;
  gap: 10px;
}

.workspace-nav-btn {
  border: none;
  background: rgba(79, 70, 229, 0.06);
  color: var(--text-strong);
  padding: 14px 16px;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 800;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.workspace-nav-btn.active {
  background: var(--brand-gradient);
  color: #fff;
}

.workspace-nav-badge {
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  display: inline-grid;
  place-items: center;
  padding: 0 8px;
  font-size: 0.8rem;
}

.hidden {
  display: none !important;
}

.workspace-page.active {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.workspace-page.hidden {
  display: none;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.workspace-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
}

.workspace-sidebar-card,
.workspace-content-card {
  padding: 20px;
  border-radius: 28px;
}

.workspace-section-head h3,
.workspace-section-head p {
  margin: 0;
}

.workspace-section-head p {
  margin-top: 8px;
  color: var(--muted);
}

.workspace-conversation-list,
.workspace-message-thread,
.workspace-task-list {
  display: grid;
  gap: 12px;
}

.workspace-message-thread {
  min-height: 320px;
  max-height: 480px;
  overflow: auto;
}

.workspace-conversation-item,
.workspace-task-card,
.workspace-notification-card {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: var(--shadow-md);
}

.workspace-conversation-item.active {
  border-color: rgba(79, 70, 229, 0.3);
  background: rgba(79, 70, 229, 0.05);
}

.workspace-list-empty {
  border: 1px dashed rgba(79,70,229,.2);
  border-radius: 18px;
  padding: 18px;
  color: var(--muted);
  background: rgba(255,255,255,.65);
}

.workspace-compose textarea {
  width: 100%;
}

.workspace-message-row {
  display: grid;
}

.workspace-message-row.from-self {
  justify-items: end;
}

.workspace-message-bubble {
  max-width: 78%;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f3f4f6;
}

.workspace-message-row.from-self .workspace-message-bubble {
  background: rgba(79,70,229,.10);
}

.workspace-task-meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 6px;
}

.workspace-task-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

@media (max-width: 980px) {
  .dashboard-grid,
  .workspace-layout {
    grid-template-columns: 1fr;
  }
}
