/* Calculador Arancel Ético Mínimo - Frontend */

.cae-wrap {
	--cae-primary: #13437E;
	--cae-primary-dark: #0e3260;
	--cae-accent: #13437E;
	--cae-danger: #e53935;
	--cae-text: #1f2433;
	--cae-muted: #6b7280;
	--cae-border: #e6e8ef;
	--cae-bg-soft: #f7f8fb;
	--cae-radius: 14px;
	--cae-shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);

	box-sizing: border-box;
	max-width: 1040px;
	margin: 0 auto;
	color: var(--cae-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
}

.cae-wrap *,
.cae-wrap *::before,
.cae-wrap *::after {
	box-sizing: border-box;
}

/* Header */
.cae-header {
	margin-bottom: 18px;
}

.cae-title {
	margin: 0 0 4px;
	font-size: 26px;
	font-weight: 700;
	color: #2b3142;
}

.cae-subtitle {
	margin: 0 0 6px;
	color: var(--cae-muted);
	font-size: 14px;
}

.cae-disclaimer {
	margin: 0;
	font-size: 13px;
	color: #4b5563;
}

/* Layout */
.cae-toprow {
	display: grid;
	grid-template-columns: 1fr 300px;
	gap: 18px;
	margin-bottom: 18px;
}

.cae-card {
	background: #fff;
	border: 1px solid var(--cae-border);
	border-radius: var(--cae-radius);
	box-shadow: var(--cae-shadow);
	padding: 20px 22px;
}

.cae-card__title {
	margin: 0 0 16px;
	font-size: 17px;
	font-weight: 700;
}

/* Search */
.cae-search__field {
	position: relative;
}

.cae-search__label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	color: var(--cae-muted);
	margin-bottom: 6px;
}

.cae-search__inputwrap {
	display: flex;
	align-items: center;
	border: 1px solid var(--cae-border);
	border-radius: 10px;
	background: #fff;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.cae-search__inputwrap:focus-within {
	border-color: var(--cae-primary);
	box-shadow: 0 0 0 3px rgba(19, 67, 126, .14);
}

.cae-search__hash {
	padding: 0 12px;
	color: #c0c4d0;
	font-size: 18px;
	font-weight: 600;
	user-select: none;
}

.cae-search__input {
	flex: 1;
	border: 0;
	outline: 0;
	background: transparent;
	padding: 13px 14px 13px 0;
	font-size: 15px;
	color: var(--cae-text);
	width: 100%;
}

.cae-search__input::placeholder {
	color: #aab0bd;
}

/* Suggestions */
.cae-suggest {
	position: absolute;
	z-index: 50;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	background: #fff;
	border: 1px solid var(--cae-border);
	border-radius: 10px;
	box-shadow: 0 12px 30px rgba(16, 24, 40, .12);
	max-height: 320px;
	overflow-y: auto;
}

.cae-suggest__item {
	display: flex;
	align-items: baseline;
	gap: 10px;
	padding: 11px 14px;
	cursor: pointer;
	border-bottom: 1px solid #f1f2f6;
}

.cae-suggest__item:last-child {
	border-bottom: 0;
}

.cae-suggest__item:hover,
.cae-suggest__item.is-active {
	background: var(--cae-bg-soft);
}

.cae-suggest__code {
	flex: 0 0 auto;
	min-width: 52px;
	font-weight: 700;
	color: var(--cae-primary);
	font-size: 13px;
}

.cae-suggest__desc {
	flex: 1;
	font-size: 14px;
	color: var(--cae-text);
}

.cae-suggest__price {
	flex: 0 0 auto;
	font-size: 13px;
	color: var(--cae-muted);
	white-space: nowrap;
}

.cae-suggest__msg {
	padding: 13px 14px;
	color: var(--cae-muted);
	font-size: 14px;
}

.cae-suggest mark {
	background: rgba(19, 67, 126, .16);
	color: inherit;
	padding: 0 1px;
	border-radius: 2px;
}

/* Extras */
.cae-extras {
	display: flex;
	flex-wrap: wrap;
	gap: 18px;
	margin-top: 16px;
}

.cae-check {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	cursor: pointer;
	user-select: none;
}

.cae-check input {
	width: 17px;
	height: 17px;
	accent-color: var(--cae-primary);
	cursor: pointer;
}

/* Help */
.cae-help {
	display: flex;
	gap: 10px;
	margin-top: 16px;
	padding: 12px 14px;
	background: #eaf0f8;
	border-radius: 10px;
	font-size: 13px;
	color: #13437E;
	font-style: italic;
}

.cae-help__icon {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--cae-accent);
	color: #fff;
	font-style: normal;
	font-weight: 700;
	font-size: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Total card */
.cae-card--total {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	border: 2px solid var(--cae-primary);
	gap: 6px;
}

.cae-total__label {
	font-size: 14px;
	font-weight: 600;
	letter-spacing: .04em;
	color: var(--cae-muted);
}

.cae-total__amount {
	font-size: 30px;
	font-weight: 800;
	color: var(--cae-primary);
	line-height: 1.1;
}

.cae-btn {
	border: 0;
	border-radius: 8px;
	padding: 9px 18px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background .15s ease, opacity .15s ease;
	font-family: inherit;
}

.cae-total__actions {
	display: flex;
	gap: 8px;
	margin-top: 6px;
	flex-wrap: wrap;
	justify-content: center;
}

.cae-btn--print {
	background: var(--cae-primary);
	color: #fff;
}

.cae-btn--print:hover {
	background: var(--cae-primary-dark);
}

.cae-btn--clear {
	background: var(--cae-danger);
	color: #fff;
}

.cae-btn--clear:hover {
	background: #c62828;
}

/* Table */
.cae-card--table {
	padding-bottom: 8px;
}

.cae-tablewrap {
	overflow-x: auto;
}

.cae-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

.cae-table thead th {
	text-align: left;
	font-size: 12px;
	font-weight: 700;
	color: var(--cae-muted);
	text-transform: none;
	padding: 10px 12px;
	border-bottom: 2px solid var(--cae-border);
	white-space: nowrap;
}

.cae-table tbody td {
	padding: 14px 12px;
	border-bottom: 1px solid #f1f2f6;
	vertical-align: middle;
}

.cae-table tbody tr:last-child td {
	border-bottom: 0;
}

.cae-col-ub,
.cae-col-unit,
.cae-col-total {
	text-align: right;
	white-space: nowrap;
}

.cae-table thead .cae-col-ub,
.cae-table thead .cae-col-unit,
.cae-table thead .cae-col-total,
.cae-table thead .cae-col-qty {
	text-align: center;
}

.cae-col-qty {
	text-align: center;
}

.cae-col-actions {
	width: 44px;
	text-align: center;
}

.cae-cell-code {
	font-weight: 600;
	color: #2b3142;
}

.cae-cell-total {
	font-weight: 700;
}

/* Quantity stepper */
.cae-qty {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.cae-qty__btn {
	width: 26px;
	height: 26px;
	border: 1px solid var(--cae-border);
	background: #fff;
	border-radius: 7px;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	color: var(--cae-primary);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background .12s ease, border-color .12s ease;
}

.cae-qty__btn:hover {
	background: var(--cae-bg-soft);
	border-color: var(--cae-primary);
}

.cae-qty__value {
	min-width: 30px;
	text-align: center;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

/* Delete */
.cae-del {
	border: 0;
	background: transparent;
	cursor: pointer;
	color: var(--cae-danger);
	padding: 6px;
	border-radius: 6px;
	display: inline-flex;
	transition: background .12s ease;
}

.cae-del:hover {
	background: rgba(229, 57, 53, .1);
}

.cae-del svg {
	width: 18px;
	height: 18px;
}

/* Empty state */
.cae-empty {
	padding: 26px 12px;
	text-align: center;
	color: var(--cae-muted);
	font-size: 14px;
}

.cae-empty[hidden] {
	display: none;
}

/* Row enter animation */
@keyframes cae-fade-in {
	from { opacity: 0; transform: translateY(-4px); }
	to   { opacity: 1; transform: translateY(0); }
}

.cae-table tbody tr {
	animation: cae-fade-in .18s ease;
}

/* Responsive */
@media (max-width: 760px) {
	.cae-toprow {
		grid-template-columns: 1fr;
	}

	.cae-title {
		font-size: 22px;
	}

	.cae-table thead {
		display: none;
	}

	.cae-table,
	.cae-table tbody,
	.cae-table tr,
	.cae-table td {
		display: block;
		width: 100%;
	}

	.cae-table tbody tr {
		border: 1px solid var(--cae-border);
		border-radius: 10px;
		margin-bottom: 12px;
		padding: 6px 4px;
	}

	.cae-table tbody td {
		border: 0;
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 8px 14px;
		text-align: right;
	}

	.cae-table tbody td::before {
		content: attr(data-label);
		font-weight: 600;
		color: var(--cae-muted);
		font-size: 12px;
		text-align: left;
		margin-right: 12px;
	}

	.cae-col-actions {
		width: auto;
	}
}
