/* ═══════════════════════════════════════════════════════════
   tw-utilities.css — Tailwind-compatible utility classes
   Offline, no-build subset that maps to the shadcn design tokens
   (single source of truth in style.css :root). Same class names as
   Tailwind so templates can use `class="flex items-center gap-2 p-4
   rounded-md bg-card text-muted-foreground"`. Unlayered on purpose so
   utilities win over the component @layer (Tailwind's utility priority).
   Spacing follows the 4/8px scale (1=4px · 2=8px · 3=12px · 4=16px …).
   ═══════════════════════════════════════════════════════════ */

/* ── Display / layout ── */
.block { display: block; }
.inline-block { display: inline-block; }
.inline { display: inline; }
.hidden { display: none; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }
.flex-none { flex: none; }
.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.items-baseline { align-items: baseline; }
.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.self-center { align-self: center; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ── Gap (4/8px scale) ── */
.gap-0 { gap: 0; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }

/* ── Padding ── */
.p-0 { padding: 0; }
.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.p-8 { padding: 32px; }
.px-2 { padding-left: 8px; padding-right: 8px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.px-6 { padding-left: 24px; padding-right: 24px; }
.py-1 { padding-top: 4px; padding-bottom: 4px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }

/* ── Margin ── */
.m-0 { margin: 0; }
.mx-auto { margin-left: auto; margin-right: auto; }
.ml-auto { margin-left: auto; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

/* ── Sizing ── */
.w-full { width: 100%; }
.w-auto { width: auto; }
.h-full { height: 100%; }
.h-8 { height: 32px; }
.h-9 { height: 36px; }
.h-10 { height: 40px; }
.min-w-0 { min-width: 0; }
.max-w-none { max-width: none; }
.max-w-md { max-width: 448px; }
.max-w-lg { max-width: 512px; }
.max-w-2xl { max-width: 672px; }

/* ── Typography ── */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-mono { font-family: var(--font-mono); }
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabular-nums { font-variant-numeric: tabular-nums; }
.uppercase { text-transform: uppercase; }

/* ── Colors (mapped to shadcn tokens) ── */
.text-foreground { color: var(--color-text-primary); }
.text-muted-foreground { color: var(--color-text-muted); }
.text-secondary-foreground { color: var(--color-text-secondary); }
.text-primary { color: var(--color-accent); }
.text-destructive { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-white { color: #fff; }
.bg-background { background-color: var(--color-surface); }
.bg-card { background-color: var(--color-surface-raised); }
.bg-muted { background-color: var(--color-surface); }
.bg-primary { background-color: var(--color-accent); }
.bg-accent { background-color: var(--color-accent-light); }
.bg-destructive { background-color: var(--color-danger); }
.bg-transparent { background-color: transparent; }

/* ── Borders / radius ── */
.border { border: 1px solid var(--color-border); }
.border-t { border-top: 1px solid var(--color-border); }
.border-b { border-bottom: 1px solid var(--color-border); }
.border-border { border-color: var(--color-border); }
.border-input { border-color: var(--color-input); }
.rounded-none { border-radius: 0; }
.rounded-sm { border-radius: 4px; }
.rounded-md { border-radius: 6px; }
.rounded-lg { border-radius: 8px; }
.rounded-xl { border-radius: 12px; }
.rounded-full { border-radius: 9999px; }

/* ── Effects ── */
.shadow-none { box-shadow: none; }
.shadow-xs { box-shadow: var(--shadow-xs); }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* ── Spacing extensions ── */
.gap-0\.5 { gap: 2px; }
.p-0\.5 { padding: 2px; }
.px-0\.5 { padding-left: 2px; padding-right: 2px; }
.px-1 { padding-left: 4px; padding-right: 4px; }
.py-0\.5 { padding-top: 2px; padding-bottom: 2px; }
.pt-1 { padding-top: 4px; }
.pt-2 { padding-top: 8px; }
.pt-4 { padding-top: 16px; }
.pb-2 { padding-bottom: 8px; }
.pl-2 { padding-left: 8px; }
.pr-2 { padding-right: 8px; }

/* ── Grid extensions ── */
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.col-span-2 { grid-column: span 2 / span 2; }
.col-span-3 { grid-column: span 3 / span 3; }
.col-span-full { grid-column: 1 / -1; }

/* ── Gap extensions ── */
.gap-0\.5 { gap: 2px; }
.gap-5 { gap: 20px; }

/* ── Width extensions ── */
.w-4 { width: 16px; }
.w-5 { width: 20px; }
.w-6 { width: 24px; }
.w-8 { width: 32px; }
.w-10 { width: 40px; }
.w-12 { width: 48px; }
.w-16 { width: 64px; }
.w-20 { width: 80px; }
.w-24 { width: 96px; }
.w-32 { width: 128px; }
.w-40 { width: 160px; }
.w-48 { width: 192px; }
.w-64 { width: 256px; }

.min-w-\[120px\] { min-width: 120px; }
.min-w-\[160px\] { min-width: 160px; }
.min-w-\[200px\] { min-width: 200px; }
.min-w-\[240px\] { min-width: 240px; }

.max-w-xs { max-width: 320px; }
.max-w-sm { max-width: 384px; }
.max-w-xl { max-width: 576px; }
.max-w-3xl { max-width: 768px; }
.max-w-4xl { max-width: 896px; }
.max-w-5xl { max-width: 1024px; }

/* ── Height ── */
.h-5 { height: 20px; }
.h-6 { height: 24px; }
.h-12 { height: 48px; }
.h-16 { height: 64px; }
.min-h-\[200px\] { min-height: 200px; }

/* ── Typography extensions ── */
.leading-tight { line-height: 1.25; }
.leading-normal { line-height: 1.5; }
.leading-relaxed { line-height: 1.65; }
.tracking-tight { letter-spacing: -0.02em; }
.tracking-normal { letter-spacing: -0.01em; }
.tracking-wide { letter-spacing: 0.02em; }
.tracking-wider { letter-spacing: 0.05em; }
.whitespace-nowrap { white-space: nowrap; }
.whitespace-pre-wrap { white-space: pre-wrap; }
.break-all { word-break: break-all; }
.italic { font-style: italic; }
.no-underline { text-decoration: none; }
.underline { text-decoration: underline; }
.line-through { text-decoration: line-through; }

/* ── Text color extensions ── */
.text-accent { color: var(--color-accent); }
.text-accent-hover { color: var(--color-accent-hover); }

/* ── Background extensions ── */
.bg-surface { background-color: var(--color-surface); }
.bg-surface-raised { background-color: var(--color-surface-raised); }
.bg-surface-alt { background-color: var(--color-surface-alt); }
.bg-success-light { background-color: var(--color-success-light); }
.bg-danger-light { background-color: var(--color-danger-light); }
.bg-warning-light { background-color: var(--color-warning-light); }
.bg-accent-light { background-color: var(--color-accent-light); }

/* ── Border extensions ── */
.border-0 { border: 0; }
.border-2 { border-width: 2px; }
.border-transparent { border-color: transparent; }
.border-accent { border-color: var(--color-accent); }
.border-success { border-color: var(--color-success-border); }
.border-danger { border-color: var(--color-danger-border); }
.rounded { border-radius: 4px; }

/* ── Shadow extensions ── */
.shadow { box-shadow: var(--shadow-sm); }

/* ── Opacity ── */
.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.opacity-100 { opacity: 1; }

/* ── Misc ── */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.top-0 { top: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }
.select-none { user-select: none; }
.pointer-events-none { pointer-events: none; }
.pointer-events-auto { pointer-events: auto; }
.transition { transition: all var(--transition-fast); }
.transition-colors { transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast); }
.transition-transform { transition: transform var(--transition-base); }
.transition-opacity { transition: opacity var(--transition-base); }

/* ── Inline / block layout helpers ── */
.inline { display: inline; }
.contents { display: contents; }
.flow-root { display: flow-root; }
.self-start { align-self: flex-start; }
.self-stretch { align-self: stretch; }
.justify-self-end { justify-self: end; }
.content-between { align-content: space-between; }

/* ── Responsive grid (no breakpoint) ── */
.grid-auto-fit { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-auto-fill { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* ── Divider ── */
.divider {
    width: 100%;
    height: 1px;
    background: var(--color-border);
    margin: var(--space-lg) 0;
}
.divider-sm { margin: var(--space-md) 0; }

/* ── Compact table variant ── */
.table-compact th,
.table-compact td {
    padding: 6px var(--space-sm);
}
.table-compact th {
    font-size: 11px;
}
.table-compact td {
    font-size: var(--text-xs);
}
