/* Authenticated app shell + components. Requires tokens.css to be loaded first. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  overflow-x: hidden; /* safety net — no single element should ever be able to push the whole page wider than the viewport */
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  font-size: var(--text-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
a { color: var(--color-blue-600); text-decoration: none; transition: color var(--transition); }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.22; margin: 0 0 0.5em; font-weight: 640; letter-spacing: var(--tracking-tight); color: var(--color-text); }
h1 { font-size: var(--text-xl); }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-md); font-weight: 620; }
p { margin: 0 0 1em; }
ul { margin: 0; padding-left: 1.2em; }
hr { border: none; border-top: 1px solid var(--color-border); margin: var(--space-5) 0; }
code, kbd, samp { font-family: var(--font-mono); }
::selection { background: rgba(22, 33, 61, 0.18); }

/* ============ App shell: sidebar + topbar + content ============ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 244px;
  flex-shrink: 0;
  background: var(--color-navy-950);
  color: #c4cde3;
  display: flex;
  flex-direction: column;
  padding: var(--space-5) var(--space-3) var(--space-3);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.08rem;
  padding: 4px 10px 22px;
}
.sidebar .brand:hover { text-decoration: none; }
.sidebar .brand .mark {
  /* Inverted from every other .brand .mark on the site (dark-on-light) — this
     is the one brand mark sitting on the dark sidebar, so it needs to be
     light-on-dark to read at all against the now-solid-ink background. */
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  background: var(--mkt-paper); color: var(--color-navy-950);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-size: 0.95rem;
}
.sidebar nav { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.sidebar nav .nav-section-label {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: var(--tracking-wide);
  font-weight: 650;
  color: #63708d; margin: 18px 12px 6px;
}
.sidebar nav a {
  color: #c4cde3; text-decoration: none;
  padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 480;
  display: flex; align-items: center; gap: 8px;
  position: relative;
  transition: background var(--transition), color var(--transition);
}
.sidebar nav a:hover { background: rgba(255, 255, 255, 0.055); color: #fff; text-decoration: none; }
.sidebar nav a.active {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  font-weight: 560;
}
.sidebar nav a.active::before {
  /* Light-on-dark, same reason as .sidebar .brand .mark — the shared
     --gradient-brand-mark token is dark-on-light everywhere else. */
  content: ""; position: absolute; left: 3px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 999px; background: #4cc487; /* green marker for the current page */
}
.sidebar .site-switcher {
  background: rgba(255, 255, 255, 0.06); border-radius: var(--radius-sm);
  padding: 8px 10px; margin-bottom: 14px;
}
.sidebar .site-switcher select { width: 100%; }
.sidebar .sidebar-footer {
  font-size: 0.76rem; color: #63708d; padding: 12px 10px 4px;
  margin-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar .sidebar-footer a { color: #8894ac; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  min-height: 62px; flex-shrink: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(160%) blur(8px);
  -webkit-backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 24px;
  gap: 12px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { margin: 0; font-family: var(--font-serif); font-size: 1.3rem; font-weight: 700; }
.topbar .breadcrumb { color: var(--color-text-muted); font-size: 0.82rem; margin-bottom: 1px; }
.topbar .user-menu { display: flex; align-items: center; gap: 9px; font-size: 0.86rem; color: var(--color-text-muted); flex-shrink: 0; }
.topbar .user-menu .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--color-blue-100); color: var(--color-blue-600);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem; flex-shrink: 0;
}
.topbar .user-menu-link { display: flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; transition: opacity var(--transition); }
.topbar .user-menu-link:hover { text-decoration: none; opacity: 0.75; }

/* Mobile nav toggle — hidden on desktop, shown < 960px. Its own drawn bars
   (not a Unicode "☰", which renders inconsistently thin/unclear across fonts)
   plus a "Menu" label make it unmistakably a menu button at a glance. */
.nav-toggle {
  display: none;
  gap: 8px; height: 38px; flex-shrink: 0;
  align-items: center; justify-content: center;
  background: var(--color-surface); border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm); cursor: pointer; color: var(--color-text);
  padding: 0 12px; font-size: 0.82rem; font-weight: 620; line-height: 1;
}
.nav-toggle:hover { background: var(--color-surface-alt); }
.nav-toggle-bars { display: flex; flex-direction: column; justify-content: center; gap: 3px; width: 18px; flex-shrink: 0; }
.nav-toggle-bars span { display: block; height: 2px; border-radius: 1px; background: currentColor; }
.nav-toggle-label { white-space: nowrap; }
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 40;
  background: rgba(10, 15, 30, 0.5); backdrop-filter: blur(2px);
}

.content { padding: 26px 24px 40px; flex: 1; background: var(--color-bg); }
.content-narrow { max-width: 760px; }

/* ============ Cards ============ */
.card {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}
/* No decorative top rail — the card's own border is the structural device
   here, consistent with "the register"'s rules-not-decoration principle. */
/* A framework item's detail card, washed by its current status. */
.card-status-complete { background: linear-gradient(180deg, var(--color-status-complete-bg), var(--color-surface) 140px); }
.card-status-in_progress { background: linear-gradient(180deg, var(--color-status-in-progress-bg), var(--color-surface) 140px); }
.card-status-blocked { background: linear-gradient(180deg, var(--color-status-blocked-bg), var(--color-surface) 140px); }

.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: var(--space-4); flex-wrap: wrap; }
.card-header h2, .card-header h3 { margin: 0; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(224px, 1fr)); gap: var(--space-4); }
.card-grid.framework-picker .card { display: flex; flex-direction: column; }
.card-grid.framework-picker .framework-picker-body { flex: 1; }

/* Package cards: descriptions run to different lengths, so without this the
   Open/Enable/badge row lands at a different height on every card. The
   description grows to fill the leftover space instead, pinning that row to
   the bottom of every card in the row (cards in a grid row already stretch
   to equal height by default). */
.card-grid.package-cards .card { display: flex; flex-direction: column; }
.card-grid.package-cards .card > p.muted { flex: 1; }

/* SCR record edit page — each field group is a collapsible card, two up, washed
   red/green by whether its check(s) still need attention (see .card-status-*
   above). Native <details> so no JS is needed to open/close one. */
.scr-group-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); align-items: start; }
@media (max-width: 720px) { .scr-group-grid { grid-template-columns: 1fr; } }
.scr-group-card > summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; font-weight: 640; font-size: 1rem; color: var(--color-text);
}
.scr-group-card > summary::-webkit-details-marker { display: none; }
.scr-group-card > summary .scr-group-title { display: flex; align-items: center; gap: 8px; }
.scr-group-card > summary::after { content: "+"; color: var(--color-text-faint); font-size: 1.15rem; line-height: 1; flex-shrink: 0; }
.scr-group-card[open] > summary::after { content: "\2212"; }
.scr-group-card[open] > summary { margin-bottom: var(--space-4); padding-bottom: var(--space-3); border-bottom: 1px solid var(--color-border); }

/* Link cards (a.card) get a hover lift. */
a.card { display: block; color: inherit; transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition); }
a.card:hover { text-decoration: none; box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--color-border-strong); }

.stat-card { text-align: left; padding: var(--space-4) var(--space-5); }
.stat-card .stat-value { font-size: var(--text-2xl); font-weight: 680; line-height: 1.05; margin-bottom: 3px; letter-spacing: var(--tracking-tight); }
.stat-card .stat-label { color: var(--color-text-muted); font-size: 0.83rem; line-height: 1.4; }

/* Dashboard's leading "featured package" card — SCR activate/launch hero and
   its live status summary. Teal-washed to spotlight the package. */
.hero-feature {
  background: var(--color-teal-100);
  border-color: var(--color-teal-500);
}
.hero-feature-list { list-style: none; margin: var(--space-3) 0; padding: 0; display: grid; gap: var(--space-2); font-size: 0.9rem; }
.hero-feature-list li { display: flex; align-items: flex-start; gap: 9px; }
.hero-feature-list li::before {
  content: "✓"; color: #fff; background: var(--color-teal-600);
  width: 17px; height: 17px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.68rem; font-weight: 800; margin-top: 2px;
}
.hero-feature-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: var(--space-4); margin: var(--space-4) 0; }
.hero-feature-stats .stat-value { font-size: var(--text-xl); font-weight: 680; line-height: 1.05; letter-spacing: var(--tracking-tight); }
.hero-feature-stats .stat-label { color: var(--color-text-muted); font-size: 0.83rem; }

.cta-row { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; margin-top: var(--space-4); }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 15px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 0.88rem; font-weight: 570; cursor: pointer; text-decoration: none;
  font-family: inherit; line-height: 1.2; white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition), color var(--transition);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(0.5px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { background: var(--color-blue-600); color: #fff; box-shadow: 0 1px 2px rgba(22, 33, 61, 0.3); }
.btn-primary:hover { background: #202f52; }
.btn-secondary { background: var(--color-surface); border-color: var(--color-border-strong); color: var(--color-text); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--color-surface-alt); border-color: var(--color-text-faint); }
.btn-danger { background: var(--color-surface); border-color: #e3b3af; color: var(--color-status-blocked-fg); box-shadow: var(--shadow-xs); }
.btn-danger:hover { background: var(--color-status-blocked-bg); border-color: var(--color-status-blocked-fg); }
.btn-success { background: var(--color-status-complete-fg); color: #fff; box-shadow: 0 1px 2px rgba(11, 122, 65, 0.3); }
.btn-success:hover { background: #0a6b39; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; border-radius: 7px; }
.btn-block { width: 100%; }
/* Management Information rows: "Self-service link" plus a work-email field and a button that emails the link. */
.mgmt-ss { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.mgmt-ss .btn { white-space: nowrap; }
.mgmt-ss-send { display: flex; align-items: center; gap: 8px; margin: 0; }
.mgmt-ss-tip { display: inline-flex; }
.mgmt-hidden { color: var(--color-text-faint); font-style: italic; }
.mgmt-edit { white-space: nowrap; }
.mgmt-dl { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 8px 12px; margin: 12px 0 16px; }
.mgmt-dl dt { font-size: 0.85rem; color: var(--color-text-muted, #5b6478); }
.mgmt-dl dd { margin: 0; overflow-wrap: anywhere; }
.mgmt-ss-tip button:disabled { pointer-events: none; opacity: 0.5; cursor: not-allowed; }

/* Email Templates editor */
.et-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: var(--space-4); align-items: start; }
@media (max-width: 900px) { .et-layout { grid-template-columns: 1fr; } }
.et-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.et-list a { display: block; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); color: inherit; text-decoration: none; line-height: 1.35; }
.et-list a:hover { border-color: var(--color-border-strong); }
.et-list a.active { border-color: var(--color-blue-600); box-shadow: inset 3px 0 0 var(--color-blue-600); }
.et-list .badge { margin-top: 4px; }
.et-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.et-editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 1200px) { .et-editor-grid { grid-template-columns: 1fr; } }
.et-code { width: 100%; min-height: 420px; font-family: var(--font-mono, ui-monospace, Consolas, monospace); font-size: 0.8rem; line-height: 1.5; tab-size: 2; white-space: pre; overflow: auto; resize: vertical; }
.et-bodyhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.et-mode { display: inline-flex; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.et-mode-btn { padding: 5px 14px; border: 0; background: var(--color-surface); color: var(--color-text); font: inherit; font-size: 0.82rem; font-weight: 570; cursor: pointer; }
.et-mode-btn + .et-mode-btn { border-left: 1px solid var(--color-border-strong); }
.et-mode-btn[aria-pressed="true"] { background: var(--color-blue-600); color: #ffffff; }
.et-toolbar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px; border: 1px solid var(--color-border); border-bottom: 0; border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: var(--color-surface-alt); }
.et-toolbar select { width: auto; padding: 4px 8px; font-size: 0.82rem; margin: 0; }
.et-tool { padding: 4px 9px; border: 1px solid var(--color-border); border-radius: 6px; background: var(--color-surface); color: var(--color-text); font: inherit; font-size: 0.82rem; cursor: pointer; line-height: 1.3; }
.et-tool:hover { border-color: var(--color-border-strong); background: #ffffff; }
.et-visual { display: block; width: 100%; height: 420px; border: 1px solid var(--color-border); border-radius: 0 0 var(--radius-sm) var(--radius-sm); background: #ffffff; resize: vertical; }
.et-preview { display: block; width: 100%; height: 420px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: #ffffff; }
/* Full-width buttons with a longer label (e.g. on cards): let the text wrap and give it room instead of squeezing it. */
.btn-wrap { white-space: normal; text-align: center; padding: 11px 20px; line-height: 1.35; }

/* ============ Forms ============ */
.field { margin-bottom: var(--space-4); }
.field label { display: block; font-size: 0.85rem; font-weight: 580; margin-bottom: 6px; color: var(--color-text); }
.field .hint { color: var(--color-text-faint); font-size: 0.8rem; margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date], input[type=url], input[type=tel],
select, textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm);
  font-size: 0.92rem; font-family: inherit; background: var(--color-surface); color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
input::placeholder, textarea::placeholder { color: var(--color-text-faint); }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--color-blue-500); box-shadow: var(--ring); }
input:disabled, select:disabled, textarea:disabled { background: var(--color-surface-sunken); color: var(--color-text-muted); cursor: not-allowed; }
.checkbox-row { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 9px; }
.checkbox-row input { width: auto; margin-top: 3px; accent-color: var(--color-blue-600); }
input[type=checkbox], input[type=radio] { accent-color: var(--color-blue-600); }
fieldset { border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 14px 16px; margin: 0 0 var(--space-4); }
legend { font-weight: 580; font-size: 0.85rem; padding: 0 6px; color: var(--color-text-muted); }

/* ============ Badges / status ============ */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--radius-pill);
  font-size: 0.76rem; font-weight: 620; white-space: nowrap; line-height: 1.4;
  border: 1px solid transparent;
}
.badge-not_started { background: var(--color-status-not-started-bg); color: var(--color-status-not-started-fg); }
.badge-in_progress { background: var(--color-status-in-progress-bg); color: var(--color-status-in-progress-fg); }
.badge-complete { background: var(--color-status-complete-bg); color: var(--color-status-complete-fg); }
.badge-blocked { background: var(--color-status-blocked-bg); color: var(--color-status-blocked-fg); }
.badge-neutral { background: var(--color-blue-100); color: var(--color-blue-600); }

/* ============ Progress bars ============ */
.progress { background: var(--color-surface-sunken); border-radius: var(--radius-pill); height: 9px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--color-teal-600); border-radius: var(--radius-pill); transition: width 0.4s var(--ease); }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .progress { flex: 1; }
.progress-row .progress-pct { font-size: 0.8rem; font-weight: 680; width: 3.2em; text-align: right; color: var(--color-text-muted); }

/* ============ Tables ============ */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--color-border-subtle); }
th {
  color: var(--color-text-muted); font-weight: 620; font-size: 0.74rem;
  text-transform: uppercase; letter-spacing: var(--tracking-wide);
  background: var(--color-surface-alt);
  border-bottom-color: var(--color-border);
}
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--color-surface-alt); }
tr:last-child td { border-bottom: none; }
.table-link-row { cursor: pointer; }

/* ============ Alerts / flash ============ */
.alert {
  padding: 12px 15px 12px 16px; border-radius: var(--radius-sm); margin-bottom: var(--space-4);
  font-size: 0.9rem; border: 1px solid transparent; position: relative;
}
.alert-success { background: var(--color-status-complete-bg); color: #0a5f34; border-color: #b4e6c6; }
.alert-error { background: var(--color-status-blocked-bg); color: #97201a; border-color: #f2c2be; }
.alert-info { background: var(--color-blue-100); color: var(--color-navy-700); border-color: #c9d9f8; }

/* ============ Misc ============ */
.muted { color: var(--color-text-muted); }
.faint { color: var(--color-text-faint); font-size: 0.85rem; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
/* flex-wrap: wrap by default — this is the app's one general-purpose flex-row
   utility, used for everything from a two-button toggle to a card-header's
   row of action buttons, inside containers of very different widths (a
   408px auth card, a full-width card-header, a table cell). Without
   wrapping, content wider than its container silently overflows the
   container's edge instead of dropping to a second line — exactly what
   happened on register.php's "new org / existing org" toggle inside the
   fixed-width auth card. Nothing in this app relies on a .flex row staying
   on one line no matter what, so wrapping is a strict improvement wherever
   it's used, not just here. */
.flex { display: flex; flex-wrap: wrap; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.breadcrumb-trail { font-size: 0.83rem; color: var(--color-text-muted); margin-bottom: var(--space-3); }
.breadcrumb-trail a { color: var(--color-text-muted); }
.breadcrumb-trail a:hover { color: var(--color-blue-600); }
.empty-state { text-align: center; padding: var(--space-10) var(--space-5); color: var(--color-text-muted); }
.empty-state strong { color: var(--color-text); font-size: 1.02rem; }

/* ============ Master-detail layout (e.g. site/services.php) ============ */
.services-layout { display: grid; grid-template-columns: 340px 1fr; gap: var(--space-5); align-items: start; }
.service-list { max-height: 74vh; overflow-y: auto; }
.service-row {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 8px; border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--color-border-subtle);
}
.service-row:last-child { border-bottom: none; }
.service-row.active { background: var(--color-blue-100); }
.service-row form { margin: 0; }
.service-row input[type=checkbox] { width: auto; margin-top: 3px; flex-shrink: 0; }
.service-row-main { flex: 1; min-width: 0; }
.service-row-name { font-weight: 580; font-size: 0.92rem; display: inline-block; }
.service-row-tags { margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; }
.service-detail-empty { text-align: center; padding: 60px 20px; color: var(--color-text-muted); }

.dpia-doc-card {
  display: flex; align-items: flex-start; gap: 12px; border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); padding: 12px; margin-bottom: var(--space-4);
}
.dpia-doc-icon {
  font-size: 1.7rem; flex-shrink: 0; width: 44px; height: 44px; display: flex; align-items: center;
  justify-content: center; background: var(--color-surface-alt); border-radius: var(--radius-sm);
}
.dpia-doc-info { flex: 1; min-width: 0; }
.dpia-doc-info .filename { font-weight: 580; word-break: break-word; }

@media (max-width: 860px) {
  .services-layout { grid-template-columns: 1fr; }
  .service-list { max-height: none; }
}

/* ============ Auth pages (login / register / reset / MFA / verify) ============ */
.auth-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--color-bg);
  padding: 24px;
}
.auth-card {
  background: var(--color-surface); border: 1px solid var(--color-border-strong); border-radius: 0;
  box-shadow: none; padding: 38px; width: 100%; max-width: 408px;
}
.auth-card .brand { display: flex; align-items: center; gap: 9px; font-family: var(--font-serif); font-size: 1.15rem; margin-bottom: 24px; }
.auth-card .brand .mark {
  width: 30px; height: 30px; border-radius: 0;
  background: var(--gradient-brand-mark);
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
  font-family: var(--font-serif); font-size: 1rem;
}
.auth-card h1, .auth-card h2 { font-family: var(--font-serif); font-weight: 700; }
.auth-card .foot-link { text-align: center; margin-top: 20px; font-size: 0.88rem; color: var(--color-text-muted); }

/* ============ Responsive: tablet / mobile ============ */
@media (max-width: 960px) {
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
    transform: translateX(-100%); transition: transform 0.28s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .app-shell.nav-open .sidebar { transform: translateX(0); }
  .app-shell.nav-open .sidebar-overlay { display: block; }
  .nav-toggle { display: inline-flex; }
  .topbar { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 860px) {
  .content { padding: 16px 14px 32px; }
  .topbar .user-menu .user-menu-link span { display: none; }
  .stat-card .stat-value { font-size: var(--text-xl); }
}
@media (max-width: 560px) {
  .card { padding: var(--space-4); }
  .topbar h1 { font-size: 1rem; }
  .nav-toggle { width: 38px; padding: 0; }
  .nav-toggle-label { display: none; }
}

/* ============ Wiki: rendered markdown + code blocks ============ */
.wiki-content h1, .wiki-content h2, .wiki-content h3 { margin-top: 1.5em; }
.wiki-content h1:first-child, .wiki-content h2:first-child, .wiki-content h3:first-child { margin-top: 0; }
.wiki-content ul, .wiki-content ol { padding-left: 1.6em; margin: 0 0 1em; }
.wiki-content blockquote {
  margin: 0 0 1em; padding: 10px 16px; border-left: 3px solid var(--color-teal-500);
  color: var(--color-text-muted); background: var(--color-surface-alt); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.wiki-content table { margin-bottom: 1em; }
.wiki-content code {
  font-family: var(--font-mono);
  font-size: 0.85em; background: var(--color-surface-sunken); border: 1px solid var(--color-border);
  border-radius: 5px; padding: 1px 5px;
}
.wiki-content pre {
  position: relative; background: var(--color-navy-950); color: #e4e9f5; border-radius: var(--radius-md);
  padding: 16px 18px; overflow-x: auto; margin: 0 0 1em;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.wiki-content pre code {
  background: none; border: none; padding: 0; font-size: 0.86rem; color: inherit; line-height: 1.55;
}
.wiki-copy-btn {
  position: absolute; top: 8px; right: 8px; padding: 3px 10px; font-size: 0.74rem; font-weight: 580;
  color: #cdd6ea; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.16);
  border-radius: var(--radius-sm); cursor: pointer; transition: background var(--transition);
}
.wiki-copy-btn:hover { background: rgba(255,255,255,0.18); }

/* highlight.js "GitHub Dark" theme, inlined (CSP style-src is 'self'/'unsafe-inline').
   Source: unpkg.com/@highlightjs/cdn-assets/styles/github-dark.min.css */
.wiki-content pre code.hljs { display: block; overflow-x: auto; }
.wiki-content .hljs { color: #c9d1d9; }
.wiki-content .hljs-doctag, .wiki-content .hljs-keyword, .wiki-content .hljs-meta .hljs-keyword,
.wiki-content .hljs-template-tag, .wiki-content .hljs-template-variable, .wiki-content .hljs-type,
.wiki-content .hljs-variable.language_ { color: #ff7b72; }
.wiki-content .hljs-title, .wiki-content .hljs-title.class_, .wiki-content .hljs-title.class_.inherited__,
.wiki-content .hljs-title.function_ { color: #d2a8ff; }
.wiki-content .hljs-attr, .wiki-content .hljs-attribute, .wiki-content .hljs-literal, .wiki-content .hljs-meta,
.wiki-content .hljs-number, .wiki-content .hljs-operator, .wiki-content .hljs-selector-attr,
.wiki-content .hljs-selector-class, .wiki-content .hljs-selector-id, .wiki-content .hljs-variable { color: #79c0ff; }
.wiki-content .hljs-meta .hljs-string, .wiki-content .hljs-regexp, .wiki-content .hljs-string { color: #a5d6ff; }
.wiki-content .hljs-built_in, .wiki-content .hljs-symbol { color: #ffa657; }
.wiki-content .hljs-code, .wiki-content .hljs-comment, .wiki-content .hljs-formula { color: #8b949e; }
.wiki-content .hljs-name, .wiki-content .hljs-quote, .wiki-content .hljs-selector-pseudo,
.wiki-content .hljs-selector-tag { color: #7ee787; }
.wiki-content .hljs-subst { color: #c9d1d9; }
.wiki-content .hljs-section { color: #79c0ff; font-weight: 700; }
.wiki-content .hljs-bullet { color: #f2cc60; }
.wiki-content .hljs-emphasis { color: #c9d1d9; font-style: italic; }
.wiki-content .hljs-strong { color: #c9d1d9; font-weight: 700; }

/* ============ Welcome tour + "Explain this page" spotlight ============ */
.tour-backdrop { position: fixed; inset: 0; z-index: 1000; background: transparent; }
.tour-spotlight {
  position: fixed; z-index: 1001; border-radius: var(--radius-md);
  box-shadow: 0 0 0 9999px rgba(10, 15, 30, 0.62), 0 0 0 3px var(--color-teal-500);
  transition: top 0.35s var(--ease), left 0.35s var(--ease), width 0.35s var(--ease), height 0.35s var(--ease);
  pointer-events: none;
  animation: tourPulse 1.9s ease-in-out infinite;
}
@keyframes tourPulse {
  0%, 100% { box-shadow: 0 0 0 9999px rgba(10, 15, 30, 0.62), 0 0 0 3px var(--color-teal-500); }
  50% { box-shadow: 0 0 0 9999px rgba(10, 15, 30, 0.62), 0 0 0 6px var(--color-teal-500); }
}
.tour-card {
  position: fixed; z-index: 1002; width: 324px; max-width: calc(100vw - 32px);
  background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 18px 20px; animation: tourFadeIn 0.25s var(--ease);
}
@keyframes tourFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.tour-card h3 { margin: 0 0 8px; font-size: 1.02rem; display: flex; align-items: center; gap: 8px; }
.tour-card h3::before {
  content: ""; width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0;
  background: var(--gradient-brand-mark);
}
.tour-card p { font-size: 0.9rem; color: var(--color-text-muted); margin: 0 0 14px; }
.tour-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tour-progress { font-size: 0.78rem; color: var(--color-text-faint); }

/* Bell rings when unread actions wait */
.bell-ringing { display: inline-block; transform-origin: 50% 0%; animation: bellRing 1.8s ease-in-out infinite; }
@keyframes bellRing {
  0%, 40%, 100% { transform: rotate(0deg); }
  5% { transform: rotate(14deg); } 10% { transform: rotate(-12deg); }
  15% { transform: rotate(9deg); } 20% { transform: rotate(-7deg); }
  25% { transform: rotate(4deg); } 30% { transform: rotate(-2deg); }
  35% { transform: rotate(0deg); }
}

#explainPageBtn { border-radius: 999px; width: 30px; height: 30px; padding: 0; font-weight: 700; flex-shrink: 0; }
.tour-toast {
  position: fixed; top: 20px; right: 20px; z-index: 1002;
  background: var(--color-surface); border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  padding: 10px 16px; font-size: 0.88rem; color: var(--color-text-muted);
  animation: tourFadeIn 0.25s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* "Guidance reference" links on a framework item, and the pop-up showing the exact source text. */
.ref-link {
  background: none; border: 0; padding: 0; margin: 0; font: inherit; cursor: pointer;
  color: var(--color-blue-500); text-decoration: underline; text-underline-offset: 2px;
}
.ref-link:hover { color: var(--color-navy-950); }
.ref-link:focus-visible { outline: 2px solid var(--color-blue-500); outline-offset: 2px; border-radius: 2px; }
.ref-dialog {
  width: min(820px, 94vw); max-height: 86vh; padding: 0; border: 0; border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3); color: var(--color-text, inherit); background: var(--color-surface, #fff);
}
.ref-dialog[open] { display: flex; flex-direction: column; }
.ref-dialog::backdrop { background: rgba(22, 33, 61, 0.45); }
.ref-dialog-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--color-border, #ddd); }
.ref-dialog-head h3 { margin: 0; font-size: 1rem; line-height: 1.35; }
.ref-dialog-head form { margin: 0; flex-shrink: 0; }
.ref-dialog-body { padding: 8px 20px 12px; overflow-y: auto; flex: 1; }
.ref-dialog-body .ref-h { margin: 18px 0 6px; font-size: 0.9rem; }
.ref-dialog-body .ref-p { margin: 0 0 8px; font-size: 0.9rem; line-height: 1.55; }
.ref-dialog-body .ref-bullet { padding-left: 1em; text-indent: -1em; }
.ref-dialog-foot { padding: 10px 20px 14px; border-top: 1px solid var(--color-border, #ddd); font-size: 0.78rem; color: var(--color-text-faint); word-break: break-word; }

/* "Plain English explanation" panel on a framework item, with how strongly evidence is expected. */
.plain-english { margin: 12px 0; padding: 12px 14px; background: var(--color-surface-alt); border-left: 3px solid var(--color-teal-500); border-radius: 4px; }
.plain-english p { margin: 0; font-size: 0.92rem; line-height: 1.5; }
.plain-english .plain-evidence { margin-top: 8px; }
.ev-badge { display: inline-block; margin-right: 6px; padding: 1px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }
.ev-should { background: var(--color-status-in-progress-bg); color: var(--color-status-in-progress-fg); }
.ev-could { background: var(--color-blue-100); color: var(--color-navy-800); }
.ev-note { background: var(--color-status-not-started-bg); color: var(--color-status-not-started-fg); }

/* Key documents: the "(N Key Documents)" chip beside a framework title, tags on items, and the pop-up content. */
.kd-chip { background: none; border: 0; padding: 0; margin: 0 0 0 4px; font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; color: var(--color-blue-500); text-decoration: underline; text-underline-offset: 2px; }
.kd-chip:hover { color: var(--color-navy-950); }
.kd-chip:focus-visible, .kd-tag:focus-visible { outline: 2px solid var(--color-blue-500); outline-offset: 2px; }
.kd-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; }
.kd-tag { border: 1px solid var(--color-teal-500); background: var(--color-teal-100); color: var(--color-teal-600); border-radius: 999px; padding: 0 9px; font: inherit; font-size: 0.74rem; font-weight: 600; line-height: 1.6; cursor: pointer; }
.kd-tag:hover { background: var(--color-teal-500); color: #fff; }
.kd-tag-related { background: transparent; border-style: dashed; font-weight: 500; }
.kd-doc { margin: 14px 0; padding: 12px 14px 8px; border: 1px solid var(--color-border); border-left: 4px solid var(--color-teal-500); border-radius: 6px; background: var(--color-surface-alt); }
.kd-doc-name { margin: 0 0 4px; font-size: 1.02rem; color: var(--color-navy-950); }
.kd-doc-desc { margin: 0 0 10px; font-size: 0.88rem; line-height: 1.5; color: var(--color-text-muted); }
.kd-legend { margin: 8px 0 0; font-size: 0.8rem; line-height: 1.9; color: var(--color-text-muted); }
.kd-fws { display: flex; flex-direction: column; gap: 8px; }
.kd-fw { padding: 8px 10px; background: var(--color-surface); border: 1px solid var(--color-border-subtle); border-radius: 5px; }
.kd-fw-name { font-size: 0.86rem; font-weight: 700; margin-bottom: 4px; }
.kd-fw-name a { color: inherit; }
.kd-this { margin-left: 6px; padding: 0 8px; border-radius: 999px; background: var(--color-navy-950); color: #fff; font-size: 0.7rem; font-weight: 600; }
.kd-add { margin-left: 8px; font-size: 0.76rem; font-weight: 500; }
.kd-items { list-style: none; margin: 0; padding: 0; }
.kd-item { margin: 3px 0; font-size: 0.86rem; line-height: 1.5; }
.kd-item a, .kd-fw-name a { text-decoration: underline; text-underline-offset: 2px; }
.kd-item a { color: var(--color-teal-600); }
.kd-item a:hover { color: var(--color-navy-950); }
.kd-item-code { font-weight: 700; }
.kd-item-related { color: var(--color-text-muted); }
.kd-rel { display: inline-block; min-width: 82px; margin-right: 6px; padding: 0 8px; border-radius: 999px; font-size: 0.7rem; font-weight: 700; text-align: center; }
.kd-rel-evidence { background: var(--color-status-in-progress-bg); color: var(--color-status-in-progress-fg); }
.kd-rel-support { background: var(--color-blue-100); color: var(--color-navy-800); }
.item-key-docs { margin: 8px 0; font-size: 0.88rem; }

/* Status pop-up shown after saving a note, evidence or link on a checklist item. */
.status-dialog { width: min(520px, 94vw); }
.status-dialog-body { padding-top: 14px; }
.status-dialog .qs-current { margin: 0 0 6px; font-size: 1rem; }
.status-dialog .qs-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.status-dialog .qs-note { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--color-border-subtle); }
.status-dialog .qs-note[hidden] { display: none; }
.status-dialog .qs-note label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 4px; }
.status-dialog .qs-note textarea { width: 100%; }
.btn-link { background: none; border: 0; padding: 6px 4px; font: inherit; font-size: 0.88rem; cursor: pointer; color: var(--color-blue-500); text-decoration: underline; text-underline-offset: 2px; }

/* Sidebar sub-menu items sit under their parent package. */
/* Package groups: a parent link with a chevron; its sub-pages are indented under a guide line and only show when the group is open. */
.sidebar nav .nav-group { display: flex; flex-direction: column; }
.sidebar nav .nav-parent { display: flex; align-items: center; }
.sidebar nav .nav-parent > a { flex: 1; min-width: 0; }
.sidebar nav .nav-group.open > .nav-parent > a { font-weight: 700; color: #fff; }
.sidebar nav .nav-chevron {
  flex-shrink: 0; width: 26px; height: 26px; margin-left: 2px; border: 0; border-radius: var(--radius-sm);
  background: transparent; cursor: pointer; position: relative; color: #8894ac;
}
.sidebar nav .nav-chevron:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.sidebar nav .nav-chevron::before {
  content: ""; position: absolute; left: 9px; top: 9px; width: 6px; height: 6px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform var(--transition);
}
.sidebar nav .nav-group.open > .nav-parent > .nav-chevron::before { transform: rotate(45deg); top: 7px; }
.sidebar nav .nav-chevron:focus-visible { outline: 2px solid #c4cde3; outline-offset: 1px; }
.sidebar nav .nav-sub-list { display: none; margin: 2px 0 4px 18px; padding-left: 8px; border-left: 1px solid rgba(255, 255, 255, 0.16); flex-direction: column; gap: 1px; }
.sidebar nav .nav-group.open > .nav-sub-list { display: flex; }
.sidebar nav a.nav-sub { padding: 6px 10px; font-size: 0.85rem; font-weight: 440; }
.sidebar nav a.nav-sub.active::before { left: -9px; top: 6px; bottom: 6px; }
.sidebar nav a.nav-soon { color: #8894ac; }
.sidebar nav .nav-soon-tag { margin-left: auto; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 0 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); color: #9aa6c0; }

/* Key Documents page: one card per document, green once uploaded. */
.kdp-tiles { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.kdp-tile { padding: 8px 14px; border: 1px solid var(--color-border); border-radius: 6px; background: var(--color-surface-alt); font-size: 0.88rem; }
.kdp-num { font-size: 1.3rem; font-weight: 700; margin-right: 4px; }
.kdp-tile-uploaded { background: var(--color-status-complete-bg); color: var(--color-status-complete-fg); border-color: transparent; }
.kdp-tile-held { background: var(--color-status-in-progress-bg); color: var(--color-status-in-progress-fg); border-color: transparent; }
.kdp-tile-missing { background: var(--color-status-not-started-bg); color: var(--color-status-not-started-fg); border-color: transparent; }
.kdp-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin: 6px 0 14px; }
.kdp-doc { margin: 10px 0; padding: 14px 16px; border: 1px solid var(--color-border); border-left: 5px solid var(--color-border); border-radius: 6px; background: var(--color-surface); }
.kdp-doc.kdp-uploaded { background: var(--color-status-complete-bg); border-left-color: var(--color-teal-500); }
.kdp-doc.kdp-held { border-left-color: #d9a21b; }
.kdp-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.kdp-name { margin: 0; font-size: 1.02rem; }
.kdp-badge { padding: 1px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 700; }
.kdp-badge-uploaded { background: var(--color-teal-600); color: #fff; }
.kdp-badge-held { background: var(--color-status-in-progress-bg); color: var(--color-status-in-progress-fg); }
.kdp-badge-missing { background: var(--color-status-not-started-bg); color: var(--color-status-not-started-fg); }
.kdp-desc { margin: 4px 0 8px; font-size: 0.88rem; color: var(--color-text-muted); }
.kdp-where, .kdp-file, .kdp-note { margin: 4px 0; font-size: 0.86rem; }
.kdp-fw { display: inline-block; margin: 0 6px 2px 0; padding: 0 9px; border: 1px solid var(--color-border); border-radius: 999px; background: var(--color-surface); }
.kdp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* Inline "Edit" for a saved note: a <details> that opens the edit form under the note (works without JavaScript). */
.note-edit { margin-top: 8px; }
.note-edit > summary { display: inline-flex; cursor: pointer; list-style: none; }
.note-edit > summary::-webkit-details-marker { display: none; }
.note-edit[open] > summary { margin-bottom: 8px; }
.note-edit form { max-width: 640px; }

/* Collapsible menu sections (global admin): the section heading becomes a button with a chevron; its links fold away. */
.sidebar nav .nav-section { display: flex; flex-direction: column; }
.sidebar nav .nav-section-body { display: flex; flex-direction: column; gap: 1px; }
.sidebar nav .nav-section:not(.open) > .nav-section-body { display: none; }
.sidebar nav .nav-section-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: calc(100% - 24px); padding: 0; background: transparent; border: 0; cursor: pointer; text-align: left; font-family: inherit;
}
.sidebar nav .nav-section-toggle::after {
  content: ""; flex: none; width: 6px; height: 6px; margin-right: 2px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform var(--transition);
}
.sidebar nav .nav-section.open > .nav-section-toggle::after { transform: rotate(45deg); }
.sidebar nav .nav-section-toggle:hover { color: #c4cde3; }
.sidebar nav .nav-section-toggle:focus-visible { outline: 2px solid #c4cde3; outline-offset: 2px; border-radius: 2px; }

/* A whole card that opens something when clicked (see assets/js/row-links.js). */
.card-link { cursor: pointer; transition: border-color var(--transition), box-shadow var(--transition); }
.card-link:hover { border-color: var(--color-border-strong); box-shadow: 0 2px 10px rgba(22, 33, 61, 0.1); }
.card-link .card-link-title { color: inherit; text-decoration: none; }
.card-link:hover .card-link-title, .card-link .card-link-title:focus-visible { text-decoration: underline; text-underline-offset: 3px; }

/* Frameworks page: the available frameworks listed one under another, like the Sites below them. */
.fw-table td { vertical-align: middle; }
.fw-table .fw-name { width: 22%; }
.fw-table .fw-name-inner { display: inline-flex; align-items: center; gap: 10px; }
.fw-table .fw-about { font-size: 0.88rem; line-height: 1.5; color: var(--color-text-muted); }
.fw-table .fw-row-actions { width: 1%; white-space: nowrap; text-align: right; }
.fw-table .fw-row-actions form { display: block; margin: 0 0 6px; }
.fw-table .fw-row-actions form:last-child { margin-bottom: 0; }
.fw-table .fw-row-actions .btn { width: 100%; }

/* A soft green button: a quiet tint with a green outline, for actions that should be inviting rather than loud. */
.btn-soft { background: #e6f0e9; color: #235a37; border: 1px solid #c5dccb; box-shadow: none; font-weight: 600; }
.btn-soft:hover { background: #d8e9dd; border-color: #a9cdb3; color: #1c4a2d; }

/* Single Central Record > Management Information launch page. */
.mi-intro { padding: 22px 24px; }
.mi-intro-top { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.mi-lede { margin: 6px 0 0; max-width: 64ch; }
.mi-plus-pill { font-size: 0.78rem; font-weight: 700; padding: 4px 12px; border-radius: 999px; background: #e9f1ec; color: #2c6a42; border: 1px solid #cfe2d5; white-space: nowrap; }
.mi-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 16px 0 0; }
.mi-chips li { font-size: 0.82rem; padding: 4px 12px; border-radius: 999px; background: var(--color-surface-alt); color: var(--color-text-muted); border: 1px solid var(--color-border-subtle); }
.mi-section { margin: 26px 0 12px; font-size: 0.95rem; font-weight: 700; }
.mi-section-count { margin-left: 6px; font-size: 0.78rem; font-weight: 600; padding: 1px 9px; border-radius: 999px; background: var(--color-surface-alt); color: var(--color-text-muted); }
.mi-section-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.mi-section-row .mi-section { margin-bottom: 12px; }
input.mi-filter { width: 260px; max-width: 100%; margin: 14px 0 12px; }
.mi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 16px; }
.mi-card { position: relative; display: flex; flex-direction: column; gap: 18px; padding: 18px 18px 16px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 12px; transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition); }
.mi-card[hidden] { display: none; }
.mi-card:hover { border-color: var(--color-border-strong); box-shadow: 0 8px 22px -12px rgba(22, 33, 61, 0.4); transform: translateY(-1px); }
.mi-card.is-on::before { content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px; border-radius: 0 3px 3px 0; background: #86bb99; }
.mi-card-head { display: flex; gap: 12px; align-items: center; }
.mi-avatar { width: 44px; height: 44px; flex: none; border-radius: 10px; background: var(--color-surface-alt); border: 1px solid var(--color-border-subtle); display: grid; place-items: center; overflow: hidden; color: var(--color-text-muted); }
.mi-card.is-locked .mi-avatar { opacity: 0.75; }
.mi-card h3 { margin: 0; font-size: 1rem; line-height: 1.25; }
.mi-pill { display: inline-block; margin-top: 5px; font-size: 0.72rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--color-status-not-started-bg); color: var(--color-status-not-started-fg); }
.mi-pill.on { background: #e9f1ec; color: #2c6a42; }
.mi-stat { display: flex; align-items: baseline; gap: 8px; }
.mi-stat b { font-size: 2rem; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.mi-stat span { font-size: 0.85rem; color: var(--color-text-muted); }
.mi-card .btn { margin-top: auto; }

/* Frameworks page, Sites table: a site's framework badges sit side by side in a row (wrapping only when they run out of room). */
.sites-table td.fw-targets { width: 58%; }
.sites-table .site-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 0.8rem; }
.fw-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fw-badges form { margin: 0; }
.fw-badges .badge { white-space: nowrap; font-size: 0.78rem; padding: 3px 9px; }
.fw-badges .fw-add { margin-left: 2px; }

/* Single Central Record overview pages (scr/index.php, scr/central.php): hero card, stat tiles, grouped tools. */
.mi-avatar.lg { width: 56px; height: 56px; border-radius: 12px; }
.mi-plus-free { background: var(--color-surface-alt); color: var(--color-text-muted); border-color: var(--color-border); }
.scr-hero { padding: 22px 24px; }
.scr-hero-top { display: flex; justify-content: space-between; align-items: center; gap: 16px 24px; flex-wrap: wrap; }
.scr-hero-id { display: flex; align-items: center; gap: 16px; min-width: 0; }
.scr-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.scr-notice { display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; padding: 11px 14px; border-radius: 10px; background: var(--color-surface-alt); border: 1px solid var(--color-border-subtle); font-size: 0.85rem; line-height: 1.5; color: var(--color-text-muted); }
.scr-notice svg { flex: none; margin-top: 2px; color: var(--color-text-faint); }
.scr-notice a { font-weight: 600; }
.scr-section { margin: 28px 0 12px; font-size: 0.95rem; font-weight: 700; display: flex; align-items: center; }
.scr-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(214px, 1fr)); gap: 14px; }
.scr-tile { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 12px; color: inherit; text-decoration: none; transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition); }
a.scr-tile:hover { border-color: var(--color-border-strong); box-shadow: 0 8px 22px -12px rgba(22, 33, 61, 0.4); transform: translateY(-1px); text-decoration: none; }
.scr-tile b { font-size: 2rem; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.scr-tile span { font-size: 0.86rem; color: var(--color-text-muted); }
.scr-tile-note { font-style: normal; font-size: 0.74rem; font-weight: 600; }
.scr-tile.is-clear { box-shadow: inset 3px 0 0 #86bb99; }
.scr-tile.is-clear b, .scr-tile.is-clear .scr-tile-note { color: #2c6a42; }
.scr-tile.is-todo { box-shadow: inset 3px 0 0 #e2b14a; }
.scr-tile.is-todo b, .scr-tile.is-todo .scr-tile-note { color: #8a5a00; }
.scr-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; margin-bottom: 8px; }
.scr-tool-group { display: flex; flex-direction: column; gap: 8px; padding: 18px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 12px; }
.scr-tool-group h3 { margin: 0; font-size: 0.95rem; }
.scr-tool-group p { margin: 0 0 6px; font-size: 0.82rem; line-height: 1.45; color: var(--color-text-muted); }
.scr-tool-group .btn { width: 100%; justify-content: flex-start; text-align: left; }

/* Management Information lists (partials/mgmt_view.php): locked card, table, avatars and the view/edit pop-ups. */
.mi-locked { display: flex; gap: 18px; align-items: flex-start; padding: 22px 24px; }
.mi-locked-icon { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--color-surface-alt); border: 1px solid var(--color-border-subtle); color: var(--color-text-muted); }
.mi-locked .mi-chips { margin-top: 12px; }
.mgmt-table th { white-space: nowrap; }
.mgmt-table tbody tr:hover { background: var(--color-surface-alt); }
.mgmt-namecell { display: inline-flex; align-items: center; gap: 10px; }
.mgmt-avatar { flex: none; width: 52px; height: 52px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; font-weight: 700; font-size: 1rem; background: #e4efe7; color: #235a37; }
.mgmt-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mgmt-avatar.sm { width: 30px; height: 30px; font-size: 0.72rem; }
.mgmt-dialog { width: min(580px, 94vw); padding: 0; border: none; border-radius: 14px; box-shadow: 0 18px 50px -12px rgba(22, 33, 61, 0.5); }
.mgmt-dialog::backdrop { background: rgba(22, 33, 61, 0.45); }
.mgmt-dialog[open] { display: flex; flex-direction: column; }
.mgmt-dialog form { display: flex; flex-direction: column; min-height: 0; margin: 0; }
.mgmt-dialog-head { display: flex; align-items: center; gap: 14px; padding: 18px 22px; background: var(--color-surface-alt); border-bottom: 1px solid var(--color-border); }
.mgmt-dialog-head h3 { margin: 0; font-size: 1.1rem; line-height: 1.25; }
.mgmt-dialog-head .mi-pill { margin-top: 4px; }
.mgmt-dialog-body { padding: 6px 22px 12px; overflow-y: auto; max-height: min(66vh, 620px); }
.mgmt-dialog-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--color-border); }
.mgmt-sec { margin: 18px 0 8px; font-size: 0.78rem; font-weight: 700; color: var(--color-text-muted); }
.mgmt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.mgmt-grid .wide { grid-column: 1 / -1; }
.mgmt-grid .field label { font-weight: 600; font-size: 0.84rem; }
@media (max-width: 560px) { .mgmt-grid { grid-template-columns: 1fr; } }
.mgmt-dialog .mgmt-dl { margin: 14px 0 6px; }
