/*
 * Appearance (same file in every TraceVerify front): theme tokens, flag stripe, text size, settings panel.
 * Each application maps the tokens onto its own elements (see the end of its main stylesheet).
 * Status colours (authentic / caution / danger) are never taken from the theme.
 */
:root {
  --tv-accent: #2563eb;
  --tv-accent-hover: #1d4ed8;
  --tv-accent-soft: #e8eefc;
  --tv-accent-ink: #1e40af; /* accent as text on a light background */
  --tv-page: #f4f6f9;
  --tv-page-image: none;
  --tv-stripe: none;
}

/* Burkina Faso: red over green, yellow star. Light page with a faint red-to-green wash. */
html[data-tv-theme='bf'] {
  --tv-accent: #007a3d;
  --tv-accent-hover: #00632f;
  --tv-accent-soft: #e5f4ec;
  --tv-accent-ink: #006633;
  --tv-page: #fbfaf5;
  --tv-page-image: linear-gradient(180deg, rgba(239, 43, 45, 0.07) 0, rgba(252, 209, 22, 0.05) 160px, rgba(0, 158, 73, 0.05) 420px, rgba(0, 158, 73, 0) 700px);
  --tv-stripe: linear-gradient(180deg, #ef2b2d 0 50%, #009e49 50% 100%);
}
/* Côte d'Ivoire: orange, white, green. */
html[data-tv-theme='ci'] {
  --tv-accent: #c25e00;
  --tv-accent-hover: #a14e00;
  --tv-accent-soft: #fff1e3;
  --tv-accent-ink: #9a4a00;
  --tv-page: #fdfbf7;
  --tv-page-image: linear-gradient(180deg, rgba(247, 127, 0, 0.07) 0, rgba(0, 158, 96, 0.04) 420px, rgba(0, 158, 96, 0) 700px);
  --tv-stripe: linear-gradient(90deg, #f77f00 0 33.3%, #ffffff 33.3% 66.6%, #009e60 66.6% 100%);
}
/* Mali: green, gold, red. */
html[data-tv-theme='ml'] {
  --tv-accent: #0f7a2c;
  --tv-accent-hover: #0b6123;
  --tv-accent-soft: #e6f5ea;
  --tv-accent-ink: #0b6123;
  --tv-page: #fcfbf4;
  --tv-page-image: linear-gradient(180deg, rgba(20, 181, 58, 0.06) 0, rgba(252, 209, 22, 0.06) 220px, rgba(206, 17, 38, 0) 700px);
  --tv-stripe: linear-gradient(90deg, #14b53a 0 33.3%, #fcd116 33.3% 66.6%, #ce1126 66.6% 100%);
}
/* Sénégal: green, yellow (green star), red. */
html[data-tv-theme='sn'] {
  --tv-accent: #00703a;
  --tv-accent-hover: #005a2e;
  --tv-accent-soft: #e4f3ea;
  --tv-accent-ink: #005a2e;
  --tv-page: #fcfbf3;
  --tv-page-image: linear-gradient(180deg, rgba(0, 133, 63, 0.06) 0, rgba(253, 239, 66, 0.07) 220px, rgba(227, 27, 35, 0) 700px);
  --tv-stripe: linear-gradient(90deg, #00853f 0 33.3%, #fdef42 33.3% 66.6%, #e31b23 66.6% 100%);
}
/* France: blue, white, red. */
html[data-tv-theme='fr'] {
  --tv-accent: #0055a4;
  --tv-accent-hover: #004487;
  --tv-accent-soft: #e6eef8;
  --tv-accent-ink: #00468a;
  --tv-page: #f8f9fc;
  --tv-page-image: linear-gradient(180deg, rgba(0, 85, 164, 0.06) 0, rgba(239, 65, 53, 0.03) 420px, rgba(239, 65, 53, 0) 700px);
  --tv-stripe: linear-gradient(90deg, #0055a4 0 33.3%, #ffffff 33.3% 66.6%, #ef4135 66.6% 100%);
}

/* Flag stripe along the top of the window. */
html:not([data-tv-theme='classic']) body::before {
  content: '';
  position: fixed;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--tv-stripe);
  z-index: 1000;
  pointer-events: none;
}

/* Theme-able elements (classes set by each application on its own buttons, tabs, logos). */
.tv-primary {
  background-color: var(--tv-accent) !important;
  color: #fff !important;
}
.tv-primary:hover {
  background-color: var(--tv-accent-hover) !important;
}
.tv-soft {
  background-color: var(--tv-accent-soft) !important;
  color: var(--tv-accent-ink) !important;
}
.tv-ink {
  color: var(--tv-accent-ink) !important;
}

@media print {
  body::before {
    display: none !important;
  }
}

/* ---------------------------------------------------------------------------
 * Settings panel
 * ------------------------------------------------------------------------- */
.tva {
  position: relative;
  display: inline-block;
}
.tva-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
}
.tva-swatch {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 14px;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
  font-size: 9px;
  line-height: 1;
  flex: none;
}
.tva-pop {
  position: absolute;
  top: calc(100% + 8px);
  z-index: 1001;
  width: min(330px, calc(100vw - 24px));
  padding: 14px;
  border: 1px solid #e2e5eb;
  border-radius: 14px;
  background: #fff;
  color: #18202e;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  font-size: 13px;
  text-align: left;
}
.tva-right {
  right: 0;
}
.tva-left {
  left: 0;
}
.tva-title {
  margin: 10px 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #6b7385;
}
.tva-title:first-child {
  margin-top: 0;
}
.tva-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.tva-grid .tva-opt:first-child {
  grid-column: 1 / -1;
}
.tva-row {
  display: flex;
  gap: 6px;
}
.tva-row .tva-opt {
  flex: 1;
  justify-content: center;
}
.tva-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid #e2e5eb;
  border-radius: 9px;
  background: #fff;
  color: #18202e;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.tva-opt b {
  display: block;
  font-weight: 600;
}
.tva-opt small {
  display: block;
  color: #6b7385;
  font-size: 11px;
}
.tva-opt:hover {
  border-color: #b8c2d6;
}
.tva-opt.tva-on {
  border-color: var(--tv-accent);
  box-shadow: 0 0 0 2px var(--tv-accent-soft);
  background: var(--tv-accent-soft);
}
.tva-note {
  margin: 10px 0 0;
  color: #6b7385;
  font-size: 11px;
}

/* Phones: the panel becomes a sheet under the header, whatever the position of its button. */
@media (max-width: 640px) {
  .tva-pop {
    position: fixed;
    top: 64px;
    left: 12px;
    right: 12px;
    width: auto;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
  }
}
