/* Bexome Study Center — shared surface.
 *
 * The palette is lifted from the data-quality console rather than invented, so a manager
 * moving from a participant card into the detailed report does not feel handed off to a
 * different product. --accent is the KI-COMPASS teal.
 *
 * Loaded after Bootstrap, and deliberately narrow: it restyles the surfaces the portal
 * actually uses instead of trying to reskin a framework.
 */

:root {
  /* Sampled from the Bexome mark rather than approximated: --sc-accent is the teal of
   * the disc, and ok/warn/poor are the ring's own green, amber and red darkened to the
   * point where they carry text at 14px. The undarkened ring colours (#9bbb59, #c0504d)
   * are correct for fills and fail contrast as type. */
  --sc-ground: #f2f4f4;
  --sc-panel: #ffffff;
  --sc-ink: #171c1c;
  --sc-muted: #5a6166;
  --sc-line: #d4dada;
  --sc-rule: #e4e9e9;
  --sc-accent: #009999;
  --sc-accent-deep: #00706f;
  --sc-accent-wash: #e0f0f0;
  --sc-ok: #5f7d33;
  --sc-warn: #a8762c;
  --sc-poor: #a8423e;

  /* The mark's ring, unmodified, for fills and rules. */
  --sc-brand-teal: #009999;
  --sc-brand-green: #9bbb59;
  --sc-brand-blue: #4f81bd;
  --sc-brand-red: #c0504d;
}

body {
  background: var(--sc-ground);
  color: var(--sc-ink);
}

/* ---- panels ------------------------------------------------------------------ */

.card,
.sc-card {
  background: var(--sc-panel);
  border: 1px solid var(--sc-line);
  border-radius: 10px;
  box-shadow: none;
  padding: 18px 20px;
}

.card-body {
  padding: 0;
}

.sc-card-title,
.card h5 {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sc-muted);
  font-weight: 600;
  margin-bottom: 10px;
}

.sc-body {
  font-size: 14px;
  line-height: 1.55;
}

.sc-muted {
  color: var(--sc-muted);
}

/* Large figures read as data, not headings. */
.card .h3,
.sc-figure {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  font-weight: 600;
  color: var(--sc-accent-deep);
}

/* ---- controls ---------------------------------------------------------------- */

.fancy-button,
.btn-primary,
.sc-button {
  background: var(--sc-accent);
  border: 1px solid var(--sc-accent);
  color: #fff;
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.12s ease;
}

.fancy-button:hover,
.btn-primary:hover,
.sc-button:hover {
  background: var(--sc-accent-deep);
  border-color: var(--sc-accent-deep);
  color: #fff;
}

/* Destructive actions are outlined, never filled: they should take a moment's thought. */
.fancy-button-red,
.btn-outline-danger {
  background: transparent;
  border: 1px solid var(--sc-poor);
  color: var(--sc-poor);
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 14px;
}

.fancy-button-red:hover,
.btn-outline-danger:hover {
  background: var(--sc-poor);
  color: #fff;
}

.sc-input,
.form-control {
  border: 1px solid var(--sc-line);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  max-width: 140px;
}

.sc-input-wide {
  max-width: 260px;
}

.sc-input:focus,
.form-control:focus {
  outline: none;
  border-color: var(--sc-accent);
  box-shadow: 0 0 0 3px var(--sc-accent-wash);
}

.sc-inline-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---- status ------------------------------------------------------------------ */

.badge-success { background: var(--sc-ok); }
.badge-warning { background: var(--sc-warn); color: #fff; }
.badge-danger  { background: var(--sc-poor); }

.text-success { color: var(--sc-ok) !important; }
.text-danger  { color: var(--sc-poor) !important; }
.text-muted   { color: var(--sc-muted) !important; }

.sc-note,
.alert {
  border: 1px solid var(--sc-line);
  border-left: 3px solid var(--sc-accent);
  background: var(--sc-accent-wash);
  border-radius: 0 8px 8px 0;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--sc-ink);
}

.sc-note-warn,
.alert-warning {
  border-left-color: var(--sc-warn);
  background: #fbf4e8;
}

.alert-success {
  border-left-color: var(--sc-ok);
  background: var(--sc-accent-wash);
}

/* ---- tables ------------------------------------------------------------------ */

.table {
  font-size: 13.5px;
}

.table thead th {
  border-bottom: 1px solid var(--sc-line);
  color: var(--sc-muted);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}

.table td {
  border-top: 1px solid var(--sc-rule);
  vertical-align: middle;
}

/* ---- header ------------------------------------------------------------------ */

#top-header {
  background: var(--sc-panel);
  /* --study-accent is set per study by the logo-colour extractor; brand teal otherwise. */
  border-bottom: 3px solid var(--study-accent, var(--sc-accent));
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.sc-brand {
  height: 30px;
  width: auto;
  display: block;
}

#header-text h3,
#header-text h3 strong {
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--sc-muted);
  font-weight: 400;
  margin: 0;
}

#header-text h3 strong {
  color: var(--sc-ink);
  font-weight: 600;
}

/* A study's own logo sits after the platform lockup, divided from it. */
.study-logo {
  border-left: 1px solid var(--sc-line);
  padding-left: 12px;
}

/* ---- reconciling the older Tailwind buttons ---------------------------------- */
/* These were defined per-page with a blue gradient. Loaded after them, this brings
 * them into the brand palette without touching each template's @apply block. */

.btn-glow {
  background: var(--sc-accent) !important;
  background-image: none !important;
  border: 1px solid var(--sc-accent);
  color: #fff;
  border-radius: 8px;
  font-weight: 500;
  box-shadow: none !important;
}

.btn-glow:hover {
  background: var(--sc-accent-deep) !important;
  transform: none !important;
}

.btn-secondary,
.btn-back {
  background: var(--sc-panel);
  border: 1px solid var(--sc-line);
  color: var(--sc-ink);
  border-radius: 8px;
  font-weight: 500;
}

.btn-secondary:hover,
.btn-back:hover {
  background: var(--sc-accent-wash);
  border-color: var(--sc-accent);
  color: var(--sc-accent-deep);
}

/* ---- recency ramp ------------------------------------------------------------ */
/* Active-24h / 3d / 7d / inactive is one ordered scale, so it is coloured as a ramp.
 * The old green/purple/cyan/red read as four unrelated categories and made a manager
 * decode a legend to see that these cards are in order. Only the last step changes hue,
 * because "inactive" is the one that wants attention. */

.sc-stat {
  border-left: 3px solid var(--sc-line);
  cursor: pointer;
}

.sc-stat .h3,
.sc-stat h3 {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--sc-ink);
}

.sc-stat-label {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--sc-muted);
  margin-bottom: 6px;
}

.sc-step-1 { border-left-color: var(--sc-accent-deep); }
.sc-step-2 { border-left-color: var(--sc-accent); }
.sc-step-3 { border-left-color: #80cccc; }
.sc-step-4 { border-left-color: var(--sc-poor); }

.sc-step-4 .sc-stat-label { color: var(--sc-poor); }

/* The total sits above the ramp rather than inside it: a heavier rule, no hue. */
.sc-total { border-left-color: var(--sc-ink); }

/* ---- header controls --------------------------------------------------------- */
/* These were .btn-outline-light, drawn for the old dark header. On the light surface the
 * lockup needs, white-on-white made them invisible. */

#top-header .btn-outline-light {
  border-color: var(--sc-line);
  color: var(--sc-ink);
  background: var(--sc-panel);
}

#top-header .btn-outline-light:hover {
  background: var(--sc-accent-wash);
  border-color: var(--sc-accent);
  color: var(--sc-accent-deep);
}

#top-header #session-timer {
  color: var(--sc-ink);
  font-variant-numeric: tabular-nums;
}

#top-header .text-gray-400 {
  color: var(--sc-muted) !important;
}

#top-header .border-secondary {
  border-color: var(--sc-line) !important;
}

/* Unread-message count on a participant row.

   Positioned over the button's corner rather than sitting inside its label. Inline, it
   widened only the rows that had something waiting, so every button to the right of it
   shifted and the column of "More details" stopped lining up -- the badge was drawing
   attention by breaking the layout rather than by being a badge.

   A number, not a dot: "3 waiting" and "1 waiting" are different amounts of work, and a
   dot makes them look the same. Carries a border as well as a fill so it survives
   greyscale printing and does not rely on colour alone. */
.sc-unread {
    position: absolute;
    top: -8px;
    /* Overhangs less than the 10px gap between buttons, so it never looks attached to
       the control on its right. */
    right: -5px;
    z-index: 2;
    display: inline-block;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    box-sizing: border-box;
    border-radius: 10px;
    border: 1px solid #fff;
    background: #b3261e;
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
}
