/**
 * CJ's Brew & BBQ - Sausage Scaler
 * Version: 3.0.0 - Design System Refresh
 * Uses design-system.md component specs with semantic CSS variables
 * Supports light/dark mode via var() semantic references
 * UPDATED: Feb 2026
 */

@import url('brand-colors.css');

/* ==========================================
   SEMANTIC CSS VARIABLES (THEME SUPPORT)
   These resolve to light or dark tokens based on theme class
   ========================================== */

:root {
	/* Semantic background tokens */
	--bg-primary: var(--neutral-000, #FFFFFF);
	--bg-secondary: var(--neutral-100, #F3F4F6);
	--bg-tertiary: var(--neutral-200, #E5E7EB);

	/* Semantic text tokens */
	--text-primary: var(--neutral-900, #101010);
	--text-secondary: var(--neutral-600, #4B5563);
	--text-tertiary: var(--neutral-400, #9CA3AF);

	/* Semantic border tokens */
	--border-default: var(--neutral-400, #9CA3AF);
	--border-subtle: var(--neutral-200, #E5E7EB);

	/* Brand tokens (same in both modes) */
	--brand-primary: #FF5810;
	--brand-primary-dark: #CC4600;

	/* Error token */
	--error: #EF4444;
	--error-dark: #DC2626;

	/* Spacing tokens (4px base) */
	--space-1: 0.25rem;
	--space-2: 0.5rem;
	--space-3: 0.75rem;
	--space-4: 1rem;
	--space-5: 1.25rem;
	--space-6: 1.5rem;
	--space-8: 2rem;
	--space-10: 2.5rem;

	/* Typography tokens */
	--text-xs: 0.75rem;
	--text-sm: 0.875rem;
	--text-base: 1rem;
	--text-lg: 1.125rem;
	--text-xl: 1.327rem;
	--text-2xl: 1.76rem;

	--font-normal: 400;
	--font-medium: 500;
	--font-semibold: 600;

	/* Border radius */
	--radius-sm: 0.25rem;
	--radius-md: 0.5rem;
	--radius-lg: 0.75rem;
	--radius-full: 9999px;

	/* Shadows */
	--shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
	--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

/* Dark mode semantic overrides */
html.theme-dark {
	--bg-primary: #0F0F0F;
	--bg-secondary: #1A1A1A;
	--bg-tertiary: #262626;
	--bg-quaternary: #333333;

	--text-primary: #F5F5F5;
	--text-secondary: #B3B3B3;
	--text-tertiary: #808080;

	--border-default: #404040;
	--border-subtle: #2A2A2A;
	--border-strong: #595959;

	--error: #F87171;
	--error-dark: #DC2626;
}

/* ==========================================
   BASE STYLES
   ========================================== */

.cj-tool {
	font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	font-size: var(--text-base);
	line-height: 1.5;
	color: var(--text-primary);
	max-width: 1600px;
	margin: 0 auto;
	padding: 0 var(--space-4);
}

.cj-head h2 {
	font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2.4rem);
	margin: var(--space-1) 0;
	text-align: center;
	color: var(--text-primary);
}

.cj-sub {
	color: var(--text-secondary);
	margin: 0 0 var(--space-6);
	text-align: center;
	font-size: 1.05rem;
}

.cj-grid {
	display: grid;
	gap: var(--space-5);
	grid-template-columns: 1fr;
}

@media (min-width: 1200px) {
	.cj-grid {
		grid-template-columns: 480px 1fr;
	}
}

.cj-card {
	background: var(--bg-primary);
	border: 1px solid var(--border-default);
	border-radius: var(--radius-lg);
	padding: var(--space-6);
	box-shadow: var(--shadow-sm);
}

/* ==========================================
   NUMBERED SECTION HEADER COMPONENT (AC-2)
   ========================================== */

.cj-section-header {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	margin: 0 0 var(--space-4) 0;
	font-size: var(--text-xl);
	font-weight: var(--font-semibold);
	text-transform: uppercase;
	letter-spacing: 0.02em;
	color: var(--text-primary);
}

.cj-section-number {
	color: var(--brand-primary);
	font-size: var(--text-xl);
	font-weight: var(--font-semibold);
}

/* ==========================================
   FORM INPUTS
   ========================================== */

.cj-field {
	margin: var(--space-5) 0;
}

.cj-field label {
	display: block;
	font-weight: var(--font-semibold);
	margin-bottom: var(--space-2);
	color: var(--text-primary);
	font-size: var(--text-sm);
}

.cj-input {
	width: 100%;
	border: 1px solid var(--border-default);
	border-radius: var(--radius-md);
	padding: var(--space-3) var(--space-4);
	font-size: var(--text-base);
	font-family: inherit;
	transition: border-color 200ms, box-shadow 200ms;
	background: var(--bg-primary);
	color: var(--text-primary);
	box-sizing: border-box;
	min-height: 44px;
}

.cj-input:focus {
	outline: none;
	border-color: var(--brand-primary);
	box-shadow: 0 0 0 2px var(--brand-primary);
}

.cj-input::placeholder {
	color: var(--text-tertiary);
}

select.cj-input {
	appearance: none;
	background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
	background-position: right var(--space-3) center;
	background-repeat: no-repeat;
	background-size: 1.5em 1.5em;
	padding-right: var(--space-10);
	cursor: pointer;
}

.cj-field-inline {
	display: flex;
	gap: var(--space-3);
	align-items: center;
	margin: var(--space-2) 0;
}

.cj-field-inline label {
	flex: 0 0 auto;
	min-width: 140px;
	margin-bottom: 0;
}

.cj-field-inline .cj-input {
	flex: 1;
}

/* ==========================================
   RANGE SLIDER COMPONENT (AC-3)
   ========================================== */

.cj-range-slider {
	width: 100%;
	padding: var(--space-4);
	background: var(--bg-secondary);
	border: 1px solid var(--border-default);
	border-radius: var(--radius-md);
	margin: var(--space-6) 0;
}

.cj-range-slider__label {
	display: block;
	font-size: var(--text-sm);
	font-weight: var(--font-medium);
	color: var(--brand-primary);
	margin-bottom: var(--space-3);
}

.cj-range-slider__track-container {
	position: relative;
	padding: var(--space-2) 0;
}

.cj-range-slider__input {
	width: 100%;
	height: 8px;
	border-radius: var(--radius-full);
	background: var(--bg-tertiary);
	outline: none;
	-webkit-appearance: none;
	appearance: none;
	cursor: grab;
}

.cj-range-slider__input:active {
	cursor: grabbing;
}

/* WebKit thumb */
.cj-range-slider__input::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 20px;
	height: 20px;
	border-radius: var(--radius-full);
	background: var(--brand-primary);
	border: 2px solid var(--bg-primary);
	cursor: grab;
	box-shadow: var(--shadow-sm);
	transition: transform 200ms, background 200ms;
}

.cj-range-slider__input::-webkit-slider-thumb:hover {
	transform: scale(1.1);
	background: var(--brand-primary-dark);
}

.cj-range-slider__input:focus::-webkit-slider-thumb {
	outline: 2px solid var(--brand-primary);
	outline-offset: 2px;
}

.cj-range-slider__input:active::-webkit-slider-thumb {
	cursor: grabbing;
	background: var(--brand-primary-dark);
}

/* Firefox thumb */
.cj-range-slider__input::-moz-range-thumb {
	width: 20px;
	height: 20px;
	border-radius: var(--radius-full);
	background: var(--brand-primary);
	border: 2px solid var(--bg-primary);
	cursor: grab;
	box-shadow: var(--shadow-sm);
	transition: transform 200ms, background 200ms;
}

.cj-range-slider__input::-moz-range-thumb:hover {
	transform: scale(1.1);
	background: var(--brand-primary-dark);
}

.cj-range-slider__input:focus::-moz-range-thumb {
	outline: 2px solid var(--brand-primary);
	outline-offset: 2px;
}

/* Firefox track fill */
.cj-range-slider__input::-moz-range-progress {
	height: 8px;
	background: var(--brand-primary);
	border-radius: var(--radius-full);
}

.cj-range-slider__value {
	text-align: center;
	font-size: var(--text-2xl);
	font-weight: var(--font-semibold);
	color: var(--text-primary);
	margin-top: var(--space-3);
}

.cj-range-slider__labels {
	display: flex;
	justify-content: space-between;
	margin-top: var(--space-2);
}

.cj-range-slider__label-min,
.cj-range-slider__label-max {
	font-size: var(--text-xs);
	font-weight: var(--font-normal);
	color: var(--text-secondary);
}

/* ==========================================
   INGREDIENT TABLE ROW COMPONENT (AC-4)
   ========================================== */

.cj-ingredient-section {
	margin: var(--space-6) 0;
	padding: var(--space-4);
	background: var(--bg-secondary);
	border-radius: var(--radius-md);
	border-left: 4px solid var(--brand-primary);
}

.cj-ingredient-section__title {
	font-weight: var(--font-semibold);
	color: var(--text-primary);
	margin-bottom: var(--space-3);
	font-size: var(--text-lg);
}

.cj-ingredient-section__note {
	font-size: var(--text-sm);
	color: var(--text-secondary);
	background: var(--bg-tertiary);
	padding: var(--space-2) var(--space-3);
	border-radius: var(--radius-sm);
	margin-bottom: var(--space-3);
	border: 1px solid var(--border-subtle);
}

.cj-ingredient-table {
	width: 100%;
	background: var(--bg-primary);
	border: 1px solid var(--border-default);
	border-radius: var(--radius-md);
	overflow: hidden;
}

/* Header row */
.cj-ingredient-table__row--header {
	display: grid;
	grid-template-columns: 1fr 80px 80px 100px 44px;
	gap: var(--space-3);
	padding: var(--space-2) var(--space-3);
	background: transparent;
	border-bottom: 1px solid var(--border-subtle);
}

.cj-ingredient-table__row--header .cj-ingredient-table__cell {
	font-size: var(--text-xs);
	font-weight: var(--font-medium);
	text-transform: uppercase;
	color: var(--text-secondary);
	letter-spacing: 0.05em;
}

/* Data rows */
.cj-ingredient-table__row {
	display: grid;
	grid-template-columns: 1fr 80px 80px 100px 44px;
	gap: var(--space-3);
	padding: var(--space-2) var(--space-3);
	background: var(--bg-secondary);
	border-bottom: 1px solid var(--border-subtle);
	align-items: center;
	min-height: 52px;
	transition: background 200ms;
}

.cj-ingredient-table__row:hover {
	background: var(--bg-tertiary);
}

.cj-ingredient-table__row:last-child {
	border-bottom: none;
}

.cj-ingredient-table__cell {
	min-width: 0;
}

/* Ingredient inputs */
.cj-ingredient-table__input {
	width: 100%;
	padding: var(--space-2) var(--space-3);
	border: 1px solid var(--border-default);
	border-radius: var(--radius-sm);
	font-size: var(--text-sm);
	font-family: inherit;
	background: var(--bg-tertiary);
	color: var(--text-primary);
	box-sizing: border-box;
	min-height: 36px;
	transition: border-color 200ms;
}

.cj-ingredient-table__input:focus {
	outline: none;
	border-color: var(--brand-primary);
}

.cj-ingredient-table__input::placeholder {
	color: var(--text-tertiary);
}

/* Amount input (right-aligned) */
.cj-ingredient-table__input--amount {
	text-align: right;
}

/* Select dropdown */
.cj-ingredient-table__select {
	width: 100%;
	padding: var(--space-2);
	border: 1px solid var(--border-default);
	border-radius: var(--radius-sm);
	font-size: var(--text-sm);
	font-family: inherit;
	background: var(--bg-tertiary);
	color: var(--text-primary);
	box-sizing: border-box;
	min-height: 36px;
	cursor: pointer;
	appearance: none;
	background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
	background-position: right 4px center;
	background-repeat: no-repeat;
	background-size: 16px 16px;
	padding-right: 24px;
}

.cj-ingredient-table__select:focus {
	outline: none;
	border-color: var(--brand-primary);
}

/* Scaled value */
.cj-ingredient-table__scaled {
	font-size: var(--text-base);
	font-weight: var(--font-semibold);
	color: var(--brand-primary);
	text-align: right;
}

/* Delete button */
.cj-ingredient-table__delete {
	width: 44px;
	height: 44px;
	background: transparent;
	border: none;
	border-radius: var(--radius-md);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 200ms;
	color: var(--error);
}

.cj-ingredient-table__delete:hover {
	background: color-mix(in srgb, var(--error) 10%, transparent);
	color: var(--error-dark);
}

.cj-ingredient-table__delete:focus {
	outline: 2px solid var(--error);
	outline-offset: 2px;
}

.cj-ingredient-table__delete-icon {
	width: 20px;
	height: 20px;
}

/* Screen reader text (accessibility) */
.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ==========================================
   STATS SUMMARY BAR COMPONENT (AC-5)
   ========================================== */

.cj-stats-bar {
	display: flex;
	width: 100%;
	background: var(--bg-secondary);
	border: 1px solid var(--border-default);
	border-radius: var(--radius-md);
	overflow: hidden;
	margin: var(--space-6) 0;
}

.cj-stats-bar__cell {
	flex: 1;
	padding: var(--space-4);
	text-align: center;
	border-right: 1px solid var(--border-subtle);
}

.cj-stats-bar__cell:last-child {
	border-right: none;
}

.cj-stats-bar__label {
	font-size: var(--text-xs);
	font-weight: var(--font-medium);
	text-transform: uppercase;
	color: var(--text-secondary);
	letter-spacing: 0.05em;
	margin-bottom: var(--space-1);
}

.cj-stats-bar__value {
	font-size: var(--text-xl);
	font-weight: var(--font-semibold);
	color: var(--text-primary);
}

/* Accent variant (Yield cell) */
.cj-stats-bar__cell--accent {
	background: var(--brand-primary);
	border-right: none;
}

.cj-stats-bar__cell--accent .cj-stats-bar__label {
	color: #FFFFFF;
}

.cj-stats-bar__cell--accent .cj-stats-bar__value {
	color: #FFFFFF;
	font-size: var(--text-2xl);
}

/* ==========================================
   BUTTONS
   ========================================== */

.cj-btn {
	display: block;
	width: 100%;
	padding: var(--space-3) var(--space-6);
	font-family: inherit;
	font-size: var(--text-base);
	font-weight: var(--font-semibold);
	text-align: center;
	border: none;
	border-radius: var(--radius-md);
	cursor: pointer;
	transition: all 200ms;
	background-color: var(--bg-secondary);
	color: var(--text-primary);
	margin-top: var(--space-4);
	min-height: 44px;
}

.cj-btn:hover {
	background-color: var(--bg-tertiary);
}

.cj-btn:focus {
	outline: 2px solid var(--brand-primary);
	outline-offset: 2px;
}

.cj-btn:active {
	transform: scale(0.98);
}

.cj-btn-primary {
	background-color: var(--brand-primary);
	color: #FFFFFF;
}

.cj-btn-primary:hover {
	background-color: var(--brand-primary-dark);
}

.cj-btn-sm {
	padding: var(--space-2) var(--space-4);
	font-size: var(--text-sm);
	margin-top: 0;
}

/* ==========================================
   ACTIONS ROW
   ========================================== */

.cj-actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
	margin-top: var(--space-4);
}

.cj-actions-3col {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--space-2);
	margin-top: var(--space-4);
}

/* Delete button (trash) */
.cj-btn-delete-sm {
	background-color: var(--error);
	color: #FFFFFF;
	border: none;
	border-radius: var(--radius-full);
	width: 44px;
	height: 44px;
	font-size: 18px;
	cursor: pointer;
	transition: all 200ms;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	margin: 0;
}

.cj-btn-delete-sm:hover {
	background-color: var(--error-dark);
	transform: scale(1.1);
}

.cj-btn-delete-sm:focus {
	outline: 2px solid var(--error);
	outline-offset: 2px;
}

/* ==========================================
   PRELOAD NOTICE
   ========================================== */

.cj-preload-notice {
	background: var(--bg-secondary);
	border: 2px solid #10b981;
	border-radius: var(--radius-md);
	padding: var(--space-3) var(--space-4);
	margin: var(--space-4) 0;
	text-align: center;
	color: var(--text-primary);
	font-size: var(--text-sm);
}

.cj-preload-notice strong {
	color: #10b981;
}

/* ==========================================
   HIDE CLASS
   ========================================== */

.cj-hide {
	display: none !important;
}

/* ==========================================
   RESPONSIVE (AC-6 - Touch Targets)
   ========================================== */

@media (max-width: 768px) {
	.cj-tool {
		padding: 0 var(--space-2);
	}

	.cj-card {
		padding: var(--space-4);
	}

	.cj-head h2 {
		font-size: 1.5rem;
	}

	.cj-sub {
		font-size: var(--text-sm);
	}

	.cj-field-inline {
		flex-direction: column;
		align-items: stretch;
	}

	.cj-field-inline label {
		min-width: auto;
	}

	.cj-field-inline .cj-input {
		max-width: none;
	}

	/* Range slider mobile */
	.cj-range-slider {
		padding: var(--space-3);
	}

	.cj-range-slider__value {
		font-size: var(--text-xl);
	}

	/* Ingredient table mobile - stack layout */
	.cj-ingredient-table__row--header {
		display: none;
	}

	.cj-ingredient-table__row {
		display: flex;
		flex-direction: column;
		gap: var(--space-2);
		padding: var(--space-3);
		min-height: auto;
	}

	.cj-ingredient-table__cell {
		width: 100%;
	}

	.cj-ingredient-table__cell::before {
		content: attr(data-label);
		display: block;
		font-size: var(--text-xs);
		font-weight: var(--font-medium);
		color: var(--text-secondary);
		text-transform: uppercase;
		margin-bottom: var(--space-1);
		letter-spacing: 0.05em;
	}

	.cj-ingredient-table__input,
	.cj-ingredient-table__select {
		min-height: 44px;
		font-size: var(--text-base);
	}

	.cj-ingredient-table__scaled {
		font-size: var(--text-lg);
		padding: var(--space-2);
		background: var(--bg-tertiary);
		border-radius: var(--radius-sm);
		text-align: center;
	}

	.cj-ingredient-table__delete {
		width: 100%;
		height: 44px;
		background: color-mix(in srgb, var(--error) 10%, transparent);
		border-radius: var(--radius-sm);
	}

	/* Stats bar mobile - vertical stack */
	.cj-stats-bar {
		flex-direction: column;
	}

	.cj-stats-bar__cell {
		border-right: none;
		border-bottom: 1px solid var(--border-subtle);
	}

	.cj-stats-bar__cell:last-child {
		border-bottom: none;
	}

	/* Actions mobile */
	.cj-actions-3col {
		grid-template-columns: 1fr;
	}

	.cj-btn {
		width: 100%;
		min-height: 44px;
	}

	.cj-ingredient-section {
		padding: var(--space-3);
		margin: var(--space-4) 0;
	}

	.cj-ingredient-section__title {
		font-size: var(--text-base);
	}

	.cj-ingredient-section__note {
		font-size: var(--text-xs);
		padding: var(--space-2);
	}
}

/* ==========================================
   LEGACY CLASS SUPPORT (BACKWARD COMPAT)
   Keep old classes working during JS update
   ========================================== */

/* Old ratio slider classes map to new */
.cj-ratio-slider-container {
	width: 100%;
	padding: var(--space-4);
	background: var(--bg-secondary);
	border: 1px solid var(--border-default);
	border-radius: var(--radius-md);
	margin: var(--space-6) 0;
}

.cj-ratio-slider-label {
	display: block;
	font-size: var(--text-sm);
	font-weight: var(--font-medium);
	color: var(--brand-primary);
	margin-bottom: var(--space-3);
}

.cj-ratio-slider {
	width: 100%;
	height: 8px;
	border-radius: var(--radius-full);
	background: var(--bg-tertiary);
	outline: none;
	-webkit-appearance: none;
	appearance: none;
	cursor: grab;
}

.cj-ratio-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 20px;
	height: 20px;
	border-radius: var(--radius-full);
	background: var(--brand-primary);
	border: 2px solid var(--bg-primary);
	cursor: grab;
	box-shadow: var(--shadow-sm);
}

.cj-ratio-slider::-moz-range-thumb {
	width: 20px;
	height: 20px;
	border-radius: var(--radius-full);
	background: var(--brand-primary);
	border: 2px solid var(--bg-primary);
	cursor: grab;
	box-shadow: var(--shadow-sm);
}

.cj-ratio-display {
	text-align: center;
	font-size: var(--text-2xl);
	font-weight: var(--font-semibold);
	color: var(--text-primary);
	margin-top: var(--space-3);
}

.cj-ratio-labels {
	display: flex;
	justify-content: space-between;
	margin-top: var(--space-2);
	font-size: var(--text-xs);
	color: var(--text-secondary);
}

/* Old summary classes map to stats bar */
.cj-summary {
	display: flex;
	width: 100%;
	background: var(--bg-secondary);
	border: 1px solid var(--border-default);
	border-radius: var(--radius-md);
	overflow: hidden;
	margin: var(--space-6) 0;
}

.cj-summary-3col {
	display: flex;
}

.cj-summary-item {
	flex: 1;
	padding: var(--space-4);
	text-align: center;
	border-right: 1px solid var(--border-subtle);
}

.cj-summary-item:last-child {
	border-right: none;
}

.cj-summary-label {
	font-size: var(--text-xs);
	font-weight: var(--font-medium);
	text-transform: uppercase;
	color: var(--text-secondary);
	letter-spacing: 0.05em;
	margin-bottom: var(--space-1);
}

.cj-summary-value {
	font-size: var(--text-xl);
	font-weight: var(--font-semibold);
	color: var(--text-primary);
}

/* Old category section classes */
.cj-category-section {
	margin: var(--space-6) 0;
	padding: var(--space-4);
	background: var(--bg-secondary);
	border-radius: var(--radius-md);
	border-left: 4px solid var(--brand-primary);
}

.cj-category-title {
	font-weight: var(--font-semibold);
	color: var(--text-primary);
	margin-bottom: var(--space-3);
	font-size: var(--text-lg);
}

.cj-meat-auto-note {
	font-size: var(--text-sm);
	color: var(--text-secondary);
	background: var(--bg-tertiary);
	padding: var(--space-2) var(--space-3);
	border-radius: var(--radius-sm);
	margin-bottom: var(--space-3);
	border: 1px solid var(--border-subtle);
}

/* Old table classes (for JS-generated rows) */
.cj-table-wrap {
	overflow-x: auto;
	margin: var(--space-4) 0;
	border: 1px solid var(--border-default);
	border-radius: var(--radius-md);
}

.cj-table {
	width: 100%;
	border-collapse: collapse;
	min-width: 700px;
}

.cj-table thead {
	background: var(--bg-secondary);
}

.cj-table th {
	padding: var(--space-3);
	text-align: left;
	font-weight: var(--font-medium);
	color: var(--text-secondary);
	border-bottom: 1px solid var(--border-subtle);
	font-size: var(--text-xs);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.cj-table td {
	padding: var(--space-2) var(--space-3);
	border-bottom: 1px solid var(--border-subtle);
}

.cj-table tbody tr {
	background: var(--bg-secondary);
	transition: background 200ms;
}

.cj-table tbody tr:hover {
	background: var(--bg-tertiary);
}

.cj-table input,
.cj-table select {
	width: 100%;
	padding: var(--space-2);
	border: 1px solid var(--border-default);
	border-radius: var(--radius-sm);
	font-size: var(--text-sm);
	box-sizing: border-box;
	background: var(--bg-tertiary);
	color: var(--text-primary);
	min-height: 36px;
}

.cj-table input:focus,
.cj-table select:focus {
	outline: none;
	border-color: var(--brand-primary);
}

.cj-table th:nth-child(1),
.cj-table td:nth-child(1) {
	width: 35%;
}

.cj-table th:nth-child(2),
.cj-table td:nth-child(2) {
	width: 10%;
}

.cj-table th:nth-child(3),
.cj-table td:nth-child(3) {
	width: 18%;
}

.cj-table th:nth-child(4),
.cj-table td:nth-child(4) {
	width: 20%;
	font-weight: var(--font-semibold);
	color: var(--brand-primary);
	font-size: 1.05rem;
}

.cj-table th:nth-child(5),
.cj-table td:nth-child(5) {
	width: 17%;
	text-align: center;
}

.cj-remove {
	background-color: var(--error);
	color: #FFFFFF;
	border: none;
	border-radius: var(--radius-md);
	padding: var(--space-2) var(--space-3);
	cursor: pointer;
	font-size: var(--text-sm);
	font-weight: var(--font-semibold);
	transition: all 200ms;
	min-height: 44px;
	min-width: 44px;
}

.cj-remove:hover {
	background-color: var(--error-dark);
}

.cj-remove:focus {
	outline: 2px solid var(--error);
	outline-offset: 2px;
}

/* Mobile legacy table support */
@media (max-width: 768px) {
	.cj-table-wrap {
		border: none;
		border-radius: 0;
	}

	.cj-table {
		min-width: 100%;
	}

	.cj-table thead {
		display: none;
	}

	.cj-table tbody {
		display: block;
	}

	.cj-table tr {
		display: flex;
		flex-direction: column;
		margin-bottom: var(--space-3);
		border: 1px solid var(--border-default);
		border-radius: var(--radius-md);
		padding: 0;
		background: var(--bg-primary);
		overflow: hidden;
	}

	.cj-table td {
		display: block;
		padding: var(--space-3);
		border: none;
		width: 100%;
	}

	.cj-table td:nth-child(1) {
		background: var(--bg-secondary);
		border-bottom: 1px solid var(--border-subtle);
		width: 100%;
	}

	.cj-table td:nth-child(2)::before {
		content: "Amount";
		display: block;
		font-size: var(--text-xs);
		font-weight: var(--font-medium);
		color: var(--text-secondary);
		text-transform: uppercase;
		margin-bottom: var(--space-1);
	}

	.cj-table td:nth-child(3)::before {
		content: "Unit";
		display: block;
		font-size: var(--text-xs);
		font-weight: var(--font-medium);
		color: var(--text-secondary);
		text-transform: uppercase;
		margin-bottom: var(--space-1);
	}

	.cj-table td:nth-child(4) {
		background: var(--bg-tertiary);
		text-align: center;
		border-top: 1px solid var(--border-subtle);
		width: 100%;
	}

	.cj-table td:nth-child(4)::before {
		content: "Scaled Amount";
		display: block;
		font-size: var(--text-xs);
		font-weight: var(--font-medium);
		color: var(--text-secondary);
		text-transform: uppercase;
		margin-bottom: var(--space-1);
	}

	.cj-table td:nth-child(5) {
		text-align: center;
		width: 100%;
	}

	.cj-table input,
	.cj-table select {
		min-height: 44px;
		font-size: var(--text-base);
	}

	.cj-remove {
		width: 100%;
		min-height: 44px;
	}

	.cj-summary {
		flex-direction: column;
	}

	.cj-summary-item {
		border-right: none;
		border-bottom: 1px solid var(--border-subtle);
	}

	.cj-summary-item:last-child {
		border-bottom: none;
	}
}
