/* Compatibility utilities formerly provided by Tailwind CDN.
   Prefer Bootstrap utilities for new markup; keep these for existing Jinja forms. */

/* Critical display / layout (used throughout templates + document_form JS) */
.block { display: block !important; }
.flex { display: flex !important; }
.grid { display: grid !important; }
.contents { display: contents !important; }

.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;
}

.min-w-0 { min-width: 0 !important; }
.max-w-md { max-width: 28rem !important; }
.max-w-lg { max-width: 32rem !important; }
.max-w-xl { max-width: 36rem !important; }
.max-w-5xl { max-width: 64rem !important; }
.max-w-\[10rem\] { max-width: 10rem !important; }
.max-w-\[min\(100\%\,16rem\)\] { max-width: min(100%, 16rem) !important; }
.max-h-28 { max-height: 7rem !important; }
.w-full { width: 100% !important; }
.w-24 { width: 6rem !important; }
.h-4 { height: 1rem !important; }
.h-5 { height: 1.25rem !important; }
.h-8 { height: 2rem !important; }
.w-4 { width: 1rem !important; }
.w-5 { width: 1.25rem !important; }
.w-auto { width: auto !important; }
.flex-1 { flex: 1 1 0% !important; }
.flex-grow-1 { flex-grow: 1 !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-col { flex-direction: column !important; }
.items-center { align-items: center !important; }
.items-end { align-items: flex-end !important; }
.items-start { align-items: flex-start !important; }
.justify-between { justify-content: space-between !important; }
.justify-center { justify-content: center !important; }
.justify-end { justify-content: flex-end !important; }
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 0.75rem !important; }
.gap-4 { gap: 1rem !important; }
.gap-5 { gap: 1.25rem !important; }

.space-y-1 > * + * { margin-top: 0.25rem !important; }
.space-y-2 > * + * { margin-top: 0.5rem !important; }
.space-y-3 > * + * { margin-top: 0.75rem !important; }
.space-y-4 > * + * { margin-top: 1rem !important; }
.space-y-5 > * + * { margin-top: 1.25rem !important; }
.space-y-6 > * + * { margin-top: 1.5rem !important; }
.divide-y > * + * { border-top: 1px solid var(--tb-border); }
.divide-slate-100 > * + * { border-top-color: #f1f5f9; }

.p-1 { padding: 0.25rem !important; }
.p-4 { padding: 1rem !important; }
.p-5 { padding: 1.25rem !important; }
.p-6 { padding: 1.5rem !important; }
.px-1 { padding-left: 0.25rem !important; padding-right: 0.25rem !important; }
.px-2 { padding-left: 0.5rem !important; padding-right: 0.5rem !important; }
.px-3 { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
.px-4 { padding-left: 1rem !important; padding-right: 1rem !important; }
.py-1 { padding-top: 0.25rem !important; padding-bottom: 0.25rem !important; }
.py-1\.5 { padding-top: 0.375rem !important; padding-bottom: 0.375rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.py-3 { padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; }
.pt-4 { padding-top: 1rem !important; }
.pb-4 { padding-bottom: 1rem !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 0.75rem !important; }
.mt-4 { margin-top: 1rem !important; }
.mt-6 { margin-top: 1.5rem !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 0.75rem !important; }
.mx-4 { margin-left: 1rem !important; margin-right: 1rem !important; }

.rounded-md { border-radius: var(--tb-radius-md, 8px) !important; }
.rounded-xl { border-radius: 0.75rem !important; }
.rounded-2xl { border-radius: var(--tb-radius-md, 8px) !important; } /* flatten old 1rem pills */
.rounded-3xl { border-radius: var(--radius-lg, 10px) !important; }
.rounded-full { border-radius: 999px !important; }

.border { border-width: 1px !important; border-style: solid !important; }
.border-0 { border-width: 0 !important; }
.border-t { border-top-width: 1px !important; border-top-style: solid !important; }
.border-b { border-bottom-width: 1px !important; border-bottom-style: solid !important; }
.border-dashed { border-style: dashed !important; }

.text-slate-400 { color: #94a3b8 !important; }
.text-slate-500 { color: #64748b !important; }
.text-slate-600 { color: #475569 !important; }
.text-slate-700 { color: #334155 !important; }
.text-slate-800 { color: #1e293b !important; }
.text-slate-900 { color: #0f172a !important; }
.text-rose-600 { color: #e11d48 !important; }
.text-rose-700 { color: #be123c !important; }
.text-amber-800 { color: #92400e !important; }
.text-amber-900 { color: #78350f !important; }
.text-white { color: #fff !important; }
.bg-white { background-color: #fff !important; }
.bg-slate-50 { background-color: #f8fafc !important; }
.bg-slate-50\/40 { background-color: rgb(248 250 252 / 0.4) !important; }
.bg-slate-50\/50 { background-color: rgb(248 250 252 / 0.5) !important; }
.bg-slate-50\/80 { background-color: rgb(248 250 252 / 0.8) !important; }
.bg-slate-100 { background-color: #f1f5f9 !important; }
.bg-rose-50 { background-color: #fff1f2 !important; }
.bg-amber-50 { background-color: #fffbeb !important; }
.border-slate-100 { border-color: #f1f5f9 !important; }
.border-slate-200 { border-color: #e2e8f0 !important; }
.border-slate-300 { border-color: #cbd5e1 !important; }
.border-amber-200 { border-color: #fde68a !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-none { box-shadow: none !important; }

.font-medium { font-weight: 500 !important; }
.font-semibold { font-weight: 600 !important; }
.font-bold { font-weight: 700 !important; }
.text-xs { font-size: 0.75rem !important; line-height: 1.25rem !important; }
.text-sm { font-size: 0.875rem !important; line-height: 1.25rem !important; }
.text-lg { font-size: 1.125rem !important; line-height: 1.5rem !important; }
.text-2xl { font-size: 1.5rem !important; line-height: 2rem !important; }
.leading-snug { line-height: 1.375 !important; }
.leading-relaxed { line-height: 1.625 !important; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.truncate {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}
.whitespace-nowrap { white-space: nowrap !important; }
.opacity-40 { opacity: 0.4 !important; }
.underline { text-decoration: underline !important; }
.no-underline { text-decoration: none !important; }

.cursor-pointer { cursor: pointer !important; }
.shrink-0 { flex-shrink: 0 !important; }
.grow { flex-grow: 1 !important; }
.inline-block { display: inline-block !important; }
.inline-flex { display: inline-flex !important; }
.object-contain { object-fit: contain !important; }
.overflow-hidden { overflow: hidden !important; }
.overflow-auto { overflow: auto !important; }

.gap-x-5 { column-gap: 1.25rem !important; }
.gap-y-2 { row-gap: 0.5rem !important; }

/* Arbitrary / brand color helpers used in templates */
.text-\[color\:var\(--ui-link\)\] { color: var(--ui-link) !important; }
.bg-\[color\:var\(--ui-accent\)\] { background-color: var(--ui-accent) !important; }
.hover\:bg-\[color\:var\(--ui-accent-hover\)\]:hover { background-color: var(--ui-accent-hover) !important; }
.hover\:bg-slate-50:hover { background-color: #f8fafc !important; }
.hover\:bg-slate-100:hover { background-color: #f1f5f9 !important; }
.hover\:text-slate-900:hover { color: #0f172a !important; }
.hover\:text-rose-600:hover { color: #e11d48 !important; }
.hover\:underline:hover { text-decoration: underline !important; }
.hover\:no-underline:hover { text-decoration: none !important; }
.decoration-slate-300 { text-decoration-color: #cbd5e1 !important; }
.underline-offset-2 { text-underline-offset: 2px !important; }

.min-h-\[2\.5rem\] { min-height: 2.5rem !important; }
.min-h-\[180px\] { min-height: 180px !important; }

@media (min-width: 576px) {
    .sm\:col-span-2 { grid-column: span 2 / span 2 !important; }
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .sm\:grid-cols-\[1fr_auto_auto\] { grid-template-columns: 1fr auto auto !important; }
    .sm\:items-end { align-items: flex-end !important; }
    .sm\:flex-row { flex-direction: row !important; }
    .sm\:items-center { align-items: center !important; }
    .sm\:w-auto { width: auto !important; }
}

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

/* Must load after .flex/.grid so display:none wins when both classes are present */
.hidden {
    display: none !important;
}
