/* Vues mobiles et tableau de bord : page publique, télécommande, administration, connexion. */

body.app {
  min-height: 100vh;
  min-height: 100dvh;
  font-size: 17px;
  line-height: 1.45;
  background: var(--bg);
}

.app--center {
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.panel {
  width: 100%;
  max-width: 420px;
}

.brand {
  width: 160px;
  height: auto;
  margin-bottom: 28px;
}

h1,
h2,
h3 {
  font-stretch: 90%;
  line-height: 1.12;
}

.app h1 {
  font-size: 30px;
  margin: 0 0 10px;
  font-weight: 700;
}

.app h2 {
  font-size: 24px;
  margin: 0 0 8px;
  font-weight: 680;
}

.muted {
  color: var(--text-2);
}

.small {
  font-size: 14px;
}

/* ---------- formulaires ---------- */
.form {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.field {
  display: grid;
  gap: 6px;
}

.field > span {
  font-size: 15px;
  font-weight: 600;
}

.field > span em {
  font-style: normal;
  font-weight: 400;
  color: var(--text-3);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--stroke);
  background: var(--surface);
  font-size: 17px;
  line-height: 1.3;
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan) 30%, transparent);
}

.field.is-invalid input,
.field.is-invalid textarea {
  border-color: var(--alert);
}

.check {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 12px;
  align-items: start;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text-2);
}

.check input {
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--cyan);
}

.check.is-invalid {
  color: var(--alert);
}

.error {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--alert) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--alert) 60%, transparent);
  color: var(--text);
  font-size: 15px;
}

.success {
  margin: 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--ok) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--ok) 60%, transparent);
  font-size: 16px;
}

.btn {
  appearance: none;
  border: 1.5px solid var(--stroke);
  background: var(--surface);
  color: var(--text);
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 17px;
  font-weight: 650;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  -webkit-tap-highlight-color: transparent;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--navy);
  border-color: var(--navy);
  color: #ffffff;
}

.btn--gold {
  background: linear-gradient(90deg, #24437f 0%, #1677b0 100%);
  border-color: transparent;
  color: #ffffff;
}

.btn--danger {
  border-color: var(--alert);
  color: var(--alert);
  background: transparent;
}

.btn--ghost {
  background: transparent;
}

.btn--sm {
  min-height: 38px;
  padding: 7px 12px;
  font-size: 14px;
  border-radius: 10px;
}

.btn--block {
  width: 100%;
}

/* ========== page publique ========== */
.join {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.topbar img {
  width: 34px;
  height: 34px;
}

.topbar__title {
  flex: 1;
  min-width: 0;
}

.topbar__title b {
  display: block;
  font-size: 16px;
  font-stretch: 90%;
}

.topbar__title span {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-3);
  flex: 0 0 auto;
}

.dot.is-on {
  background: var(--ok);
}

.dot.is-off {
  background: var(--alert);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px 16px 10px;
  position: sticky;
  top: 58px;
  z-index: 9;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}

.tab {
  appearance: none;
  border: 1.5px solid var(--stroke);
  background: transparent;
  color: var(--text-2);
  border-radius: 12px;
  padding: 10px 6px;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  position: relative;
}

.tab[aria-selected='true'] {
  background: var(--surface);
  color: var(--text);
  border-color: var(--cyan);
}

.tab .badge {
  position: absolute;
  top: -5px;
  right: -3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--chip);
  border: 2px solid var(--bg);
}

.pane {
  padding: 8px 16px 40px;
  padding-bottom: max(40px, env(safe-area-inset-bottom));
  flex: 1;
}

.pane[hidden] {
  display: none;
}

.waiting {
  margin-top: 28px;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 14px;
}

.waiting .minicard {
  width: 118px;
  height: 150px;
  border-radius: 14px;
  background: var(--gradient-diag);
  position: relative;
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.6);
  animation: float 4s ease-in-out infinite;
}

/* Mini dossier d'audit : trois lignes cochées */
.waiting .minicard::before {
  content: '';
  position: absolute;
  left: 16px;
  right: 16px;
  top: 22px;
  height: 84px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 86 84'%3E%3Cg fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='1' y='2' width='16' height='16' rx='4' fill='%23ffffff'/%3E%3Cpath d='M5 10l3 3 6-6' stroke='%2306bbe6' stroke-width='2.4'/%3E%3Cpath d='M26 10h58' stroke='%23ffffff' stroke-opacity='.7' stroke-width='4'/%3E%3Crect x='1' y='34' width='16' height='16' rx='4' fill='%23ffffff'/%3E%3Cpath d='M5 42l3 3 6-6' stroke='%2306bbe6' stroke-width='2.4'/%3E%3Cpath d='M26 42h46' stroke='%23ffffff' stroke-opacity='.7' stroke-width='4'/%3E%3Crect x='1' y='66' width='16' height='16' rx='4' fill='%23ffffff'/%3E%3Cpath d='M5 74l3 3 6-6' stroke='%2306bbe6' stroke-width='2.4'/%3E%3Cpath d='M26 74h52' stroke='%23ffffff' stroke-opacity='.7' stroke-width='4'/%3E%3C/g%3E%3C/svg%3E") no-repeat center / contain;
}

/* la loupe de l'auditeur */
.waiting .minicard::after {
  content: '';
  position: absolute;
  right: -22px;
  bottom: -18px;
  width: 64px;
  height: 64px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cline x1='38' y1='38' x2='58' y2='58' stroke='%2324437f' stroke-width='8' stroke-linecap='round'/%3E%3Ccircle cx='26' cy='26' r='19' fill='%2306bbe6' fill-opacity='.3' stroke='%2324437f' stroke-width='5'/%3E%3Cpath d='M15 24a11 11 0 0 1 9-9' fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / contain;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-8px) rotate(-2deg); }
}

.waiting p {
  margin: 0;
  max-width: 340px;
}

.qcard {
  margin-top: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--chip) 20%, transparent);
  color: var(--chip);
  font-size: 14px;
  font-weight: 650;
}

.chip::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chip);
}

.qcard h2 {
  margin: 14px 0 18px;
  font-size: 23px;
  line-height: 1.2;
  font-weight: 680;
}

.opts {
  display: grid;
  gap: 10px;
}

.opt {
  appearance: none;
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  min-height: 60px;
  border-radius: 14px;
  border: 1.5px solid var(--stroke);
  background: var(--surface);
  font-size: 17px;
  line-height: 1.3;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.opt .l {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 15px;
  background: var(--bg);
  border: 1.5px solid var(--stroke);
}

.opt[aria-pressed='true'] {
  border-color: var(--navy);
  background: color-mix(in srgb, #06bbe6 12%, var(--surface));
}

.opt[aria-pressed='true'] .l {
  background: var(--navy);
  border-color: var(--navy);
  color: #ffffff;
}

.opt:disabled {
  cursor: default;
}

.opt.is-correct {
  border-color: var(--ok);
  background: color-mix(in srgb, var(--ok) 16%, var(--surface));
}

.opt.is-correct .l {
  background: var(--ok);
  border-color: var(--ok);
  color: #06301b;
}

.opt.opt.is-wrong-mine {
  border-color: var(--alert);
  background: color-mix(in srgb, var(--alert) 12%, var(--surface));
}

.opt.opt.is-wrong-mine .l {
  background: var(--alert);
  border-color: var(--alert);
  color: #fff;
}

.opt .res {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-2);
}

.opt .res i {
  display: block;
  height: 6px;
  border-radius: 3px;
  background: var(--cyan);
  flex: 0 0 auto;
}

.actions {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.note {
  margin-top: 14px;
  font-size: 15px;
  color: var(--text-2);
}

.verdict {
  margin: 0 0 14px;
  padding: 14px 16px;
  border-radius: 14px;
  font-weight: 650;
  font-size: 18px;
}

.verdict.ok {
  background: color-mix(in srgb, var(--ok) 18%, transparent);
  border: 1px solid var(--ok);
}

.verdict.ko {
  background: color-mix(in srgb, var(--alert) 14%, transparent);
  border: 1px solid var(--alert);
}

.explain-m {
  margin-top: 14px;
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.45;
}

.sent {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.sent span {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  font-size: 15px;
}

.toplist {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.toplist li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface);
}

.toplist li b {
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-weight: 500;
}

.banner {
  margin: 4px 0 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--chip) 18%, transparent);
  border: 1px solid var(--chip);
  font-size: 16px;
}

.myqs {
  margin-top: 26px;
}

.myqs ul {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.myqs li {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  font-size: 15px;
}

.myqs li small {
  display: block;
  margin-top: 4px;
  color: var(--text-3);
  font-size: 13px;
}

.privacy {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.45;
}

.footer-note {
  padding: 18px 16px 30px;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}

/* ========== télécommande ========== */
.remote {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.remote__head {
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
  border-bottom: 1px solid var(--stroke);
}

.remote__pos {
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-2);
}

.remote__title {
  grid-column: 1;
  font-size: 20px;
  font-weight: 680;
  font-stretch: 90%;
  line-height: 1.15;
}

.remote__timer {
  grid-row: 1 / span 2;
  grid-column: 2;
  text-align: right;
}

.remote__timer b {
  display: block;
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 26px;
  font-weight: 500;
}

.remote__timer span {
  font-size: 13px;
}

.late {
  color: var(--alert);
}

.early {
  color: var(--ok);
}

.remote__body {
  flex: 1;
  padding: 14px 16px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-content: start;
}

.box {
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: var(--surface);
  padding: 14px 16px;
}

.box h3 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 650;
  color: var(--text-2);
  font-stretch: 100%;
}

.notes-text {
  font-size: 18px;
  line-height: 1.5;
  white-space: pre-line;
}

.next-title {
  font-size: 16px;
}

.ctrl-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.stat-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 15px;
  color: var(--text-2);
}

.stat-line b {
  color: var(--text);
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-weight: 500;
}

.modlist {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
}

.modlist li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg);
  font-size: 15px;
}

.modlist li.is-hidden span {
  text-decoration: line-through;
  color: var(--text-3);
}

.modlist li .flag {
  color: var(--alert);
  font-size: 12px;
  margin-left: 6px;
}

.qlist li {
  grid-template-columns: 1fr;
}

.qlist .ctrl-row {
  margin-top: 4px;
}

.remote__nav {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 10px;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  border-top: 1px solid var(--stroke);
}

.remote__nav .btn {
  min-height: 72px;
  font-size: 20px;
}

.remote__extra {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.remote__extra select {
  flex: 1 1 100%;
  min-width: 0;
  max-width: 100%;
}

.modlist li > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* ========== administration ========== */
.admin {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.admin__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  margin-bottom: 18px;
}

.admin__head img {
  height: 34px;
  width: auto;
}

.admin__head h1 {
  margin: 0;
  font-size: 26px;
}

.admin__head .spacer {
  flex: 1;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin: 10px 0 22px;
}

.kpi {
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: var(--surface);
  padding: 14px 16px;
}

.kpi b {
  display: block;
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 30px;
  font-weight: 500;
}

.kpi span {
  font-size: 14px;
  color: var(--text-2);
}

.atabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.atabs .tab {
  padding: 10px 16px;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--stroke);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--stroke) 60%, transparent);
  vertical-align: top;
}

th {
  background: var(--surface);
  font-weight: 650;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.toolbar .spacer {
  flex: 1;
}

.result-block {
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: var(--surface);
  padding: 16px;
  margin-bottom: 12px;
}

.result-block h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.rbar {
  display: grid;
  grid-template-columns: 1fr 160px 70px;
  gap: 10px;
  align-items: center;
  font-size: 14px;
  padding: 4px 0;
}

.rbar .track {
  height: 8px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--text-3) 25%, transparent);
  overflow: hidden;
}

.rbar .track i {
  display: block;
  height: 100%;
  background: var(--cyan);
}

.rbar.is-correct .track i {
  background: var(--ok);
}

.pairqr {
  width: 240px;
  height: 240px;
  background: #fff;
  border-radius: 16px;
  padding: 12px;
}

.pairqr svg {
  width: 100%;
  height: 100%;
}

.section {
  margin-bottom: 28px;
}

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
}

.switch input {
  width: 20px;
  height: 20px;
  accent-color: var(--cyan);
}

@media (min-width: 900px) {
  .grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
}

/* Charte BAYSON pour les vues mobiles */
body.app {
  background: var(--bg);
}

.topbar {
  border-bottom: 1px solid var(--stroke);
}

.topbar__title b {
  color: var(--navy);
  font-weight: 800;
}

.tab[aria-selected='true'] {
  border-color: var(--navy);
  color: var(--navy);
  background: color-mix(in srgb, #06bbe6 10%, var(--surface));
}

.chip {
  background: color-mix(in srgb, #06bbe6 16%, transparent);
  color: var(--navy);
}

.chip::before {
  background: #06bbe6;
}

.app h1,
.app h2 {
  color: var(--phantom);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.box,
.kpi,
.result-block,
.opt,
.field input,
.field textarea,
.field select {
  border-color: var(--smoke);
}

.kpi b {
  font-family: var(--font);
  font-weight: 800;
  color: var(--navy);
}

.opt .res i,
.rbar .track i {
  background: var(--gradient);
}

.remote__timer b {
  font-family: var(--font);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.remote__pos,
.stat-line b {
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
}
