/* Layout */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-row { display: flex; flex-direction: row; }
/* `.flex-wrap` was referenced by markup (e.g. the run-detail metadata row
   `flex flex-wrap gap-6`) but never defined, so those rows stayed a single
   non-wrapping line and overflowed the viewport on mobile. Define it. */
.flex-wrap { flex-wrap: wrap; }
.grid { display: grid; }
/* Grid children must be allowed to shrink below their content's intrinsic
   width, otherwise a wide child (e.g. a data table) blows its `1fr` track past
   the viewport and causes page-level horizontal scroll. With min-width:0 the
   child shrinks and its own `.cci-table-wrapper` scrolls internally instead. */
.grid > * { min-width: 0; }
.hidden { display: none; }
.block { display: block; }
.w-full { width: 100%; }
.h-full { height: 100%; }

.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--cci-space-1); }
.gap-2 { gap: var(--cci-space-2); }
.gap-4 { gap: var(--cci-space-4); }
.gap-6 { gap: var(--cci-space-6); }

/* Spacing */
.m-0 { margin: 0; }
.mt-2 { margin-top: var(--cci-space-2); }
.mt-4 { margin-top: var(--cci-space-4); }
.mt-6 { margin-top: var(--cci-space-6); }
.mb-2 { margin-bottom: var(--cci-space-2); }
.mb-4 { margin-bottom: var(--cci-space-4); }
.mb-6 { margin-bottom: var(--cci-space-6); }
.mb-8 { margin-bottom: var(--cci-space-8); }
.mr-2 { margin-right: var(--cci-space-2); }
.mx-auto { margin-left: auto; margin-right: auto; }
.p-4 { padding: var(--cci-space-4); }
.p-6 { padding: var(--cci-space-6); }
.pl-0 { padding-left: 0; }
.pl-5 { padding-left: 1.25rem; }
.py-3 { padding-top: var(--cci-space-3); padding-bottom: var(--cci-space-3); }
.py-6 { padding-top: var(--cci-space-6); padding-bottom: var(--cci-space-6); }
.py-16 { padding-top: 4rem; padding-bottom: 4rem; }

/* Typography */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-sm { font-size: var(--cci-text-sm); }
.text-lg { font-size: var(--cci-text-lg); }
.text-xl { font-size: var(--cci-text-xl); }
.text-muted { color: var(--cci-color-text-muted); }
.font-bold { font-weight: 700; }
.font-mono { font-family: var(--cci-font-mono); }
.italic { font-style: italic; }

/* List */
.list-disc { list-style-type: disc; }

/* Widths */
.max-w-md { max-width: 28rem; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }

/* Responsive Grid (Basic).
   Tracks use minmax(0, 1fr) — a bare 1fr resolves its min to the content's
   min-width, so a wide grid child (data table, sparkline) forces the track past
   the viewport. minmax(0, 1fr) lets tracks shrink so children scroll internally
   instead of causing page-level horizontal scroll. */
@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:flex { display: flex; }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Narrow viewports: page-header rows (title on the left, action buttons on the
   right — `flex items-center justify-between`) must wrap instead of forcing the
   page wider than the phone. Let both the row and its button groups wrap. */
@media (max-width: 640px) {
    .cci-main .flex.justify-between { flex-wrap: wrap; gap: var(--cci-space-3); }
    .cci-main .flex.justify-between > .flex { flex-wrap: wrap; }
}
