/* CAS Shared Styling - Used by CAS.Client and CAS.Admin */

/* Tint-derived border color (darker shade of the theme tint) */
.border-cas-tint-dark {
    border-color: color-mix(in srgb, var(--cas-tint), black 40%);
}

/* CSS Variables for consistent theming */
:root {
    --border-color: 229 231 235; /* gray-200 RGB values */

    /* Syntax highlighting palette - uses --cas-tint as accent for keys */
    --syntax-key: rgb(var(--cas-tint, 37 99 235));      /* tint - property names */
    --syntax-string: #16a34a;      /* green-600 - string values */
    --syntax-number: #d97706;      /* amber-600 - number values */
    --syntax-literal: #7c3aed;     /* violet-600 - true, false, null */
    --syntax-punctuation: #64748b; /* slate-500 - { } [ ] : , */
    --syntax-comment: #94a3b8;     /* slate-400 - comments */
    --syntax-link: rgb(var(--cas-tint, 37 99 235));
    --syntax-quote: #64748b;       /* slate-500 - blockquotes */
    --syntax-text: #1e293b;        /* slate-800 - base text */
}

.dark {
    --border-color: 55 65 81; /* gray-700 RGB values */

    --syntax-key: rgb(var(--cas-tint-dark, 96 165 250));    /* tint - property names */
    --syntax-string: #4ade80;      /* green-400 - string values */
    --syntax-number: #fbbf24;      /* amber-400 - number values */
    --syntax-literal: #a78bfa;     /* violet-400 - true, false, null */
    --syntax-punctuation: #94a3b8; /* slate-400 - { } [ ] : , */
    --syntax-comment: #64748b;     /* slate-500 */
    --syntax-link: rgb(var(--cas-tint-dark, 96 165 250));
    --syntax-quote: #94a3b8;       /* slate-400 */
    --syntax-text: #e5e7eb;        /* gray-200 */
}

/* Form controls */
.form-control {
    @apply block w-full px-3 py-2 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-800 placeholder:text-gray-400 dark:placeholder:text-gray-500 border border-gray-300 dark:border-gray-600 focus:outline-none focus:border-cas-tint focus:ring-2 focus:ring-cas-tint/20 transition-colors rounded-md;
}

/* Fixed height for single-line inputs and selects (not textareas) */
input.form-control,
select.form-control,
.form-control-select {
    @apply h-[38px];
}

/* Invalid state styling */
.invalid.form-control {
    @apply text-red-600 border-red-500 dark:border-red-400 bg-red-50 dark:bg-red-900/20 focus:border-red-500 focus:ring-red-500/20;
}

/* Disabled/Readonly state styling */
.form-control:disabled,
.form-control[readonly] {
    @apply bg-gray-100 dark:bg-gray-900 text-gray-500 dark:text-gray-500 border-gray-200 dark:border-gray-700 cursor-not-allowed opacity-75;
}

.form-control:disabled:focus,
.form-control[readonly]:focus {
    @apply outline-none border-gray-200 dark:border-gray-700 ring-0;
}

/* Compact form controls for inline/tree editing */
.form-control-compact {
    @apply block w-full px-2 py-0.5 text-xs text-gray-900 dark:text-gray-50
           bg-white dark:bg-gray-800 placeholder:text-gray-400 dark:placeholder:text-gray-500
           border border-gray-300 dark:border-gray-600 rounded
           focus:outline-none focus:border-cas-tint focus:ring-1 focus:ring-cas-tint/20
           transition-colors h-[26px];
}

input.form-control-compact,
select.form-control-compact {
    @apply h-[26px];
}

.form-control-compact:disabled {
    @apply bg-gray-100 dark:bg-gray-900 text-gray-500 dark:text-gray-500 cursor-not-allowed opacity-75;
}

/* Inline dropdown trigger - inherits font from parent context */
.dropdown-inline-trigger {
    @apply inline-flex items-center gap-0.5 cursor-pointer whitespace-nowrap;
    font: inherit;
    line-height: inherit;
}

.dropdown-inline-trigger.disabled {
    @apply opacity-50 cursor-not-allowed;
}

/* Hidden sizer: stacked item labels set the trigger's min-width */
.dropdown-sizer {
    @apply flex flex-col overflow-hidden pointer-events-none;
    height: 0;
    visibility: hidden;
}

/* Remove focus outline from non-interactive elements (headings, divs, table rows, etc.) */
*:focus:not(input):not(select):not(textarea):not(button):not(a):not([role="button"]):not(summary) {
    @apply outline-none;
}

/* Universal scrollbar styling for all elements */
* {
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}

*::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
    border: 1px solid transparent;
    background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
    background-clip: content-box;
}

*::-webkit-scrollbar-corner {
    background: transparent;
}

/* Dark mode universal scrollbar */
.dark * {
    scrollbar-color: #4b5563 transparent;
}

.dark *::-webkit-scrollbar-thumb {
    background: #4b5563;
    background-clip: content-box;
}

.dark *::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
    background-clip: content-box;
}

/* Panel System */
.panel {
    @apply bg-surface border border-default;
}

.panel-header {
    @apply flex items-center justify-between px-4 py-4 border-b border-default bg-surface-secondary;
}

.panel-title {
    @apply text-lg font-medium text-body;
}

.panel-header-actions {
    @apply flex items-center space-x-2;
}

.panel-header-lg {
    @apply px-6 py-6 border-b border-default bg-surface-secondary;
}

.panel-body {
    @apply p-4;
}

.panel-body-lg {
    @apply p-6;
}

/* Fix for table border conflicts within panels */
.panel .table {
    @apply divide-y-0;
}

/* Table System */
.table-container {
    @apply panel;
}

.table {
    @apply w-full leading-6;
}

/* Table header - gray background */
.table-header {
    @apply bg-surface-secondary;
}

/* Sticky header shadow - uses CSS variable, shadow stays attached to sticky element */
.sticky-header-shadow {
    @apply shadow-[0_1px_0_0_rgb(var(--border-color))];
}

/* Header cell styling - used for th elements */
.table-header-cell {
    @apply px-4 py-3 text-left text-xs font-medium text-muted uppercase tracking-wider;
}

/* Bordered table container - standalone use with outer border */
.table-bordered {
    @apply border border-default;
}

/* Cell borders - vertical lines between columns */
.table-cell-borders .table-header-cell,
.table-cell-borders .table-cell {
    @apply border-r border-default last:border-r-0;
}

.table-body {
    @apply bg-surface;
}

.table-row {
    @apply border-b border-default hover-default;
}

.table-row-focused {
    @apply bg-cas-tint/15;
    box-shadow: inset 3px 0 0 0 var(--cas-tint);
}
.table-row-selected {
    @apply bg-cas-tint/10;
}

/* Keyboard shortcuts modal */
.kbd {
    @apply inline-flex items-center justify-center min-w-[24px] h-6 px-1.5 text-xs font-medium rounded border;
    @apply bg-surface-secondary text-secondary border-default shadow-sm;
}

.shortcut-section-title {
    @apply text-sm font-semibold text-heading uppercase tracking-wider mb-3 pb-2 border-b border-default;
}

.shortcut-list {
    @apply space-y-0;
}

.shortcut-row {
    @apply flex items-center justify-between py-1.5;
}

.shortcut-row dt {
    @apply text-sm text-secondary;
}

.shortcut-row dd {
    @apply flex items-center gap-1 ml-2 flex-shrink-0;
}

.table-body-flush > :last-child {
    @apply border-b-0;
}

/* Restore last-row border inside DefinitionTable (section headers follow field tables) */
.dt-panel .table-body-flush > :last-child {
    @apply border-b border-default;
}

.table-cell {
    @apply px-4 py-1.5 text-body;
}

/* Compact table variants */
.table-compact .table-header-cell {
    @apply px-3 py-2.5;
}

.table-compact .table-cell {
    @apply px-3 py-1;
}

/* Table cell content layouts */
.table-cell-icon-text {
    @apply flex items-center gap-2 overflow-hidden min-w-0;
}

.table-cell-logo {
    @apply flex-shrink-0 flex items-center justify-center relative;
    height: 1lh;
    width: 2.5rem;
}

.table-cell-logo img {
    @apply max-w-full max-h-full object-contain relative;
}

/* Table cell padding overrides - work with both normal and compact tables */
.table-cell.table-cell-p-0 {
    @apply p-0;
}

.table-cell.table-cell-pl-0 {
    @apply pl-0;
}

.table-cell.table-cell-pl-1 {
    @apply pl-1;
}

/* Table cell horizontal padding override */
.table-cell.table-cell-px-1 {
    @apply px-1;
}

/* Table header padding overrides */
.table-header-cell.table-cell-pl-0 {
    @apply pl-0;
}

.table-header-cell.table-cell-pl-1 {
    @apply pl-1;
}

.table-header-cell.table-cell-px-1 {
    @apply px-1;
}

/* Loading States */
.table-loading-row {
    @apply border-b border-default animate-pulse;
}

.loading-skeleton {
    @apply h-4 bg-gray-200 dark:bg-gray-700;
}

.loading-skeleton-sm {
    @apply h-3 bg-gray-200 dark:bg-gray-700;
}

.loading-skeleton-lg {
    @apply h-6 bg-gray-200 dark:bg-gray-700;
}

.loading-spinner {
    @apply animate-spin h-5 w-5 text-gray-400;
}

.loading-spinner svg {
    @apply text-cas-tint;
}

/* Modal System */
.modal-overlay {
    @apply fixed inset-0 bg-gray-500 bg-opacity-75 dark:bg-black dark:bg-opacity-75 transition-opacity;
}

.modal-container {
    @apply fixed inset-0 z-50 overflow-y-auto;
}

.modal-content {
    @apply bg-surface shadow-xl;
}

.modal-header {
    @apply px-4 py-4 sm:px-6 bg-surface-secondary border-b border-default;
}

.modal-body {
    @apply px-4 py-4 sm:px-6;
}

.modal-footer {
    @apply px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse sm:gap-3 bg-surface-secondary border-t border-default;
}

/* Button System */
.btn {
    @apply inline-flex items-center px-4 py-2 text-sm font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2;
}

.btn-primary {
    @apply btn bg-cas-tint text-white hover:bg-opacity-90 focus:ring-cas-tint;
}

.btn-secondary {
    @apply btn bg-surface text-secondary border border-input hover:bg-gray-50 dark:hover:bg-gray-700 focus:ring-cas-tint;
}

.btn-danger {
    @apply btn bg-red-600 text-white hover:bg-red-700 focus:ring-red-500;
}

.btn-warning {
    @apply btn bg-amber-600 text-white hover:bg-amber-700 focus:ring-amber-500;
}

/* Icon Buttons - Round buttons with icons */
.icon-btn {
    @apply w-8 h-8 rounded-full flex items-center justify-center transition-colors;
}

.icon-btn-sm {
    @apply w-7 h-7 rounded-full flex items-center justify-center transition-colors;
}

.icon-btn-xs {
    @apply w-5 h-5 rounded-full flex items-center justify-center transition-colors;
}

/* Solid icon buttons - using semantic colors */
.icon-btn-primary {
    @apply icon-btn bg-cas-tint/70 hover:bg-cas-tint/80 text-white;
}

.icon-btn-success {
    @apply icon-btn bg-green-600/70 hover:bg-green-600/80 dark:bg-green-500/70 dark:hover:bg-green-500/80 disabled:bg-gray-400 text-white;
}

.icon-btn-warning {
    @apply icon-btn bg-amber-600/70 hover:bg-amber-600/80 dark:bg-amber-500/70 dark:hover:bg-amber-500/80 text-white;
}

.icon-btn-danger {
    @apply icon-btn bg-red-600/70 hover:bg-red-600/80 dark:bg-red-500/70 dark:hover:bg-red-500/80 text-white;
}

/* Ghost icon buttons (transparent background) */
.icon-btn-ghost {
    @apply icon-btn text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700;
}

.icon-btn-ghost-primary {
    @apply icon-btn color-primary hover:bg-cas-tint/10;
}

.icon-btn-ghost-success {
    @apply icon-btn color-success hover:bg-green-600/10 dark:hover:bg-green-500/10;
}

.icon-btn-ghost-warning {
    @apply icon-btn color-warning hover:bg-amber-600/10 dark:hover:bg-amber-500/10;
}

.icon-btn-ghost-danger {
    @apply icon-btn color-error hover:bg-red-600/10 dark:hover:bg-red-500/10;
}

/* Logo delete button - small circular delete overlay on images */
.logo-delete-btn {
    @apply w-5 h-5 bg-red-500 hover:bg-red-600 text-white rounded-full text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity;
}

/* Small variants */
.icon-btn-sm-primary {
    @apply icon-btn-sm bg-cas-tint/70 hover:bg-cas-tint/80 text-white;
}

.icon-btn-sm-success {
    @apply icon-btn-sm bg-green-600/70 hover:bg-green-600/80 dark:bg-green-500/70 dark:hover:bg-green-500/80 text-white;
}

/* Small ghost variants */
.icon-btn-sm-ghost {
    @apply icon-btn-sm text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700;
}

.icon-btn-sm-ghost-success {
    @apply icon-btn-sm color-success hover:bg-green-600/10 dark:hover:bg-green-500/10;
}

.icon-btn-sm-ghost-warning {
    @apply icon-btn-sm color-warning hover:bg-amber-600/10 dark:hover:bg-amber-500/10;
}

.icon-btn-sm-ghost-danger {
    @apply icon-btn-sm color-error hover:bg-red-600/10 dark:hover:bg-red-500/10;
}

/* Extra small variants */
.icon-btn-xs-success {
    @apply icon-btn-xs bg-green-600/70 hover:bg-green-600/80 dark:bg-green-500/70 dark:hover:bg-green-500/80 text-white;
}

.icon-btn-xs-danger {
    @apply icon-btn-xs bg-red-600/70 hover:bg-red-600/80 dark:bg-red-500/70 dark:hover:bg-red-500/80 text-white;
}

/* Avatar/initials circle */
.avatar {
    @apply w-7 h-7 rounded-full bg-cas-tint/70 flex items-center justify-center text-white text-xs font-medium;
}

/* ===========================================
   SEMANTIC COLOR SYSTEM
   Use these classes everywhere for consistent colors
   =========================================== */

/* Text colors - for icons, text */
.color-primary {
    @apply text-cas-tint;
}
.color-success {
    @apply text-green-600 dark:text-green-500;
}
.color-warning {
    @apply text-amber-600 dark:text-amber-500;
}
.color-error {
    @apply text-red-600 dark:text-red-500;
}
.color-info {
    @apply text-blue-600 dark:text-blue-400;
}
.color-purple {
    @apply text-purple-600 dark:text-purple-400;
}

/* Semantic borders */
.border-error {
    @apply border-red-500 dark:border-red-400;
}

/* Solid backgrounds - for buttons, indicators, progress bars */
.bg-primary {
    @apply bg-cas-tint/70;
}
.bg-success {
    @apply bg-green-600/70 dark:bg-green-500/70;
}
.bg-warning {
    @apply bg-amber-600/70 dark:bg-amber-500/70;
}
.bg-error {
    @apply bg-red-600/70 dark:bg-red-500/70;
}
.bg-info {
    @apply bg-blue-600/70 dark:bg-blue-500/70;
}

/* Light backgrounds - for subtle backgrounds, badges */
.bg-primary-light {
    @apply bg-cas-tint/20 dark:bg-cas-tint/30;
}
.bg-success-light {
    @apply bg-green-600/20 dark:bg-green-500/30;
}
.bg-warning-light {
    @apply bg-yellow-200/30 dark:bg-yellow-500/10;
}
.bg-error-light {
    @apply bg-red-600/20 dark:bg-red-500/30;
}
.bg-info-light {
    @apply bg-blue-600/20 dark:bg-blue-500/30;
}

/* Status indicator dot */
.status-dot {
    @apply w-3 h-3 rounded-full;
}
.status-dot-success {
    @apply status-dot bg-success;
}
.status-dot-warning {
    @apply status-dot bg-warning;
}
.status-dot-danger {
    @apply status-dot bg-error;
}

/* Alert styles - consistent background, border, and text colors */
.alert-success {
    @apply bg-green-50 border-green-200 text-green-700 dark:bg-green-900/20 dark:border-green-800 dark:text-green-400;
}
.alert-warning {
    @apply bg-amber-50 border-amber-200 text-amber-700 dark:bg-amber-900/20 dark:border-amber-800 dark:text-amber-400;
}
.alert-error {
    @apply bg-red-50 border-red-200 text-red-700 dark:bg-red-900/20 dark:border-red-800 dark:text-red-400;
}
.alert-info {
    @apply bg-cas-tint/10 border-cas-tint/20 text-cas-tint dark:bg-cas-tint/20 dark:border-cas-tint/30 dark:text-white;
}

/* Badge styles - for pills and tags */
.badge-success {
    @apply bg-green-100 text-green-700 dark:bg-green-500/20 dark:text-green-400;
}
.badge-warning {
    @apply bg-amber-100 text-amber-700 dark:bg-amber-500/20 dark:text-amber-400;
}
.badge-error {
    @apply bg-red-100 text-red-700 dark:bg-red-500/20 dark:text-red-400;
}
.badge-primary {
    @apply bg-cas-tint/15 text-cas-tint dark:bg-cas-tint/20 dark:text-white;
}

/* Toast styles */
.toast-success {
    @apply bg-green-50 text-green-800 border-green-200 dark:bg-green-900/30 dark:text-green-200 dark:border-green-700;
}
.toast-warning {
    @apply bg-amber-50 text-amber-800 border-amber-200 dark:bg-amber-900/30 dark:text-amber-200 dark:border-amber-700;
}
.toast-error {
    @apply bg-red-50 text-red-800 border-red-200 dark:bg-red-900/30 dark:text-red-200 dark:border-red-700;
}
.toast-info {
    @apply bg-cas-tint/10 text-cas-tint border-cas-tint/20 dark:bg-cas-tint/20 dark:text-white dark:border-cas-tint/30;
}

/* Button solid backgrounds - for primary action buttons */
.btn-bg-success {
    @apply bg-green-600/70 hover:bg-green-600/80 focus:ring-green-500;
}
.btn-bg-warning {
    @apply bg-amber-600/70 hover:bg-amber-600/80 focus:ring-amber-500;
}
.btn-bg-error {
    @apply bg-red-600/70 hover:bg-red-600/80 focus:ring-red-500;
}
.btn-bg-primary {
    @apply bg-cas-tint hover:bg-cas-tint-dark focus:ring-cas-tint;
}

/* Icon background - subtle background for icon containers */
.icon-bg-success {
    @apply bg-green-100 dark:bg-green-900/20;
}
.icon-bg-warning {
    @apply bg-amber-100 dark:bg-amber-900/20;
}
.icon-bg-error {
    @apply bg-red-100 dark:bg-red-900/20;
}
.icon-bg-primary {
    @apply bg-cas-tint/10 dark:bg-cas-tint/20;
}

/* Chip Input - inline tag editor with chips + input in one container */
.chip-input {
    @apply flex flex-wrap items-center gap-1.5 px-2 py-1.5 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700/50 min-h-[38px];
}

.chip-input:focus-within {
    @apply ring-1 ring-cas-tint border-cas-tint;
}

.chip-input-field {
    @apply flex-1 min-w-[100px] bg-transparent border-none outline-none text-sm text-gray-900 dark:text-white p-0;
}

.chip-input-field::placeholder {
    @apply text-gray-400 dark:text-gray-500;
}

.chip {
    @apply inline-flex items-center gap-1 px-2 py-0.5 rounded text-sm;
}

.chip-blue {
    @apply bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-300;
}

.chip-purple {
    @apply bg-purple-100 dark:bg-purple-900/30 text-purple-800 dark:text-purple-300;
}

.chip-green {
    @apply bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300;
}

.chip-orange {
    @apply bg-orange-100 dark:bg-orange-900/30 text-orange-800 dark:text-orange-300;
}

.chip-remove {
    @apply opacity-60 hover:opacity-100 transition-opacity;
}

/* Empty State */
.empty-state {
    @apply text-center py-8 text-muted;
}

/* Log Parameter Highlighting - colored parameters in structured log messages */
.log-param {
    @apply text-sky-600 dark:text-sky-400;
}

/* Log Flash Animation - subtle highlight for new logs */
@keyframes log-flash {
    0% {
        background-color: rgb(254 240 138 / 0.5); /* yellow-200 with transparency */
    }
    100% {
        background-color: transparent;
    }
}

.log-flash-animation {
    animation: log-flash 1.2s ease-out forwards;
    will-change: auto; /* Don't retain will-change after animation */
}

/* Dark mode flash animation */
.dark .log-flash-animation {
    animation: log-flash-dark 1.2s ease-out forwards;
}

@keyframes log-flash-dark {
    0% {
        background-color: rgb(133 77 14 / 0.4); /* yellow-800 with transparency */
    }
    100% {
        background-color: transparent;
    }
}

/* SVG Icon Color Matching */
.svg-icon {
    /* Match text-gray-600 (#4B5563 = rgb(75, 85, 99)) */
    filter: brightness(0) saturate(100%) invert(31%) sepia(7%) saturate(684%) hue-rotate(185deg) brightness(96%) contrast(91%);
    flex-shrink: 0;
}

.dark .svg-icon {
    /* Match text-gray-300 (#D1D5DB = rgb(209, 213, 219)) */
    filter: brightness(0) saturate(100%) invert(87%) sepia(4%) saturate(349%) hue-rotate(185deg) brightness(95%) contrast(88%);
}

/* ===========================================
   DESIGN SYSTEM - Text Colors
   Semantic text color classes for consistent light/dark mode
   =========================================== */

.text-heading {
    @apply text-gray-900 dark:text-white;
}
.text-body {
    @apply text-gray-900 dark:text-gray-50;
}
.text-secondary {
    @apply text-gray-700 dark:text-gray-300;
}
.text-tertiary {
    @apply text-gray-600 dark:text-gray-400;
}
.text-muted {
    @apply text-gray-500 dark:text-gray-400;
}
.text-placeholder {
    @apply text-gray-400 dark:text-gray-500;
}
.text-disabled {
    @apply text-gray-500 dark:text-gray-500;
}

/* ===========================================
   DESIGN SYSTEM - Surface / Background Colors
   =========================================== */

.bg-surface {
    @apply bg-white dark:bg-gray-800;
}
.bg-surface-secondary {
    @apply bg-gray-50 dark:bg-gray-800;
}
.bg-surface-header {
    @apply bg-gray-50 dark:bg-gray-700;
}
.bg-surface-hover {
    @apply bg-gray-100 dark:bg-gray-700;
}
.bg-surface-muted {
    @apply bg-gray-100 dark:bg-gray-800;
}
.bg-surface-inset {
    @apply bg-gray-50 dark:bg-gray-900;
}

/* ===========================================
   DESIGN SYSTEM - Borders
   =========================================== */

.border-default {
    @apply border-gray-200 dark:border-gray-700;
}
.border-input {
    @apply border-gray-300 dark:border-gray-600;
}
.divide-default > :not([hidden]) ~ :not([hidden]) {
    @apply border-gray-200 dark:border-gray-700;
}
.divider {
    @apply border-b border-gray-200 dark:border-gray-700;
}
.divider-t {
    @apply border-t border-gray-200 dark:border-gray-700;
}

/* ===========================================
   DESIGN SYSTEM - Hover States
   =========================================== */

.hover-default {
    @apply hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors;
}
.hover-subtle {
    @apply hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors;
}

/* ===========================================
   DESIGN SYSTEM - Form Classes
   =========================================== */

.form-label {
    @apply block text-sm font-medium text-secondary mb-1;
}
.form-help {
    @apply mt-1 text-sm text-muted;
}
.form-error {
    @apply mt-1 text-sm text-red-600 dark:text-red-400;
}
.form-control-select {
    @apply form-control appearance-none cursor-pointer pr-10;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.25rem;
}
:is(.dark .form-control-select) {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%239ca3af'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
}
.form-control-textarea {
    @apply form-control resize-y;
}

/* ===========================================
   DESIGN SYSTEM - Typography
   =========================================== */

.section-title {
    @apply text-lg font-semibold text-heading;
}
.section-title-sm {
    @apply text-base font-semibold text-heading;
}
.stat-title {
    @apply text-xs font-medium text-tertiary uppercase tracking-wider;
}
.stat-value {
    @apply text-2xl font-bold text-heading;
}

/* Status filter pills */
.status-pill {
    @apply relative inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium text-muted bg-surface-secondary border border-default rounded-full cursor-pointer transition-colors;
}
.status-pill i {
    @apply text-xs;
}
.status-pill:hover {
    @apply bg-gray-200 dark:bg-gray-600;
}
.status-pill-active {
    @apply bg-cas-tint/10 border-cas-tint/30 text-heading;
}

/* Status pill popover */
.status-pill-popover {
    @apply absolute z-50 text-xs hidden;
    top: 100%;
    left: 0;
    padding-top: 4px;
    pointer-events: none;
}
.status-pill:hover .status-pill-popover {
    @apply block;
}
.status-pill-popover-inner {
    @apply bg-surface border border-default rounded-lg shadow-lg py-1.5 px-2.5;
    min-width: 140px;
}
.status-pill-popover-row {
    @apply flex justify-between items-center gap-4 py-0.5;
}
.status-pill-popover-label {
    @apply text-muted whitespace-nowrap;
}
.status-pill-popover-value {
    @apply font-mono text-heading font-medium whitespace-nowrap;
}

/* ===========================================
   DESIGN SYSTEM - Containers
   =========================================== */

.card {
    @apply bg-surface border border-default;
}
.card-padded {
    @apply card p-4;
}
.card-section {
    @apply bg-surface-inset border border-default rounded-md p-4;
}

/* ===========================================
   DESIGN SYSTEM - Page Layout
   =========================================== */

.page-header {
    @apply p-2 px-5 flex items-center justify-between border-b border-default;
}
.page-title {
    @apply section-title my-2;
}

/* ===========================================
   DESIGN SYSTEM - Menu / Dropdown
   =========================================== */

.dropdown-menu {
    @apply bg-surface border border-default rounded-md shadow-lg z-50 overflow-hidden;
}
.dropdown-item {
    @apply w-full text-left px-4 py-2 text-sm text-secondary hover-default;
}
.dropdown-item-danger {
    @apply dropdown-item text-red-600 dark:text-red-500;
}
.dropdown-header {
    @apply px-3 py-1 text-[11px] font-medium text-placeholder uppercase tracking-wide;
}
.context-menu {
    @apply absolute right-0 top-full mt-2 w-56 bg-surface shadow-xl ring-1 ring-black ring-opacity-5 dark:ring-gray-700 z-50;
}

/* ===========================================
   DESIGN SYSTEM - Badges (additions)
   =========================================== */

.badge {
    @apply inline-flex items-center px-2 py-0.5 text-xs font-medium rounded-full;
}
.badge-default {
    @apply bg-gray-100 text-gray-700 dark:bg-gray-600 dark:text-gray-200;
}
.badge-info {
    @apply bg-blue-100 text-blue-700 dark:bg-blue-500/20 dark:text-blue-400;
}

/* ===========================================
   DESIGN SYSTEM - Buttons (additions)
   =========================================== */

.btn-success {
    @apply btn bg-green-600/70 hover:bg-green-600/80 text-white shadow-sm focus:ring-green-500;
}
.btn-ghost {
    @apply btn text-secondary hover:bg-gray-100 dark:hover:bg-gray-800 focus:ring-gray-500;
}
.btn-link {
    @apply btn text-cas-tint hover:text-cas-tint-dark focus:ring-cas-tint underline underline-offset-4;
}
.btn-sm {
    @apply px-3 py-1.5 h-[30px] text-sm;
}
.btn-lg {
    @apply px-6 py-3 h-[46px] text-base;
}

/* Easter egg: button runs away on mouseenter */
.btn-runaway-away {
    position: fixed !important;
    z-index: 9999;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25);
    transition: left 0.3s cubic-bezier(0.2, 0, 0, 1), top 0.3s cubic-bezier(0.2, 0, 0, 1);
}

/* ===========================================
   DESIGN SYSTEM - Table Cell Editing
   =========================================== */

.table-cell-input {
    @apply w-full px-2 py-1 text-sm font-mono bg-transparent text-gray-900 dark:text-gray-50 placeholder:text-gray-400 dark:placeholder:text-gray-500 border-0 focus:outline-none focus:bg-blue-50 dark:focus:bg-blue-900/20;
}
.table-cell-select {
    @apply w-full px-2 py-1 text-sm bg-transparent border-0 focus:outline-none focus:bg-blue-50 dark:focus:bg-blue-900/20 appearance-none cursor-pointer;
}

/* ===========================================
   DESIGN SYSTEM - Overlay / Backdrop
   =========================================== */

.backdrop {
    @apply fixed inset-0 z-40;
}
.overlay {
    @apply fixed inset-0 bg-gray-500/75 dark:bg-black/75;
}

/* ===========================================
   DESIGN SYSTEM - Slide-in Panel
   =========================================== */

.slide-panel-backdrop {
    @apply fixed inset-0 z-40 bg-black/50 dark:bg-black/70;
    animation: fade-in 200ms ease-out;
}
.slide-panel-backdrop-closing {
    animation: fade-out 200ms ease-in forwards;
}
.slide-panel {
    @apply fixed top-0 right-0 z-50 h-full bg-surface shadow-2xl flex flex-col;
    animation: slide-in-right 250ms cubic-bezier(0.2, 0, 0, 1);
}
.slide-panel-closing {
    animation: slide-out-right 200ms cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes slide-in-right {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}
@keyframes slide-out-right {
    from { transform: translateX(0); }
    to { transform: translateX(100%); }
}
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ===========================================
   DESIGN SYSTEM - Navigation
   =========================================== */

.nav-item {
    @apply flex items-center px-4 py-2.5 text-secondary hover-default rounded-md;
}
.nav-item-active {
    @apply bg-cas-tint/10 text-cas-tint font-medium;
}
.sidebar-item-active {
    @apply bg-surface-hover text-heading font-medium;
}

/* ===========================================
   DESIGN SYSTEM - Logo
   =========================================== */

.logo {
    font-family: 'Smush', sans-serif;
}

.logo-collapsed {
    font-family: 'Smush', sans-serif;
    font-size: 3.5rem;
    line-height: 2.5rem;
    @apply font-bold text-cas-tint;
}

/* Required field asterisk */
.text-required { @apply text-red-500; }

/* Input icon positioning */
.input-icon-left { @apply absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none; }
.input-icon-right { @apply absolute inset-y-0 right-0 pr-3 flex items-center; }

/* Link styling */
.link { @apply text-cas-tint hover:underline; }

/* Progress bar track */
.progress-track { @apply bg-gray-200 dark:bg-gray-700 rounded-full; }

/* Job pipeline — bar and CSS-only hover popover.
   The popover is triggered by the td.job-pipeline-cell hover (set via cellClass). */
.job-pipeline-cell:hover {
    anchor-name: --pipeline-cell;
}

.job-pipeline-bar {
    @apply flex gap-px w-full overflow-hidden rounded-full;
    height: 6px;
}


.job-pipeline-bar .pipeline-pulse {
    animation: pipeline-pulse 1.5s ease-in-out infinite;
}

@keyframes pipeline-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.job-pipeline-popover {
    @apply fixed z-50 text-xs;
    min-width: 280px;
    display: none;
    pointer-events: none;
    position-anchor: --pipeline-cell;
    left: anchor(right);
    top: anchor(top);
    position-try-fallbacks: flip-block;
}
.job-pipeline-popover-inner {
    @apply bg-surface border border-default rounded-md shadow-lg px-3 py-2;
}

.job-pipeline-cell:hover .job-pipeline-popover {
    display: block;
    pointer-events: auto;
}

/* Generic CSS-only hover tooltip — used by <FieldLabel> for renamed certificate fields */
.field-tooltip-trigger {
    @apply relative inline-flex items-center;
}

.field-tooltip {
    @apply absolute z-50 text-xs hidden;
    bottom: 100%;
    left: 0;
    padding-bottom: 4px;
    pointer-events: none;
}

.field-tooltip-trigger:hover > .field-tooltip {
    @apply block;
}

.field-tooltip-inner {
    @apply block bg-surface border border-default rounded-lg py-1.5 px-2.5 text-body whitespace-nowrap;
    max-width: 320px;
    white-space: normal;
}

/* Normalization factor popover — CSS-only hover tooltip for chemical factor info */
.dt-has-normalization-popover:hover {
    anchor-name: --normpop;
}

.dt-normalization-popover {
    @apply text-xs hidden z-50;
    position: fixed;
    position-anchor: --normpop;
    bottom: calc(anchor(top) + 4px);
    left: anchor(left);
    pointer-events: none;
    position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
}

.dt-has-normalization-popover:hover > .dt-normalization-popover {
    @apply block;
}

.dt-normalization-popover-inner {
    @apply bg-surface border border-default rounded-lg shadow-lg py-1.5 px-2.5;
    min-width: 160px;
}

.dt-normalization-row {
    @apply flex justify-between items-center gap-4 py-0.5;
}

.dt-normalization-label {
    @apply text-muted whitespace-nowrap;
}

.dt-normalization-value {
    @apply font-mono text-heading font-medium whitespace-nowrap;
}

.dt-normalization-result {
    @apply border-t border-default mt-0.5 pt-1;
}

/* Definition table keyboard focus */
.dt-keyboard-focus {
    @apply bg-cas-tint/15 !important;
}

/* Table inline input */
.table-inline-input { @apply w-full h-[36px] px-4 bg-transparent text-body focus:outline-none focus:bg-gray-50 dark:focus:bg-gray-700/50; }

/* Table validation error input */
.table-inline-input-error { @apply w-full h-[36px] px-4 bg-red-50 dark:bg-red-900/20 text-body focus:outline-none border-y border-red-500 dark:border-red-400; }

/* Checkbox styling (for forms and tables) */
.form-checkbox { @apply w-4 h-4 text-cas-tint bg-surface-muted border-input rounded focus:ring-cas-tint; }

/* SortableJS drag and drop styling */
.sortable-ghost {
    @apply opacity-40;
    background-color: rgb(var(--cas-tint-rgb, 59 130 246) / 0.1);
}

.sortable-chosen {
    background-color: rgb(var(--cas-tint-rgb, 59 130 246) / 0.05);
}

.sortable-drag {
    @apply opacity-100 bg-white shadow-md;
}

.dark .sortable-drag {
    @apply bg-gray-800;
}

/* netstack.js - .NET stack trace formatting */
.st-frame {
    @apply py-0.5;
}

.st-type {
    @apply text-gray-400;
}

.st-method {
    @apply text-green-400;
}

.st-param-type {
    @apply text-blue-400;
}

.st-param-name {
    @apply text-gray-500;
}

.st-file {
    @apply text-cyan-400;
}

.st-line {
    @apply text-yellow-400;
}

/* ===========================================
   DESIGN SYSTEM - Compact UI Components
   For dense/tool-like interfaces (sidebars, panels, toolbars)
   =========================================== */

/* Sidebar tree item — factory/location/certificate navigation */
.sidebar-item {
    @apply w-full text-left px-3 py-1 text-sm flex items-center gap-1.5 select-none;
}

.sidebar-item-child {
    @apply sidebar-item text-muted;
    padding-left: 34px;
}

.sidebar-item-grandchild {
    @apply sidebar-item text-body;
    padding-left: 56px;
}

/* Collapsible section header — details/summary */
.collapsible-header {
    @apply px-4 py-2 text-sm font-medium text-muted bg-surface-secondary cursor-pointer hover-subtle select-none;
}

.collapsible-body {
    @apply px-4 py-2 text-sm text-body bg-surface;
}

/* Toolbar — horizontal bar with actions */
.toolbar {
    @apply px-4 py-2 text-sm bg-surface-secondary flex-shrink-0 flex items-center;
}

.toolbar-divider {
    @apply toolbar divider;
}

.toolbar-divider-t {
    @apply toolbar divider-t;
}

/* Tab button — underlined tab in a toolbar */
.tab-btn {
    @apply text-sm font-medium h-full border-b-2 transition-colors border-transparent text-placeholder;
}
.tab-btn:hover {
    @apply text-heading;
}

.tab-btn-active {
    @apply text-sm font-medium h-full border-b-2 transition-colors border-cas-tint text-heading;
}

/* Pill toggle button — small rounded toggle in a group */
.pill-btn {
    @apply px-2 py-0.5 rounded text-sm transition-colors text-muted;
}
.pill-btn:hover {
    @apply text-body;
}

.pill-btn-active {
    @apply px-2 py-0.5 rounded text-sm transition-colors bg-cas-tint/70 text-white;
}

/* Run history chip — clickable extraction run in horizontal list */
.run-chip {
    @apply flex items-center gap-1.5 px-2 py-0.5 rounded text-[11px] transition-colors text-muted border border-transparent cursor-pointer flex-shrink-0;
}
.run-chip:hover {
    @apply text-body bg-surface;
}
.run-chip-active {
    @apply flex items-center gap-1.5 px-2 py-0.5 rounded text-[11px] transition-colors border border-cas-tint/40 bg-cas-tint/10 text-heading cursor-pointer flex-shrink-0;
}

/* Inline action link */
.action-link {
    @apply text-sm font-medium transition-colors text-cas-tint;
}
.action-link:hover {
    @apply opacity-80;
}

/* Upload button — outlined tint button for file upload */
.btn-upload {
    @apply inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-cas-tint border border-cas-tint/30 rounded hover:bg-cas-tint/10 transition-colors cursor-pointer;
}

/* Stats bar — monospace info bar */
.stats-bar {
    @apply px-4 py-2 text-sm text-muted bg-surface-secondary divider-t flex-shrink-0 flex items-center gap-6 font-mono;
}

/* Compact select — small inline select for toolbars */
.select-compact {
    @apply text-sm bg-surface border border-default rounded px-2 py-1 text-body;
}

/* Inline form label — small label above input in compact contexts */
.label-compact {
    @apply block text-sm font-medium text-muted mb-1;
}


/* ===========================================
   DEFINITION TABLE (.dt-*)
   Styles for DefinitionTable and DtSection components.
   --dt-cell-py / --dt-header-py / --dt-px on .dt-panel are the single
   source of truth for all internal spacing.
   =========================================== */

/* ── Panel wrapper ────────────────────────────────────────────────── */

.dt-panel {
    --dt-cell-py: 4px;
    --dt-header-py: 8px;
    --dt-px: 12px;
    @apply text-xs bg-surface border-r border-default;
}

.dt-panel .table {
    table-layout: fixed;
}

.dt-panel .table-row:hover {
    --tw-bg-opacity: 0;
}

/* All td cells inside the panel use cell padding */
.dt-panel .table-cell {
    padding: var(--dt-cell-py) var(--dt-px);
}

/* ── Empty state ──────────────────────────────────────────────────── */

.dt-no-data {
    @apply flex-1 flex items-center justify-center text-muted;
}

/* ── Sticky header wrapper ────────────────────────────────────────── */

.dt-sticky-header {
    @apply sticky top-0 z-10;
}

/* ── Toolbar (summary bar) ────────────────────────────────────────── */

.dt-toolbar {
    @apply flex items-center gap-4 border-b border-default min-w-0 flex-wrap;
}

.dt-summary-correct {
    @apply color-success font-medium;
}

.dt-summary-btn {
    @apply font-medium cursor-pointer hover:underline;
}

/* ── Column header row (Property / Saved / Now) ──────────────────── */

.dt-column-header {
    @apply flex font-medium text-muted uppercase tracking-wide bg-surface border-b border-default;
    font-size: 0.625rem;
}

.dt-column-header > div {
    padding: var(--dt-cell-py) var(--dt-px);
}

.dt-column-header > div + div {
    @apply border-l border-default;
}

/* ── Run selector dropdown ────────────────────────────────────────── */

.dt-run-select {
    @apply uppercase tracking-wide font-medium -my-0.5;
    font-size: inherit;
}

/* ── Section (collapsible header) ─────────────────────────────────── */

.dt-section-header {
    padding: var(--dt-header-py) var(--dt-px);
    @apply w-full font-medium text-heading bg-surface-secondary border-y border-default cursor-pointer hover-subtle select-none flex items-center justify-between;
}

.dt-section {
    margin-top: -1px;
}

.dt-section > div > table {
    margin-top: -1px;
}

.dt-section-chevron {
    @apply transition-transform duration-150;
    width: 10px;
    font-size: 0.5em;
}

.dt-section-chevron.open {
    transform: rotate(90deg);
}

.dt-section-content {
    @apply bg-surface;
}

.dt-section-title-group {
    @apply flex items-center gap-1.5;
}

.dt-section-title {
    @apply font-mono;
}

.dt-section-subtitle {
    @apply font-mono color-primary;
}


/* ── Add button + dropdown ────────────────────────────────────────── */

.dt-add-wrapper {
    position: relative;
}

.dt-add-btn {
    border: none;
    background: none;
    color: var(--syntax-string);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0;
    transition: opacity 150ms;
}
.dt-add-root:hover .dt-add-btn,
.dt-section-header:hover .dt-add-btn {
    opacity: 0.7;
}
.dt-add-btn:hover {
    opacity: 1;
}

.dt-add-root {
    display: flex;
    justify-content: flex-end;
    padding: 4px var(--dt-px);
    border-bottom: 1px solid var(--border-default);
}

.dt-add-overlay {
    position: fixed;
    inset: 0;
    z-index: 49;
}

.dt-add-dropdown {
    position: fixed;
    z-index: 50;
    min-width: 200px;
    max-height: 360px;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid var(--border-default);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
    padding: 6px;
    @apply bg-surface;
}

.dt-add-dropdown-divider {
    height: 1px;
    margin: 4px 0;
    background: var(--border-default);
}

.dt-add-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    padding: 6px 10px;
    font-size: var(--dt-font-size);
    color: var(--text-body);
    background: none;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
}
.dt-add-dropdown-item:hover {
    @apply bg-surface-secondary;
}

.dt-add-dropdown-action {
    color: var(--syntax-string);
    @apply font-medium;
}

.dt-add-dropdown-indent {
    padding-left: 26px;
}

.dt-add-dropdown-group {
    padding: 10px 10px 3px;
    font-size: calc(var(--dt-font-size) - 1px);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    @apply text-muted font-semibold select-none;
}

/* ── Dropdown cell ────────────────────────────────────────────────── */
/* Negative margin stretches container to td edges (+ 1px for the td
   border) so the fixed-position panel aligns with the cell borders.
   Padding on the trigger restores the normal cell spacing. */

.dt-dropdown-cell {
    margin: calc(-1 * var(--dt-cell-py)) calc(-1 * var(--dt-px)) calc(-1 * var(--dt-cell-py)) calc(-1 * var(--dt-px) - 1px);
}

.dt-dropdown-cell [role="button"] {
    padding: var(--dt-cell-py) var(--dt-px) var(--dt-cell-py) calc(var(--dt-px) + 1px);
}

/* ── File dropdown (toolbar) ──────────────────────────────────────── */
/* Stretch trigger to toolbar edges so the dropdown panel aligns with
   the toolbar's bottom border, matching dt-dropdown-cell behaviour. */

.dt-file-dropdown {
    @apply self-stretch;
}

.dt-file-dropdown [role="button"] {
    @apply h-full border-l border-default px-3 gap-2;
}

.dt-file-dropdown [role="option"].text-secondary {
    @apply text-body;
}

/* ── Editable cell ────────────────────────────────────────────────── */

.dt-cell-editable {
    @apply w-full h-full flex items-center relative;
}

.dt-cell-editable input {
    @apply flex-1 min-w-0 bg-transparent outline-none border-0 text-body;
    padding: 0 16px 0 0;
    font: inherit;
    line-height: inherit;
}

.dt-cell-invalid input {
    @apply text-red-600 dark:text-red-500;
}

.dt-cell-valid input {
    @apply text-green-600 dark:text-green-500;
}

.dt-cell-overlay {
    @apply absolute flex items-center gap-1 pointer-events-none;
    right: 0;
    top: 0;
    bottom: 0;
}

.dt-cell-overlay > * {
    pointer-events: auto;
}

.dt-delete-field {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    margin-left: 4px;
    opacity: 0;
    transition: opacity 150ms;
    @apply text-red-600 dark:text-red-500;
}

.dt-cell-display:hover .dt-delete-field {
    opacity: 1;
}

.dt-cell-reset {
    @apply text-placeholder transition-colors;
    font-size: 0.625rem;
}

.dt-cell-reset:hover {
    @apply text-heading;
}

/* ── Display cell ─────────────────────────────────────────────────── */

.dt-cell-display {
    @apply w-full h-full flex items-center cursor-pointer;
}


.dt-status-dot {
    @apply w-2 h-2 rounded-full flex-shrink-0 mr-1;
}

/* ── JSON syntax colours ──────────────────────────────────────────── */

.dt-json-null {
    color: var(--syntax-literal);
    @apply italic;
}

.dt-json-string {
    color: var(--syntax-string);
}

.dt-json-number {
    color: var(--syntax-number);
}

.dt-json-value {
    @apply flex-1 min-w-0 break-all;
}

.dt-now-value {
    @apply break-all;
}

/* ── Stats table ──────────────────────────────────────────────────── */

.dt-stats-table {
    @apply w-full;
    table-layout: fixed;
}

.dt-stats-body {
    @apply divide-y divide-default;
}

.dt-stats-label {
    @apply py-1 pr-2 font-mono text-muted align-top border-r border-default text-right;
    padding-left: var(--dt-px);
}

.dt-stats-value {
    @apply py-1 px-2 align-top font-mono;
}

/* ── Remarks section ──────────────────────────────────────────────── */

.dt-remarks {
    @apply divider-t px-4 py-3;
}

/* ===========================================
   NORMALIZED SAMPLES TABLE
   =========================================== */

.normalized-samples-table {
    @apply font-mono text-xs;
    table-layout: auto;
}

.normalized-samples-table .table-header-cell {
    @apply px-3 py-1.5 normal-case text-xs;
    min-width: 70px;
}

.normalized-samples-table .table-cell {
    @apply px-3 py-1.5 text-xs;
}

.normalized-level-prefix {
    @apply font-semibold mr-1;
}

.normalized-level-heat {
    @apply text-blue-500;
}

.normalized-level-product {
    @apply text-amber-600;
}

.normalized-level-sample {
    @apply text-emerald-600;
}

.normalized-samples-table .table-cell.dt-cell-corrected {
    @apply text-amber-600 dark:text-amber-400 font-semibold;
}

.normalized-samples-table .table-cell.dt-cell-invalid {
    @apply text-red-600 dark:text-red-500;
}

.normalized-samples-table .table-cell.dt-cell-valid {
    @apply text-green-600 dark:text-green-500;
}

.normalized-samples-table .normalized-cell-input {
    @apply w-full bg-transparent outline-none border-0 text-body p-0 m-0;
    font: inherit;
}

/* Source cell highlight when linked to a bounding box.
   Two shapes:
   - On a single <td> (NormalizedSamplesTable cell click): highlight that cell directly.
   - On a <tr> (DefinitionTable row whose id matches the field path): highlight only the
     value cell (last column), never the property/label cell. */
td.field-source-active,
tr.field-source-active > td:last-child {
    background: rgba(255, 220, 0, 0.35) !important;
    box-shadow: inset 0 0 0 2px rgba(220, 180, 0, 1) !important;
}