/* ==========================================================================
   iCREDIT -- credit.irad.app
   Sits in the iRad family: same deep navy ground and purple-blue gradient as
   iRad Report and iRad Trainer. iCREDIT's own accent is emerald (quality and
   improvement); each module then carries a colour of its own so a screenshot
   is identifiable at a glance.
   ========================================================================== */

:root {
  --bg-deep:        #00111f;
  --bg-raise:       #0a1d30;
  --bg-panel:       rgba(255, 255, 255, 0.035);
  --bg-panel-hover: rgba(255, 255, 255, 0.06);
  --bg-navbar:      rgba(8, 21, 36, 0.94);
  --border-soft:    rgba(255, 255, 255, 0.09);
  --border-strong:  rgba(255, 255, 255, 0.16);

  --accent-1:       #667eea;   /* shared iRad purple-blue */
  --accent-2:       #764ba2;
  --accent-credit:  #10b981;   /* iCREDIT: quality / improvement */
  --accent-cyan:    #22d3ee;   /* iRad circuit cyan */

  --mod-training:   #22d3ee;
  --mod-audit:      #10b981;
  --mod-dose:       #f59e0b;

  --ok:             #22c55e;
  --warn:           #f59e0b;
  --risk:           #ef4444;

  --text:           rgba(255, 255, 255, 0.92);
  --text-muted:     rgba(255, 255, 255, 0.60);
  --text-faint:     rgba(255, 255, 255, 0.40);

  --radius:         12px;
  --radius-sm:      8px;
}

/* --- Base ---------------------------------------------------------------- */
body {
  background:
    radial-gradient(900px 480px at 82% -12%, rgba(16, 185, 129, 0.10), transparent 62%),
    radial-gradient(760px 420px at 6% 0%, rgba(102, 126, 234, 0.12), transparent 60%),
    var(--bg-deep);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
}

main { flex: 1 0 auto; }

a { color: var(--accent-cyan); text-decoration: none; }
a:hover { color: #7dd3fc; }

h1, h2, h3, h4, h5 { font-weight: 600; letter-spacing: -0.01em; }

.text-muted-soft { color: var(--text-muted) !important; }
.text-faint { color: var(--text-faint) !important; }

.page-title {
  font-size: 1.6rem;
  margin-bottom: 0.15rem;
}
.page-sub {
  color: var(--text-muted);
  font-size: 0.93rem;
  margin-bottom: 1.5rem;
}

/* --- Navbar -------------------------------------------------------------- */
.navbar-credit {
  background: var(--bg-navbar);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
  box-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
}
.navbar-credit .navbar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  font-weight: 650;
  font-size: 1.28rem;
  letter-spacing: -0.02em;
}
/* The mark is a raster of the official iRad logo, so give it a floor: below
   about 34px the circuit detail turns to mush. */
.brand-mark { display: block; width: 100%; height: auto; }
.navbar-credit .navbar-brand .brand-mark { width: 42px; height: 42px; flex: none; }
.navbar-credit .brand-stack { display: flex; flex-direction: column; line-height: 1.04; }
.navbar-credit .brand-sub {
  font-size: 0.625rem;
  color: var(--accent-credit);
  letter-spacing: 1.4px;
  text-transform: uppercase;
  font-weight: 600;
}
.navbar-credit .nav-link {
  color: var(--text-muted) !important;
  font-size: 0.94rem;
  padding: 0.5rem 0.85rem !important;
  border-radius: var(--radius-sm);
  transition: color .15s ease, background .15s ease;
}
.navbar-credit .nav-link:hover { color: #fff !important; background: var(--bg-panel-hover); }
.navbar-credit .nav-link.active { color: #fff !important; background: rgba(16, 185, 129, 0.16); }
.navbar-credit .dropdown-menu {
  background: #0d2036;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}
.navbar-credit .dropdown-item { color: var(--text); font-size: 0.93rem; }
.navbar-credit .dropdown-item:hover { background: rgba(102, 126, 234, 0.18); color: #fff; }
.navbar-credit .dropdown-item.active-module { background: rgba(255,255,255,0.07); color: #fff; }
.navbar-credit .dropdown-divider { border-color: var(--border-soft); }
.navbar-credit .navbar-toggler { border-color: var(--border-strong); padding: 4px 8px; }
.navbar-credit .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255,255,255,0.85%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.avatar-chip {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.74rem; font-weight: 700; color: #fff; letter-spacing: 0.4px;
}

/* --- Panels / cards ------------------------------------------------------ */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
}
.panel-tight { padding: 0.9rem 1rem; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 0.9rem;
}
.panel-head h2, .panel-head h3 {
  font-size: 1.02rem; margin: 0; font-weight: 600;
}
.panel-head .bi { color: var(--accent-credit); }

/* --- Stat tiles ---------------------------------------------------------- */
.stat-row { display: grid; gap: 0.85rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 0.95rem 1.05rem;
}
.stat .stat-label {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.9px;
  color: var(--text-faint); font-weight: 600;
}
.stat .stat-value {
  font-size: 1.85rem; font-weight: 680; line-height: 1.15; margin-top: 0.15rem;
  font-variant-numeric: tabular-nums;
}
.stat .stat-note { font-size: 0.78rem; color: var(--text-muted); }
.stat.accent-ok .stat-value { color: var(--ok); }
.stat.accent-warn .stat-value { color: var(--warn); }
.stat.accent-risk .stat-value { color: var(--risk); }
.stat.accent-cyan .stat-value { color: var(--accent-cyan); }

/* --- Module icon (launcher cards, module pages) --------------------------- */
.mod-icon, .launch-icon {
  width: 44px; height: 44px; border-radius: 11px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.3rem; margin-bottom: 0.8rem;
  background: color-mix(in srgb, var(--mod, var(--accent-credit)) 16%, transparent);
  color: var(--mod, var(--accent-credit));
}

/* --- Module bar ----------------------------------------------------------
   Sits under the global navbar and carries everywhere you can go *inside*
   the module you are in. Items are already role-filtered server side.
   ------------------------------------------------------------------------ */
.modulebar {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.015));
  border-bottom: 1px solid var(--border-soft);
  box-shadow: inset 0 2px 0 0 var(--mod, var(--accent-credit));
}
.modulebar.is-training { --mod: var(--mod-training); }
.modulebar.is-audit    { --mod: var(--mod-audit); }
.modulebar.is-dose     { --mod: var(--mod-dose); }

.modulebar-inner {
  display: flex; align-items: center; gap: 0.7rem;
  min-height: 54px; padding: 0.45rem 0;
}
.modulebar-home {
  width: 32px; height: 32px; flex: none; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted); border: 1px solid var(--border-soft);
  transition: background .15s ease, color .15s ease;
}
.modulebar-home:hover { background: var(--bg-panel-hover); color: #fff; }
.modulebar-title {
  display: flex; align-items: center; gap: 0.5rem; flex: none;
  font-weight: 650; font-size: 0.94rem; color: var(--text);
  padding-right: 0.85rem; border-right: 1px solid var(--border-soft);
}
.modulebar-title .bi { color: var(--mod, var(--accent-credit)); font-size: 1.05rem; }
.modulebar-links {
  display: flex; align-items: center; gap: 0.12rem;
  overflow-x: auto; scrollbar-width: thin; padding-bottom: 1px;
}
.modulebar-links::-webkit-scrollbar { height: 4px; }
.modulebar-links::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }
.modulebar-link {
  display: inline-flex; align-items: center; gap: 0.42rem; white-space: nowrap;
  padding: 0.42rem 0.75rem; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 0.88rem; font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.modulebar-link .bi { font-size: 0.95rem; opacity: 0.85; }
.modulebar-link:hover { background: var(--bg-panel-hover); color: #fff; }
.modulebar-link.active {
  color: #fff;
  background: color-mix(in srgb, var(--mod, var(--accent-credit)) 20%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mod, var(--accent-credit)) 38%, transparent);
}

/* --- Launcher (the home page) -------------------------------------------- */
.launcher { max-width: 980px; margin: 0 auto; padding-bottom: 1.5rem; }
.launcher-head { text-align: center; margin-bottom: 2rem; }
.launcher-mark { width: 120px; margin: 0 auto 1rem; }
.launcher-head h1 { font-size: 2.05rem; letter-spacing: -0.03em; margin-bottom: 0.3rem; }
.launcher-head p { color: var(--text-muted); margin-bottom: 0; font-size: 0.97rem; }
.launcher-head.signed-in { text-align: left; margin-bottom: 1.6rem; }
.launcher-prompt { color: var(--text-faint) !important; font-size: 0.89rem; margin-top: 0.7rem !important; }
/* Fixed-width columns, centred: three cards fill the row, and a technologist
   with one card gets a card the same size rather than a full-width banner. */
.launcher-grid {
  display: grid; gap: 1rem; justify-content: center;
  grid-template-columns: repeat(auto-fit, minmax(250px, 296px));
}

.admin-card {
  display: flex; align-items: center; gap: 1rem;
  margin: 1rem auto 0; max-width: 928px;
  background: var(--bg-panel); border: 1px solid var(--border-soft);
  border-left: 3px solid var(--accent-1);
  border-radius: var(--radius); padding: 1.1rem 1.3rem; color: var(--text);
  transition: background .15s ease, border-color .15s ease;
}
.admin-card:hover { background: var(--bg-panel-hover); color: var(--text); border-color: var(--border-strong); }
.admin-card:hover .launch-go { opacity: 1; transform: translateX(0); }
.admin-card .mod-icon { --mod: var(--accent-1); margin-bottom: 0; }
.admin-card h2 { font-size: 1.02rem; margin-bottom: 0.15rem; }
.admin-card p { color: var(--text-muted); font-size: 0.86rem; margin: 0; }
.admin-card .launch-go { margin-left: auto; }
.launcher-note {
  text-align: center; color: var(--text-faint); font-size: 0.83rem;
  margin-top: 2.2rem; max-width: 560px; margin-left: auto; margin-right: auto;
}

.launch-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--bg-panel); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 1.45rem 1.35rem 1.15rem;
  color: var(--text); overflow: hidden; min-height: 208px;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.launch-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--mod, var(--accent-credit));
}
a.launch-card:hover {
  transform: translateY(-3px); border-color: var(--border-strong);
  background: var(--bg-panel-hover); color: var(--text);
}
a.launch-card:hover .launch-go { opacity: 1; transform: translateX(0); }
.launch-card.is-soon { opacity: 0.7; }
.launch-card h2 { font-size: 1.1rem; margin-bottom: 0.35rem; }
.launch-card p { color: var(--text-muted); font-size: 0.87rem; margin-bottom: 1rem; }
.launch-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.launch-go {
  color: var(--mod, var(--accent-credit)); font-size: 0.85rem; font-weight: 600;
  opacity: 0; transform: translateX(-4px); transition: opacity .16s ease, transform .16s ease;
}
.launch-badge {
  margin-top: 0.85rem; padding-top: 0.7rem; font-size: 0.8rem; color: var(--warn);
  display: flex; align-items: center; gap: 0.4rem;
  border-top: 1px solid var(--border-soft);
}
.launch-card.is-training { --mod: var(--mod-training); }
.launch-card.is-audit    { --mod: var(--mod-audit); }
.launch-card.is-dose     { --mod: var(--mod-dose); }

/* --- Mini link cards (inside module dashboards) --------------------------- */
.mini-card {
  display: block; padding: 0.85rem 1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft); border-left: 3px solid var(--mod, var(--accent-credit));
  color: var(--text); transition: background .15s ease;
}
.mini-card:hover { background: var(--bg-panel-hover); color: var(--text); }
.mini-card strong { display: block; font-size: 0.94rem; font-weight: 600; }
.mini-card span { display: block; font-size: 0.82rem; color: var(--text-muted); margin-top: 0.2rem; }
.mini-card.is-training { --mod: var(--mod-training); }
.mini-card.is-audit    { --mod: var(--mod-audit); }

/* --- Buttons ------------------------------------------------------------- */
.btn-credit {
  background: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 100%);
  color: #fff; border: none; font-weight: 550;
  padding: 0.55rem 1.15rem; border-radius: var(--radius-sm);
  transition: transform .14s ease, box-shadow .14s ease;
}
.btn-credit:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 8px 22px rgba(102, 126, 234, 0.35); }
.btn-quality {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #fff; border: none; font-weight: 550;
  padding: 0.55rem 1.15rem; border-radius: var(--radius-sm);
}
.btn-quality:hover { color: #fff; box-shadow: 0 8px 22px rgba(16, 185, 129, 0.32); }
.btn-ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 0.52rem 1.05rem; font-weight: 500;
}
.btn-ghost:hover { background: var(--bg-panel-hover); color: #fff; border-color: rgba(255,255,255,0.3); }

/* --- Forms --------------------------------------------------------------- */
.form-control, .form-select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-soft);
  color: var(--text);
  border-radius: var(--radius-sm);
}
.form-control:focus, .form-select:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-credit);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
  color: var(--text);
}
.form-control::placeholder { color: var(--text-faint); }
.form-select option { background: #0d2036; color: var(--text); }
.form-label { font-size: 0.83rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.3rem; }
.form-text { color: var(--text-faint); font-size: 0.78rem; }
.form-check-input { background-color: rgba(255,255,255,0.08); border-color: var(--border-strong); }
.form-check-input:checked { background-color: var(--accent-credit); border-color: var(--accent-credit); }
.input-group-text { background: rgba(255,255,255,0.05); border-color: var(--border-soft); color: var(--text-muted); }

/* --- Tables -------------------------------------------------------------- */
.table-credit {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--border-soft);
  --bs-table-hover-bg: rgba(255, 255, 255, 0.045);
  --bs-table-hover-color: var(--text);
  margin-bottom: 0;
}
.table-credit thead th {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-faint); font-weight: 650;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.table-credit td { vertical-align: middle; font-size: 0.9rem; }
.table-credit td .sub { font-size: 0.78rem; color: var(--text-faint); }

/* --- Progress ------------------------------------------------------------ */
.bar {
  height: 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--accent-credit); }
.bar.is-complete > span { background: var(--ok); }
.bar.is-on-track > span { background: var(--accent-cyan); }
.bar.is-behind   > span { background: var(--warn); }
.bar.is-at-risk  > span { background: var(--risk); }
/* Domain with nothing required at this stage: no claim either way. */
.bar.is-none > span { background: transparent; }

.ring {
  --p: 0;
  width: 86px; height: 86px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background:
    conic-gradient(var(--accent-credit) calc(var(--p) * 1%), rgba(255,255,255,0.09) 0);
  position: relative;
}
.ring::after {
  content: ""; position: absolute; inset: 8px; border-radius: 50%;
  background: var(--bg-deep);
}
.ring b { position: relative; z-index: 1; font-size: 1.15rem; font-variant-numeric: tabular-nums; }

/* --- Domain progress tiles ----------------------------------------------- */
.domain-grid { display: grid; gap: 0.8rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.domain-tile {
  background: var(--bg-panel); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 0.95rem 1.05rem;
}
.domain-tile .d-name { font-weight: 600; font-size: 0.96rem; }
.domain-tile .d-count { font-size: 0.78rem; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.domain-tile .gap-list { font-size: 0.78rem; color: var(--warn); margin-top: 0.45rem; }

/* --- Status badges ------------------------------------------------------- */
.badge-soft {
  font-size: 0.72rem; font-weight: 600; padding: 0.26rem 0.6rem;
  border-radius: 999px; border: 1px solid transparent;
}
.badge-ok   { background: rgba(34,197,94,0.14);  color: #4ade80; border-color: rgba(34,197,94,0.3); }
.badge-warn { background: rgba(245,158,11,0.14); color: #fbbf24; border-color: rgba(245,158,11,0.3); }
.badge-risk { background: rgba(239,68,68,0.14);  color: #f87171; border-color: rgba(239,68,68,0.3); }
.badge-info { background: rgba(34,211,238,0.12); color: #67e8f9; border-color: rgba(34,211,238,0.28); }
.badge-mute { background: rgba(255,255,255,0.06); color: var(--text-muted); border-color: var(--border-soft); }

/* --- Case library -------------------------------------------------------- */
.case-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); }
.case-card {
  background: var(--bg-panel); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 1rem 1.1rem; color: var(--text);
  display: flex; flex-direction: column; gap: 0.45rem;
  transition: transform .15s ease, border-color .15s ease;
}
.case-card:hover { transform: translateY(-2px); border-color: var(--border-strong); color: var(--text); }
.case-card .c-title { font-weight: 600; font-size: 0.98rem; line-height: 1.3; }
.case-card .c-meta { font-size: 0.78rem; color: var(--text-faint); }

/* --- Compare view (resident report vs consultant report) ----------------- */
.compare { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
/* Exactly two equal columns, whatever the container width -- auto-fit would
   happily make three if a third pane ever appeared, and the whole point of the
   comparison is that it is a pair. */
.compare-wide { grid-template-columns: 1fr 1fr; }
@media (max-width: 860px) { .compare-wide { grid-template-columns: 1fr; } }
.compare-wide .report-text { font-size: 0.93rem; line-height: 1.65; }
.compare .col-pane {
  background: var(--bg-panel); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 1rem 1.1rem;
}
.compare .col-pane.mine { border-left: 3px solid var(--accent-1); }
.compare .col-pane.final { border-left: 3px solid var(--accent-credit); }
.compare h4 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.9px; color: var(--text-faint); }
.report-text { white-space: pre-wrap; font-size: 0.9rem; line-height: 1.6; }

/* --- Alerts / messages --------------------------------------------------- */
.alert { border-radius: var(--radius); border: 1px solid var(--border-soft); font-size: 0.9rem; }
.alert-success { background: rgba(34,197,94,0.12); color: #86efac; border-color: rgba(34,197,94,0.3); }
.alert-danger  { background: rgba(239,68,68,0.12); color: #fca5a5; border-color: rgba(239,68,68,0.3); }
.alert-warning { background: rgba(245,158,11,0.12); color: #fcd34d; border-color: rgba(245,158,11,0.3); }
.alert-info    { background: rgba(34,211,238,0.10); color: #a5f3fc; border-color: rgba(34,211,238,0.28); }

/* --- Empty state --------------------------------------------------------- */
.empty {
  text-align: center; padding: 2.6rem 1rem; color: var(--text-muted);
  border: 1px dashed var(--border-soft); border-radius: var(--radius);
}
.empty .bi { font-size: 2rem; color: var(--text-faint); display: block; margin-bottom: 0.6rem; }

/* --- Governance note ----------------------------------------------------- */
.gov-note {
  font-size: 0.79rem; color: var(--text-faint);
  border-left: 2px solid rgba(16,185,129,0.4); padding-left: 0.7rem;
}

/* --- Footer -------------------------------------------------------------- */
.footer-credit {
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.35));
  border-top: 1px solid var(--border-soft);
  color: var(--text-faint); font-size: 0.82rem;
  padding: 1.4rem 0; margin-top: 3rem;
}
.footer-credit a { color: var(--text-muted); }
.footer-credit a:hover { color: #fff; }

/* --- Auth page ----------------------------------------------------------- */
.auth-wrap { min-height: calc(100vh - 120px); display: grid; place-items: center; padding: 2rem 1rem; }
.auth-card {
  width: 100%; max-width: 420px;
  background: rgba(255,255,255,0.045);
  border: 1px solid var(--border-soft);
  border-radius: 16px; padding: 2rem 1.9rem;
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
}
.auth-card .brand-lockup { display: flex; flex-direction: column; align-items: center; gap: 0.55rem; margin-bottom: 1.4rem; }
.auth-card .brand-lockup .brand-mark { width: 96px; height: 96px; }
.auth-card .brand-lockup .name { font-size: 1.5rem; font-weight: 680; letter-spacing: -0.02em; }
.auth-card .brand-lockup .tag { font-size: 0.74rem; color: var(--text-faint); text-align: center; line-height: 1.4; }

/* --- Print / PDF portfolio ----------------------------------------------- */
@media print {
  body { background: #fff !important; color: #111 !important; }
  .navbar-credit, .modulebar, .footer-credit, .no-print { display: none !important; }
  .panel, .stat, .domain-tile { border: 1px solid #ccc !important; background: #fff !important; }
  .table-credit { --bs-table-color: #111; --bs-table-border-color: #ccc; }
  .table-credit thead th { color: #444 !important; }
  a { color: #111 !important; }
}

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 575.98px) {
  .modulebar-link span { display: none; }
  .modulebar-link { padding: 0.45rem 0.6rem; }
  .modulebar-title { font-size: 0.86rem; }
  .launcher-head h1 { font-size: 1.6rem; }
  .page-title { font-size: 1.3rem; }
  .stat .stat-value { font-size: 1.5rem; }
  .panel { padding: 1rem; }
}


/* --- New-case source popup ------------------------------------------------
   One decision, four rows. No card grid, no paragraphs: the explanation lives
   on the fallback page for anyone who wants it.
   ------------------------------------------------------------------------ */
.source-modal {
  background: #0d2036;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  color: var(--text);
}
.source-modal .modal-header { border-bottom: 1px solid var(--border-soft); padding: 0.85rem 1rem; }
.source-modal .modal-title { font-size: 1rem; font-weight: 650; }

.source-row {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.7rem 0.8rem; border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none;
  border-left: 3px solid var(--mod, var(--accent-credit));
  transition: background .14s ease;
}
.source-row + .source-row { margin-top: 0.3rem; }
.source-row:hover { background: var(--bg-panel-hover); color: var(--text); }
.source-row.is-training { --mod: var(--mod-training); }
.source-row.is-audit    { --mod: var(--mod-audit); }
.source-row.is-dose     { --mod: var(--mod-dose); }

.source-row-icon {
  width: 34px; height: 34px; flex: none; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--mod, var(--accent-credit)) 16%, transparent);
  color: var(--mod, var(--accent-credit));
}
.source-row-text { flex: 1 1 auto; line-height: 1.3; }
.source-row-text strong { display: block; font-size: 0.94rem; font-weight: 600; }
.source-row-text .sub { font-size: 0.79rem; color: var(--text-faint); }

/* --- searchable combobox (topic picker on the case form) ---------------- */
.combo {
  position: relative;
}

.combo-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.combo-clear {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  width: 1.4rem;
  height: 1.4rem;
  line-height: 1;
  border: 0;
  border-radius: 50%;
  background: var(--bg-panel-hover);
  color: var(--text-muted);
  font-size: 1rem;
  padding: 0;
}

.combo-clear:hover {
  color: var(--text);
  background: var(--border-strong);
}

.combo-menu {
  position: absolute;
  z-index: 1060;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 16rem;
  overflow-y: auto;
  padding: 0.25rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-raise);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.combo-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
}

.combo-item i {
  color: var(--text-faint);
  font-size: 0.85rem;
}

.combo-item:hover,
.combo-item.is-active {
  background: var(--bg-panel-hover);
}

.combo-item.combo-add {
  color: var(--mod-training);
}

.combo-item.combo-add i {
  color: var(--mod-training);
}

.combo-empty {
  padding: 0.5rem 0.55rem;
  font-size: 0.85rem;
  color: var(--text-faint);
}

/* --- shared odds and ends ------------------------------------------------ */
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list > li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.9rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.plain-list > li:last-child { border-bottom: 0; }

.sub { font-size: 0.78rem; }

/* --- notification bell --------------------------------------------------- */
.bell-count {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--risk);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}

.note-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.7rem 0.2rem;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  text-decoration: none;
}
.note-row:last-child { border-bottom: 0; }
.note-row:hover { background: var(--bg-panel-hover); }
.note-row.is-unread { border-left: 2px solid var(--accent-cyan); padding-left: 0.6rem; }
.note-row:not(.is-unread) { opacity: 0.66; }
.note-icon { font-size: 1.05rem; line-height: 1.4; flex: none; }
.note-body { flex: 1; min-width: 0; }
.note-body strong { display: block; font-weight: 620; font-size: 0.92rem; }
.note-sub { display: block; font-size: 0.82rem; color: var(--text-muted); }
.note-when { flex: none; font-size: 0.74rem; color: var(--text-faint); white-space: nowrap; }

/* --- rotation schedule grid ---------------------------------------------- */
.sched-scroll { overflow-x: auto; }
.sched { min-width: 720px; }
.sched-row { display: flex; align-items: stretch; gap: 0.6rem; }
.sched-row + .sched-row { border-top: 1px solid var(--border-soft); }
.sched-name {
  width: 170px;
  flex: none;
  padding: 0.5rem 0;
  font-size: 0.86rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.sched-name a { color: var(--text); text-decoration: none; }
.sched-name a:hover { color: var(--accent-cyan); }
.sched-track {
  position: relative;
  flex: 1;
  min-height: 38px;
  background: repeating-linear-gradient(
    90deg, transparent, transparent calc(8.333% - 1px),
    var(--border-soft) calc(8.333% - 1px), var(--border-soft) 8.333%
  );
}
.sched-head .sched-track { min-height: 22px; background: none; }
.sched-month {
  position: absolute;
  top: 2px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-faint);
  text-align: center;
}
.sched-block {
  position: absolute;
  top: 6px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.3px;
  color: #04121d;
  text-decoration: none;
  opacity: 0.88;
}
.sched-block:hover { opacity: 1; color: #04121d; }
.sched-block.is-now { box-shadow: 0 0 0 2px var(--text) inset; opacity: 1; }
.sched-leave {
  position: absolute;
  bottom: 2px;
  height: 7px;
  border-radius: 3px;
  background: repeating-linear-gradient(
    45deg, var(--warn), var(--warn) 3px, transparent 3px, transparent 6px
  );
}
.sched-today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent-cyan);
  opacity: 0.8;
}
.rot-swatch {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  margin-right: 0.35rem;
  vertical-align: baseline;
}

/* --- academic calendar month grid ---------------------------------------- */
.cal-scroll { overflow-x: auto; }
.cal { min-width: 700px; }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-week + .cal-week { margin-top: 4px; }
.cal-dow {
  text-align: center;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-faint);
  padding-bottom: 0.3rem;
}
.cal-day {
  min-height: 92px;
  padding: 0.3rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
}
.cal-day.is-outside { opacity: 0.4; }
.cal-day.is-today { border-color: var(--accent-cyan); }
.cal-num {
  display: block;
  font-size: 0.74rem;
  color: var(--text-faint);
  margin-bottom: 0.25rem;
  font-variant-numeric: tabular-nums;
}
.cal-day.is-today .cal-num { color: var(--accent-cyan); font-weight: 700; }
.cal-event {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  padding: 2px 4px;
  margin-bottom: 2px;
  border-radius: 4px;
  background: rgba(34, 211, 238, 0.13);
  border-left: 2px solid var(--mod-training);
  font-size: 0.72rem;
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
}
.cal-event:hover { background: rgba(34, 211, 238, 0.24); color: var(--text); }
.cal-event i { font-size: 0.66rem; color: var(--mod-training); flex: none; }
.cal-event .cal-time { color: var(--text-faint); flex: none; }
.cal-event .cal-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-event.is-optional { background: rgba(255,255,255,0.05); border-left-color: var(--text-faint); }
.cal-event.is-optional i { color: var(--text-faint); }
.cal-event.is-cancelled { text-decoration: line-through; opacity: 0.55; }

/* --- register ------------------------------------------------------------ */
.reg-choices { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.reg-choice {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
}
.reg-choice:hover { border-color: var(--border-strong); }
.reg-choice input { margin: 0; }
.reg-choice:has(input:checked) {
  border-color: var(--accent-credit);
  background: rgba(16, 185, 129, 0.12);
}
.register-table td { vertical-align: middle; }

/* --- module bar: wrap rather than scroll --------------------------------- */
/* A scrolling nav bar hides its own last item, and overflow also clips the
   dropdown menus. Wrapping costs a second line on a narrow screen and keeps
   everything reachable. */
.modulebar-links {
  flex-wrap: wrap;
  overflow: visible;
  row-gap: 0.2rem;
}
.modulebar-caret { font-size: 0.65rem !important; opacity: 0.6; margin-left: 0.1rem; }
.modulebar-links .dropdown-menu {
  background: var(--bg-raise);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  padding: 0.25rem;
}
.modulebar-links .dropdown-item {
  color: var(--text);
  border-radius: 6px;
  font-size: 0.88rem;
  padding: 0.4rem 0.6rem;
}
.modulebar-links .dropdown-item:hover,
.modulebar-links .dropdown-item:focus {
  background: var(--bg-panel-hover);
  color: #fff;
}
.modulebar-links .dropdown-item .bi { opacity: 0.75; font-size: 0.9rem; }

/* On a phone the module title crowds the links into a single narrow column.
   Give the title its own line and hand the links the full width. */
@media (max-width: 767.98px) {
  .modulebar-inner { flex-wrap: wrap; }
  .modulebar-title { border-right: 0; padding-right: 0; }
  .modulebar-links { width: 100%; }
}

/* --- the module name under the wordmark ---------------------------------- */
/* Thin, sentence case, in the module's own colour: it is context, not
   branding, and should not compete with iCREDIT above it. */
.navbar-credit .brand-sub.brand-module {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  text-transform: none;
  letter-spacing: 0.2px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--mod, var(--accent-credit));
  margin-top: 1px;
}
.navbar-credit .brand-sub.brand-module .bi { font-size: 0.78rem; opacity: 0.9; }
.navbar-credit .brand-module.is-training { --mod: var(--mod-training); }
.navbar-credit .brand-module.is-audit    { --mod: var(--mod-audit); }
.navbar-credit .brand-module.is-dose     { --mod: var(--mod-dose); }

/* With the title gone the bar is links only, so let them start at the left
   edge rather than sitting where the old divider used to be. */
.modulebar-inner > .modulebar-home + .modulebar-links { margin-left: 0.25rem; }

/* --- morning meetings ---------------------------------------------------- */
.chip-dim {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--bg-panel);
  color: var(--text-muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.meeting-row .meeting-date {
  color: var(--text);
  text-decoration: none;
  font-weight: 640;
  font-size: 0.98rem;
}
.meeting-row .meeting-date:hover { color: var(--accent-cyan); }
.meeting-row .meeting-date .bi { color: var(--mod-dose); }

.meeting-cases {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.meeting-cases li { padding: 0.15rem 0; }
.meeting-cases li > * { margin-left: 0.35rem; vertical-align: middle; }

/* The numbered list on a meeting's own page. */
.case-list { margin: 0; padding-left: 1.4rem; }
.case-list > li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-soft);
}
.case-list > li:last-child { border-bottom: 0; }
.case-list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}
.case-list-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.25rem;
}
.case-list-point {
  margin-top: 0.35rem;
  padding-left: 0.6rem;
  border-left: 2px solid var(--border-strong);
  font-size: 0.86rem;
  color: var(--text-muted);
}

/* --- the case rows on the form ------------------------------------------- */
.case-row {
  display: flex;
  gap: 0.6rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border-soft);
}
.case-row:last-child { border-bottom: 0; }
.case-row.is-removed { opacity: 0.4; }
.case-row-num {
  flex: none;
  width: 1.7rem;
  padding-top: 1.75rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  color: var(--text-faint);
}
.case-row-body { flex: 1; min-width: 0; }
.case-row-side {
  flex: none;
  width: 2rem;
  padding-top: 1.7rem;
  display: flex;
  justify-content: center;
}
.case-drop {
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-faint);
  font-size: 0.75rem;
}
.case-drop:hover { background: var(--bg-panel-hover); color: var(--text); }
.case-remove {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.66rem;
  color: var(--text-faint);
  cursor: pointer;
}
.case-remove input { margin: 0; }

@media (max-width: 575.98px) {
  .case-row-num, .case-row-side { padding-top: 0; }
  .case-row { flex-wrap: wrap; }
  .case-row-body { flex-basis: 100%; order: 3; }
}

/* --- charts -------------------------------------------------------------- */
.chart-box { position: relative; height: 260px; }
.chart-box.chart-tall { height: 420px; }
.chart-box.chart-short { height: 180px; }
@media (max-width: 767.98px) { .chart-box { height: 220px; } }

/* --- small inline figures ------------------------------------------------ */
.mini-stat {
  text-align: center;
  padding: 0.5rem 0.3rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
}
.mini-stat b {
  display: block;
  font-size: 1.3rem;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.mini-stat span {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-faint);
}
.mini-stat.is-warn b { color: var(--warn); }
.mini-stat.is-risk b { color: var(--risk); }
.mini-stat.is-ok b { color: var(--ok); }

/* --- board of fame ------------------------------------------------------- */
.fame-strip { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.fame-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--bg-panel);
  font-size: 0.86rem;
}
.fame-chip > .bi { color: var(--mod-dose); font-size: 1rem; }
.fame-chip strong { display: block; line-height: 1.15; }
.fame-chip .sub { color: var(--text-faint); }
.fame-count {
  display: inline-grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.16);
  color: var(--warn);
  font-weight: 700;
  font-size: 0.8rem;
}

.fame-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.fame-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--bg-panel);
  border-top: 3px solid var(--fame, var(--mod-dose));
}
.fame-card.is-volume      { --fame: var(--mod-training); }
.fame-card.is-turnaround  { --fame: var(--accent-cyan); }
.fame-card.is-teaching    { --fame: #a78bfa; }
.fame-card.is-quality     { --fame: var(--mod-audit); }
.fame-card.is-improvement { --fame: var(--ok); }
.fame-card.is-nominated   { --fame: var(--mod-dose); }
.fame-card-top {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-faint);
}
.fame-card-top .bi { color: var(--fame, var(--mod-dose)); font-size: 0.95rem; }
.fame-month { margin-left: auto; }
.fame-who { font-size: 1.05rem; font-weight: 650; }
.fame-citation { font-size: 0.86rem; color: var(--text-muted); }
.fame-card-foot { display: flex; align-items: center; margin-top: auto; padding-top: 0.4rem; }

.fame-suggest {
  height: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
}
.fame-suggest.is-taken { opacity: 0.55; }

/* --- a reader's own shelf: bookmarks, study queue, notes ----------------- */
.case-card { position: relative; }
.card-star { position: absolute; top: 0.45rem; right: 0.45rem; z-index: 2; }

.star {
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-faint);
  font-size: 0.92rem;
  line-height: 1;
  transition: color .15s ease, background .15s ease;
}
.star:hover { background: var(--bg-panel-hover); color: var(--text); }
.star.is-on { color: var(--mod-dose); }

.shelf { list-style: none; margin: 0; padding: 0; }
.shelf-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border-soft);
}
.shelf-row:last-child { border-bottom: 0; }
.shelf-main {
  flex: 1;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}
.shelf-main:hover .shelf-title { color: var(--accent-cyan); }
.shelf-title { display: block; font-size: 0.92rem; font-weight: 560; }
.shelf-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.2rem;
}
.shelf-reason { font-size: 0.74rem; color: var(--text-faint); }
.shelf-actions { flex: none; display: flex; align-items: center; gap: 0.25rem; }

/* --- notes --------------------------------------------------------------- */
.note-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.note-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--bg-panel);
}
.note-card.is-pinned { border-color: var(--mod-dose); }
.note-card-top {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}
.note-card-top strong {
  flex: 1;
  min-width: 0;
  font-size: 0.94rem;
  font-weight: 620;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.note-card-top .bi-pin-angle-fill { color: var(--mod-dose); font-size: 0.8rem; }
.note-when { flex: none; font-size: 0.72rem; color: var(--text-faint); }
.note-body {
  font-size: 0.86rem;
  color: var(--text-muted);
  white-space: normal;
  overflow: hidden;
}
.note-card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin-top: auto;
  padding-top: 0.3rem;
}
.note-card-foot a.chip-dim { text-decoration: none; }
.note-card-foot a.chip-dim:hover { color: var(--text); }

/* --- modules as horizontal bars ----------------------------------------- */
/* Replaces the three side-by-side cards. One line each, full width: the
   module name is what you are choosing between, and a card's worth of chrome
   around three words was doing nothing for that. */
.mod-bars { display: flex; flex-direction: column; gap: 0.55rem; }

.mod-bar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--mod, var(--accent-credit));
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--text);
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease;
}
a.mod-bar:hover {
  background: var(--bg-panel-hover);
  border-color: var(--border-strong);
  border-left-color: var(--mod, var(--accent-credit));
  color: var(--text);
}
a.mod-bar:hover .mod-bar-go { transform: translateX(2px); opacity: 1; }
.mod-bar.is-soon { opacity: 0.62; }

.mod-bar.is-training { --mod: var(--mod-training); }
.mod-bar.is-audit    { --mod: var(--mod-audit); }
.mod-bar.is-dose     { --mod: var(--mod-dose); }

.mod-bar-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--mod, var(--accent-credit)) 16%, transparent);
  color: var(--mod, var(--accent-credit));
  font-size: 1.1rem;
}

.mod-bar-text { flex: 1; min-width: 0; }
.mod-bar-text b {
  display: block;
  font-size: 0.98rem;
  font-weight: 620;
  line-height: 1.25;
}
.mod-bar-text span {
  display: block;
  font-size: 0.83rem;
  color: var(--text-muted);
}

.mod-bar-end {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.mod-bar-go {
  color: var(--text-faint);
  font-size: 0.85rem;
  opacity: 0.7;
  transition: transform .15s ease, opacity .15s ease;
}

@media (max-width: 575.98px) {
  .mod-bar { flex-wrap: wrap; }
  .mod-bar-text { flex-basis: calc(100% - 3.5rem); }
  .mod-bar-end { margin-left: auto; }
}

/* --- the inline study viewer --------------------------------------------- */
.mini .mini-stage {
  position: relative;
  aspect-ratio: 1 / 1;
  max-height: 60vh;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: #000;
  border: 1px solid var(--border-soft);
  cursor: ns-resize;
  user-select: none;
  touch-action: none;
}
.mini .mini-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: center center;
  /* Nearest-neighbour: a windowed grey is a measurement, and smoothing it
     invents intermediate values that were never in the data. */
  image-rendering: pixelated;
}
.mini .mini-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 0.4rem;
  color: var(--text-faint);
  font-size: 0.84rem;
  text-align: center;
  padding: 1rem;
}

.mini .mini-corner {
  position: absolute;
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.72);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.mini .mini-tl { top: 0.25rem; left: 0.45rem; }
.mini .mini-tr { top: 0.25rem; right: 0.45rem; }
.mini .mini-bl { bottom: 0.25rem; left: 0.45rem; }
.mini .mini-br { bottom: 0.25rem; right: 0.45rem; opacity: 0.5; }

.mini .mini-scrub {
  width: 100%;
  margin: 0.5rem 0 0.35rem;
  accent-color: var(--mod-training);
  height: 3px;
}

.mini .mini-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.mini .mini-series { width: auto; max-width: 14rem; }
.mini .btn-group .btn {
  font-size: 0.74rem;
  padding: 0.2rem 0.5rem;
}
.mini .btn.is-on {
  background: color-mix(in srgb, var(--mod-training) 22%, transparent);
  color: #fff;
  box-shadow: inset 0 0 0 1px
    color-mix(in srgb, var(--mod-training) 40%, transparent);
}

@media (max-width: 575.98px) {
  .mini .mini-br { display: none; }
  .mini .mini-stage { max-height: 48vh; }
}

/* ==========================================================================
   One navbar
   Replaces the global bar + module bar pair. The module's own accent colours
   the strip under it, so you can tell where you are at a glance without the
   bar having to say it twice.
   ========================================================================== */
.navbar-credit {
  /* The accent strip, plus the drop shadow the bar already had -- a second
     box-shadow rule would replace it, not add to it. */
  box-shadow:
    inset 0 -2px 0 0 var(--mod, transparent),
    0 2px 18px rgba(0, 0, 0, 0.35);
}
.navbar-credit.is-training { --mod: var(--mod-training); }
.navbar-credit.is-audit    { --mod: var(--mod-audit); }
.navbar-credit.is-dose     { --mod: var(--mod-dose); }

/* --- the brand, on one line --------------------------------------------- */
.navbar-credit .brand-line {
  display: flex;
  align-items: baseline;
  gap: 0.34rem;
  white-space: nowrap;
}
.navbar-credit .brand-name { font-weight: 680; }
.navbar-credit .brand-sep {
  color: var(--text-faint);
  font-weight: 400;
}
.navbar-credit .brand-module {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  font-size: 0.98rem;
  font-weight: 560;
  letter-spacing: 0;
  text-transform: none;
  color: var(--mod, var(--accent-credit));
}
.navbar-credit .brand-module .bi {
  font-size: 0.86rem;
  align-self: center;
}
.navbar-credit .brand-module.is-training { --mod: var(--mod-training); }
.navbar-credit .brand-module.is-audit    { --mod: var(--mod-audit); }
.navbar-credit .brand-module.is-dose     { --mod: var(--mod-dose); }
/* Off a module the tagline takes the same slot. */
.navbar-credit .brand-line .brand-sub { font-size: 0.62rem; }

.navbar-credit .navbar-brand .brand-mark { width: 34px; height: 34px; }

/* --- the module links, now in the bar ------------------------------------ */
.module-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.1rem;
  margin-left: 1.1rem;
  padding-left: 1.1rem;
  border-left: 1px solid var(--border-soft);
}
.module-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  padding: 0.36rem 0.62rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.module-link .bi { font-size: 0.92rem; opacity: 0.85; }
.module-link:hover { background: var(--bg-panel-hover); color: #fff; }
.module-link.active {
  color: #fff;
  background: color-mix(in srgb, var(--mod, var(--accent-credit)) 20%, transparent);
  box-shadow: inset 0 0 0 1px
    color-mix(in srgb, var(--mod, var(--accent-credit)) 38%, transparent);
}
.module-caret { font-size: 0.64rem !important; opacity: 0.55; margin-left: 0.05rem; }

.module-nav .dropdown-menu {
  background: var(--bg-raise);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  padding: 0.25rem;
}
.module-nav .dropdown-item {
  color: var(--text);
  border-radius: 6px;
  font-size: 0.86rem;
  padding: 0.4rem 0.6rem;
}
.module-nav .dropdown-item:hover,
.module-nav .dropdown-item:focus {
  background: var(--bg-panel-hover);
  color: #fff;
}
.module-nav .dropdown-item .bi { opacity: 0.75; font-size: 0.88rem; }

/* --- narrow: the collapse stacks, so the divider becomes a rule ---------- */
@media (max-width: 991.98px) {
  .module-nav {
    margin: 0.6rem 0 0.2rem;
    padding: 0.6rem 0 0;
    border-left: 0;
    border-top: 1px solid var(--border-soft);
    width: 100%;
  }
  .module-link { padding: 0.45rem 0.6rem; }
}

/* The schedule's hatching key, beside the grid it explains. */
.sched-key {
  display: inline-block;
  width: 1.5rem;
  height: 0.5rem;
  vertical-align: middle;
  border-radius: 3px;
  background: repeating-linear-gradient(
    45deg, var(--warn), var(--warn) 3px, transparent 3px, transparent 6px
  );
}

/* --- lists as rows, not cards -------------------------------------------- */
/* A card is worth its chrome when the thing on it is visual. These lists are
   a line of text each, and a grid of boxes around single lines made every
   list read like a wall while fitting fewer of them on screen. */
.shelf-panel {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--bg-panel);
  padding: 0 1rem;
}
.shelf-panel .shelf-row:first-child { padding-top: 0.75rem; }
.shelf-panel .shelf-row:last-child { padding-bottom: 0.75rem; }

.shelf-row.is-pinned { border-left: 2px solid var(--mod-dose); padding-left: 0.6rem; }
.note-pin { color: var(--mod-dose); font-size: 0.8rem; margin-right: 0.2rem; }

/* The first line of a note, so a list of them is readable without opening
   each one. */
.note-line {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ==========================================================================
   Rows, tidied
   Three columns: what it is, what is true of it, what you can do. The middle
   column is where a row gets messy, so flags are a fixed size and the actions
   sit on a grid rather than wherever the flags leave them.
   ========================================================================== */
.shelf-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border-soft);
}
.shelf-row:last-child { border-bottom: 0; }
.shelf-row:hover { background: rgba(255, 255, 255, 0.018); }
.shelf-row.is-overdue { box-shadow: inset 2px 0 0 0 var(--risk); padding-left: 0.6rem; }

.shelf-main {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}
.shelf-main:hover .shelf-title { color: var(--accent-cyan); }
.shelf-title {
  display: block;
  font-size: 0.93rem;
  font-weight: 580;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shelf-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.22rem;
}
.shelf-reason { font-size: 0.74rem; color: var(--text-faint); }

/* --- the middle column: what is true of this row ------------------------ */
.shelf-flags {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.flag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  font-size: 0.71rem;
  color: var(--text-faint);
  white-space: nowrap;
}
.flag .bi { font-size: 0.72rem; }
.flag.is-done { color: var(--ok); border-color: rgba(34, 197, 94, 0.3); }
.flag.is-set  { color: var(--accent-cyan); border-color: rgba(34, 211, 238, 0.3); }
.flag.is-open { color: var(--mod-dose); border-color: rgba(245, 158, 11, 0.3); }
.flag.is-late { color: var(--risk); border-color: rgba(239, 68, 68, 0.35); }

/* --- the right column: what you can do --------------------------------- */
.shelf-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.15rem;
}
.shelf-actions form { display: flex; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-faint);
  font-size: 0.88rem;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--bg-panel-hover); color: #fff; }
.icon-btn.is-on { color: var(--mod-dose); }

.shelf-assign {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0.5rem;
  padding: 0.24rem 0.6rem;
  font-size: 0.76rem;
  white-space: nowrap;
}

/* The checkbox rows on the assign page. */
.assign-pick {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
}
.assign-pick input { flex: none; margin: 0; }

@media (max-width: 767.98px) {
  .shelf-row { flex-wrap: wrap; }
  .shelf-main { flex-basis: 100%; }
  .shelf-flags { order: 3; }
  .shelf-actions { order: 4; margin-left: auto; }
  .shelf-assign span { display: none; }
}

/* ==========================================================================
   Assessing a report
   The pictures column runs long -- a study, key images, findings, teaching
   points -- while the feedback box is short. Pinning the feedback box means
   the assessor can scroll the evidence without losing the thing they came to
   write in.
   ========================================================================== */
@media (min-width: 992px) {
  .review-side { position: sticky; top: 1rem; }
}

/* ==========================================================================
   Cohort table
   Everything in a row is one short fact, so nothing in it should wrap. The
   two places that can legitimately run long -- a supervisors name and a

/* ==========================================================================
   Cohort table
   Everything in a row is one short fact, so nothing in it should wrap. The
   two places that can legitimately run long, a supervisor name and a
   curriculum topic, are given a ceiling and an ellipsis instead, with the
   full text on the title attribute.
   ========================================================================== */
.cohort-table td,
.cohort-table th { white-space: nowrap; }

.cohort-table .who {
  font-weight: 580;
  color: var(--text);
  text-decoration: none;
}
.cohort-table .who:hover { color: var(--accent-cyan); }

.cohort-table .year-chip {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.02rem 0.4rem;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-faint);
  vertical-align: 1px;
}

.cohort-table .sub {
  max-width: 15rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cohort-table th.num,
.cohort-table td.num {
  text-align: right;
  padding-right: 1.25rem;
  font-variant-numeric: tabular-nums;
}
.cohort-table .tabular { font-variant-numeric: tabular-nums; }
.cohort-table .curric { min-width: 170px; width: 18%; }

.cohort-table td.pending .badge-soft { text-decoration: none; }
.cohort-table td.pending .badge-soft + .badge-soft { margin-left: 0.25rem; }

/* One line per row, without guessing a width.

   A fixed max-width on the chips is wrong at every window size except the one
   it was measured at: too wide and the "+N more" counter drops to a second
   line and the table looks ragged, too narrow and short topic names get
   clipped for no reason. Letting the chips shrink (flex 0 1 auto, min-width 0)
   while the counter holds its size (flex: none) makes the row fit whatever
   space the column actually has. */
.gaps-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
}
.gap-chip {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gaps-more { flex: none; }

/* ==========================================================================
   File inputs
   The browser paints its own button inside a file input, and left alone it is
   a light grey slab in the middle of a dark form. Styled here rather than on
   any one page, because every upload in the product has the same input.
   ========================================================================== */
input[type="file"].form-control {
  padding: 0.3rem 0.5rem;
  color: var(--text-muted);
}
input[type="file"].form-control::file-selector-button {
  margin: 0 0.75rem 0 0;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--bg-panel-hover);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
input[type="file"].form-control::file-selector-button:hover {
  background: var(--bg-panel-hover);
  border-color: var(--accent-cyan);
  color: #fff;
}

/* ==========================================================================
   Dose notes
   The reason a study used the dose it used, written at the console. Set off
   from the numbers around it: it is somebody speaking, not a measurement.
   ========================================================================== */
.dose-note {
  padding: 0.6rem 0.75rem;
  border-left: 2px solid var(--border-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: rgba(255, 255, 255, 0.02);
}
.dose-note + .dose-note { margin-top: 0.5rem; }

/* ==========================================================================
   A case published somewhere else
   It sits where the viewer would, so it gets the viewer's proportions: tall
   enough to scroll a case in, and it keeps its shape on a phone.
   ========================================================================== */
.linked-thumb {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}
.linked-case .sub { word-break: break-all; }


/* The accession number, readable and copyable. */
.pacs-ref {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}
.pacs-ref code {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-cyan);
  letter-spacing: 0.02em;
  word-break: break-all;
}

/* ==========================================================================
   Signing in
   The Google button keeps Google's own colours and wordmark: it is their
   brand guideline, and a user recognises it faster than anything we could
   design. Everything else on the card stays ours.
   ========================================================================== */
.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  background: #fff;
  color: #1f1f1f;
  border: 1px solid #dadce0;
  font-weight: 500;
}
.btn-google:hover,
.btn-google:focus {
  background: #f7f8f8;
  color: #1f1f1f;
  border-color: #d2d5d9;
}
.btn-google svg { flex: none; }

/* A rule with a word in it, for "or". */
.auth-or {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.1rem 0;
  color: var(--text-faint);
  font-size: 0.8rem;
}
.auth-or::before,
.auth-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-soft);
}

.auth-card-wide { max-width: 30rem; }
