/*
 * OMS CDC — design system
 * Professional project governance UI for IV Consulting / Electroplanet.
 * No external font or CSS dependency is required.
 */

:root {
  color-scheme: light;
  --navy-950: #071523;
  --navy-900: #0b1f33;
  --navy-850: #102a43;
  --navy-800: #163954;
  --navy-700: #24506f;
  --slate-950: #10243d;
  --slate-800: #263b53;
  --slate-700: #40556d;
  --slate-600: #586d84;
  --slate-500: #718198;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #dde5ee;
  --slate-100: #edf2f7;
  --slate-50: #f6f8fb;
  --white: #ffffff;
  --teal-700: #08706f;
  --teal-600: #0b8583;
  --teal-500: #12a3a0;
  --teal-100: #d9f4f1;
  --teal-50: #effcfb;
  --blue-700: #1d4ed8;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-100: #dbeafe;
  --blue-50: #eff6ff;
  --green-700: #167044;
  --green-100: #d9f5e5;
  --green-50: #effbf4;
  --amber-800: #8a4b08;
  --amber-700: #a05a0b;
  --amber-100: #ffedbd;
  --amber-50: #fff9e8;
  --red-700: #b4232f;
  --red-100: #fee2e2;
  --red-50: #fff3f3;
  --purple-700: #6d28d9;
  --purple-100: #ede9fe;
  --surface: var(--white);
  --surface-subtle: var(--slate-50);
  --canvas: #f1f5f9;
  --text: var(--slate-950);
  --text-muted: var(--slate-600);
  --border: var(--slate-200);
  --border-strong: var(--slate-300);
  --link: var(--blue-700);
  --focus: #0f6fff;
  --shadow-xs: 0 1px 2px rgb(7 21 35 / 0.07);
  --shadow-sm: 0 2px 8px rgb(7 21 35 / 0.08);
  --shadow-md: 0 10px 30px rgb(7 21 35 / 0.12);
  --shadow-lg: 0 24px 60px rgb(7 21 35 / 0.2);
  --radius-sm: 0.4rem;
  --radius-md: 0.7rem;
  --radius-lg: 1rem;
  --radius-xl: 1.35rem;
  --sidebar-width: 17.5rem;
  --topbar-height: 4.5rem;
  --content-max: 100rem;
  --transition-fast: 150ms ease;
  --transition-base: 220ms ease;
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 20rem;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.nav-open {
  overflow: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
select {
  cursor: pointer;
}

a {
  color: var(--link);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
}

a:hover {
  color: var(--blue-600);
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

::selection {
  background: var(--blue-100);
  color: var(--navy-950);
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
figure,
blockquote,
pre {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  color: var(--slate-950);
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 {
  margin-bottom: 0.55rem;
  font-size: clamp(1.75rem, 2.2vw, 2.35rem);
}

h2 {
  margin-bottom: 0.75rem;
  font-size: clamp(1.3rem, 1.7vw, 1.65rem);
}

h3 {
  margin-bottom: 0.55rem;
  font-size: 1.08rem;
}

small,
.text-small {
  font-size: 0.875rem;
}

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

.text-danger {
  color: var(--red-700) !important;
}

.text-success {
  color: var(--green-700) !important;
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.sr-only,
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 0.9rem;
  transform: translateY(-160%);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--navy-950);
  box-shadow: var(--shadow-lg);
  font-weight: 700;
}

.skip-link:focus {
  transform: translateY(0);
}

/* Application shell */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  z-index: 60;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(circle at 20% 0%, rgb(18 163 160 / 0.16), transparent 28rem),
    linear-gradient(180deg, var(--navy-900), var(--navy-950));
  color: #dce7f1;
  box-shadow: inset -1px 0 rgb(255 255 255 / 0.06);
}

.sidebar-brand,
.brand {
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem 1.2rem;
  border-bottom: 1px solid rgb(255 255 255 / 0.09);
  color: var(--white);
  text-decoration: none;
}

.sidebar-brand img,
.brand img,
.brand-logo {
  width: auto;
  max-width: 8.75rem;
  max-height: 2.45rem;
  object-fit: contain;
}

.brand-mark {
  display: grid;
  width: 2.55rem;
  height: 2.55rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, var(--teal-500), var(--blue-500));
  color: var(--white);
  font-weight: 850;
  letter-spacing: -0.03em;
}

.brand-copy {
  min-width: 0;
}

.brand-title {
  display: block;
  overflow: hidden;
  color: var(--white);
  font-size: 0.96rem;
  font-weight: 760;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-subtitle {
  display: block;
  margin-top: 0.18rem;
  color: #99afc2;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.8rem 1.5rem;
}

.nav-section + .nav-section {
  margin-top: 1.25rem;
}

.nav-label {
  display: block;
  padding: 0 0.7rem 0.45rem;
  color: #89a0b5;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.sidebar-nav ul,
.nav-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sidebar-nav li + li,
.nav-list li + li {
  margin-top: 0.2rem;
}

.sidebar-nav a,
.nav-link {
  position: relative;
  display: flex;
  min-height: 2.7rem;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.6rem;
  color: #cbd8e4;
  font-size: 0.9rem;
  font-weight: 620;
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.sidebar-nav a:hover,
.nav-link:hover {
  background: rgb(255 255 255 / 0.07);
  color: var(--white);
}

.sidebar-nav a[aria-current="page"],
.sidebar-nav a.active,
.nav-link.active {
  background: linear-gradient(90deg, rgb(18 163 160 / 0.24), rgb(37 99 235 / 0.13));
  color: var(--white);
  box-shadow: inset 3px 0 var(--teal-500);
}

.nav-icon {
  display: grid;
  width: 1.25rem;
  height: 1.25rem;
  flex: 0 0 1.25rem;
  place-items: center;
  color: #8fb5c4;
}

.nav-icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

.nav-count {
  min-width: 1.45rem;
  margin-left: auto;
  padding: 0.08rem 0.38rem;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.11);
  color: #dce8f1;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.sidebar-footer {
  margin: auto 0.8rem 0.85rem;
  padding: 0.85rem;
  border: 1px solid rgb(255 255 255 / 0.08);
  border-radius: var(--radius-md);
  background: rgb(255 255 255 / 0.04);
  color: #aabccc;
  font-size: 0.78rem;
}

.sidebar-footer strong {
  display: block;
  margin-bottom: 0.15rem;
  color: #e7eef5;
}

.sidebar-overlay {
  position: fixed;
  z-index: 50;
  inset: 0;
  visibility: hidden;
  background: rgb(7 21 35 / 0.62);
  opacity: 0;
  backdrop-filter: blur(2px);
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.app-frame,
.app-main {
  grid-column: 2;
  min-width: 0;
}

.topbar {
  position: sticky;
  z-index: 40;
  top: 0;
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  gap: 1rem;
  padding: 0.65rem clamp(1rem, 2.4vw, 2rem);
  border-bottom: 1px solid var(--border);
  background: rgb(255 255 255 / 0.94);
  box-shadow: 0 1px 0 rgb(7 21 35 / 0.02);
  backdrop-filter: blur(14px);
}

.mobile-menu-toggle {
  display: none;
  width: 2.65rem;
  height: 2.65rem;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: var(--white);
  color: var(--navy-850);
}

.mobile-menu-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
}

.topbar-project {
  min-width: 0;
}

.topbar-title {
  overflow: hidden;
  color: var(--slate-950);
  font-size: 0.96rem;
  font-weight: 750;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-context {
  margin-top: 0.15rem;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-left: auto;
}

.topbar-search,
.search-box {
  position: relative;
  width: min(26rem, 34vw);
}

.topbar-search input,
.search-box input {
  width: 100%;
  min-height: 2.65rem;
  padding: 0.6rem 0.9rem 0.6rem 2.45rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--slate-50);
}

.topbar-search svg,
.search-box svg {
  position: absolute;
  top: 50%;
  left: 0.8rem;
  width: 1rem;
  height: 1rem;
  transform: translateY(-50%);
  color: var(--slate-500);
  pointer-events: none;
}

.icon-button {
  position: relative;
  display: inline-grid;
  width: 2.65rem;
  height: 2.65rem;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: var(--white);
  color: var(--slate-700);
  transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.icon-button:hover {
  border-color: var(--border-strong);
  background: var(--slate-50);
  color: var(--navy-850);
}

.icon-button svg {
  width: 1.15rem;
  height: 1.15rem;
}

.notification-dot {
  position: absolute;
  top: 0.42rem;
  right: 0.42rem;
  width: 0.48rem;
  height: 0.48rem;
  border: 2px solid var(--white);
  border-radius: 50%;
  background: var(--red-700);
}

.user-menu,
.user-summary {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.25rem 0.35rem;
  border: 0;
  border-radius: 0.7rem;
  background: transparent;
  text-align: left;
}

.user-menu:hover,
.user-summary:hover {
  background: var(--slate-50);
}

.avatar {
  display: inline-grid;
  width: 2.35rem;
  height: 2.35rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-600), var(--blue-600));
  color: var(--white);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.user-name {
  display: block;
  color: var(--slate-950);
  font-size: 0.82rem;
  font-weight: 720;
  line-height: 1.2;
}

.user-role {
  display: block;
  margin-top: 0.15rem;
  color: var(--text-muted);
  font-size: 0.69rem;
}

.main-content,
main.content {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: clamp(1.1rem, 2.8vw, 2.2rem);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.page-header p {
  max-width: 52rem;
  margin-bottom: 0;
  color: var(--text-muted);
}

.page-actions,
.card-actions,
.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.65rem;
  padding: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  list-style: none;
}

.breadcrumbs li:not(:last-child)::after {
  margin-left: 0.35rem;
  color: var(--slate-400);
  content: "/";
}

.breadcrumbs a {
  color: var(--slate-700);
}

/* Layout helpers */

.stack > * + * {
  margin-top: 1rem;
}

.stack-sm > * + * {
  margin-top: 0.55rem;
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.grid {
  display: grid;
  gap: 1.15rem;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4,
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(19rem, 0.85fr);
  gap: 1.15rem;
}

.span-2 {
  grid-column: span 2;
}

.section {
  margin-top: 1.4rem;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.section-header h2,
.section-header h3,
.section-header p {
  margin-bottom: 0;
}

/* Cards and metrics */

.card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.card-interactive {
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.card-interactive:hover {
  border-color: #b6c6d6;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
}

.card-header h2,
.card-header h3,
.card-header p {
  margin-bottom: 0;
}

.card-title {
  font-size: 1rem;
}

.card-subtitle {
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.card-body {
  padding: 1.15rem;
}

.card-footer {
  padding: 0.8rem 1.15rem;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: var(--slate-50);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.metric-card {
  position: relative;
  min-height: 8.4rem;
  overflow: hidden;
  padding: 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.metric-card::after {
  position: absolute;
  top: -2.25rem;
  right: -2.25rem;
  width: 6rem;
  height: 6rem;
  border-radius: 50%;
  background: rgb(18 163 160 / 0.08);
  content: "";
}

.metric-label {
  display: block;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 680;
}

.metric-value {
  display: block;
  margin-top: 0.35rem;
  color: var(--navy-900);
  font-size: clamp(1.65rem, 2vw, 2.1rem);
  font-variant-numeric: tabular-nums;
  font-weight: 820;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.metric-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.65rem;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.metric-trend {
  font-weight: 750;
}

.metric-trend.up {
  color: var(--green-700);
}

.metric-trend.down,
.metric-trend.warning {
  color: var(--red-700);
}

.progress {
  width: 100%;
  height: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--slate-100);
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal-600), var(--blue-600));
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.progress-labels strong {
  color: var(--slate-800);
  font-variant-numeric: tabular-nums;
}

/* Buttons, forms and alerts */

.btn,
button.btn {
  display: inline-flex;
  min-height: 2.65rem;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.58rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 0.65rem;
  font-size: 0.86rem;
  font-weight: 720;
  line-height: 1.2;
  text-decoration: none;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  border-color: var(--blue-700);
  background: var(--blue-700);
  color: var(--white);
  box-shadow: 0 1px 2px rgb(29 78 216 / 0.22);
}

.btn-primary:hover {
  border-color: #163fbd;
  background: #163fbd;
  color: var(--white);
}

.btn-accent {
  border-color: var(--teal-700);
  background: var(--teal-700);
  color: var(--white);
}

.btn-accent:hover {
  border-color: #075e5d;
  background: #075e5d;
  color: var(--white);
}

.btn-secondary,
.btn-outline {
  border-color: var(--border-strong);
  background: var(--white);
  color: var(--slate-800);
}

.btn-secondary:hover,
.btn-outline:hover {
  border-color: #9eafc1;
  background: var(--slate-50);
  color: var(--navy-900);
}

.btn-ghost {
  background: transparent;
  color: var(--slate-700);
}

.btn-ghost:hover {
  background: var(--slate-100);
  color: var(--navy-900);
}

.btn-danger {
  border-color: var(--red-700);
  background: var(--red-700);
  color: var(--white);
}

.btn-sm {
  min-height: 2.15rem;
  padding: 0.4rem 0.7rem;
  font-size: 0.78rem;
}

.btn-block {
  width: 100%;
}

.btn:disabled,
.btn[aria-disabled="true"],
button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
  transform: none;
}

.form-group {
  margin-bottom: 1rem;
}

.form-label,
label {
  display: inline-block;
  margin-bottom: 0.38rem;
  color: var(--slate-800);
  font-size: 0.82rem;
  font-weight: 700;
}

.required-marker {
  color: var(--red-700);
}

.form-control,
.form-select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
select,
textarea {
  width: 100%;
  min-height: 2.7rem;
  padding: 0.62rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.62rem;
  background: var(--white);
  color: var(--text);
  box-shadow: inset 0 1px 1px rgb(7 21 35 / 0.025);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

textarea {
  min-height: 7.5rem;
  resize: vertical;
}

.form-control:hover,
.form-select:hover,
input:hover,
select:hover,
textarea:hover {
  border-color: #a5b5c5;
}

.form-control:focus,
.form-select:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue-600);
  outline: 0;
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.16);
}

[aria-invalid="true"],
.is-invalid {
  border-color: var(--red-700) !important;
  background: var(--red-50) !important;
}

.form-help,
.help-text {
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.form-error,
.errorlist {
  margin: 0.35rem 0 0;
  padding: 0;
  color: var(--red-700);
  font-size: 0.78rem;
  font-weight: 650;
  list-style: none;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.checkbox-row input {
  width: 1.05rem;
  height: 1.05rem;
  min-height: 0;
  margin-top: 0.18rem;
  accent-color: var(--blue-700);
}

.filter-bar,
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.7rem;
  margin-bottom: 1rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
}

.filter-field {
  min-width: 10rem;
  flex: 1 1 11rem;
}

.filter-field label {
  margin-bottom: 0.2rem;
  font-size: 0.72rem;
}

.alert,
[data-alert] {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.85rem 2.9rem 0.85rem 0.95rem;
  border: 1px solid var(--border-strong);
  border-left-width: 4px;
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--slate-800);
  box-shadow: var(--shadow-xs);
  transition: opacity var(--transition-fast), transform var(--transition-fast), max-height var(--transition-fast), margin var(--transition-fast), padding var(--transition-fast);
}

.alert-info {
  border-color: #93b9f4;
  border-left-color: var(--blue-600);
  background: var(--blue-50);
}

.alert-success {
  border-color: #9fd6b8;
  border-left-color: var(--green-700);
  background: var(--green-50);
}

.alert-warning {
  border-color: #e9c672;
  border-left-color: var(--amber-700);
  background: var(--amber-50);
}

.alert-danger,
.alert-error {
  border-color: #efb4ba;
  border-left-color: var(--red-700);
  background: var(--red-50);
}

.alert-title {
  display: block;
  margin-bottom: 0.12rem;
  color: var(--slate-950);
  font-weight: 750;
}

.alert p:last-child {
  margin-bottom: 0;
}

.alert-close,
[data-dismiss-alert] {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--slate-600);
  font-size: 1.2rem;
}

.alert-close:hover,
[data-dismiss-alert]:hover {
  background: rgb(7 21 35 / 0.07);
  color: var(--slate-950);
}

.alert.is-leaving {
  max-height: 0;
  margin: 0;
  padding-block: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-0.4rem);
}

/* Status badges */

.badge {
  display: inline-flex;
  min-height: 1.65rem;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 760;
  line-height: 1.1;
  white-space: nowrap;
}

.badge::before {
  width: 0.4rem;
  height: 0.4rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.badge-neutral,
.badge-draft,
.badge-planned,
.badge-a-documenter {
  border-color: var(--slate-300);
  background: var(--slate-100);
  color: var(--slate-700);
}

.badge-info,
.badge-in-progress,
.badge-en-cours,
.badge-audit,
.badge-poc {
  border-color: #a8c6f7;
  background: var(--blue-100);
  color: var(--blue-700);
}

.badge-success,
.badge-done,
.badge-termine,
.badge-validated,
.badge-valide,
.badge-production {
  border-color: #9ad4b5;
  background: var(--green-100);
  color: var(--green-700);
}

.badge-warning,
.badge-review,
.badge-en-validation,
.badge-attention {
  border-color: #e9c46f;
  background: var(--amber-100);
  color: var(--amber-800);
}

.badge-danger,
.badge-blocked,
.badge-bloque,
.badge-late {
  border-color: #edafb5;
  background: var(--red-100);
  color: var(--red-700);
}

.badge-purple,
.badge-decision {
  border-color: #c9baf5;
  background: var(--purple-100);
  color: var(--purple-700);
}

.badge-not-started,
.badge-untested,
.badge-disabled,
.badge-superseded {
  border-color: var(--slate-300);
  background: var(--slate-100);
  color: var(--slate-700);
}

.badge-study,
.badge-execution,
.badge-observed-reusable,
.badge-coded,
.badge-static-checked,
.badge-dry-run,
.badge-monitored {
  border-color: #a8c6f7;
  background: var(--blue-100);
  color: var(--blue-700);
}

.badge-ready-for-review,
.badge-paused,
.badge-manual-only,
.badge-deferred,
.badge-open {
  border-color: #e9c46f;
  background: var(--amber-100);
  color: var(--amber-800);
}

.badge-installed,
.badge-active,
.badge-enabled,
.badge-poc-validated,
.badge-production-validated,
.badge-mitigated,
.badge-closed,
.badge-accepted {
  border-color: #9ad4b5;
  background: var(--green-100);
  color: var(--green-700);
}

.badge-static::before,
.badge-method::before,
.badge-role::before {
  display: none;
}

.badge-role {
  border-color: var(--border);
  background: var(--slate-50);
  color: var(--slate-700);
  font-size: 0.65rem;
  text-transform: uppercase;
}

/* Tables and lists */

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-xs);
  -webkit-overflow-scrolling: touch;
}

.data-table,
table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.data-table th,
.data-table td,
table.table th,
table.table td {
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  text-align: left;
}

.data-table th,
table.table th {
  background: var(--slate-50);
  color: var(--slate-700);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table tbody tr,
table.table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover,
table.table tbody tr:hover {
  background: #f8fafc;
}

.data-table tr:last-child td,
table.table tr:last-child td {
  border-bottom: 0;
}

.data-table .primary-cell {
  min-width: 13rem;
  color: var(--slate-950);
  font-weight: 680;
}

.data-table .secondary-line {
  display: block;
  margin-top: 0.16rem;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 450;
}

.row-link {
  color: var(--slate-950);
  font-weight: 700;
  text-decoration: none;
}

.row-link:hover {
  color: var(--blue-700);
  text-decoration: underline;
}

.list-group {
  margin: 0;
  padding: 0;
  list-style: none;
}

.list-group-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

.list-group-item:first-child {
  padding-top: 0;
}

.list-group-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.list-item-body {
  min-width: 0;
  flex: 1;
}

.list-item-title {
  margin: 0;
  color: var(--slate-950);
  font-size: 0.88rem;
  font-weight: 700;
}

.list-item-meta {
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  margin: 1.2rem 0 0;
  padding: 0;
  list-style: none;
}

.pagination a,
.pagination span {
  display: grid;
  min-width: 2.35rem;
  min-height: 2.35rem;
  place-items: center;
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: var(--white);
  color: var(--slate-700);
  font-size: 0.8rem;
  text-decoration: none;
}

.pagination [aria-current="page"],
.pagination .active {
  border-color: var(--blue-700);
  background: var(--blue-700);
  color: var(--white);
}

/* Tabs, kanban and project views */

.tabs {
  display: flex;
  gap: 0.2rem;
  margin: 0 0 1rem;
  padding: 0.25rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 0.72rem;
  background: var(--white);
  list-style: none;
  scrollbar-width: thin;
}

.tabs a,
.tab-button {
  display: inline-flex;
  min-height: 2.25rem;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.75rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--slate-600);
  font-size: 0.8rem;
  font-weight: 680;
  text-decoration: none;
  white-space: nowrap;
}

.tabs a:hover,
.tab-button:hover {
  background: var(--slate-50);
  color: var(--slate-950);
}

.tabs a[aria-current="page"],
.tabs a.active,
.tab-button[aria-selected="true"],
.tab-button.active {
  background: var(--navy-850);
  color: var(--white);
}

.kanban {
  display: grid;
  grid-auto-columns: minmax(17rem, 1fr);
  grid-auto-flow: column;
  gap: 0.9rem;
  padding-bottom: 0.65rem;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: inline proximity;
}

.kanban-column {
  min-height: 20rem;
  padding: 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #eaf0f6;
  scroll-snap-align: start;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.2rem 0.2rem 0.7rem;
}

.kanban-column-title {
  margin: 0;
  color: var(--slate-800);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.kanban-count {
  min-width: 1.55rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--white);
  color: var(--slate-600);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.kanban-card {
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-xs);
}

.kanban-card + .kanban-card {
  margin-top: 0.65rem;
}

.kanban-card:hover {
  border-color: #afbfce;
  box-shadow: var(--shadow-sm);
}

.kanban-card h3 {
  margin-bottom: 0.4rem;
  font-size: 0.87rem;
}

.kanban-card h3 a {
  color: var(--slate-950);
  text-decoration: none;
}

.kanban-card h3 a:hover {
  color: var(--blue-700);
}

.kanban-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.status-form,
[data-status-form] {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem;
}

.status-form select,
[data-status-form] select {
  min-width: 10.5rem;
}

/* Timelines and activity */

.timeline {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline::before {
  position: absolute;
  top: 0.4rem;
  bottom: 0.4rem;
  left: 0.55rem;
  width: 2px;
  background: var(--slate-200);
  content: "";
}

.timeline-item {
  position: relative;
  padding: 0 0 1.15rem 2rem;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-marker {
  position: absolute;
  z-index: 1;
  top: 0.28rem;
  left: 0.18rem;
  width: 0.78rem;
  height: 0.78rem;
  border: 3px solid var(--white);
  border-radius: 50%;
  background: var(--teal-600);
  box-shadow: 0 0 0 1px var(--teal-600);
}

.timeline-marker.warning {
  background: var(--amber-700);
  box-shadow: 0 0 0 1px var(--amber-700);
}

.timeline-marker.danger {
  background: var(--red-700);
  box-shadow: 0 0 0 1px var(--red-700);
}

.timeline-title {
  margin-bottom: 0.15rem;
  color: var(--slate-900);
  font-size: 0.86rem;
  font-weight: 700;
}

.timeline-meta {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.timeline-body {
  margin-top: 0.35rem;
  color: var(--slate-700);
  font-size: 0.82rem;
}

.activity-icon {
  display: grid;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 0.58rem;
  background: var(--teal-100);
  color: var(--teal-700);
}

/* API documentation */

.api-layout {
  display: grid;
  grid-template-columns: minmax(14rem, 18rem) minmax(0, 1fr);
  gap: 1.15rem;
  align-items: start;
}

.api-sidebar,
.docs-sidebar {
  position: sticky;
  top: calc(var(--topbar-height) + 1rem);
  max-height: calc(100vh - var(--topbar-height) - 2rem);
  overflow-y: auto;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-xs);
}

.api-sidebar ul,
.docs-sidebar ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.api-sidebar a,
.docs-sidebar a {
  display: block;
  padding: 0.5rem 0.6rem;
  border-radius: 0.48rem;
  color: var(--slate-700);
  font-size: 0.78rem;
  font-weight: 620;
  text-decoration: none;
}

.api-sidebar a:hover,
.docs-sidebar a:hover,
.api-sidebar a[aria-current="page"],
.docs-sidebar a[aria-current="page"] {
  background: var(--blue-50);
  color: var(--blue-700);
}

.api-catalog {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.api-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-xs);
}

.api-card:hover {
  border-color: #adc0d0;
  box-shadow: var(--shadow-sm);
}

.api-card-header,
.endpoint-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.api-card h2,
.api-card h3 {
  margin-bottom: 0.3rem;
  font-size: 1rem;
}

.api-card p {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.api-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.api-endpoint,
.endpoint-panel {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-xs);
}

.endpoint-summary {
  align-items: center;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--slate-50);
}

.endpoint-route {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.65rem;
}

.http-method,
.badge-method {
  min-width: 3.35rem;
  padding: 0.3rem 0.5rem;
  border-radius: 0.42rem;
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
}

.method-get {
  background: var(--blue-700);
}

.method-post {
  background: var(--green-700);
}

.method-put,
.method-patch {
  background: var(--amber-800);
}

.method-delete {
  background: var(--red-700);
}

.endpoint-path,
code {
  font-family: var(--font-mono);
}

.endpoint-path {
  overflow: hidden;
  color: var(--slate-950);
  font-size: 0.82rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.endpoint-body {
  padding: 1rem;
}

.api-metadata,
.definition-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.definition-item {
  padding: 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--slate-50);
}

.definition-item dt,
.definition-label {
  margin-bottom: 0.18rem;
  color: var(--text-muted);
  font-size: 0.67rem;
  font-weight: 780;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.definition-item dd,
.definition-value {
  margin: 0;
  color: var(--slate-900);
  font-size: 0.8rem;
  font-weight: 640;
}

pre,
.code-block {
  max-width: 100%;
  overflow: auto;
  padding: 1rem;
  border: 1px solid #263f58;
  border-radius: var(--radius-md);
  background: var(--navy-950);
  color: #dbe8f3;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.6;
  tab-size: 2;
  white-space: pre;
}

code {
  padding: 0.08em 0.3em;
  border-radius: 0.28rem;
  background: var(--slate-100);
  color: #163b68;
  font-size: 0.88em;
}

pre code,
.code-block code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

.flow-map {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.7rem;
}

.flow-node {
  position: relative;
  min-height: 6rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-top: 3px solid var(--teal-600);
  border-radius: var(--radius-md);
  background: var(--white);
  text-align: center;
}

.flow-node strong {
  display: block;
  color: var(--slate-950);
}

.flow-node span {
  display: block;
  margin-top: 0.25rem;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.docs-article {
  max-width: 58rem;
}

.docs-article h2 {
  margin-top: 2rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.docs-article h3 {
  margin-top: 1.45rem;
}

.docs-article p,
.docs-article li {
  color: var(--slate-700);
}

.docs-article blockquote {
  margin-inline: 0;
  padding: 0.8rem 1rem;
  border-left: 4px solid var(--teal-600);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--teal-50);
  color: var(--slate-700);
}

/* Comments */

.comments-section {
  margin-top: 1.5rem;
}

.comments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.comments-header h2,
.comments-header h3 {
  margin: 0;
}

.comment-count {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.comment-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.comment,
.comment-item {
  display: grid;
  grid-template-columns: 2.35rem minmax(0, 1fr);
  gap: 0.75rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.comment:first-child,
.comment-item:first-child {
  padding-top: 0;
}

.comment:last-child,
.comment-item:last-child {
  border-bottom: 0;
}

.comment-main {
  min-width: 0;
}

.comment-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.55rem;
  margin-bottom: 0.35rem;
}

.comment-author {
  color: var(--slate-950);
  font-size: 0.84rem;
  font-weight: 750;
}

.comment-time {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.comment-body {
  color: var(--slate-700);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.comment-body > :last-child {
  margin-bottom: 0;
}

.comment-permalink {
  color: var(--slate-500);
  font-size: 0.72rem;
}

.comment-composer {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--slate-50);
}

.comment-composer textarea {
  background: var(--white);
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.65rem;
}

.character-count {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.character-count.is-near-limit,
[data-comment-characters].is-near-limit {
  color: var(--amber-800);
  font-weight: 700;
}

.character-count.is-at-limit,
[data-comment-characters].is-at-limit {
  color: var(--red-700);
  font-weight: 750;
}

/* Empty, error and loading states */

.empty-state,
.error-state {
  display: grid;
  min-height: 16rem;
  place-items: center;
  padding: 2.25rem 1.25rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--white);
  text-align: center;
}

.empty-state-inner,
.error-state-inner {
  max-width: 28rem;
}

.empty-state-icon,
.error-state-icon {
  display: grid;
  width: 3.35rem;
  height: 3.35rem;
  margin: 0 auto 0.9rem;
  place-items: center;
  border-radius: 1rem;
  background: var(--blue-50);
  color: var(--blue-700);
}

.error-state-icon {
  background: var(--red-50);
  color: var(--red-700);
}

.empty-state h2,
.empty-state h3,
.error-state h2,
.error-state h3 {
  margin-bottom: 0.35rem;
}

.empty-state p,
.error-state p {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.skeleton {
  overflow: hidden;
  border-radius: 0.35rem;
  background: linear-gradient(90deg, var(--slate-100) 25%, #f7f9fc 50%, var(--slate-100) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.35s infinite linear;
}

.skeleton-line {
  height: 0.85rem;
  margin-bottom: 0.55rem;
}

@keyframes skeleton-shimmer {
  to {
    background-position: -200% 0;
  }
}

/* Login */

.login-page {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(20rem, 0.9fr) minmax(28rem, 1.1fr);
  background: var(--white);
}

.login-brand-panel {
  position: relative;
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: clamp(2rem, 5vw, 4.5rem);
  background:
    radial-gradient(circle at 18% 15%, rgb(18 163 160 / 0.3), transparent 24rem),
    radial-gradient(circle at 90% 85%, rgb(37 99 235 / 0.2), transparent 28rem),
    linear-gradient(145deg, var(--navy-850), var(--navy-950));
  color: var(--white);
}

.login-brand-panel::after {
  position: absolute;
  right: -8rem;
  bottom: -8rem;
  width: 24rem;
  height: 24rem;
  border: 1px solid rgb(255 255 255 / 0.1);
  border-radius: 50%;
  box-shadow: 0 0 0 4rem rgb(255 255 255 / 0.025), 0 0 0 8rem rgb(255 255 255 / 0.018);
  content: "";
}

.login-brand-panel h1 {
  max-width: 34rem;
  color: var(--white);
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.login-brand-panel p {
  max-width: 32rem;
  color: #bfd0de;
}

.login-form-panel {
  display: grid;
  place-items: center;
  padding: 2rem;
}

.login-card {
  width: min(100%, 27rem);
}

.login-logo {
  width: auto;
  max-width: 11rem;
  max-height: 3.5rem;
  margin-bottom: 1.6rem;
  object-fit: contain;
}

.login-card h1,
.login-card h2 {
  margin-bottom: 0.45rem;
}

.login-intro {
  margin-bottom: 1.5rem;
  color: var(--text-muted);
}

.login-footer {
  margin-top: 1.2rem;
  color: var(--text-muted);
  font-size: 0.74rem;
  text-align: center;
}

/* Footer */

.app-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 2rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.72rem;
}

/* Responsive */

@media (max-width: 75rem) {
  .grid-4,
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .api-metadata,
  .definition-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 62rem) {
  .app-shell {
    display: block;
  }

  .sidebar {
    visibility: hidden;
    transform: translateX(-102%);
    box-shadow: var(--shadow-lg);
    transition: transform var(--transition-base), visibility var(--transition-base);
  }

  .sidebar.is-open,
  body.nav-open .sidebar {
    visibility: visible;
    transform: translateX(0);
  }

  .sidebar-overlay.is-open,
  body.nav-open .sidebar-overlay {
    visibility: visible;
    opacity: 1;
  }

  .app-frame,
  .app-main {
    grid-column: auto;
  }

  .mobile-menu-toggle {
    display: grid;
  }

  .topbar-search,
  .search-box {
    width: min(22rem, 40vw);
  }

  .api-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .api-sidebar,
  .docs-sidebar {
    position: static;
    max-height: none;
  }

  .api-sidebar ul,
  .docs-sidebar ul {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
  }

  .api-sidebar a,
  .docs-sidebar a {
    white-space: nowrap;
  }
}

@media (max-width: 48rem) {
  :root {
    --topbar-height: 4rem;
  }

  .topbar {
    gap: 0.55rem;
    padding-inline: 0.8rem;
  }

  .topbar-search {
    display: none;
  }

  .user-copy {
    display: none;
  }

  .main-content,
  main.content {
    padding: 1rem;
  }

  .page-header,
  .section-header {
    align-items: stretch;
    flex-direction: column;
  }

  .page-actions,
  .page-actions .btn {
    width: 100%;
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .metrics-grid,
  .api-catalog {
    grid-template-columns: minmax(0, 1fr);
  }

  .span-2 {
    grid-column: auto;
  }

  .metric-card {
    min-height: 7.5rem;
  }

  .card-header,
  .card-body {
    padding: 0.9rem;
  }

  .filter-bar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-field,
  .filter-bar .btn,
  .toolbar .btn {
    width: 100%;
  }

  .data-table.responsive-table thead,
  table.table.responsive-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .data-table.responsive-table,
  .data-table.responsive-table tbody,
  .data-table.responsive-table tr,
  .data-table.responsive-table td,
  table.table.responsive-table,
  table.table.responsive-table tbody,
  table.table.responsive-table tr,
  table.table.responsive-table td {
    display: block;
    width: 100%;
  }

  .data-table.responsive-table tr,
  table.table.responsive-table tr {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
  }

  .data-table.responsive-table tr:last-child,
  table.table.responsive-table tr:last-child {
    border-bottom: 0;
  }

  .data-table.responsive-table td,
  table.table.responsive-table td {
    display: grid;
    grid-template-columns: minmax(7.5rem, 38%) minmax(0, 1fr);
    gap: 0.65rem;
    padding: 0.42rem 0.85rem;
    border: 0;
    text-align: right;
  }

  .data-table.responsive-table td::before,
  table.table.responsive-table td::before {
    color: var(--text-muted);
    content: attr(data-label);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-align: left;
    text-transform: uppercase;
  }

  .api-metadata,
  .definition-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .endpoint-summary,
  .endpoint-route {
    align-items: flex-start;
    flex-direction: column;
  }

  .endpoint-path {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .composer-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .composer-footer .btn {
    width: 100%;
  }

  .login-page {
    display: block;
    background: var(--canvas);
  }

  .login-brand-panel {
    min-height: auto;
    padding: 1.4rem;
  }

  .login-brand-panel h1 {
    margin-bottom: 0.45rem;
    font-size: 1.6rem;
  }

  .login-brand-panel p {
    margin-bottom: 0;
    font-size: 0.85rem;
  }

  .login-form-panel {
    padding: 1.35rem 1rem;
  }

  .login-card {
    padding: 1.2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--white);
    box-shadow: var(--shadow-sm);
  }

  .app-footer {
    padding-inline: 1rem;
  }
}

@media (max-width: 30rem) {
  .sidebar {
    width: min(90vw, var(--sidebar-width));
  }

  .topbar-context,
  .icon-button.optional-mobile {
    display: none;
  }

  .topbar-actions {
    gap: 0.3rem;
  }

  .page-actions,
  .card-actions,
  .toolbar-actions,
  .status-form,
  [data-status-form] {
    align-items: stretch;
    flex-direction: column;
  }

  .page-actions .btn,
  .card-actions .btn,
  .status-form .btn,
  .status-form select,
  [data-status-form] .btn,
  [data-status-form] select {
    width: 100%;
  }

  .comment,
  .comment-item {
    grid-template-columns: 2rem minmax(0, 1fr);
  }

  .comment .avatar,
  .comment-item .avatar {
    width: 2rem;
    height: 2rem;
  }
}

/* Accessibility preferences */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  .badge,
  .btn,
  .card,
  .metric-card,
  .kanban-card,
  .api-card {
    border: 1px solid ButtonText;
  }

  .badge::before,
  .timeline-marker {
    background: currentColor;
  }

  :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 3px solid Highlight;
  }
}

@media print {
  body {
    background: var(--white);
    color: #000;
  }

  .sidebar,
  .topbar,
  .sidebar-overlay,
  .page-actions,
  .filter-bar,
  .toolbar,
  .comment-composer,
  .app-footer {
    display: none !important;
  }

  .app-shell,
  .app-frame,
  .app-main {
    display: block;
  }

  .main-content,
  main.content {
    max-width: none;
    padding: 0;
  }

  .card,
  .metric-card,
  .table-responsive,
  .api-card,
  .api-endpoint {
    break-inside: avoid;
    box-shadow: none;
  }

  a {
    color: #000;
    text-decoration: underline;
  }
}

/* Template integration ----------------------------------------------------
 * These semantic aliases match the server-rendered Django templates while
 * keeping the reusable primitives above available to future screens.
 */

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

.eyebrow {
  display: inline-block;
  margin-bottom: 0.35rem;
  color: var(--teal-700);
  font-size: 0.68rem;
  font-weight: 820;
  letter-spacing: 0.09em;
  line-height: 1.2;
  text-transform: uppercase;
}

.eyebrow-light {
  color: #8bdad5;
}

.main-column {
  grid-column: 2;
  min-width: 0;
}

.sidebar-brand > a {
  display: flex;
  min-width: 0;
  align-items: center;
}

.program-label {
  min-width: 0;
  padding-left: 0.8rem;
  border-left: 1px solid rgb(255 255 255 / 0.18);
  line-height: 1.25;
}

.program-label span,
.program-label strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.program-label span {
  color: #9fb2c4;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.program-label strong {
  margin-top: 0.16rem;
  color: var(--white);
  font-size: 0.84rem;
}

.sidebar-nav .nav-link.is-active {
  background: linear-gradient(90deg, rgb(18 163 160 / 0.24), rgb(37 99 235 / 0.13));
  color: var(--white);
  box-shadow: inset 3px 0 var(--teal-500);
}

.environment-chip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: #e7eef5;
  font-weight: 700;
}

.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #35d399;
  box-shadow: 0 0 0 3px rgb(53 211 153 / 0.14);
}

.sidebar-footer p {
  margin: 0.28rem 0 0;
}

.mobile-menu-button {
  display: none;
}

.global-search {
  position: relative;
  width: min(32rem, 44vw);
}

.global-search input {
  width: 100%;
  min-height: 2.7rem;
  padding: 0.6rem 0.9rem 0.6rem 2.45rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--slate-50);
}

.global-search .search-icon {
  position: absolute;
  top: 50%;
  left: 0.85rem;
  transform: translateY(-50%);
  color: var(--slate-500);
  font-size: 1.25rem;
  pointer-events: none;
}

.topbar .user-menu {
  margin-left: auto;
}

.user-avatar,
.comment-avatar {
  display: inline-grid;
  width: 2.35rem;
  height: 2.35rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-600), var(--blue-600));
  color: var(--white);
  font-size: 0.78rem;
  font-weight: 800;
}

.user-meta {
  min-width: 0;
}

.user-meta strong,
.user-meta span {
  display: block;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-meta strong {
  color: var(--slate-950);
  font-size: 0.8rem;
}

.user-meta span {
  color: var(--text-muted);
  font-size: 0.68rem;
}

.text-button {
  min-height: 2.2rem;
  padding: 0.35rem 0.55rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--slate-600);
  font-size: 0.74rem;
  font-weight: 680;
}

.text-button:hover {
  background: var(--slate-100);
  color: var(--navy-900);
}

.message-stack {
  position: relative;
  z-index: 35;
  width: min(calc(100% - 2rem), var(--content-max));
  margin: 1rem auto -0.25rem;
  padding-inline: clamp(0rem, 1.4vw, 1rem);
}

.page-header-split {
  flex-direction: row;
}

.header-meta {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.text-link {
  color: var(--blue-700);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.button {
  display: inline-flex;
  min-height: 2.65rem;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.58rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 0.65rem;
  font-size: 0.86rem;
  font-weight: 720;
  line-height: 1.2;
  text-decoration: none;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  border-color: var(--blue-700);
  background: var(--blue-700);
  color: var(--white);
  box-shadow: 0 1px 2px rgb(29 78 216 / 0.22);
}

.button-primary:hover {
  border-color: #163fbd;
  background: #163fbd;
  color: var(--white);
}

.button-secondary {
  border-color: var(--border-strong);
  background: var(--white);
  color: var(--slate-800);
}

.button-secondary:hover {
  border-color: #9eafc1;
  background: var(--slate-50);
  color: var(--navy-900);
}

.button-block {
  width: 100%;
}

section.card,
article.card,
.discussion.card {
  padding: 1.1rem;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-heading h2,
.section-heading h3,
.section-heading p {
  margin-bottom: 0;
}

.count-chip,
.role-chip,
.priority {
  display: inline-flex;
  min-height: 1.65rem;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--slate-50);
  color: var(--slate-700);
  font-size: 0.69rem;
  font-weight: 750;
  white-space: nowrap;
}

.count-chip {
  font-variant-numeric: tabular-nums;
}

.role-chip {
  min-height: 1.35rem;
  padding-block: 0.12rem;
  color: var(--teal-700);
  font-size: 0.61rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.priority-critical,
.priority-high {
  border-color: #edafb5;
  background: var(--red-100);
  color: var(--red-700);
}

.priority-medium {
  border-color: #e9c46f;
  background: var(--amber-100);
  color: var(--amber-800);
}

.priority-low {
  border-color: #a8c6f7;
  background: var(--blue-100);
  color: var(--blue-700);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.metric-card-primary {
  border-color: #9ddbd7;
  background: linear-gradient(145deg, var(--white), var(--teal-50));
}

.metric-card-warning {
  border-color: #e9c46f;
  background: linear-gradient(145deg, var(--white), var(--amber-50));
}

.metric-value small {
  color: var(--slate-500);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
}

.metric-card > small:last-child {
  display: block;
  margin-top: 0.62rem;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.progress-track {
  height: 0.5rem;
  margin-top: 0.7rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--slate-100);
}

.progress-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal-600), var(--blue-600));
}

.transition-card {
  display: grid;
  grid-template-columns: minmax(16rem, 0.9fr) minmax(28rem, 1.45fr);
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: center;
  margin-bottom: 1.15rem;
  border-color: #b7d7de;
  background:
    radial-gradient(circle at 95% 20%, rgb(37 99 235 / 0.08), transparent 22rem),
    var(--white);
}

.transition-intro h2 {
  font-size: clamp(1.2rem, 1.7vw, 1.55rem);
}

.transition-intro p {
  margin-bottom: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.transition-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 0.55rem;
  align-items: center;
}

.flow-step {
  min-height: 7.5rem;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--slate-50);
  text-align: center;
}

.flow-step > span {
  display: grid;
  width: 1.8rem;
  height: 1.8rem;
  margin: 0 auto 0.5rem;
  place-items: center;
  border-radius: 50%;
  background: var(--navy-850);
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 800;
}

.flow-step strong,
.flow-step small {
  display: block;
}

.flow-step strong {
  color: var(--slate-950);
  font-size: 0.78rem;
}

.flow-step small {
  margin-top: 0.25rem;
  color: var(--text-muted);
  font-size: 0.67rem;
}

.flow-step.is-current {
  border-color: #84ccc8;
  background: var(--teal-50);
}

.flow-step.is-current > span {
  background: var(--teal-700);
}

.flow-arrow {
  color: var(--slate-400);
  font-size: 1.2rem;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.75fr) minmax(17rem, 0.85fr);
  margin-bottom: 1.15rem;
}

.dashboard-grid > .span-2 {
  grid-column: auto;
}

.content > section.card + section.card,
.content > .card + .card {
  margin-top: 1.15rem;
}

.milestone-row {
  display: grid;
  grid-template-columns: 0.7rem minmax(0, 1fr) auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.72rem 0;
  border-bottom: 1px solid var(--border);
}

.milestone-row:first-child {
  padding-top: 0;
}

.milestone-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.milestone-marker,
.severity-dot {
  width: 0.58rem;
  height: 0.58rem;
  border-radius: 50%;
  background: var(--blue-600);
}

.milestone-marker.status-success,
.milestone-marker.status-done,
.milestone-marker.status-validated {
  background: var(--green-700);
}

.milestone-marker.status-warning,
.milestone-marker.status-review {
  background: var(--amber-700);
}

.milestone-marker.status-danger,
.milestone-marker.status-blocked {
  background: var(--red-700);
}

.milestone-row > div:nth-child(2) strong,
.milestone-row > div:nth-child(2) span {
  display: block;
}

.milestone-row > div:nth-child(2) strong {
  color: var(--slate-950);
  font-size: 0.82rem;
}

.milestone-row > div:nth-child(2) span,
.milestone-row time {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.risk-item {
  display: grid;
  grid-template-columns: 0.65rem minmax(0, 1fr);
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.risk-item:first-child {
  padding-top: 0;
}

.risk-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.severity-dot {
  margin-top: 0.35rem;
}

.severity-critical,
.severity-high {
  background: var(--red-700);
}

.severity-medium {
  background: var(--amber-700);
}

.severity-low {
  background: var(--blue-600);
}

.risk-item strong,
.risk-item small {
  display: block;
}

.risk-item strong {
  color: var(--slate-950);
  font-size: 0.8rem;
}

.risk-item small {
  margin-top: 0.15rem;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.workstream-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.workstream-grid.large {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workstream-card {
  display: flex;
  min-width: 0;
  min-height: 12rem;
  flex-direction: column;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--white);
  color: inherit;
  box-shadow: var(--shadow-xs);
  text-decoration: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.workstream-card:hover {
  border-color: #9fb6c8;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.workstream-card.detailed {
  min-height: 15rem;
}

.workstream-key,
.mono-key {
  color: var(--teal-700);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.workstream-card h2,
.workstream-card h3 {
  margin: 0.45rem 0 0.4rem;
}

.workstream-card p {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.workstream-card footer,
.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.workstream-card footer {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  color: var(--slate-600);
  font-size: 0.7rem;
}

.workstream-card footer strong {
  color: var(--blue-700);
}

.system-path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 0.35rem 0 0.85rem;
  padding: 0.55rem;
  border-radius: 0.55rem;
  background: var(--slate-50);
  color: var(--slate-700);
  font-size: 0.7rem;
  font-weight: 680;
}

.compact-timeline::before {
  left: 0.4rem;
}

.compact-timeline .timeline-item {
  padding: 0 0 0.9rem 1.65rem;
}

.timeline-dot {
  position: absolute;
  z-index: 1;
  top: 0.3rem;
  left: 0.08rem;
  width: 0.66rem;
  height: 0.66rem;
  border: 2px solid var(--white);
  border-radius: 50%;
  background: var(--teal-600);
  box-shadow: 0 0 0 1px var(--teal-600);
}

.compact-timeline .timeline-item strong,
.compact-timeline .timeline-item small,
.change-line {
  display: block;
}

.compact-timeline .timeline-item strong {
  color: var(--slate-900);
  font-size: 0.8rem;
}

.compact-timeline .timeline-item small {
  margin-top: 0.15rem;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.change-line {
  margin-top: 0.3rem;
  padding: 0.3rem 0.5rem;
  border-radius: 0.4rem;
  background: var(--slate-50);
  color: var(--slate-700);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.phase-stack > * + * {
  margin-top: 1rem;
}

.phase-header {
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: flex-start;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.phase-index {
  display: grid;
  width: 3.2rem;
  height: 3.2rem;
  place-items: center;
  border-radius: 0.9rem;
  background: var(--navy-850);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 800;
}

.phase-title h2 {
  margin-bottom: 0.3rem;
}

.phase-title p {
  margin-bottom: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.phase-content-grid,
.two-column-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.linked-list > * + * {
  margin-top: 0.4rem;
}

.linked-list > a,
.linked-row {
  display: grid;
  grid-template-columns: minmax(4.5rem, auto) minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: var(--slate-50);
  color: var(--slate-700);
  font-size: 0.72rem;
  text-decoration: none;
}

.linked-list > a:hover {
  border-color: #aac0d1;
  background: var(--blue-50);
  color: var(--blue-700);
}

.linked-list strong,
.linked-row strong {
  overflow: hidden;
  color: var(--slate-950);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-ring {
  --ring-color: var(--teal-600);
  position: relative;
  display: grid;
  width: 6.25rem;
  height: 6.25rem;
  flex: 0 0 auto;
  place-content: center;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color) calc(var(--progress) * 1%), var(--slate-100) 0);
  text-align: center;
}

.progress-ring::before {
  position: absolute;
  inset: 0.55rem;
  border-radius: 50%;
  background: var(--white);
  content: "";
}

.progress-ring strong,
.progress-ring span {
  position: relative;
  z-index: 1;
}

.progress-ring strong {
  color: var(--navy-900);
  font-size: 1.25rem;
  line-height: 1;
}

.progress-ring span {
  margin-top: 0.22rem;
  color: var(--text-muted);
  font-size: 0.6rem;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  -webkit-overflow-scrolling: touch;
}

.table-wrap .data-table td > small {
  display: block;
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(17rem, 22rem);
  gap: 1.15rem;
  align-items: start;
}

.detail-main,
.detail-sidebar {
  min-width: 0;
}

.detail-main > * + *,
.detail-sidebar > * + * {
  margin-top: 1rem;
}

.detail-sidebar {
  position: sticky;
  top: calc(var(--topbar-height) + 1rem);
}

.detail-layout.api-layout {
  grid-template-columns: minmax(0, 1fr) minmax(17rem, 22rem);
}

.prose {
  color: var(--slate-700);
}

.prose > :last-child {
  margin-bottom: 0;
}

.plain-list,
.warning-list,
.check-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.plain-list li,
.warning-list li,
.check-list li {
  position: relative;
  padding: 0.48rem 0 0.48rem 1.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--slate-700);
  font-size: 0.82rem;
}

.plain-list li:last-child,
.warning-list li:last-child,
.check-list li:last-child {
  border-bottom: 0;
}

.plain-list li::before,
.check-list li::before {
  position: absolute;
  top: 0.54rem;
  left: 0;
  display: grid;
  width: 1rem;
  height: 1rem;
  place-items: center;
  border-radius: 50%;
  background: var(--teal-100);
  color: var(--teal-700);
  content: "✓";
  font-size: 0.62rem;
  font-weight: 900;
}

.warning-list li::before {
  position: absolute;
  top: 0.55rem;
  left: 0.1rem;
  color: var(--amber-800);
  content: "!";
  font-weight: 900;
}

.metadata-card h2,
.status-action-card h2 {
  font-size: 1rem;
}

.metadata-list {
  margin: 0;
}

.metadata-list > div {
  display: grid;
  grid-template-columns: minmax(7rem, 42%) minmax(0, 1fr);
  gap: 0.6rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}

.metadata-list > div:last-child {
  border-bottom: 0;
}

.metadata-list dt {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 650;
}

.metadata-list dd {
  margin: 0;
  color: var(--slate-900);
  font-size: 0.74rem;
  font-weight: 650;
  overflow-wrap: anywhere;
  text-align: right;
}

.status-action-card {
  border-color: #9ddbd7;
  background: var(--teal-50);
}

.status-action-card p,
.permission-note p {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.permission-note {
  border-left: 4px solid var(--blue-600);
  background: var(--blue-50);
}

.permission-note strong {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--slate-950);
}

.permission-note p:last-child,
.status-action-card p:last-of-type {
  margin-bottom: 0.75rem;
}

.empty-state.compact {
  min-height: 6rem;
  padding: 1rem;
}

.empty-state.compact p:last-child {
  margin-bottom: 0;
}

/* API catalogue templates */

.api-principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.api-principles > div {
  position: relative;
  padding-left: 1.2rem;
}

.api-principles strong,
.api-principles p {
  display: block;
}

.api-principles strong {
  color: var(--slate-950);
  font-size: 0.8rem;
}

.api-principles p {
  margin: 0.18rem 0 0;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.api-legend-dot {
  position: absolute;
  top: 0.3rem;
  left: 0;
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  background: var(--slate-500);
}

.api-legend-dot.implementation {
  background: var(--teal-600);
}

.api-legend-dot.validation {
  background: var(--blue-600);
}

.api-legend-dot.activation {
  background: var(--amber-700);
}

.form-field.inline {
  min-width: 10rem;
  flex: 1 1 12rem;
}

.form-field.inline label {
  margin-bottom: 0.2rem;
  font-size: 0.7rem;
}

.api-list > * + * {
  margin-top: 0.75rem;
}

.api-list .api-card {
  display: grid;
  min-height: auto;
  grid-template-columns: 4rem minmax(0, 1fr) minmax(7rem, auto);
  gap: 1rem;
  align-items: flex-start;
  color: inherit;
  text-decoration: none;
}

.api-list .api-card.is-planned {
  border-style: dashed;
  background: #fbfcfe;
}

.api-card-main {
  min-width: 0;
}

.api-card-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.75rem;
}

.api-card-title h2 {
  margin-bottom: 0.2rem;
}

.api-card-main > code {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-card-main p {
  margin: 0.5rem 0;
}

.api-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.api-system {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 680;
  text-align: right;
}

.api-method {
  display: inline-grid;
  min-width: 3.6rem;
  min-height: 2rem;
  place-items: center;
  padding: 0.3rem 0.45rem;
  border-radius: 0.42rem;
  background: var(--slate-700);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 850;
}

.api-method-get {
  background: var(--blue-700);
}

.api-method-post {
  background: var(--green-700);
}

.api-method-put,
.api-method-patch {
  background: var(--amber-800);
}

.api-method-delete {
  background: var(--red-700);
}

.api-method-event {
  background: var(--purple-700);
}

.api-detail-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  justify-content: stretch;
}

.api-detail-header .api-method {
  margin-top: 0.2rem;
}

.api-detail-header .endpoint-path {
  display: inline-block;
  margin-bottom: 0.5rem;
}

.api-state-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}

.state-card {
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-xs);
}

.state-card span,
.state-card strong {
  display: block;
}

.state-card span {
  color: var(--text-muted);
  font-size: 0.68rem;
}

.state-card strong {
  margin-top: 0.2rem;
  color: var(--slate-950);
  font-size: 0.82rem;
}

.definition-grid > div {
  padding: 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--slate-50);
}

.definition-grid > div dt {
  margin-bottom: 0.18rem;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 780;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.definition-grid > div dd {
  margin: 0;
  color: var(--slate-900);
  font-size: 0.78rem;
  font-weight: 640;
}

.code-card pre {
  margin-bottom: 0;
}

/* Discussion template */

.discussion {
  scroll-margin-top: calc(var(--topbar-height) + 1rem);
}

.comment-avatar {
  width: 2.2rem;
  height: 2.2rem;
  background: linear-gradient(135deg, var(--navy-700), var(--teal-600));
}

.comment-content {
  min-width: 0;
}

.comment-content header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  margin-bottom: 0.35rem;
}

.comment-content header > strong {
  color: var(--slate-950);
  font-size: 0.82rem;
}

.comment-content p {
  margin-bottom: 0;
  color: var(--slate-700);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.comment-form {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.comment-form textarea {
  min-height: 8rem;
}

.comment-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.65rem;
}

.comment-form-footer .muted {
  font-size: 0.7rem;
}

.field-error {
  display: block;
  margin-top: 0.32rem;
  color: var(--red-700);
  font-size: 0.74rem;
  font-weight: 650;
}

/* Login template */

body.login-page {
  display: block;
  background: var(--navy-950);
}

.login-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(22rem, 1.05fr) minmax(27rem, 0.95fr);
}

.login-visual {
  position: relative;
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: clamp(2rem, 5vw, 4.5rem);
  background:
    radial-gradient(circle at 18% 15%, rgb(18 163 160 / 0.3), transparent 24rem),
    radial-gradient(circle at 90% 85%, rgb(37 99 235 / 0.2), transparent 28rem),
    linear-gradient(145deg, var(--navy-850), var(--navy-950));
  color: var(--white);
}

.login-visual::after {
  position: absolute;
  right: -8rem;
  bottom: -8rem;
  width: 24rem;
  height: 24rem;
  border: 1px solid rgb(255 255 255 / 0.1);
  border-radius: 50%;
  box-shadow: 0 0 0 4rem rgb(255 255 255 / 0.025), 0 0 0 8rem rgb(255 255 255 / 0.018);
  content: "";
}

.login-visual .login-logo {
  position: relative;
  z-index: 1;
  max-width: 11rem;
}

.login-visual-content,
.login-principles {
  position: relative;
  z-index: 1;
}

.login-visual-content h1 {
  max-width: 38rem;
  color: var(--white);
  font-size: clamp(2.1rem, 4.5vw, 3.75rem);
}

.login-visual-content p {
  max-width: 34rem;
  margin-bottom: 0;
  color: #bfd0de;
  font-size: clamp(0.9rem, 1.2vw, 1.05rem);
}

.login-principles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.login-principles span {
  padding: 0.3rem 0.62rem;
  border: 1px solid rgb(255 255 255 / 0.16);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.06);
  color: #d5e1eb;
  font-size: 0.68rem;
  font-weight: 650;
}

.login-panel {
  display: grid;
  min-width: 0;
  place-items: center;
  align-content: center;
  padding: 2rem;
  background: var(--canvas);
}

.login-panel .login-card {
  width: min(100%, 27rem);
  padding: clamp(1.3rem, 3vw, 2rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--white);
  box-shadow: var(--shadow-md);
}

.login-panel .login-footer {
  width: min(100%, 27rem);
}

.login-form {
  margin-top: 1.25rem;
}

.login-form .form-field + .form-field {
  margin-top: 0.9rem;
}

.login-form .button {
  margin-top: 1rem;
}

.login-help {
  margin-top: 1rem;
  padding: 0.7rem;
  border-radius: var(--radius-md);
  background: var(--slate-50);
  color: var(--text-muted);
  font-size: 0.72rem;
}

.login-help strong,
.login-help span {
  display: block;
}

.login-help strong {
  margin-bottom: 0.2rem;
  color: var(--slate-800);
}

@media (max-width: 75rem) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .transition-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .workstream-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .api-state-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 62rem) {
  .main-column {
    grid-column: auto;
  }

  .mobile-menu-button {
    display: inline-grid;
  }

  .global-search {
    width: min(28rem, 46vw);
  }

  .detail-sidebar {
    position: static;
  }
}

@media (max-width: 48rem) {
  .global-search {
    flex: 1;
    width: auto;
  }

  .global-search input {
    min-width: 0;
  }

  .topbar .user-meta,
  .topbar .user-avatar {
    display: none;
  }

  .topbar .user-menu {
    gap: 0;
  }

  .page-header-split,
  .api-detail-header {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
  }

  .header-meta {
    align-items: flex-start;
  }

  .metric-grid,
  .workstream-grid,
  .workstream-grid.large,
  .api-principles,
  .phase-content-grid,
  .two-column-card,
  .detail-layout,
  .detail-layout.api-layout,
  .api-state-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .transition-flow {
    grid-template-columns: minmax(0, 1fr);
  }

  .flow-arrow {
    transform: rotate(90deg);
    text-align: center;
  }

  .milestone-row {
    grid-template-columns: 0.65rem minmax(0, 1fr) auto;
  }

  .milestone-row time {
    grid-column: 2 / -1;
  }

  .phase-header {
    grid-template-columns: 2.7rem minmax(0, 1fr);
  }

  .phase-index {
    width: 2.7rem;
    height: 2.7rem;
  }

  .phase-header > .badge {
    grid-column: 2;
    justify-self: start;
  }

  .linked-list > a,
  .linked-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .linked-list > a > span:first-child,
  .linked-row > span:first-child {
    grid-column: 1 / -1;
  }

  .api-list .api-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .api-system {
    grid-column: 2;
    justify-content: flex-start;
    text-align: left;
  }

  .comment-form-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .comment-form-footer .button {
    width: 100%;
  }

  .login-shell {
    display: block;
    min-height: 100vh;
    background: var(--canvas);
  }

  .login-visual {
    min-height: auto;
    padding: 1.35rem;
  }

  .login-visual .login-logo {
    margin-bottom: 1.25rem;
  }

  .login-visual-content h1 {
    margin-bottom: 0.45rem;
    font-size: 1.65rem;
  }

  .login-principles {
    margin-top: 1rem;
  }

  .login-panel {
    padding: 1.25rem 1rem;
  }
}

@media (max-width: 36rem) {
  .global-search {
    display: none;
  }

  .topbar .user-menu {
    margin-left: auto;
  }

  .metric-grid,
  .api-state-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .api-list .api-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .api-system {
    grid-column: auto;
  }

  .comment-item {
    grid-template-columns: 2rem minmax(0, 1fr);
  }
}

/* Activity, documents, governance and global search */

.activity-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.activity-comments .comment-item:first-child {
  padding-top: 0;
}

.context-link {
  display: inline-flex;
  margin-top: 0.45rem;
  color: var(--blue-700);
  font-size: 0.7rem;
  font-weight: 700;
  text-decoration: none;
}

.context-link:hover {
  text-decoration: underline;
}

.document-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.document-card {
  display: grid;
  min-width: 0;
  grid-template-columns: 2.6rem minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: flex-start;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  color: inherit;
  text-decoration: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.document-card:hover {
  border-color: #9fb6c8;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.document-icon {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  place-items: center;
  border-radius: 0.72rem;
  background: var(--blue-50);
  color: var(--blue-700);
  font-size: 1.1rem;
}

.document-card h3 {
  margin: 0 0 0.28rem;
  color: var(--slate-950);
  font-size: 0.9rem;
}

.document-card p {
  margin-bottom: 0;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.source-chip {
  display: inline-flex;
  min-height: 1.8rem;
  align-items: center;
  padding: 0.24rem 0.62rem;
  border: 1px solid #9ddbd7;
  border-radius: 999px;
  background: var(--teal-50);
  color: var(--teal-700);
  font-size: 0.68rem;
  font-weight: 750;
  white-space: nowrap;
}

.document-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.document-prose {
  min-height: 20rem;
  padding: clamp(1.15rem, 3vw, 2rem) !important;
}

.document-prose h1,
.document-prose h2 {
  margin-top: 1.8rem;
  padding-bottom: 0.42rem;
  border-bottom: 1px solid var(--border);
}

.document-prose h1:first-child,
.document-prose h2:first-child {
  margin-top: 0;
}

.document-prose h3 {
  margin-top: 1.25rem;
}

.document-prose p,
.document-prose li {
  color: var(--slate-700);
}

.document-prose table {
  width: 100%;
  margin-bottom: 1rem;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.document-prose th,
.document-prose td {
  padding: 0.62rem;
  border: 1px solid var(--border);
  text-align: left;
}

.document-prose th {
  background: var(--slate-50);
}

.governance-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(19rem, 0.9fr);
}

.risk-register > * + *,
.decision-list > * + * {
  margin-top: 0.7rem;
}

.risk-register-item {
  display: grid;
  grid-template-columns: 5.2rem minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--slate-50);
}

.risk-severity {
  display: grid;
  min-height: 2rem;
  place-items: center;
  padding: 0.25rem 0.4rem;
  border-radius: 0.45rem;
  background: var(--slate-200);
  color: var(--slate-700);
  font-size: 0.62rem;
  font-weight: 820;
  letter-spacing: 0.035em;
  text-align: center;
  text-transform: uppercase;
}

.risk-severity.severity-critical,
.risk-severity.severity-high {
  background: var(--red-100);
  color: var(--red-700);
}

.risk-severity.severity-medium {
  background: var(--amber-100);
  color: var(--amber-800);
}

.risk-severity.severity-low {
  background: var(--blue-100);
  color: var(--blue-700);
}

.risk-register-item h3 {
  margin: 0.22rem 0 0.32rem;
  font-size: 0.9rem;
}

.risk-register-item p {
  margin-bottom: 0;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.mitigation {
  margin-top: 0.55rem;
  padding: 0.55rem 0.65rem;
  border-left: 3px solid var(--teal-600);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--teal-50);
}

.mitigation strong,
.mitigation span {
  display: block;
}

.mitigation strong {
  color: var(--teal-700);
  font-size: 0.65rem;
  text-transform: uppercase;
}

.mitigation span {
  margin-top: 0.16rem;
  color: var(--slate-700);
  font-size: 0.72rem;
}

.decision-item {
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-xs);
}

.decision-item header,
.decision-item footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.decision-item h3 {
  margin: 0.55rem 0 0.3rem;
  font-size: 0.9rem;
}

.decision-item p {
  color: var(--text-muted);
  font-size: 0.76rem;
}

.decision-item blockquote {
  margin: 0.65rem 0;
  padding: 0.65rem 0.75rem;
  border-left: 3px solid var(--purple-700);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: #f7f4ff;
  color: var(--slate-700);
  font-size: 0.78rem;
}

.decision-item footer {
  justify-content: flex-start;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.68rem;
}

.search-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.result-list > * + * {
  margin-top: 0.45rem;
}

.result-list > a {
  display: grid;
  grid-template-columns: minmax(5.25rem, auto) minmax(0, 1fr);
  gap: 0.25rem 0.7rem;
  padding: 0.62rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: var(--slate-50);
  color: inherit;
  text-decoration: none;
}

.result-list > a:hover {
  border-color: #a8bdd0;
  background: var(--blue-50);
}

.result-list > a strong {
  overflow: hidden;
  color: var(--slate-950);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-list > a small,
.result-list > a code {
  grid-column: 2;
  color: var(--text-muted);
  font-size: 0.68rem;
  overflow-wrap: anywhere;
}

@media (max-width: 62rem) {
  .activity-grid,
  .governance-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 48rem) {
  .document-grid,
  .search-results {
    grid-template-columns: minmax(0, 1fr);
  }

  .risk-register-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .risk-severity {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (max-width: 30rem) {
  .document-card {
    grid-template-columns: 2.4rem minmax(0, 1fr);
  }

  .document-card > .badge {
    grid-column: 2;
    justify-self: start;
  }

  .risk-register-item,
  .result-list > a {
    grid-template-columns: minmax(0, 1fr);
  }

  .risk-register-item > .badge,
  .result-list > a small,
  .result-list > a code {
    grid-column: auto;
    justify-self: start;
  }
}
