/* =========================================================
   Next Call AI — Syndic | Refonte
   Design tokens, layout, components
   ========================================================= */

:root {
  /* Palette inspirée de l'existant, recalibrée pour AA/AAA */
  --c-bg: #fcfcfd;
  --c-surface: #ffffff;
  --c-surface-2: #f4f6fa;
  --c-border: #e1e7ef;
  --c-border-strong: #cbd5e1;

  --c-text: #0f1729;
  --c-text-2: #334155;
  --c-text-muted: #64748b;

  --c-primary: #0e7490;        /* cyan-700 */
  --c-primary-600: #0891b2;    /* cyan-600 */
  --c-primary-50: #ecfeff;
  --c-primary-100: #cffafe;

  --c-accent: #a3e635;         /* lime-400 */
  --c-accent-600: #84cc16;

  --c-warn: #fbbf24;
  --c-warn-bg: #fef3c7;
  --c-warn-text: #92400e;

  --c-danger: #ef4444;
  --c-danger-bg: #fee2e2;
  --c-danger-text: #991b1b;

  --c-success: #16a34a;
  --c-success-bg: #dcfce7;
  --c-success-text: #166534;

  --c-info-bg: #ecfeff;
  --c-info-text: #0e7490;

  /* Spacing & radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-full: 999px;

  --shadow-sm: 0 1px 2px rgba(15,23,41,.06), 0 1px 1px rgba(15,23,41,.04);
  --shadow-md: 0 10px 15px -3px rgba(15,23,41,.08), 0 4px 6px -4px rgba(15,23,41,.06);
  --shadow-lg: 0 25px 50px -12px rgba(15,23,41,.18);

  --container: 1240px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --header-grad: linear-gradient(120deg, #082f49 0%, #0e7490 55%, #06b6d4 100%);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
input, select, button, textarea { font-family: inherit; }
a { color: var(--c-primary); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }

.sr-only {
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

.container {
  width: min(100% - 32px, var(--container));
  margin-inline: auto;
}

/* =========================================================
   Topbar
   ========================================================= */
.topbar {
  background: #0f1d3d;
  color: #cbd5e1;
  font-size: 13px;
}
.topbar__inner {
  width: min(100% - 32px, var(--container));
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}
.topbar__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--c-accent);
  box-shadow: 0 0 0 4px rgba(163,230,53,.15);
}
.topbar__link {
  margin-left: auto;
  color: #fff;
  font-weight: 500;
}

/* =========================================================
   Hero / Header
   ========================================================= */
.hero {
  position: relative;
  color: #fff;
  overflow: hidden;
  isolation: isolate;
}
.hero__bg {
  position: absolute; inset: 0;
  background: var(--header-grad);
  z-index: -2;
}
.hero__bg::after {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(800px 400px at 85% -10%, rgba(255,255,255,.15), transparent 60%),
    radial-gradient(600px 300px at 10% 110%, rgba(163,230,53,.18), transparent 60%);
}
.hero__inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 28px;
  padding: 32px 0 28px;
}
.hero__badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  padding: 6px 12px;
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 500;
  backdrop-filter: blur(8px);
}
.hero__title {
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
  font-weight: 800;
  margin: 14px 0 6px;
  letter-spacing: -.02em;
}
.hero__subtitle {
  color: #a5f3fc;
  margin: 0 0 16px;
  font-size: 16px;
}
.hero__bullets {
  list-style: none;
  padding: 0; margin: 0;
  display: grid;
  gap: 10px;
}
.hero__bullets li {
  display: flex; align-items: flex-start; gap: 10px;
  color: rgba(255,255,255,.92);
  font-size: 15px;
}
.bullet-icon {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px;
  border-radius: var(--r-sm);
  background: rgba(255,255,255,.12);
  flex-shrink: 0;
}

/* Right column toolbar + CTA */
.hero__cta {
  display: grid;
  gap: 12px;
  align-content: start;
  justify-items: end;
}
.hero__toolbar {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: flex-end;
  width: 100%;
}

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-weight: 600;
  font-size: 14px;
  transition: transform .12s ease, background-color .15s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--sm { padding: 6px 10px; font-size: 13px; }
.btn--lg { padding: 14px 20px; font-size: 16px; border-radius: var(--r-lg); }
.btn--ghost {
  background: rgba(255,255,255,.96);
  color: var(--c-text);
  border-color: var(--c-border);
  box-shadow: var(--shadow-sm);
}
.btn--ghost:hover { background: #fff; }
.btn--primary {
  background: var(--c-warn);
  color: var(--c-text);
  box-shadow: 0 8px 24px -8px rgba(251,191,36,.55);
}
.btn--primary:hover { background: #f59e0b; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  padding: 6px 12px;
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 500;
}
.badge--live .live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(163,230,53,.25);
  animation: livepulse 1.6s ease-in-out infinite;
}
@keyframes livepulse {
  0%,100% { box-shadow: 0 0 0 3px rgba(163,230,53,.25); }
  50%     { box-shadow: 0 0 0 6px rgba(163,230,53,.05); }
}

.avatar {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.96);
  color: var(--c-primary);
  font-weight: 700;
  border: 1px solid var(--c-border);
}

.hero__rgpd {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.12);
  color: #ecfeff;
  padding: 8px 14px;
  border-radius: var(--r-full);
  border: 1px solid rgba(255,255,255,.18);
  font-size: 13px;
  margin: 0;
}

/* =========================================================
   Main
   ========================================================= */
.main { padding: 24px 0 64px; }

.periods {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 16px 0 20px;
}
.chip {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-2);
}
.chip:hover { background: var(--c-surface-2); }
.chip--active {
  background: var(--c-primary);
  color: #fff; border-color: var(--c-primary);
  box-shadow: 0 6px 16px -8px rgba(14,116,144,.5);
}

/* =========================================================
   KPI cards
   ========================================================= */
.kpis {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.kpi {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s ease, transform .2s ease;
}
.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi--primary { grid-column: span 2; background: linear-gradient(180deg,#fff 0%,#f0fdff 100%); }
.kpi__head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.kpi__icon {
  width: 32px; height: 32px;
  display: inline-grid; place-items: center;
  border-radius: var(--r-sm);
  background: var(--c-primary-50);
  color: var(--c-primary);
  font-size: 16px;
}
.kpi__icon--warn { background: #fef3c7; color: #92400e; }
.kpi__icon--alt  { background: #f1f5f9; color: var(--c-text-2); }
.kpi__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-text-muted);
  margin: 0;
}
.kpi__value {
  font-size: clamp(28px, 3vw, 36px);
  font-weight: 800;
  margin: 4px 0;
  letter-spacing: -.02em;
}
.kpi__sub { color: var(--c-text-muted); font-size: 13px; margin: 0 0 10px; }
.kpi__chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-full);
}
.pill--success { background: var(--c-success-bg); color: var(--c-success-text); }
.pill--info    { background: #fef3c7;            color: #92400e; }
.pill--danger  { background: var(--c-danger-bg);  color: var(--c-danger-text); }

/* =========================================================
   Journal
   ========================================================= */
.journal {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.journal__head {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--c-border);
}
.journal__title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}
.journal__count { color: var(--c-text-muted); font-weight: 500; font-size: 13px; }
.journal__filters { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.select, .input {
  height: 36px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 0 12px;
  font-size: 13px;
  color: var(--c-text);
  background: var(--c-surface);
  transition: border-color .15s, box-shadow .15s;
}
.select:focus, .input:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(14,116,144,.15); }
.input-icon {
  position: relative; display: inline-flex; align-items: center;
}
.input-icon > span {
  position: absolute; left: 10px;
  pointer-events: none; color: var(--c-text-muted);
}
.input-icon .input { padding-left: 30px; min-width: 200px; }

/* Table */
.table-wrap { overflow-x: auto; }
.calls {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.calls thead th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--c-text-muted);
  background: var(--c-surface-2);
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
.calls tbody tr { border-bottom: 1px solid var(--c-border); transition: background-color .12s; }
.calls tbody tr:hover { background: #f8fafc; }
.calls td { padding: 14px 16px; vertical-align: middle; }
.cell-date { color: var(--c-text-2); white-space: nowrap; }
.cell-date b { display: block; color: var(--c-text); font-weight: 600; }
.cell-date span { display: block; color: var(--c-text-muted); font-size: 12px; margin-top: 2px; }
.cell-client b { display: block; font-weight: 600; }
.cell-client span { color: var(--c-text-muted); font-size: 12px; }
.cell-prop b { display: block; font-weight: 500; }
.cell-prop span { color: var(--c-text-muted); font-size: 12px; }
.cell-summary { color: var(--c-text-2); max-width: 280px; }
.cell-summary span { display:-webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 12px; font-weight: 600;
}
.tag--urgence  { background: #fee2e2; color: #991b1b; }
.tag--sinistre { background: #ffedd5; color: #9a3412; }
.tag--compta   { background: #fef3c7; color: #92400e; }
.tag--ag       { background: #ecfeff; color: #0e7490; }
.tag--documents{ background: #ede9fe; color: #6d28d9; }
.tag--travaux  { background: #dcfce7; color: #166534; }
.tag--autre    { background: #f1f5f9; color: #475569; }

.priority {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 12px; font-weight: 600;
}
.priority::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.priority--critique { background: #fee2e2; color: #991b1b; }
.priority--critique::before { background: #dc2626; }
.priority--urgent   { background: #ffedd5; color: #9a3412; }
.priority--urgent::before   { background: #f97316; }
.priority--normal   { background: #dcfce7; color: #166534; }
.priority--normal::before   { background: #16a34a; }

.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 12px; font-weight: 600;
}
.status--todo     { background: #fee2e2; color: #991b1b; }
.status--progress { background: #dbeafe; color: #1e3a8a; }
.status--done     { background: #dcfce7; color: #166534; }

.icon-btn {
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-danger);
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  display: inline-grid; place-items: center;
  transition: background-color .15s, border-color .15s;
}
.icon-btn:hover { background: #fef2f2; border-color: #fecaca; }

.th-actions { width: 40px; }

/* Mobile cards (shown <768px) */
.calls-mobile { display: none; list-style: none; padding: 0; margin: 0; }
.call-card {
  padding: 16px;
  border-bottom: 1px solid var(--c-border);
  display: grid;
  gap: 8px;
}
.call-card__row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.call-card__row b { font-weight: 600; }
.call-card__row span { color: var(--c-text-muted); font-size: 13px; }

/* Pagination */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  background: var(--c-surface-2);
  border-top: 1px solid var(--c-border);
}
.pagination__info { color: var(--c-text-2); font-size: 13px; }

/* =========================================================
   Conversion banner
   ========================================================= */
.convert {
  margin-top: 32px;
  background: linear-gradient(120deg, #0e7490 0%, #082f49 100%);
  color: #fff;
  border-radius: var(--r-xl);
  padding: 32px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.convert::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(500px 250px at 90% 0%, rgba(163,230,53,.18), transparent 60%);
  pointer-events: none;
}
.convert__kicker {
  display: inline-block;
  background: rgba(163,230,53,.18);
  color: #d9f99d;
  padding: 4px 12px;
  border-radius: var(--r-full);
  font-size: 12px; font-weight: 600;
  margin: 0 0 12px;
  letter-spacing: .04em;
}
.convert__title {
  font-size: clamp(22px, 3vw, 30px);
  margin: 0 0 12px;
  letter-spacing: -.02em;
  font-weight: 800;
}
.convert__lead { margin: 0; color: #e0f2fe; font-size: 15px; line-height: 1.6; }

.convert__form { display: grid; gap: 10px; position: relative; z-index: 1; }
.convert__form .input { height: 44px; background: #fff; }
.convert__form .btn { justify-content: center; }
.convert__note { margin: 6px 0 0; color: #bae6fd; font-size: 12px; text-align: center; }

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  border-top: 1px solid var(--c-border);
  background: #0f1d3d;
  color: #94a3b8;
  font-size: 13px;
}
.site-footer__inner {
  padding: 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.site-footer a { color: #cbd5e1; margin-left: 16px; }
.site-footer a:hover { color: #fff; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1024px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi--primary { grid-column: span 2; }
}
@media (max-width: 768px) {
  .topbar__link { display: none; }
  .hero__inner {
    grid-template-columns: 1fr;
    padding: 24px 0;
  }
  .hero__cta { justify-items: stretch; }
  .hero__cta .btn--lg { width: 100%; justify-content: center; }
  .hero__toolbar { justify-content: flex-start; }

  .kpis { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpi--primary { grid-column: span 2; }
  .kpi { padding: 14px 16px; }

  .journal__head { flex-direction: column; align-items: stretch; }
  .journal__filters { margin-left: 0; }
  .filters { display: grid; grid-template-columns: 1fr 1fr; }
  .filters .select, .filters .input-icon { width: 100%; }
  .filters .input-icon .input { width: 100%; min-width: 0; }

  /* hide table, show cards */
  .table-wrap { display: none; }
  .calls-mobile { display: block; }

  .convert { grid-template-columns: 1fr; padding: 24px; }
}
@media (max-width: 480px) {
  .filters { grid-template-columns: 1fr; }
  .periods { overflow-x: auto; flex-wrap: nowrap; }
  .periods .chip { white-space: nowrap; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Focus visible everywhere */
:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
}
