/* ============================================================
   Globalronde — Classes du prototype Claude Design v2.6
   Ces classes sont AJOUTÉES par-dessus Bootstrap (non destructif).
   Les vues peuvent mélanger .card (Bootstrap) et .gr-kpi (prototype).
   Prefixe "gr-" pour eviter les collisions.
   ============================================================ */

/* ═══════════════════════════════════════════════════════════════
   PAGE HEADER — Breadcrumbs + Titre + Actions
   ═══════════════════════════════════════════════════════════════ */
.gr-pg-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 18px; flex-wrap: wrap; gap: 12px;
}
.gr-pg-head h1 {
  margin: 0 0 2px;
  font-size: 22px; font-weight: 700; letter-spacing: -.01em;
  color: var(--gr-text);
}
.gr-crumbs {
  font-size: 11px; color: var(--gr-text-faint);
  letter-spacing: .1em; text-transform: uppercase;
  font-weight: 600; margin-bottom: 4px;
}
.gr-crumbs span { color: var(--gr-gold); }
.gr-pg-sub { color: var(--gr-text-muted); font-size: 13px; }
.gr-pg-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════════
   BUTTONS — Ghost, Primary, Danger, Small
   ═══════════════════════════════════════════════════════════════ */
.gr-btn {
  border: none; cursor: pointer;
  padding: 8px 14px; border-radius: 8px;
  font-family: inherit; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .15s;
  text-decoration: none;
}
.gr-btn-primary {
  background: linear-gradient(135deg, var(--gr-gold), var(--gr-gold-dark));
  color: var(--gr-bg); font-weight: 700;
  box-shadow: 0 2px 10px rgba(245,158,11,.25);
}
.gr-btn-primary:hover { box-shadow: 0 4px 16px rgba(245,158,11,.35); transform: translateY(-1px); }
.gr-btn-ghost {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--gr-border-2);
  color: var(--gr-text-muted);
}
.gr-btn-ghost:hover { background: rgba(255,255,255,.07); color: var(--gr-text); }
.gr-btn-danger {
  background: rgba(220,38,38,.12);
  border: 1px solid rgba(220,38,38,.25);
  color: var(--gr-red);
}
.gr-btn-danger:hover { background: rgba(220,38,38,.22); }
.gr-btn-sm { padding: 5px 9px; font-size: 12px; border-radius: 6px; }

/* Day mode ajuste les boutons ghost/danger */
html[data-theme="day"] .gr-btn-ghost {
  background: #ffffff;
  border-color: rgba(15,23,41,.12);
  color: #475569;
}
html[data-theme="day"] .gr-btn-ghost:hover { background: #f4f5f7; color: #0f172a; }

/* ═══════════════════════════════════════════════════════════════
   CARDS — Card, Card header, Card body
   ═══════════════════════════════════════════════════════════════ */
.gr-card {
  background: var(--gr-surface);
  border: 1px solid var(--gr-border);
  border-radius: var(--gr-radius-md);
  overflow: hidden;
}
.gr-card-h {
  padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--gr-border);
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent);
}
.gr-card-h .gr-title {
  font-size: 12.5px; font-weight: 700; letter-spacing: .04em;
  display: flex; align-items: center; gap: 8px; color: var(--gr-text);
}
.gr-card-h .gr-title .ico { color: var(--gr-gold); font-size: 14px; }
.gr-card-h .gr-meta { font-size: 11px; color: var(--gr-text-faint); }
.gr-card-b { padding: 18px; }
.gr-card-b.p0 { padding: 0; }

/* ═══════════════════════════════════════════════════════════════
   GRID HELPERS
   ═══════════════════════════════════════════════════════════════ */
.gr-grid { display: grid; gap: 16px; }
.gr-g-cols-2 { grid-template-columns: repeat(2, 1fr); }
.gr-g-cols-3 { grid-template-columns: repeat(3, 1fr); }
.gr-g-cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 992px) {
  .gr-g-cols-3, .gr-g-cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 576px) {
  .gr-g-cols-2, .gr-g-cols-3, .gr-g-cols-4 { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════
   KPI CARDS — Avec accent coloré et sparkline
   ═══════════════════════════════════════════════════════════════ */
.gr-kpi {
  position: relative;
  background: var(--gr-surface);
  border: 1px solid var(--gr-border);
  border-radius: var(--gr-radius-md);
  padding: 16px 18px;
  overflow: hidden;
}
.gr-kpi::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
}
.gr-kpi.gold::before  { background: linear-gradient(90deg, var(--gr-gold-darker), var(--gr-gold)); }
.gr-kpi.cyan::before  { background: linear-gradient(90deg, #0891b2, var(--gr-cyan)); }
.gr-kpi.green::before { background: linear-gradient(90deg, #047857, var(--gr-green)); }
.gr-kpi.red::before   { background: linear-gradient(90deg, #b91c1c, var(--gr-red)); }
.gr-kpi.slate::before { background: linear-gradient(90deg, var(--gr-surface-3), var(--gr-text-faint)); }
.gr-kpi-lbl {
  font-size: 10.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--gr-text-faint);
  display: flex; align-items: center; gap: 6px;
}
.gr-kpi-val {
  font-size: 30px; font-weight: 700; margin-top: 6px;
  line-height: 1.1; letter-spacing: -.02em; color: var(--gr-text);
  font-variant-numeric: tabular-nums;
  font-family: var(--gr-font);
}
.gr-kpi-val .u {
  font-size: 13px; color: var(--gr-text-muted);
  font-weight: 500; margin-left: 4px;
}
.gr-kpi-delta {
  margin-top: 4px; font-size: 11.5px; color: var(--gr-text-faint);
  display: flex; align-items: center; gap: 4px;
}
.gr-kpi-delta .up { color: var(--gr-green); }
.gr-kpi-delta .dn { color: var(--gr-red); }
.gr-kpi-spark {
  position: absolute; right: 12px; bottom: 10px; opacity: .6;
}

/* Hi-viz : KPI accent noir */
html[data-theme="hiviz"] .gr-kpi::before { background: #000 !important; }
html[data-theme="hiviz"] .gr-kpi { box-shadow: 4px 4px 0 #000 !important; }

/* ═══════════════════════════════════════════════════════════════
   TABLES — Style proto (par-dessus .table Bootstrap)
   ═══════════════════════════════════════════════════════════════ */
.gr-tbl { width: 100%; border-collapse: collapse; font-size: 13px; color: var(--gr-text); }
.gr-tbl thead th {
  background: var(--gr-surface-2);
  color: var(--gr-text-muted);
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase;
  padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--gr-border-2);
}
.gr-tbl tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--gr-border);
  vertical-align: middle;
}
.gr-tbl tbody tr:last-child td { border-bottom: none; }
.gr-tbl tbody tr { transition: background .15s; }
.gr-tbl tbody tr:hover { background: rgba(245,158,11,.03); }
.gr-tbl td.num {
  font-variant-numeric: tabular-nums;
  font-family: var(--gr-mono);
  font-size: 12px;
}
.gr-agent-cell { display: flex; align-items: center; gap: 10px; }
.gr-agent-cell .av {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

/* Day mode : zebra striping */
html[data-theme="day"] .gr-tbl tbody tr:nth-child(even) { background: var(--gr-surface-2); }
html[data-theme="day"] .gr-tbl tbody tr:hover { background: rgba(180,83,9,.06); }

/* ═══════════════════════════════════════════════════════════════
   BADGES & PILL-DOT — Statuts
   ═══════════════════════════════════════════════════════════════ */
.gr-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  border: 1px solid transparent;
}
.gr-badge.gold  { background: rgba(245,158,11,.14); color: var(--gr-gold); border-color: rgba(245,158,11,.25); }
.gr-badge.green { background: rgba(5,150,105,.14); color: var(--gr-green); border-color: rgba(5,150,105,.25); }
.gr-badge.red   { background: rgba(220,38,38,.14); color: var(--gr-red); border-color: rgba(220,38,38,.25); }
.gr-badge.cyan  { background: rgba(6,182,212,.14); color: var(--gr-cyan); border-color: rgba(6,182,212,.25); }
.gr-badge.slate { background: rgba(255,255,255,.05); color: var(--gr-text-muted); border-color: var(--gr-border-2); }

html[data-theme="day"] .gr-badge.gold  { background: rgba(180,83,9,.10); border-color: rgba(180,83,9,.30); }
html[data-theme="day"] .gr-badge.green { background: rgba(4,120,87,.10); border-color: rgba(4,120,87,.30); }
html[data-theme="day"] .gr-badge.red   { background: rgba(185,28,28,.10); border-color: rgba(185,28,28,.30); }
html[data-theme="day"] .gr-badge.cyan  { background: rgba(3,105,161,.10); border-color: rgba(3,105,161,.30); }
html[data-theme="day"] .gr-badge.slate { background: #f4f5f7; border-color: rgba(15,23,41,.12); }

.gr-pill-dot {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 7px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--gr-border-2);
  border-radius: 999px;
  font-size: 11px; color: var(--gr-text-muted);
}
.gr-pill-dot .d { width: 6px; height: 6px; border-radius: 50%; }

/* ═══════════════════════════════════════════════════════════════
   PROGRESS BARS
   ═══════════════════════════════════════════════════════════════ */
.gr-progress {
  height: 6px; border-radius: 10px;
  background: rgba(255,255,255,.06); overflow: hidden;
}
.gr-progress .bar { height: 100%; border-radius: 10px; transition: width .6s; }
.gr-progress .bar.gold  { background: linear-gradient(90deg, var(--gr-gold-dark), var(--gr-gold)); }
.gr-progress .bar.green { background: linear-gradient(90deg, var(--gr-green-dark), var(--gr-green)); }
.gr-progress .bar.red   { background: linear-gradient(90deg, #b91c1c, var(--gr-red)); }
.gr-progress .bar.cyan  { background: linear-gradient(90deg, var(--gr-cyan-muted), var(--gr-cyan)); }

html[data-theme="day"] .gr-progress { background: rgba(15,23,41,.08); }

/* ═══════════════════════════════════════════════════════════════
   CHIPS — Filtres actifs/inactifs
   ═══════════════════════════════════════════════════════════════ */
.gr-chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.gr-chip {
  padding: 5px 10px; font-size: 11.5px; border-radius: 999px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--gr-border-2);
  color: var(--gr-text-muted);
  cursor: pointer; transition: all .15s;
  text-decoration: none; display: inline-block;
}
.gr-chip:hover { color: var(--gr-text); border-color: rgba(255,255,255,.2); }
.gr-chip.active {
  background: rgba(245,158,11,.15);
  color: var(--gr-gold);
  border-color: rgba(245,158,11,.35);
}

html[data-theme="day"] .gr-chip { background: #ffffff; }

/* ═══════════════════════════════════════════════════════════════
   TIMELINE
   ═══════════════════════════════════════════════════════════════ */
.gr-timeline { position: relative; padding-left: 22px; }
.gr-timeline::before {
  content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 1px;
  background: linear-gradient(180deg, var(--gr-gold), transparent);
}
.gr-tl-item { position: relative; padding-bottom: 14px; }
.gr-tl-item::before {
  content: ''; position: absolute; left: -20px; top: 6px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--gr-gold);
  box-shadow: 0 0 0 3px rgba(245,158,11,.15);
}
.gr-tl-item.cyan::before  { background: var(--gr-cyan); box-shadow: 0 0 0 3px rgba(34,211,238,.15); }
.gr-tl-item.green::before { background: var(--gr-green); box-shadow: 0 0 0 3px rgba(52,211,153,.15); }
.gr-tl-item.red::before   { background: var(--gr-red); box-shadow: 0 0 0 3px rgba(248,113,113,.15); }
.gr-tl-time { font-family: var(--gr-mono); font-size: 11px; color: var(--gr-text-faint); }
.gr-tl-title { font-size: 13px; font-weight: 600; margin: 1px 0; color: var(--gr-text); }
.gr-tl-meta { font-size: 11.5px; color: var(--gr-text-muted); }

/* ═══════════════════════════════════════════════════════════════
   MAP BLOCK — Placeholder pour carte temps réel
   ═══════════════════════════════════════════════════════════════ */
.gr-map {
  position: relative;
  border-radius: var(--gr-radius-md);
  background:
    radial-gradient(ellipse at 30% 50%, rgba(34,211,238,.06), transparent 50%),
    radial-gradient(ellipse at 70% 30%, rgba(245,158,11,.05), transparent 50%),
    #0a1020;
  overflow: hidden;
  border: 1px solid var(--gr-border-2);
}
.gr-map::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(34,211,238,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34,211,238,.04) 1px, transparent 1px);
  background-size: 40px 40px;
}
html[data-theme="day"] .gr-map { background: linear-gradient(135deg, #eef2f7, #f8fafc); }
html[data-theme="hiviz"] .gr-map { background: #ffffff; border: 2px solid #000; }

/* ═══════════════════════════════════════════════════════════════
   AVATARS — Tailles md / lg pour cartes agent
   ═══════════════════════════════════════════════════════════════ */
.gr-av-md {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   BUILDING SILHOUETTE — Page Sites & Clients
   ═══════════════════════════════════════════════════════════════ */
.gr-bldg-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
@media (min-width: 1400px) {
  .gr-bldg-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .gr-bldg-grid { grid-template-columns: 1fr; }
}

.gr-bldg-card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--gr-surface);
  border: 1px solid var(--gr-border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  font-family: inherit; color: var(--gr-text);
  transition: all .18s ease;
  padding: 0;
}
.gr-bldg-card:hover {
  border-color: var(--gr-gold);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0,0,0,.25);
}

.gr-bldg-stage {
  position: relative;
  height: 260px;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 12px 18px 20px;
  overflow: hidden;
  background:
    radial-gradient(ellipse 60% 40% at 70% 18%, rgba(245,158,11,.05), transparent 70%),
    linear-gradient(180deg, #050812 0%, var(--gr-surface) 70%, var(--gr-surface-2) 100%);
}

.gr-bldg-sign {
  position: absolute;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  padding: 3px 8px;
  background: rgba(7,12,26,.75);
  border: 1px solid;
  border-radius: 4px;
  font-family: var(--gr-mono);
  font-size: 11px; font-weight: 800;
  letter-spacing: .1em;
  z-index: 2;
}

.gr-bldg-body {
  position: relative;
  width: 70%;
  margin: 0 auto;
  border: 1.5px solid;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  display: flex; flex-direction: column-reverse;
  overflow: hidden;
  box-shadow: 0 -4px 20px rgba(0,0,0,.15);
}
.gr-bldg-floors {
  display: flex; flex-direction: column-reverse;
  padding: 4px; gap: 1px;
}
.gr-bldg-row {
  min-height: 16px;
  border-bottom: 1px dashed;
  display: flex; align-items: center; justify-content: center; gap: 3px;
  opacity: .35;
}
.gr-bldg-row.ref { opacity: 1; background: rgba(255,255,255,.03); }
.gr-bldg-qr-dot {
  width: 4px; height: 4px; border-radius: 50%;
  box-shadow: 0 0 4px currentColor;
}

.gr-bldg-ground {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 12px;
  background:
    linear-gradient(180deg, transparent, rgba(0,0,0,.3)),
    repeating-linear-gradient(45deg, var(--gr-surface-2), var(--gr-surface-2) 4px, var(--gr-surface-3) 4px, var(--gr-surface-3) 8px);
  border-top: 1px solid var(--gr-border-2);
}

.gr-bldg-meta {
  padding: 12px 14px;
  border-top: 1px solid var(--gr-border);
  background: var(--gr-surface-2);
}
.gr-bldg-name { font-weight: 700; font-size: 13.5px; margin-bottom: 3px; }
.gr-bldg-code { font-family: var(--gr-mono); font-size: 10px; color: var(--gr-text-faint); }
.gr-bldg-stats {
  display: flex; gap: 12px;
  padding: 8px 0;
  border-top: 1px dashed var(--gr-border);
  margin-top: 8px;
}
.gr-bldg-stats > div { flex: 1; }
.gr-bldg-stats .n {
  font-family: var(--gr-mono); font-size: 15px; font-weight: 700;
  color: var(--gr-text);
}
.gr-bldg-stats .l {
  font-size: 9px; color: var(--gr-text-faint);
  text-transform: uppercase; letter-spacing: .08em;
}

/* ═══════════════════════════════════════════════════════════════
   INPUT / SELECT proto (override doux sur form-control)
   ═══════════════════════════════════════════════════════════════ */
.gr-input, .gr-select {
  width: 100%;
  background: var(--gr-surface-2);
  border: 1px solid var(--gr-border-2);
  color: var(--gr-text);
  padding: 8px 12px; font-size: 13px;
  border-radius: 8px; font-family: inherit;
  outline: none; transition: all .15s;
}
.gr-input:focus, .gr-select:focus {
  border-color: var(--gr-gold);
  box-shadow: 0 0 0 3px rgba(245,158,11,.15);
  background: var(--gr-surface-3);
}
.gr-input::placeholder { color: var(--gr-text-faint); }
.gr-lbl {
  display: block;
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gr-text-faint); margin-bottom: 6px;
}

/* ═══════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════ */
.gr-anim-in > * { animation: gr-slideUp .3s ease both; }
.gr-anim-in > *:nth-child(1) { animation-delay: .02s; }
.gr-anim-in > *:nth-child(2) { animation-delay: .06s; }
.gr-anim-in > *:nth-child(3) { animation-delay: .10s; }
.gr-anim-in > *:nth-child(4) { animation-delay: .14s; }
.gr-anim-in > *:nth-child(5) { animation-delay: .18s; }

@keyframes gr-slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.gr-hr { border: none; height: 1px; background: var(--gr-border); margin: 12px 0; }

.gr-bg-dots {
  position: relative;
}
.gr-bg-dots::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.025) 1px, transparent 0);
  background-size: 28px 28px;
}

/* Override body : applique le fond du thème + pattern points */
html[data-theme] body {
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--gr-text) var(--gr-bg-pattern-opacity), transparent) 1px, transparent 0);
  background-size: 28px 28px;
  background-color: var(--gr-bg);
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE FIXES
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .gr-pg-head { flex-direction: column; align-items: flex-start; }
  .gr-pg-head h1 { font-size: 18px; }
  .gr-kpi-val { font-size: 24px; }
}
