/* =========================================================================
   PETICA — compléments d'interface (PHP natif)
   S'appuie sur les jetons et composants d'origine ; n'altère aucune règle
   existante, ajoute uniquement ce dont les écrans serveur ont besoin.
   ========================================================================= */

/* Bouton rond « compagnon » de l'en-tête */
.header-companion-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--violet-600, #5F3AA0);
  color: #fff;
  flex: none;
  transition: transform .18s ease, background .18s ease;
}
.header-companion-btn:hover { background: var(--violet-700, #4a2c80); transform: translateY(-1px); }
.header-companion-btn svg { display: block; }

/* Badges de statut */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { background: #E7F5EC; color: #246B44; border-color: #C6E7D3; }
.badge-warn { background: #FDF3E2; color: #8A5A12; border-color: #F3DFBB; }
.badge-danger { background: #FBEAEA; color: #9B2C2C; border-color: #F0CFCF; }
.badge-muted { background: #EFEDF4; color: #4B4560; border-color: #E1DDEC; }

/* Tableaux de gestion */
.data-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line, #E5E1EC);
  border-radius: var(--radius-lg, 14px);
  background: #fff;
}
.data-table { width: 100%; border-collapse: collapse; font-size: var(--step--1, .9rem); }
.data-table th, .data-table td { padding: 12px 14px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line, #E5E1EC); }
.data-table thead th {
  background: #FAF8FD;
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--stone-500, #7A7488);
  font-weight: 700;
  white-space: nowrap;
}
.data-table tbody tr:hover { background: #FCFBFE; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .mono { font-size: .82rem; }
.data-table td .cluster { gap: var(--sp-2, 8px); flex-wrap: nowrap; }

/* Barre de filtres */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3, 12px);
  align-items: flex-end;
  padding: var(--sp-4, 16px);
  background: #fff;
  border: 1px solid var(--line, #E5E1EC);
  border-radius: var(--radius-lg, 14px);
  margin-bottom: var(--sp-5, 20px);
}
.filter-bar .field { margin: 0; min-width: 150px; flex: 1 1 150px; }
.filter-bar .field label { font-size: .76rem; }
.filter-bar .field input, .filter-bar .field select {
  height: 40px;
  padding: 0 12px;
  font-size: .88rem;
  border: 1px solid var(--line, #E5E1EC);
  border-radius: 10px;
  background: #fff;
  width: 100%;
}
.filter-bar .actions { display: flex; gap: 8px; }

/* Cartes de statistiques */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-4, 16px); }
.stat-card {
  padding: var(--sp-5, 20px);
  background: #fff;
  border: 1px solid var(--line, #E5E1EC);
  border-radius: var(--radius-lg, 14px);
}
.stat-card .label { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--stone-500, #7A7488); font-weight: 700; }
.stat-card .value { font-family: var(--font-display, serif); font-size: 1.9rem; font-weight: 600; margin-top: 6px; line-height: 1.1; }
.stat-card .hint { font-size: .78rem; color: var(--stone-500, #7A7488); margin-top: 6px; }

/* Formulaires */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-4, 16px); }
.form-grid .full { grid-column: 1 / -1; }
.form-section { padding: var(--sp-5, 20px); background: #fff; border: 1px solid var(--line, #E5E1EC); border-radius: var(--radius-lg, 14px); margin-bottom: var(--sp-4, 16px); }
.form-section h2, .form-section h3 { font-size: var(--step-0, 1.05rem); margin-bottom: var(--sp-4, 16px); }
.field-error { color: #9B2C2C; font-size: .78rem; margin-top: 4px; display: block; }
.input-error { border-color: #D46A6A !important; background: #FFF7F7 !important; }
.form-help { font-size: .78rem; color: var(--stone-500, #7A7488); margin-top: 4px; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: .9rem; }

/* Onglets */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--line, #E5E1EC); margin-bottom: var(--sp-5, 20px); }
.tabs a {
  padding: 10px 16px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--stone-500, #7A7488);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a.is-active { color: var(--violet-600, #5F3AA0); border-bottom-color: var(--violet-600, #5F3AA0); }

/* Pagination */
.pager { justify-content: center; margin-top: var(--sp-5, 20px); flex-wrap: wrap; }

/* Détail compagnon / identité */
.pet-hero { display: grid; grid-template-columns: 120px 1fr; gap: var(--sp-5, 20px); align-items: center; }
.pet-hero .photo {
  width: 120px; height: 120px; border-radius: 22px; object-fit: cover;
  background: #F2EEF9; display: flex; align-items: center; justify-content: center;
  color: var(--violet-600, #5F3AA0); font-size: 2rem; font-weight: 700;
}
.serial { font-family: var(--font-mono, monospace); font-size: .95rem; letter-spacing: .04em; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-4, 16px); }
.kv .k { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--stone-500, #7A7488); font-weight: 700; }
.kv .v { margin-top: 4px; font-weight: 600; }

.qr-frame { display: inline-block; padding: 12px; background: #fff; border: 1px solid var(--line, #E5E1EC); border-radius: 16px; }
.qr-frame svg { display: block; width: 160px; height: 160px; }

/* QR permanents et lien de test (fiche identité) */
.qr-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--sp-4, 16px); }
.qr-link {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px; border: 1px solid var(--line, #E5E1EC); border-radius: 16px;
  background: #FCFBFE; text-align: center;
}
.qr-link .qr-frame { border: 0; padding: 0; }
.qr-link__title { margin: 0; font-weight: 700; font-size: .95rem; }
.qr-link__desc { margin: 0; font-size: .78rem; line-height: 1.4; color: var(--stone-500, #7A7488); }
.qr-link__url {
  display: block; width: 100%; box-sizing: border-box; padding: 6px 8px;
  border: 1px solid var(--line, #E5E1EC); border-radius: 8px; background: #fff;
  font-family: var(--font-mono, monospace); font-size: .7rem; line-height: 1.35;
  color: #5B5568; overflow-wrap: anywhere;
}

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 var(--sp-4, 16px) 22px; border-left: 2px solid var(--line, #E5E1EC); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--violet-600, #5F3AA0);
}

/* Assistant / conseils */
.tip { padding: 14px 16px; border-radius: 12px; background: #F6F2FC; border: 1px solid #E7DDF7; font-size: .88rem; }

/* Suivi et statistiques */
.meter-row { margin-bottom: var(--sp-4, 16px); }
.meter-row:last-child { margin-bottom: 0; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: .88rem; margin-bottom: 6px; }
.meter-head strong { font-family: var(--font-mono, monospace); font-size: .92rem; }
.meter-track { height: 10px; border-radius: 999px; background: #EFEDF4; overflow: hidden; }
.meter-fill { display: block; height: 100%; border-radius: 999px; background: var(--violet-600, #5F3AA0); transition: width .3s ease; }
.meter-fill.is-ok { background: #2F855A; }
.meter-fill.is-warn { background: #C98A16; }
.meter-fill.is-danger { background: #B03A3A; }
.meter-fill.is-muted { background: #9A93AD; }
.meter-hint { font-size: .76rem; color: var(--stone-500, #7A7488); margin-top: 4px; }
.stat-card.is-danger { border-color: #F0CFCF; background: #FFF9F9; }
.stat-card.is-ok { border-color: #C6E7D3; background: #F8FDFA; }
.stat-card.is-accent { border-color: #E7DDF7; background: #FBF9FE; }
.funnel-note { font-size: .78rem; color: var(--stone-500, #7A7488); margin-top: var(--sp-3, 12px); }

/* Contacter l'administration */
.contact-admin { border-color: #E7DDF7; }
.contact-admin-actions .btn { white-space: nowrap; }

/* Suggestions de saisie */
.suggest-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.suggest-list li { position: relative; padding-left: 20px; font-size: .86rem; }
.suggest-list li::before { content: "✓"; position: absolute; left: 0; color: #2F855A; font-weight: 700; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.suggestion { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: #F6F2FC; border: 1px dashed #D9CBEF; font-size: .78rem; color: var(--violet-700, #4a2c80); }
.order-summary { display: grid; gap: 6px; font-size: .9rem; }
.order-summary .row { display: flex; justify-content: space-between; gap: 10px; }
.order-summary .total { border-top: 1px solid var(--line, #E5E1EC); padding-top: 8px; font-weight: 700; }

/* Impression des QR */
@media print {
  .app-sidebar, .app-mobilebar, .app-nav-scrim, .site-header, .site-footer,
  .cta-float, .nero-launcher, .nero-panel, .no-print, .filter-bar, .pager { display: none !important; }
  .dashboard-shell { display: block !important; }
  .app-main { padding: 0 !important; }
  body { background: #fff !important; }
  .qr-frame { border: 0; }
  .qr-link { border: 0; padding: 0; background: #fff; }
  .qr-link__desc, .qr-link__url, .qr-link .btn { display: none !important; }
}

/* Mobile */
@media (max-width: 720px) {
  .pet-hero { grid-template-columns: 80px 1fr; }
  .pet-hero .photo { width: 80px; height: 80px; border-radius: 16px; }
  .filter-bar .field { flex: 1 1 100%; }
  .data-table th, .data-table td { padding: 10px; }
}
