/* ═══════════════════════════════════════════════════════════════════════════════
   OVIRO Admin — Neumorphic Glamour Theme
   Fond gris perle · Accent or/ambre · Ombres douces en relief
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─── Tokens ──────────────────────────────────────────────────────────────────── */
:root {
  color-scheme: light;

  /* ── Fond neumorphique ── */
  --bg:  #eaeaf4;
  --bg2: #e4e4f0;
  --bg3: #dddde8;
  --bg4: #d6d6e2;

  /* ── Ombres neumorphiques ── */
  --neu-out:  6px 6px 16px rgba(140,140,175,0.42), -4px -4px 12px rgba(255,255,255,0.88);
  --neu-sm:   4px 4px 10px rgba(140,140,175,0.36), -3px -3px 7px  rgba(255,255,255,0.86);
  --neu-xs:   2px 2px 6px  rgba(140,140,175,0.28), -2px -2px 5px  rgba(255,255,255,0.82);
  --neu-in:   inset 4px 4px 10px rgba(140,140,175,0.36), inset -3px -3px 8px rgba(255,255,255,0.80);
  --neu-in-sm:inset 2px 2px 6px  rgba(140,140,175,0.28), inset -2px -2px 5px rgba(255,255,255,0.76);

  /* ── Or / Ambre (accent principal) ── */
  --gold:      #f0b429;
  --gold2:     #d99400;
  --gold3:     #fcd34d;
  --gold-glow: rgba(240,180,41,0.38);
  --gold-soft: rgba(240,180,41,0.12);
  --gold-bg:   rgba(240,180,41,0.10);

  /* Compatibilité app.js */
  --accent:         #f0b429;
  --accent-2:       #d99400;
  --accent-3:       #fcd34d;
  --accentBorder:   rgba(240,180,41,0.28);
  --tabBar:         #eaeaf4;
  --glass:          rgba(234,234,244,0.90);
  --glass2:         rgba(250,250,255,0.95);
  --glass3:         #ffffff;

  /* Purple/Violet (accents secondaires KPI) */
  --purple:      #7c5cff;
  --purple2:     #8b6fff;
  --purple3:     #5b3fd8;
  --purple-dark: #3d2cb0;
  --purple-glow: rgba(124,92,255,0.28);
  --violet:      #9333ea;

  /* Couleurs de statut */
  --success:  #10b981;
  --success2: #059669;
  --warn:     #f59e0b;
  --warn2:    #d97706;
  --danger:   #ef4444;
  --danger2:  #dc2626;
  --info:     #3b82f6;
  --info2:    #2563eb;
  --red:      #ef4444;
  --red2:     #dc2626;
  --green:    #10b981;
  --green2:   #059669;
  --teal:     #14b8a6;
  --teal2:    #0d9488;
  --yellow:   #f59e0b;
  --yellow2:  #d97706;
  --cyan:     #06b6d4;
  --cyan2:    #0891b2;
  --pink:     #ec4899;
  --pink2:    #be185d;

  /* Texte */
  --text:  #1c1c34;
  --text2: #3c3c58;
  --muted: #8a8aaa;

  /* Bordures */
  --line:  rgba(100,100,150,0.10);
  --line2: rgba(100,100,150,0.18);
  --line3: rgba(100,100,150,0.30);

  /* Gradients (compatibilité KPI) */
  --grad-purple: linear-gradient(135deg,#7c5cff,#a855f7);
  --grad-pink:   linear-gradient(135deg,#ec4899,#f97316);
  --grad-teal:   linear-gradient(135deg,#06b6d4,#14b8a6);
  --grad-green:  linear-gradient(135deg,#10b981,#059669);
  --grad-gold:   linear-gradient(135deg,#f8c332,#f0b429);

  /* Layout */
  --sidebar-w: 248px;
  --radius:    22px;
  --radius-sm: 16px;
  --radius-xs: 12px;
}

/* ─── Reset ───────────────────────────────────────────────────────────────────── */
*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── Shell ───────────────────────────────────────────────────────────────────── */
.shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  /* Légère élévation neumorphique latérale */
  box-shadow: 4px 0 20px rgba(140,140,175,0.18);
}

.main {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  background: var(--bg);
}

/* ─── Brand ───────────────────────────────────────────────────────────────────── */
.brand {
  padding: 22px 16px 18px;
  border-bottom: 1px solid var(--line);
}

.brand-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.brand-top h1 {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand-top p {
  font-size: 10px;
  color: var(--muted);
  margin-top: 1px;
  letter-spacing: 0.04em;
}

.brand-badge {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fcd34d, var(--gold));
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 900;
  color: #1c1c34;
  letter-spacing: -0.02em;
  box-shadow: 4px 4px 10px rgba(240,180,41,0.45), -2px -2px 7px rgba(255,255,255,0.92);
  flex-shrink: 0;
}

.brand-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--bg);
  box-shadow: var(--neu-sm);
}

.brand-avatar {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, #fcd34d, var(--gold));
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 900;
  color: #1c1c34;
  flex-shrink: 0;
}

/* ─── Sidebar nav ─────────────────────────────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-section-label {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding: 14px 12px 5px;
}

.nav-item {
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 14px;
  transition: all 140ms ease;
}

.nav-item-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 14px;
  transition: all 140ms ease;
}

.nav-item:hover .nav-item-inner {
  background: rgba(240,180,41,0.09);
}

.nav-item.active .nav-item-inner {
  background: linear-gradient(135deg, #fcd34d, var(--gold));
  box-shadow: 4px 4px 12px rgba(240,180,41,0.42), -2px -2px 6px rgba(255,255,255,0.82);
}

.nav-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 14px;
  background: var(--bg);
  box-shadow: var(--neu-xs);
  flex-shrink: 0;
  transition: all 140ms ease;
  color: var(--muted);
}

.nav-item.active .nav-icon {
  background: rgba(255,255,255,0.28);
  box-shadow: none;
  color: #1c1c34;
}

.nav-item-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.nav-item-text strong {
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  transition: color 140ms ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item-text span {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 140ms ease;
}

.nav-item.active .nav-item-text strong,
.nav-item.active .nav-item-text span {
  color: #1c1c34;
}

/* ─── Sidebar footer ─────────────────────────────────────────────────────────── */
.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.api-url-chip {
  font-size: 10px;
  color: var(--muted);
  padding: 7px 11px;
  border-radius: 9px;
  background: var(--bg);
  box-shadow: var(--neu-in);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-url-chip span {
  color: var(--gold2);
  font-weight: 700;
}

/* ─── Topbar ──────────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 4px 0 2px;
}

.topbar-left h2 {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.eyebrow {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--gold2);
}

/* ─── Boutons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 22px;
  font-size: 13px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: all 130ms ease;
  white-space: nowrap;
  letter-spacing: 0.01em;
  font-family: inherit;
  /* Neumorphic or/ambre */
  background: linear-gradient(145deg, #fcd34d, var(--gold));
  color: #1c1c34;
  box-shadow: 5px 5px 12px rgba(240,180,41,0.40), -3px -3px 8px rgba(255,255,255,0.88);
}

.btn:hover {
  box-shadow: 6px 6px 16px rgba(240,180,41,0.50), -3px -3px 8px rgba(255,255,255,0.92);
  transform: translateY(-1px);
}

.btn:active {
  box-shadow: inset 3px 3px 8px rgba(180,130,0,0.35), inset -2px -2px 5px rgba(255,255,255,0.70);
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  pointer-events: none;
}

.btn.secondary {
  background: var(--bg);
  color: var(--text2);
  box-shadow: var(--neu-sm);
}

.btn.secondary:hover {
  color: var(--gold2);
  box-shadow: 5px 5px 12px rgba(140,140,175,0.40), -3px -3px 8px rgba(255,255,255,0.92);
}

.btn.secondary:active {
  box-shadow: var(--neu-in);
  color: var(--text);
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  border: 1.5px solid var(--line2);
}

.btn.ghost:hover {
  background: var(--gold-bg);
  color: var(--gold2);
  border-color: rgba(240,180,41,0.35);
}

.btn.danger {
  background: linear-gradient(145deg, #f87171, var(--danger));
  color: #fff;
  box-shadow: 5px 5px 12px rgba(239,68,68,0.36), -3px -3px 7px rgba(255,255,255,0.82);
}

.btn.danger:hover {
  box-shadow: 6px 6px 16px rgba(239,68,68,0.46), -3px -3px 7px rgba(255,255,255,0.86);
  transform: translateY(-1px);
}

.btn.success {
  background: linear-gradient(145deg, #34d399, var(--success));
  color: #fff;
  box-shadow: 5px 5px 12px rgba(16,185,129,0.35), -3px -3px 7px rgba(255,255,255,0.82);
}

/* ─── Inputs ──────────────────────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field label,
label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}

.field input,
.field select,
.field textarea,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 12px 15px;
  border-radius: var(--radius-xs);
  border: none;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  box-shadow: var(--neu-in);
  outline: none;
  transition: box-shadow 150ms ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
input:focus,
select:focus,
textarea:focus {
  box-shadow: var(--neu-in),
              0 0 0 2px rgba(240,180,41,0.32);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.65;
}

/* ─── Badges ──────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge.success { background:rgba(16,185,129,0.13);  color:#047857; border:1px solid rgba(16,185,129,0.18); }
.badge.warn    { background:rgba(245,158,11,0.13);  color:#92400e; border:1px solid rgba(245,158,11,0.18); }
.badge.danger  { background:rgba(239,68,68,0.12);   color:#b91c1c; border:1px solid rgba(239,68,68,0.18); }
.badge.info    { background:rgba(240,180,41,0.14);  color:#854d0e; border:1px solid rgba(240,180,41,0.22); }

/* ─── KPI cards ───────────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 14px;
}

.kpi-grid-3 {
  grid-template-columns: repeat(3,1fr);
}

.kpi-card {
  border-radius: var(--radius);
  padding: 22px;
  background: var(--bg);
  box-shadow: var(--neu-out);
  position: relative;
  overflow: hidden;
  transition: box-shadow 200ms ease, transform 200ms ease;
  border: 1px solid rgba(255,255,255,0.55);
}

.kpi-card:hover {
  box-shadow: 8px 8px 20px rgba(140,140,175,0.44), -5px -5px 14px rgba(255,255,255,0.92);
  transform: translateY(-2px);
}

.kpi-card-glow {
  position: absolute;
  top: -30%; right: -15%;
  width: 130px; height: 130px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.6;
}

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 18px;
  margin-bottom: 14px;
  box-shadow: 3px 3px 8px rgba(140,140,175,0.32), -2px -2px 6px rgba(255,255,255,0.88);
}

.kpi-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin-bottom: 7px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 9px;
}

.kpi-hint {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.kpi-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.kpi-dot.live {
  animation: neuPulse 2s infinite;
}

@keyframes neuPulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%     { opacity:0.6; transform:scale(1.3); }
}

/* Gradient text helpers */
.grad-purple { }
.grad-pink   { }
.grad-teal   { }
.grad-green  { }

/* ─── Panel card ──────────────────────────────────────────────────────────────── */
.panel-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--neu-out);
  border: 1px solid rgba(255,255,255,0.55);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-head h3 {
  font-size: 16px;
  font-weight: 800;
  margin: 0;
  color: var(--text);
}

/* ─── Tables ──────────────────────────────────────────────────────────────────── */
.table-wrap {
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--neu-out);
  border: 1px solid rgba(255,255,255,0.55);
  overflow: hidden;
}

.table-toolbar {
  padding: 16px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: linear-gradient(180deg, rgba(240,180,41,0.09) 0%, transparent 100%);
}

thead th {
  padding: 13px 16px;
  text-align: left;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold2);
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

thead th svg { vertical-align: -1px; opacity: 0.65; }

tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  vertical-align: middle;
  font-size: 13px;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr { transition: background 120ms ease; }

tbody tr:hover { background: rgba(240,180,41,0.05); }

tbody tr[data-user-modal] { cursor: pointer; }
tbody tr[data-user-modal]:hover { background: rgba(240,180,41,0.07); }

/* ─── Row actions ─────────────────────────────────────────────────────────────── */
.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ─── Tabs ────────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 9px 18px;
  border-radius: var(--radius-xs);
  border: none;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  background: var(--bg);
  color: var(--muted);
  box-shadow: var(--neu-sm);
  transition: all 140ms ease;
  font-family: inherit;
}

.tab-btn:hover {
  color: var(--gold2);
  box-shadow: 5px 5px 12px rgba(140,140,175,0.38), -3px -3px 8px rgba(255,255,255,0.88);
}

.tab-btn.active {
  background: linear-gradient(145deg, #fcd34d, var(--gold));
  color: #1c1c34;
  box-shadow: 4px 4px 12px rgba(240,180,41,0.42), -2px -2px 7px rgba(255,255,255,0.85);
}

/* ─── Login ───────────────────────────────────────────────────────────────────── */
.login-root {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 15% 20%, rgba(240,180,41,0.10) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 80%, rgba(124,92,255,0.07) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 50%, rgba(255,255,255,0.20) 0%, transparent 70%);
}

.login-card {
  padding: 40px;
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--neu-out);
  border: 1px solid rgba(255,255,255,0.65);
}

/* ─── Empty state ─────────────────────────────────────────────────────────────── */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 44px 20px;
  font-size: 14px;
}

/* ─── Toast ───────────────────────────────────────────────────────────────────── */
.floating {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: var(--bg);
  border-radius: 16px;
  padding: 14px 20px;
  box-shadow: 6px 6px 20px rgba(140,140,175,0.44), -3px -3px 10px rgba(255,255,255,0.88);
  border: 1px solid rgba(255,255,255,0.65);
  min-width: 260px;
  max-width: 400px;
  font-size: 13px;
  font-weight: 600;
  animation: slideUp 250ms cubic-bezier(0.34,1.56,0.64,1);
}

/* ─── HTTP method badges ──────────────────────────────────────────────────────── */
.method {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.method.get    { background:rgba(16,185,129,0.12);  color:#047857; }
.method.post   { background:rgba(240,180,41,0.15);  color:#92400e; }
.method.put    { background:rgba(59,130,246,0.12);  color:#1d4ed8; }
.method.patch  { background:rgba(245,158,11,0.14);  color:#b45309; }
.method.delete { background:rgba(239,68,68,0.12);   color:#b91c1c; }

/* ─── Code block ──────────────────────────────────────────────────────────────── */
.code-block {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: var(--neu-in);
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
}

/* ─── Chart card ──────────────────────────────────────────────────────────────── */
.chart-card { padding: 24px; }
.chart-card canvas { max-height: 200px; }

/* ─── Animations ──────────────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0 }
  to   { opacity: 1 }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(22px) scale(0.97) }
  to   { opacity: 1; transform: translateY(0)    scale(1)    }
}

/* ─── Scrollbar ───────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(140,140,175,0.30);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(240,180,41,0.55);
}

/* ─── Inline style overrides pour couleurs de fond blancs dans app.js ─────────── */
/* Les éléments avec background:#ffffff inline doivent être neumorphiques */
[style*="background:#ffffff"],
[style*="background: #ffffff"],
[style*="background:#f8f6ff"],
[style*="background:#f4f2ff"],
[style*="background:#f0eeff"] {
  background: var(--bg) !important;
}

/* Ajustement pour les selects et inputs inline */
select[style*="background:#ffffff"],
input[style*="background:#ffffff"] {
  background: var(--bg) !important;
  box-shadow: var(--neu-in) !important;
  border: none !important;
}
