/*
 * Insight's own stylesheet — the SECUTIX Design System, copied rather than
 * imported so the app still looks like SECUTIX after it is cut out of this
 * repository: burgundy #B40050 to orange #FF5500, the 135° gradient for hero
 * surfaces only, neutral greys (no full black anywhere), Montserrat, 12 px
 * cards, 8 px buttons, 999 px pills. Cards never carry a left-edge accent;
 * their state shows as a coloured top edge.
 *
 * --accent is overwritten at runtime from the institution's branding, which is
 * the one thing the subdomain decides.
 */
@font-face {
  font-family: "Montserrat";
  src: url("/assets/fonts/Montserrat-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --burgundy:       #b40050;
  --burgundy-dark:  #8c0046;
  --burgundy-mid:   #c8508c;
  --orange:         #ff5500;
  --orange-dark:    #c82d00;
  --orange-mid:     #ff8255;
  --grey-dark:      #3c4b55;
  --grey:           #697378;
  --grey-light:     #f0f0f0;
  --fg-1:           #3c4b55;
  --fg-2:           #697378;
  --fg-3:           #9aa3a8;
  --bg-1:           #ffffff;
  --bg-2:           #f0f0f0;
  --bg-3:           #e5e7e9;
  --success:        #1f8a5b;
  --success-bg:     #e6f4ee;
  --wait:           #c82d00;
  --wait-bg:        #fff1ea;
  --info:           #c8508c;
  --danger:         #c82d00;
  --danger-bg:      #fdeee8;
  --accent:         #b40050;
  --accent-hover:   #8c0046;
  --gradient:       linear-gradient(135deg, #b40050 0%, #ff5500 100%);
  --hairline:       rgba(60, 75, 85, 0.12);
  --border-strong:  rgba(60, 75, 85, 0.24);
  --shadow-sm:      0 1px 2px rgba(60, 75, 85, 0.06), 0 1px 3px rgba(60, 75, 85, 0.04);
  --shadow-md:      0 8px 24px rgba(60, 75, 85, 0.10);
  --shadow-lg:      0 24px 48px rgba(140, 0, 70, 0.18);
  --radius-sm:      8px;
  --radius-md:      12px;
  --radius-lg:      24px;
  --radius-pill:    999px;
  --ease:           cubic-bezier(0.4, 0, 0.2, 1);
  --font:           "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono:           ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --container:      1280px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg-2);
  color: var(--fg-1);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }

:focus-visible { outline: 2px solid var(--burgundy); outline-offset: 2px; }
.band :focus-visible, .viewer-bar :focus-visible, .checkout-head :focus-visible { outline-color: #ffffff; }

/* ── The gradient band: top bar, then sign-in, a message, or the hero ───── */

.band {
  background: var(--gradient);
  color: #ffffff;
  padding: 0 24px;
}
.band > * { max-width: var(--container); margin-left: auto; margin-right: auto; }

header.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding: 8px 0;
}
.topbar .brand { display: flex; align-items: center; gap: 14px; }
.topbar .stx-logo { height: 28px; width: auto; display: block; }
.topbar .stx-mark { height: 28px; width: auto; display: none; }
.topbar .product { font-weight: 600; font-size: 20px; letter-spacing: 0.02em; }
.topbar .spacer { flex: 1; }
.topbar .who { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; min-width: 0; }
.topbar .org { font-weight: 700; }
.topbar .whoami { opacity: 0.9; }
.topbar .org-logo { height: 28px; width: auto; border-radius: 6px; background: #ffffff; padding: 3px; }

.lang {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.16);
}
.lang button {
  border: 0;
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  min-height: 32px;
  font: 600 12px/1 var(--font);
  letter-spacing: 0.04em;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  transition: background 200ms var(--ease), color 200ms var(--ease);
}
.lang button:hover { background: rgba(255, 255, 255, 0.14); }
.lang button[aria-pressed="true"] { background: #ffffff; color: var(--burgundy); font-weight: 700; }

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.9;
}
.display {
  margin: 12px 0 0;
  font-weight: 900;
  font-size: clamp(36px, 5.2vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  max-width: 14ch;
}
.display.sm { font-size: clamp(28px, 4vw, 44px); max-width: 22ch; }
.hero-lede {
  margin: 20px 0 0;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.65;
  max-width: 640px;
  opacity: 0.94;
}

.hero { padding: 40px 0 128px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.band-message { padding: 64px 0 96px; }

.sign-in {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 48px;
  align-items: center;
  padding: 64px 0 112px;
}
.sign-in .display { font-size: clamp(36px, 5.6vw, 72px); }
.sign-in-card {
  justify-self: end;
  width: 100%;
  max-width: 460px;
  background: #ffffff;
  color: var(--fg-1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.sign-in-card h2 { margin: 0; font-size: 24px; font-weight: 800; }
.sign-in-card p { margin: 0; color: var(--fg-2); line-height: 1.6; font-size: 15px; }
.sign-in-card .fine { font-size: 13px; border-top: 1px solid var(--hairline); padding-top: 16px; }

/* ── Buttons (8 px, lift on hover, never opacity-only) ───────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #ffffff;
  font: 700 14px/1.2 var(--font);
  cursor: pointer;
  text-decoration: none;
  transition: background 200ms var(--ease), transform 200ms var(--ease), box-shadow 200ms var(--ease), color 200ms var(--ease);
}
.btn:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.lg { min-height: 48px; padding: 12px 24px; font-size: 16px; }
.btn.secondary { background: #ffffff; color: var(--fg-1); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--bg-2); box-shadow: var(--shadow-md); }
.btn.ghost { background: transparent; color: var(--burgundy); border-color: var(--burgundy); }
.btn.ghost:hover { background: var(--burgundy); color: #ffffff; }
.btn.gradient { background: var(--gradient); }
.btn.gradient:hover { background: var(--gradient); filter: saturate(1.1); }
.btn.on-brand { background: #ffffff; color: var(--burgundy); }
.btn.on-brand:hover { background: #ffffff; color: var(--burgundy-dark); }
.btn.on-brand-outline { background: transparent; color: #ffffff; border-color: rgba(255, 255, 255, 0.8); }
.btn.on-brand-outline:hover { background: rgba(255, 255, 255, 0.14); box-shadow: none; }

/* ── The body: stat tiles over the band's edge, then the lists ───────────── */

main { max-width: var(--container); margin: 0 auto; padding: 0 24px 96px; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: -72px;
  position: relative;
}
.stat {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--hairline);
  border-top: 4px solid var(--burgundy);
  box-shadow: var(--shadow-md);
  padding: 20px 24px 22px;
}
.stat.tone-ok { border-top-color: var(--success); }
.stat.tone-wait { border-top-color: var(--orange-mid); }
.stat.tone-info { border-top-color: var(--info); }
.stat-label { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-2); }
.stat-value { margin: 6px 0 0; font-size: 40px; font-weight: 900; line-height: 1.1; }
.stat-note { margin: 4px 0 0; font-size: 14px; color: var(--fg-2); }

.error {
  margin: 24px 0 0;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--danger-bg);
  border: 1px solid rgba(200, 45, 0, 0.24);
  color: var(--danger);
  font-weight: 600;
}
.notice {
  margin: 0 0 20px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--success-bg);
  border: 1px solid rgba(31, 138, 91, 0.24);
  color: var(--fg-1);
  font-weight: 500;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 40px;
  scroll-margin-top: 16px;
}
.tabs {
  display: inline-flex;
  padding: 4px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--hairline);
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 18px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--fg-1);
  font: 600 14px/1 var(--font);
  cursor: pointer;
  transition: background 200ms var(--ease), color 200ms var(--ease);
}
.tab:hover { background: var(--bg-2); }
.tab[aria-selected="true"] { background: var(--burgundy); color: #ffffff; font-weight: 700; }
.tab .count { font-weight: 600; opacity: 0.75; }
.tab .count:empty { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--fg-1);
  font: 600 14px/1 var(--font);
  cursor: pointer;
  transition: background 200ms var(--ease), color 200ms var(--ease), border-color 200ms var(--ease);
}
.filter-chip::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--burgundy); }
.filter-chip:first-child::before { background: var(--grey); }
.filter-chip:hover { border-color: var(--burgundy); }
.filter-chip.is-active { background: var(--grey-dark); border-color: var(--grey-dark); color: #ffffff; }
.filter-chip.is-active::before { background: #ffffff; }
.filter-count { opacity: 0.7; }

.section-title { margin: 32px 0 4px; font-size: 24px; font-weight: 800; }
p.lede { margin: 0 0 24px; color: var(--fg-2); }
.filter-empty { margin: 8px 0 0; color: var(--fg-2); font-style: italic; }

/* ── Cards ───────────────────────────────────────────────────────────────── */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 24px;
}
.report-card {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--hairline);
  border-top: 4px solid var(--burgundy);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease);
}
.report-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.report-card.tone-ok { border-top-color: var(--success); }
.report-card.tone-wait { border-top-color: var(--orange-mid); }
.report-card.tone-off { border-top-color: var(--fg-3); }
.report-card.tone-offer { border-top: 1px solid var(--hairline); }
.report-card.is-muted { opacity: 0.72; }
.report-card.is-muted:hover { transform: none; box-shadow: var(--shadow-sm); }

.card-band {
  min-height: 136px;
  padding: 20px 24px;
  background: var(--gradient);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}
.card-figure { margin: 0; font-size: 30px; font-weight: 900; line-height: 1.1; }

.card-body { display: flex; flex-direction: column; gap: 12px; padding: 24px; flex: 1; }
.card-top { display: flex; align-items: flex-start; gap: 8px; }
.card-top .card-chips { flex: 1; }
.card-top:has(.card-chips:empty):not(:has(.pill)) { display: none; }
.card-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  background: var(--bg-2);
  color: var(--fg-1);
  font-size: 12px;
  font-weight: 600;
}
.chip.on-band { background: #ffffff; color: var(--fg-1); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--success-bg); color: var(--success); }
.pill.wait { background: var(--wait-bg); color: var(--wait); }
.pill.off { background: var(--bg-2); color: var(--fg-2); }

.card-title { margin: 0; font-size: 20px; font-weight: 800; line-height: 1.25; }
.card-summary {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--fg-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta { margin: 0; font-family: var(--mono); font-size: 12px; color: var(--fg-2); }
.card-highlight { margin: 0; font-weight: 700; }
.card-note { margin: 0; font-size: 14px; line-height: 1.55; color: var(--fg-2); font-style: italic; }
.card-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 4px; }
.card-foot:empty { display: none; }

.empty {
  margin-top: 8px;
  padding: 48px 32px;
  text-align: center;
  background: #ffffff;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
}
.empty h3 { margin: 0 0 8px; font-size: 20px; font-weight: 800; }
.empty p { margin: 0 0 20px; color: var(--fg-2); }
.empty p:last-child { margin-bottom: 0; }

/* ── Overlays: the viewer and the checkout ───────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(60, 75, 85, 0.40);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.viewer { padding: 0; align-items: stretch; }
.viewer-panel { display: flex; flex-direction: column; width: 100%; height: 100%; background: var(--bg-2); }
.viewer-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: var(--gradient);
  color: #ffffff;
}
.viewer-heading { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.viewer-heading strong { font-size: 18px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-meta { font-size: 13px; opacity: 0.9; }
.viewer-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.viewer-lang { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.viewer-lang select {
  font: 600 14px var(--font);
  color: var(--fg-1);
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  min-height: 40px;
}
/* "Not yet available in French — shown in English": one quiet line, never a modal. */
.viewer-note {
  margin: 12px auto 0;
  width: min(1200px, calc(100% - 48px));
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--hairline);
  color: var(--fg-1);
  font-size: 14px;
}
.paper {
  flex: 1;
  margin: 24px auto;
  width: min(1200px, calc(100% - 48px));
  background: #ffffff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.paper iframe { display: block; width: 100%; height: 100%; border: 0; background: #ffffff; }

.checkout-panel {
  width: 100%;
  max-width: 560px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.checkout-head { background: var(--gradient); color: #ffffff; padding: 28px 32px; }
.checkout-head h2 { margin: 8px 0 0; font-size: 26px; font-weight: 900; line-height: 1.15; }
.checkout-meta { margin: 6px 0 0; font-size: 14px; opacity: 0.92; }
.checkout-meta:empty { display: none; }
.checkout-body { padding: 28px 32px 32px; display: flex; flex-direction: column; gap: 20px; }
.checkout-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--hairline);
  font-weight: 600;
}
.checkout-price { font-size: 28px; font-weight: 900; text-align: right; }
.test-notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--wait-bg);
  border: 1px solid rgba(255, 85, 0, 0.28);
  color: var(--fg-1);
  font-size: 14px;
  line-height: 1.55;
}
.test-notice svg { flex-shrink: 0; margin-top: 1px; color: var(--orange-dark); }
.test-notice strong { display: block; }
.checkout-body .error { margin: 0; }
.checkout-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }

/* ── Narrow screens ──────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .sign-in { grid-template-columns: minmax(0, 1fr); gap: 32px; padding: 32px 0 64px; }
  .sign-in-card { justify-self: stretch; max-width: none; padding: 28px; }
}

@media (max-width: 600px) {
  .band { padding: 0 16px; }
  main { padding: 0 16px 64px; }
  .topbar .stx-logo { display: none; }
  .topbar .stx-mark { display: block; }
  .topbar .product { font-size: 17px; }
  .topbar .who { order: 5; flex-basis: 100%; font-size: 13px; }
  .topbar .whoami { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .hero { padding: 24px 0 96px; }
  .hero-lede { font-size: 16px; }
  .hero-actions .btn { flex: 1 1 auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: -56px; }
  .stat { padding: 14px 16px; }
  .stat-value { font-size: 30px; }
  .stat-note { display: none; }
  .toolbar { margin-top: 24px; }
  .tabs { display: flex; width: 100%; }
  .tab { flex: 1; justify-content: center; }
  .cards { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .card-body { padding: 18px; }
  .checkout-head, .checkout-body { padding-left: 20px; padding-right: 20px; }
  .checkout-actions .btn { flex: 1 1 auto; }
  .viewer-bar { padding: 12px 16px; }
  .paper { margin: 12px auto; width: calc(100% - 24px); }
}
