/* Admin panel: a sidebar of sections and one section at a time. Every block is the same
   card; component internals keep their styles from profil.css, practice.css and etap-i.css. */

.admin-body { min-height: 100vh; display: flex; flex-direction: column; margin: 0; background: var(--app-canvas); color: var(--app-ink); }
.admin-body [hidden] { display: none !important; }
.admin-body .site-footer { margin-top: auto; }

/* Access check */
.admin-gate { width: min(calc(100% - 48px), 1240px); margin: 0 auto; padding: 40px 0 80px; flex: 1 0 auto; }
.admin-gate-skeleton { display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 40px; }
.admin-sk-nav { height: 360px; border-radius: var(--app-radius); }
.admin-sk-main { display: grid; gap: 20px; align-content: start; }
.admin-sk-title { width: 260px; height: 40px; border-radius: 10px; }
.admin-sk-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.admin-sk-tiles span { height: 104px; border-radius: var(--app-radius); }
.admin-sk-card { height: 320px; border-radius: var(--app-radius); }
.admin-gate-message { max-width: 460px; margin: 40px auto 0; display: grid; justify-items: start; gap: 18px; padding: 32px; border: 1px solid var(--app-line); border-radius: var(--app-radius); background: var(--app-paper); box-shadow: var(--app-shadow-sm); }
.admin-gate-message h1 { margin: 0; font-size: 22px; letter-spacing: -.02em; }

/* Shell */
.admin-shell { width: min(calc(100% - 48px), 1240px); margin: 0 auto; padding: 40px 0 88px; flex: 1 0 auto; display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 40px; align-items: start; }
.admin-sidebar { position: sticky; top: 96px; }
.admin-sidebar-title { margin: 0 12px 14px; color: var(--app-muted); font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.admin-nav { display: grid; gap: 2px; }
.admin-nav-group { margin: 18px 12px 6px; color: var(--app-muted-light); font-size: 11px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.admin-nav a { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 12px; border-radius: 10px; color: var(--app-muted); font-size: 14px; font-weight: 650; text-decoration: none; transition: background var(--app-motion-fast) var(--app-ease), color var(--app-motion-fast) var(--app-ease); }
.admin-nav a:hover { background: var(--app-accent-soft); color: var(--app-ink); }
.admin-nav a[aria-current="page"] { background: var(--app-paper); color: var(--app-ink); box-shadow: var(--app-shadow-sm); }
.admin-nav a:focus-visible { outline: 2px solid var(--app-ink); outline-offset: 2px; }
.admin-nav-badge { min-width: 22px; height: 22px; display: inline-grid; place-items: center; padding: 0 7px; border-radius: 999px; background: var(--app-ink); color: #fff; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }

.admin-main { min-width: 0; }
.admin-section-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.admin-section-eyebrow { margin: 0 0 10px; color: var(--app-muted); font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.admin-section-header h1 { margin: 0; font-size: 34px; font-weight: 690; line-height: 1.1; letter-spacing: -.035em; }
.admin-section-lead { max-width: 640px; margin: 10px 0 0; color: var(--app-muted); font-size: 15px; line-height: 1.6; }
.admin-section-header .secondary-btn { flex: 0 0 auto; }

.admin-section { display: grid; gap: 20px; }
.admin-section > .inline-message:empty { display: none; }

/* One card for every block of every section. */
.admin-section .admin-card { min-width: 0; display: grid; gap: 18px; margin: 0; padding: 28px; border: 1px solid var(--app-line); border-radius: var(--app-radius); background: var(--app-paper); box-shadow: var(--app-shadow-sm); }
.admin-section .admin-card > * { margin-top: 0; margin-bottom: 0; }
.admin-section .admin-card { scroll-margin-top: 104px; }
.admin-section .admin-card > .inline-message:empty { display: none; }
.admin-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.admin-card-head h2 { margin: 0 0 6px; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.admin-card-head p { max-width: 640px; margin: 0; color: var(--app-muted); font-size: 14px; line-height: 1.55; }
.admin-card-head h2:only-child { margin: 0; }
.admin-card-count { flex: 0 0 auto; font-size: 24px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.admin-section .admin-card .codes-loading { padding: 4px 0; }
.admin-section .admin-card .site-metrics-subheading { margin: 6px 0 -6px; }
.admin-section .admin-card .site-users-section { margin: 0; padding-top: 0; border-top: 0; }
.admin-section .admin-generator form > .primary-btn,
.admin-section .admin-operations-form > .primary-btn { justify-self: start; }
.admin-more-btn { justify-self: center; }

/* Groups of tiles (overview and activity). */
.admin-activity-groups { display: grid; gap: 36px; }
.admin-activity-group { display: grid; gap: 14px; }
.admin-group-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.admin-group-title { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.admin-group-heading p { margin: 0; color: var(--app-muted); font-size: 13px; }
.admin-activity-group > .inline-message:empty { display: none; }

.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.admin-toolbar-note { max-width: 560px; margin: 0; color: var(--app-muted); font-size: 13px; line-height: 1.5; text-align: right; }
.admin-section .admin-period-switch { background: var(--app-paper-soft); border-radius: 12px; }
.admin-section .admin-period-switch button { border-radius: 9px; }

.admin-section .admin-activity-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.admin-section .admin-activity-tile { gap: 8px; padding: 18px 18px 12px; border: 1px solid var(--app-line); border-radius: var(--app-radius); background: var(--app-paper); box-shadow: var(--app-shadow-sm); }
.admin-section .admin-activity-tile.is-featured { grid-column: 1 / -1; }
.admin-section .admin-activity-tile.is-featured .admin-bar-chart { height: 168px; }
.admin-section .admin-activity-tile h3 { font-size: 15px; }
.admin-section .admin-activity-tile header span { font-size: 12px; }
.admin-activity-value { flex: 0 0 auto; text-align: right; }
.admin-activity-value strong { display: block; font-size: 22px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.admin-section .admin-activity-tile header .admin-activity-value span { margin-top: 4px; }

/* Overview */
.admin-attention { display: grid; }
.admin-attention-row { min-height: 56px; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 8px 0; color: var(--app-ink); text-decoration: none; }
.admin-attention-row + .admin-attention-row { border-top: 1px solid var(--app-line); }
.admin-attention-row:hover .admin-attention-open { color: var(--app-ink); }
.admin-attention-row:focus-visible { outline: 2px solid var(--app-ink); outline-offset: 2px; border-radius: 6px; }
.admin-attention-row strong { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.admin-attention-row span { font-size: 15px; font-weight: 600; }
.admin-attention-row .admin-attention-open { color: var(--app-muted); font-size: 13px; font-weight: 700; }
.admin-attention-row .admin-attention-open::after { content: " →"; }
.admin-attention-empty { margin: 0; color: var(--app-muted); font-size: 14px; }

.admin-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.admin-kpi { min-width: 0; display: grid; grid-template-rows: auto 1fr auto; gap: 6px; padding: 18px; border: 1px solid var(--app-line); border-radius: var(--app-radius); background: var(--app-paper); box-shadow: var(--app-shadow-sm); }
.admin-kpi span { color: var(--app-muted); font-size: 13px; font-weight: 650; }
.admin-kpi strong { align-self: end; font-size: 28px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.admin-kpi small { color: var(--app-muted); font-size: 12px; }

/* Mobile app section */
.admin-app-group-heading { align-items: flex-end; }
.admin-app-group-heading p { margin-top: 4px; }
.admin-app-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.admin-app-insights { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.admin-app-insight { --tone: #6f8791; display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 14px; padding: 12px 14px; border: 1px solid var(--app-line); border-left: 3px solid var(--tone); border-radius: 10px; }
.admin-app-insight[data-severity="high"] { --tone: #c8432f; }
.admin-app-insight[data-severity="medium"] { --tone: #d18f00; }
.admin-app-insight-tag { color: var(--tone); font-size: 12px; font-weight: 700; line-height: 1.5; }
.admin-app-insight strong { display: block; font-size: 14px; line-height: 1.4; }
.admin-app-insight p { margin: 3px 0 0; color: var(--app-muted); font-size: 13px; line-height: 1.5; }
.admin-app-empty { margin: 0; color: var(--app-muted); font-size: 13px; line-height: 1.5; }
.admin-app-funnel { display: grid; gap: 8px; }
.admin-app-funnel-row { display: grid; grid-template-columns: minmax(0, 170px) minmax(0, 1fr) 92px; align-items: center; gap: 10px; font-size: 12px; }
.admin-app-funnel-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-app-funnel-row strong { font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.admin-app-funnel-track { height: 10px; border-radius: 5px; background: var(--app-paper-soft); overflow: hidden; }
.admin-app-funnel-track i { display: block; height: 100%; border-radius: 5px; }
.admin-app-table-wrap { display: grid; gap: 12px; overflow-x: auto; }
.admin-app-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.admin-app-table th { padding: 0 6px 6px; color: var(--app-muted); font-weight: 600; text-align: right; white-space: nowrap; }
.admin-app-table td { padding: 5px 6px; border-top: 1px solid var(--app-line); text-align: right; white-space: nowrap; }
.admin-app-table th:first-child,
.admin-app-table td:first-child { padding-left: 0; text-align: left; white-space: normal; }
.admin-app-heat { display: inline-block; min-width: 38px; padding: 2px 4px; border-radius: 4px; background: rgba(27, 175, 122, calc(var(--heat) * .45)); text-align: center; }
.admin-app-setup { padding: 14px 16px; border: 1px solid #ecd9a6; border-radius: var(--app-radius); background: #fffaf0; font-size: 13px; line-height: 1.5; }
.admin-app-setup ol { margin: 6px 0 0; padding-left: 20px; }
.admin-app-setup li + li { margin-top: 4px; }
.admin-app-reviews { display: grid; gap: 10px; max-height: 460px; overflow-y: auto; }
.admin-app-review { display: grid; gap: 4px; padding-bottom: 10px; border-bottom: 1px solid var(--app-line); }
.admin-app-review:last-child { padding-bottom: 0; border-bottom: 0; }
.admin-app-review header { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--app-muted); font-size: 11px; }
.admin-app-review p { margin: 0; font-size: 13px; line-height: 1.5; }
.admin-app-stars { color: #d18f00; font-size: 13px; letter-spacing: 1px; }
.admin-app-review[data-low="true"] .admin-app-stars { color: #c8432f; }
.admin-app-review-tag { padding: 1px 6px; border-radius: 4px; background: #fbeae7; color: #a4321f; font-weight: 700; }
.admin-kpis + .admin-kpis { margin-top: 0; }
.admin-kpi small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* A test answered faster than it can be read. */
.admin-user-tests .admin-test-rushed { color: var(--danger, #b42318); font-weight: 700; }

/* Embedded payments and events keep their own layout inside the section. */
.admin-section #payApp,
.admin-section #adApp { min-width: 0; }
.admin-section :is(#payApp, #adApp) .practice-card h2 { font-size: 18px; letter-spacing: -.01em; }
/* profil.css sizes every input like a text field; checkboxes and radios keep their own size. */
.admin-body input:is([type="checkbox"], [type="radio"]) { width: auto; height: auto; min-height: 0; padding: 0; border: revert; border-radius: revert; background: revert; box-shadow: none; }

@media (max-width: 960px) {
  .admin-shell { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 16px; }
  .admin-gate-skeleton { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .admin-sk-nav { height: 44px; }
  .admin-sidebar { position: sticky; top: 60px; z-index: 5; margin: 0 -24px; padding: 8px 24px; background: var(--app-canvas); }
  .admin-sidebar-title, .admin-nav-group { display: none; }
  .admin-nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
  .admin-nav::-webkit-scrollbar { display: none; }
  .admin-nav a { flex: 0 0 auto; min-height: 38px; white-space: nowrap; }
  .admin-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .admin-shell, .admin-gate { width: calc(100% - 32px); }
  .admin-sidebar { margin: 0 -16px; padding: 8px 16px; }
  .admin-section-header { flex-direction: column; align-items: stretch; gap: 16px; margin-bottom: 20px; }
  .admin-section-header h1 { font-size: 28px; }
  .admin-section-header .secondary-btn { align-self: flex-start; }
  .admin-section .admin-card { padding: 20px; }
  .admin-card-head { gap: 14px; }
  .admin-section .admin-activity-charts { grid-template-columns: minmax(0, 1fr); }
  .admin-toolbar { flex-direction: column; align-items: flex-start; }
  .admin-group-heading { flex-direction: column; gap: 4px; }
  .admin-app-group-heading { align-items: flex-start; gap: 12px; }
  .admin-app-grid { grid-template-columns: minmax(0, 1fr); }
  .admin-app-insight { grid-template-columns: 1fr; gap: 4px; }
  .admin-app-funnel-row { grid-template-columns: minmax(0, 1fr) 84px; }
  .admin-app-funnel-track { grid-column: 1 / -1; grid-row: 2; }
  .admin-toolbar-note { text-align: left; }
  .admin-kpi strong { font-size: 24px; }
  .admin-sk-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
