/* ═══════════════════════════════════════════════════════════════
   admin-overview-v9.css — ElectroCAD admin Overview + Audit Log
   Mobile-first refonte (2026-05-02). Scope: .aov-* (overview) + .aud-* (audit)
   ═══════════════════════════════════════════════════════════════ */

/* ── shared tokens (locally scoped to avoid clash with existing admin-v9) ── */
.aov-stats-grid,
.aud-root,
.aud-sheet {
  --aov-bg-glass: rgba(15, 23, 42, 0.65);
  --aov-bg-glass-strong: rgba(15, 23, 42, 0.82);
  --aov-border: rgba(148, 163, 184, 0.14);
  --aov-border-strong: rgba(148, 163, 184, 0.28);
  --aov-red: #DC2626;
  --aov-red-soft: rgba(220, 38, 38, 0.16);
  --aov-amber: #F59E0B;
  --aov-amber-soft: rgba(245, 158, 11, 0.18);
  --aov-emerald: #10B981;
  --aov-emerald-soft: rgba(16, 185, 129, 0.18);
  --aov-blue: #3B82F6;
  --aov-blue-soft: rgba(59, 130, 246, 0.18);
  --aov-purple: #A855F7;
  --aov-purple-soft: rgba(168, 85, 247, 0.18);
  --aov-text: #F1F5F9;
  --aov-text-2: #CBD5E1;
  --aov-text-3: #94A3B8;
  --aov-radius: 14px;
  --aov-radius-lg: 18px;
}

/* ════════ STATS GRID (Overview) ════════ */
.aov-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.aov-stat {
  position: relative;
  background: linear-gradient(155deg, var(--aov-bg-glass-strong) 0%, var(--aov-bg-glass) 100%);
  border: 1px solid var(--aov-border);
  border-radius: var(--aov-radius);
  padding: 14px 14px 16px;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  min-height: 96px;
}

.aov-stat::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(140% 80% at 100% 0%, rgba(220, 38, 38, 0.08) 0%, transparent 60%);
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.aov-stat--subs::before { background: radial-gradient(140% 80% at 100% 0%, rgba(220, 38, 38, 0.14) 0%, transparent 60%); }
.aov-stat--mrr::before { background: radial-gradient(140% 80% at 100% 0%, rgba(245, 158, 11, 0.12) 0%, transparent 60%); }
.aov-stat--act::before { background: radial-gradient(140% 80% at 100% 0%, rgba(59, 130, 246, 0.10) 0%, transparent 60%); }
.aov-stat--users::before { background: radial-gradient(140% 80% at 100% 0%, rgba(168, 85, 247, 0.10) 0%, transparent 60%); }
.aov-stat--new::before { background: radial-gradient(140% 80% at 100% 0%, rgba(16, 185, 129, 0.12) 0%, transparent 60%); }

@media (hover: hover) {
  .aov-stat:hover {
    transform: translateY(-2px);
    border-color: var(--aov-border-strong);
    box-shadow: 0 8px 28px -12px rgba(0, 0, 0, 0.35);
  }
  .aov-stat:hover::before { opacity: 1; }
}

.aov-stat--full {
  grid-column: 1 / -1;
}

.aov-stat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.aov-stat__label {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--aov-text-3);
  font-weight: 600;
  line-height: 1.3;
}

.aov-stat__icon {
  font-size: 0.78rem;
  color: var(--aov-text-3);
  opacity: 0.55;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(148, 163, 184, 0.08);
  border-radius: 8px;
  flex-shrink: 0;
}
.aov-stat--subs .aov-stat__icon { background: var(--aov-red-soft); color: var(--aov-red); opacity: 0.95; }
.aov-stat--mrr .aov-stat__icon { background: var(--aov-amber-soft); color: var(--aov-amber); opacity: 0.95; }
.aov-stat--act .aov-stat__icon { background: var(--aov-blue-soft); color: var(--aov-blue); opacity: 0.95; }
.aov-stat--users .aov-stat__icon { background: var(--aov-purple-soft); color: var(--aov-purple); opacity: 0.95; }
.aov-stat--new .aov-stat__icon { background: var(--aov-emerald-soft); color: var(--aov-emerald); opacity: 0.95; }

.aov-stat__value {
  font-family: 'Instrument Serif', 'Times New Roman', serif;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  font-weight: 400;
  color: var(--aov-text);
  line-height: 1.05;
  letter-spacing: -0.02em;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
}

.aov-stat__value--accent { color: var(--aov-red); }
.aov-stat__value--amber { color: var(--aov-amber); }
.aov-stat__value--emerald { color: var(--aov-emerald); }

.aov-stat__unit {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.62rem;
  color: var(--aov-text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-left: 2px;
}

.aov-stat__trend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(148, 163, 184, 0.10);
  color: var(--aov-text-3);
  position: relative;
  z-index: 1;
}
.aov-stat__trend--up { background: var(--aov-emerald-soft); color: var(--aov-emerald); }
.aov-stat__trend--down { background: var(--aov-red-soft); color: var(--aov-red); }
.aov-stat__trend i { font-size: 0.62rem; }

/* Quick actions row */
.aov-quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.aov-qa {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--aov-border);
  background: var(--aov-bg-glass);
  color: var(--aov-text-2);
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.aov-qa:hover, .aov-qa:focus-visible {
  border-color: var(--aov-red);
  color: var(--aov-text);
  background: var(--aov-red-soft);
  outline: none;
}
.aov-qa:focus-visible { outline: 2px solid var(--aov-red); outline-offset: 2px; }
.aov-qa:active { transform: scale(0.98); }
.aov-qa i {
  font-size: 0.85rem;
  color: var(--aov-red);
  opacity: 0.85;
}

/* ≥640px: 4 cols stats + 4 cols actions */
@media (min-width: 640px) {
  .aov-stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
  }
  .aov-stat { padding: 18px 20px; min-height: 110px; }
  .aov-stat__value { font-size: clamp(1.8rem, 3vw, 2.5rem); }
  .aov-stat--full { grid-column: 1 / -1; }
  .aov-quick-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }
  .aov-qa { font-size: 0.88rem; }
}

@media (min-width: 1024px) {
  .aov-stats-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .aov-stat--full { grid-column: auto; }
}

/* ════════ AUDIT LOG ════════ */
.aud-root {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0;
}

/* Toolbar */
.aud-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(180deg, rgba(6, 9, 26, 0.96) 0%, rgba(6, 9, 26, 0.88) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 12px 0 10px;
  border-bottom: 1px solid var(--aov-border);
  margin: -2px 0 4px;
}

.aud-toolbar__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.aud-toolbar__h {
  font-family: 'Inter', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--aov-text);
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}
.aud-toolbar__h i {
  color: var(--aov-red);
  font-size: 0.95rem;
}
.aud-toolbar__count {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--aov-text-3);
  background: rgba(148, 163, 184, 0.08);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--aov-border);
  white-space: nowrap;
}

.aud-toolbar__row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 10px;
}

.aud-search {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}
.aud-search__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--aov-text-3);
  font-size: 0.85rem;
  pointer-events: none;
}
.aud-search input {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 38px;
  background: var(--aov-bg-glass);
  border: 1px solid var(--aov-border);
  border-radius: 10px;
  color: var(--aov-text);
  font-family: 'Inter', sans-serif;
  font-size: 16px; /* ≥16px to prevent iOS zoom */
  font-weight: 500;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.aud-search input::placeholder { color: var(--aov-text-3); }
.aud-search input:focus { border-color: var(--aov-red); background: var(--aov-bg-glass-strong); }
.aud-search input::-webkit-search-cancel-button { display: none; }

.aud-search__clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: 0;
  background: rgba(148, 163, 184, 0.10);
  color: var(--aov-text-3);
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.aud-search__clear:hover { background: rgba(148, 163, 184, 0.18); color: var(--aov-text); }

.aud-filter-btn,
.aud-refresh-btn {
  position: relative;
  height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border: 1px solid var(--aov-border);
  background: var(--aov-bg-glass);
  color: var(--aov-text-2);
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.aud-filter-btn:hover, .aud-refresh-btn:hover {
  border-color: var(--aov-border-strong);
  background: var(--aov-bg-glass-strong);
  color: var(--aov-text);
}
.aud-filter-btn:focus-visible, .aud-refresh-btn:focus-visible {
  outline: 2px solid var(--aov-red);
  outline-offset: 2px;
}

.aud-refresh-btn { padding: 0; width: 44px; }
.aud-refresh-btn.is-spinning i { animation: aud-spin 0.6s linear; }

@keyframes aud-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.aud-filter-btn__lbl { display: none; }

.aud-filter-btn__dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--aov-red);
  box-shadow: 0 0 0 2px rgba(6, 9, 26, 0.9);
}

@media (min-width: 480px) {
  .aud-filter-btn__lbl { display: inline; }
}

/* Quick filter chips */
.aud-quickfilters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 2px 0;
  margin: 0 -2px;
}
.aud-quickfilters::-webkit-scrollbar { display: none; }

.aud-chip {
  flex-shrink: 0;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--aov-border);
  background: transparent;
  color: var(--aov-text-3);
  border-radius: 999px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.aud-chip:hover {
  border-color: var(--aov-border-strong);
  color: var(--aov-text-2);
}
.aud-chip.is-active {
  background: var(--aov-red);
  border-color: var(--aov-red);
  color: white;
}
.aud-chip:focus-visible { outline: 2px solid var(--aov-red); outline-offset: 2px; }

/* List */
.aud-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
}

.aud-card {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: var(--aov-bg-glass);
  border: 1px solid var(--aov-border);
  border-radius: 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.15s ease, transform 0.15s ease;
  animation: aud-fade-up 0.3s ease both;
  align-items: flex-start;
}

@keyframes aud-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (hover: hover) {
  .aud-card:hover {
    border-color: var(--aov-border-strong);
    transform: translateY(-1px);
  }
}

.aud-card__avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  color: white;
  letter-spacing: 0.02em;
  user-select: none;
}

/* 10-color palette via hash */
.aud-color-0 { background: linear-gradient(135deg, #DC2626 0%, #991B1B 100%); }
.aud-color-1 { background: linear-gradient(135deg, #F59E0B 0%, #B45309 100%); }
.aud-color-2 { background: linear-gradient(135deg, #10B981 0%, #047857 100%); }
.aud-color-3 { background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%); }
.aud-color-4 { background: linear-gradient(135deg, #A855F7 0%, #7E22CE 100%); }
.aud-color-5 { background: linear-gradient(135deg, #EC4899 0%, #BE185D 100%); }
.aud-color-6 { background: linear-gradient(135deg, #06B6D4 0%, #0E7490 100%); }
.aud-color-7 { background: linear-gradient(135deg, #84CC16 0%, #4D7C0F 100%); }
.aud-color-8 { background: linear-gradient(135deg, #F97316 0%, #C2410C 100%); }
.aud-color-9 { background: linear-gradient(135deg, #6366F1 0%, #4338CA 100%); }

.aud-card__body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.aud-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.aud-card__date {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  color: var(--aov-text-3);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.aud-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
}
.aud-pill code {
  font-family: inherit;
  background: transparent;
  padding: 0;
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 14ch;
}
.aud-pill i { font-size: 0.62rem; flex-shrink: 0; }

.aud-pill--success { background: var(--aov-emerald-soft); color: var(--aov-emerald); border: 1px solid rgba(16, 185, 129, 0.30); }
.aud-pill--neutral { background: rgba(148, 163, 184, 0.12); color: var(--aov-text-2); border: 1px solid var(--aov-border); }
.aud-pill--danger { background: var(--aov-red-soft); color: #FCA5A5; border: 1px solid rgba(220, 38, 38, 0.30); }
.aud-pill--warning { background: var(--aov-amber-soft); color: #FCD34D; border: 1px solid rgba(245, 158, 11, 0.30); }
.aud-pill--info { background: var(--aov-blue-soft); color: #93C5FD; border: 1px solid rgba(59, 130, 246, 0.30); }

.aud-card__user {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  color: var(--aov-text);
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aud-card__details {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--aov-text-3);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--aov-border);
  border-radius: 8px;
  padding: 6px 10px;
  margin-top: 4px;
  word-break: break-word;
  line-height: 1.45;
  max-height: 4.4em;
  overflow: hidden;
  position: relative;
}

/* ≥768px: card → row hybrid (more horizontal density) */
@media (min-width: 768px) {
  .aud-card {
    padding: 14px 18px;
    align-items: center;
  }
  .aud-card__avatar { width: 44px; height: 44px; font-size: 0.85rem; }
  .aud-card__body {
    flex-direction: row;
    align-items: center;
    gap: 14px;
  }
  .aud-card__top {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin: 0;
    flex-shrink: 0;
    min-width: 180px;
  }
  .aud-card__user {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.92rem;
  }
  .aud-card__details {
    flex: 0 1 360px;
    max-width: 360px;
    margin: 0;
    font-size: 0.72rem;
    max-height: 2.8em;
  }
}

/* Skeleton */
.aud-card--skeleton { animation: none; pointer-events: none; }
.aud-skel {
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.06) 0%, rgba(148, 163, 184, 0.14) 50%, rgba(148, 163, 184, 0.06) 100%);
  background-size: 200% 100%;
  animation: aud-shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}
.aud-card--skeleton .aud-card__avatar { width: 40px; height: 40px; border-radius: 50%; }
.aud-skel--line { height: 12px; margin: 6px 0; }
@keyframes aud-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty state */
.aud-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  background: var(--aov-bg-glass);
  border: 1px dashed var(--aov-border);
  border-radius: var(--aov-radius-lg);
  gap: 8px;
}
.aud-empty__icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--aov-text-3);
  font-size: 1.4rem;
  margin-bottom: 6px;
}
.aud-empty h3 {
  margin: 0;
  font-family: 'Inter', sans-serif;
  font-size: 1.05rem;
  color: var(--aov-text);
  font-weight: 700;
}
.aud-empty p {
  margin: 0;
  color: var(--aov-text-3);
  font-size: 0.85rem;
  max-width: 320px;
  line-height: 1.5;
}
.aud-empty__btn {
  margin-top: 12px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid var(--aov-border-strong);
  background: transparent;
  color: var(--aov-text);
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.aud-empty__btn:hover { background: var(--aov-red-soft); border-color: var(--aov-red); color: var(--aov-red); }

/* Error state */
.aud-error {
  padding: 24px;
  text-align: center;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.30);
  border-radius: var(--aov-radius);
  color: var(--aov-text-2);
}
.aud-error i { color: var(--aov-red); font-size: 1.3rem; margin-bottom: 6px; display: block; }
.aud-error p { margin: 0 0 12px; font-size: 0.88rem; }
.aud-error__retry {
  height: 36px;
  padding: 0 14px;
  border: 0;
  background: var(--aov-red);
  color: white;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

/* Load more */
.aud-loadmore {
  display: flex;
  justify-content: center;
  margin-top: 4px;
}
.aud-loadmore__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 24px;
  border: 1px solid var(--aov-border);
  background: var(--aov-bg-glass);
  color: var(--aov-text-2);
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.aud-loadmore__btn:hover {
  border-color: var(--aov-red);
  background: var(--aov-red-soft);
  color: var(--aov-text);
}
.aud-loadmore__btn.is-loading {
  opacity: 0.7;
  cursor: wait;
}
.aud-loadmore__btn.is-loading i { animation: aud-spin 0.8s linear infinite; }

.aud-sentinel { height: 1px; }

/* Bottom-sheet filter modal (mobile-first) */
.aud-sheet[hidden] { display: none; }
.aud-sheet {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}
.aud-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: auto;
}
.aud-sheet.is-open .aud-sheet__backdrop { opacity: 1; }

.aud-sheet__panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  background: linear-gradient(180deg, #0E1322 0%, #0A0E1A 100%);
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  border: 1px solid var(--aov-border);
  border-bottom: 0;
  padding: 8px 18px calc(18px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.aud-sheet.is-open .aud-sheet__panel { transform: translateY(0); }

.aud-sheet__handle {
  width: 40px;
  height: 4px;
  background: rgba(148, 163, 184, 0.30);
  border-radius: 999px;
  margin: 6px auto 6px;
}

.aud-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.aud-sheet__head h3 {
  margin: 0;
  font-family: 'Inter', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--aov-text);
}
.aud-sheet__close {
  width: 36px;
  height: 36px;
  border: 0;
  background: rgba(148, 163, 184, 0.10);
  color: var(--aov-text-2);
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.aud-sheet__close:hover { background: rgba(148, 163, 184, 0.18); color: var(--aov-text); }

.aud-sheet__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.aud-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.aud-field__lbl {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--aov-text-3);
  font-weight: 600;
}
.aud-field__ctrl {
  height: 44px;
  padding: 0 14px;
  background: var(--aov-bg-glass);
  border: 1px solid var(--aov-border);
  border-radius: 10px;
  color: var(--aov-text);
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 500;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' width='12' height='8'><path fill='none' stroke='%2394A3B8' stroke-width='1.6' d='M1 1l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}
.aud-field__ctrl:focus { border-color: var(--aov-red); }

.aud-sheet__foot {
  display: flex;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--aov-border);
  padding-top: 14px;
}
.aud-sheet__btn {
  flex: 1 1 auto;
  height: 46px;
  padding: 0 16px;
  border: 1px solid var(--aov-border);
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.aud-sheet__btn--ghost {
  background: transparent;
  color: var(--aov-text-2);
}
.aud-sheet__btn--ghost:hover { background: var(--aov-bg-glass); color: var(--aov-text); }
.aud-sheet__btn--primary {
  background: var(--aov-red);
  border-color: var(--aov-red);
  color: white;
}
.aud-sheet__btn--primary:hover { filter: brightness(1.08); }
.aud-sheet__btn:focus-visible { outline: 2px solid var(--aov-red); outline-offset: 2px; }

/* Center as modal on tablet+ */
@media (min-width: 720px) {
  .aud-sheet { align-items: center; }
  .aud-sheet__panel {
    max-height: 70vh;
    border-radius: 18px;
    border: 1px solid var(--aov-border);
    margin: 0 24px;
  }
  .aud-sheet__handle { display: none; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .aov-stat,
  .aud-card,
  .aud-sheet__panel,
  .aud-search input,
  .aud-chip,
  .aud-qa,
  .aov-qa,
  .aud-filter-btn,
  .aud-refresh-btn {
    transition: none !important;
    animation: none !important;
  }
  .aud-skel { animation: none; }
  .aud-card { animation: none !important; }
  .aud-refresh-btn.is-spinning i { animation: none; }
  .aud-loadmore__btn.is-loading i { animation: none; }
}

/* Hide legacy admin-stat-grid + redundant tabs nav while overview is rendered (defensive) */
.aov-stats-grid + .aud-root { margin-top: 16px; }


/* light-theme override block (auto-generated) */
[data-theme="light"] {
    --aov-bg-glass: rgba(255, 254, 248, 0.85);
    --aov-bg-glass-strong: rgba(255, 254, 248, 0.95);
    --aov-border: rgba(20, 18, 12, 0.10);
    --aov-border-strong: rgba(20, 18, 12, 0.20);
    --aov-text: #1A1A1F;
    --aov-text-2: #3B3B3D;
    --aov-text-3: #6F6E6A;
    --aov-red-soft: rgba(220, 38, 38, 0.12);
    --aov-amber-soft: rgba(245, 158, 11, 0.16);
    --aov-emerald-soft: rgba(16, 185, 129, 0.16);
    --aov-blue-soft: rgba(59, 130, 246, 0.14);
    --aov-purple-soft: rgba(168, 85, 247, 0.14);
}


/* ═════════════════════════════════════════════════════════════════════════
   light-theme hardcoded overrides
   ═════════════════════════════════════════════════════════════════════════ */

[data-theme="light"] .aov-stat:hover {
    box-shadow: 0 8px 28px -12px rgba(120, 80, 40, 0.20);
}

[data-theme="light"] .aud-toolbar {
    background: linear-gradient(180deg, rgba(255, 254, 248, 0.96) 0%, rgba(255, 254, 248, 0.88) 100%);
}

[data-theme="light"] .aud-card__details {
    background: rgba(20, 18, 12, 0.05);
}

[data-theme="light"] .aud-filter-btn__dot {
    box-shadow: 0 0 0 2px rgba(255, 254, 248, 0.95);
}

[data-theme="light"] .aud-sheet__backdrop {
    background: rgba(20, 18, 12, 0.40);
}

[data-theme="light"] .aud-sheet__panel {
    background: linear-gradient(180deg, #FFFEF8 0%, #F5F1E8 100%);
}


/* light-theme override des variables LOCALES (scopées sur .aov-stats-grid/.aud-root/.aud-sheet, pas :root) */
[data-theme="light"] .aov-stats-grid,
[data-theme="light"] .aud-root,
[data-theme="light"] .aud-sheet {
    --aov-bg-glass: rgba(255, 254, 248, 0.85);
    --aov-bg-glass-strong: rgba(255, 254, 248, 0.95);
    --aov-border: rgba(20, 18, 12, 0.10);
    --aov-border-strong: rgba(20, 18, 12, 0.20);
    --aov-text: #1A1A1F;
    --aov-text-2: #3B3B3D;
    --aov-text-3: #6F6E6A;
    --aov-red-soft: rgba(220, 38, 38, 0.12);
    --aov-amber-soft: rgba(245, 158, 11, 0.16);
    --aov-emerald-soft: rgba(16, 185, 129, 0.16);
    --aov-blue-soft: rgba(59, 130, 246, 0.14);
    --aov-purple-soft: rgba(168, 85, 247, 0.14);
}

/* ═══════════════════════════════════════════════════════════════════════════
   scroll-x guard 2026-05-03
   Cause root: nombreux white-space:nowrap sur stats/buttons/pills. Quickfilters
   chips sont déjà en overflow-x:auto. Aud-card top a min-width:180px en
   media >= certain breakpoint — on contrôle. .aud-pill code a max-width:14ch
   ce qui est déjà bon.
   ═══════════════════════════════════════════════════════════════════════════ */
.aov-wrap,
.aov-shell,
.aud-wrap,
.aov-stats,
.aov-stat,
.aov-card,
.aov-grid,
.aov-pagehead,
.aov-section,
.aud-search,
.aud-quickfilters,
.aud-card,
.aud-card__body,
.aud-card__top,
.aud-card__details,
.aud-empty {
    max-width: 100%;
    min-width: 0;
}
.aov-card { overflow: hidden; }

/* Stats grid : valeurs potentiellement longues */
.aov-stat__value,
.aov-stat__label { max-width: 100%; word-break: break-word; }

/* Quickfilters : déjà en overflow-x:auto, pas de scrollbar visible. OK. */
.aud-quickfilters {
    overflow-x: auto;
    scrollbar-width: none;
    max-width: 100%;
}
.aud-quickfilters::-webkit-scrollbar { display: none; }

/* Audit cards : top section a min-width:180px en desktop layout. Sur mobile
   le card body est en column donc pas problème, on confirme. */
.aud-card__top { max-width: 100%; }
@media (max-width: 640px) {
    .aud-card__body { flex-direction: column !important; align-items: stretch !important; }
    .aud-card__top { min-width: 0 !important; }
    .aud-card__details { max-width: 100% !important; flex-basis: auto !important; }
}

/* Pills/codes/dates : break-word déjà ok. */
.aud-pill,
.aud-chip { max-width: 100%; }

/* Filter buttons row (44px x 44px tap targets) - flex-wrap déjà ok */
.aud-filter-btn,
.aud-refresh-btn { flex-shrink: 0; }
