:root {
	--brand-primary: #2c3e50;
	--brand-dark: #1a252f;
	--brand-light: #f5f7f8;
	--brand-accent: #25d366;
	--border: #dde2e6;
	--radius: 8px;
}

* { box-sizing: border-box; }
body {
	margin: 0;
	font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
	background: var(--brand-light);
	color: var(--brand-dark);
	line-height: 1.5;
}

.app-header {
	display: none;
}
.app-main {
	max-width: 1100px;
	margin: 0 auto;
	padding: 20px 16px 48px;
}
.app-main--auth {
	max-width: none;
}

/* ——— App shell + sidebar ——— */
.app-shell {
	display: flex;
	min-height: 100vh;
}

.app-sidebar {
	width: 260px;
	flex-shrink: 0;
	background: #fff;
	border-right: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	padding: 20px 16px;
	position: sticky;
	top: 0;
	height: 100vh;
	z-index: 40;
}

.app-sidebar__brand {
	margin-bottom: 24px;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--border);
}

.app-sidebar__logo {
	display: block;
	margin-bottom: 6px;
}

.app-sidebar__tag {
	font-size: 0.8rem;
	font-weight: 600;
	color: #666;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.app-sidebar__brand-link {
	display: block;
	text-decoration: none;
	color: inherit;
}

.app-sidebar__brand-link:hover .app-sidebar__tag {
	color: var(--brand-primary);
}

.app-sidebar__nav {
	display: flex;
	flex-direction: column;
	gap: 4px;
	flex: 1;
}

.app-sidebar__link {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border-radius: 8px;
	color: var(--brand-dark);
	text-decoration: none;
	font-weight: 500;
	font-size: 0.95rem;
	transition: background 0.15s;
}

.app-sidebar__link:hover {
	background: var(--brand-light);
}

.app-sidebar__link.is-active {
	background: var(--brand-primary);
	color: #fff;
}

.app-sidebar__link--muted {
	color: #666;
	font-size: 0.9rem;
}

.app-sidebar__link--logout {
	color: #8a1f11;
	margin-top: 4px;
}

.app-sidebar__footer {
	margin-top: auto;
	padding-top: 16px;
	border-top: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.app-sidebar__user {
	padding: 10px 12px;
	font-size: 0.85rem;
	color: #555;
	line-height: 1.4;
}

.app-sidebar__user strong {
	display: block;
	color: var(--brand-dark);
}

.app-sidebar__icon {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	opacity: 0.85;
	background: currentColor;
	mask-size: contain;
	mask-repeat: no-repeat;
	mask-position: center;
	-webkit-mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	-webkit-mask-position: center;
}

.app-sidebar__icon--home {
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3Cpath d='M9 22V12h6v10'/%3E%3C/svg%3E");
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3Cpath d='M9 22V12h6v10'/%3E%3C/svg%3E");
}

.app-sidebar__icon--ruler {
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 8h16M6 8v3M10 8v2M14 8v3M18 8v2M4 16h16'/%3E%3C/svg%3E");
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 8h16M6 8v3M10 8v2M14 8v3M18 8v2M4 16h16'/%3E%3C/svg%3E");
}

.app-sidebar__icon--list {
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01'/%3E%3C/svg%3E");
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01'/%3E%3C/svg%3E");
}

.app-sidebar__icon--plus {
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
}

.app-sidebar__icon--receipt {
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 2v20l3-2 3 2 3-2 3 2 3-2 3 2V2l-3 2-3-2-3 2-3-2-3 2z'/%3E%3Cpath d='M8 10h8M8 14h5'/%3E%3C/svg%3E");
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 2v20l3-2 3 2 3-2 3 2 3-2 3 2V2l-3 2-3-2-3 2-3-2-3 2z'/%3E%3Cpath d='M8 10h8M8 14h5'/%3E%3C/svg%3E");
}

.app-sidebar__icon--invoice {
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 2v6h6M8 13h8M8 17h8M8 9h2'/%3E%3C/svg%3E");
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 2v6h6M8 13h8M8 17h8M8 9h2'/%3E%3C/svg%3E");
}

.app-sidebar__icon--web {
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z'/%3E%3C/svg%3E");
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z'/%3E%3C/svg%3E");
}

.app-sidebar__icon--logout {
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9'/%3E%3C/svg%3E");
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9'/%3E%3C/svg%3E");
}

.app-sidebar__icon--users {
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM23 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E");
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM23 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E");
}

.app-content {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.app-topbar {
	display: none;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	background: #fff;
	border-bottom: 1px solid var(--border);
	position: sticky;
	top: 0;
	z-index: 30;
}

.app-topbar__menu {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 40px;
	height: 40px;
	padding: 8px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: #fff;
	cursor: pointer;
}

.app-topbar__menu span {
	display: block;
	height: 2px;
	background: var(--brand-primary);
	border-radius: 1px;
}

.app-topbar__title {
	font-weight: 600;
	font-size: 1rem;
	color: var(--brand-primary);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.app-sidebar-backdrop {
	display: none;
}

.app-bottom-nav {
	display: none;
}

.page-head--compact h1 {
	font-size: 1.35rem;
}

/* ——— Dashboard ——— */
.stat-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 12px;
	margin-bottom: 16px;
}

.stat-card {
	background: #fff;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.stat-card__label {
	font-size: 0.8rem;
	font-weight: 600;
	color: #666;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.stat-card__value {
	font-size: 1.75rem;
	line-height: 1.2;
	color: var(--brand-primary);
}

.stat-card--success .stat-card__value { color: #166534; }
.stat-card--warn .stat-card__value { color: #b45309; }

.dashboard-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	margin-bottom: 16px;
}

.dashboard-metric {
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.dashboard-metric strong {
	font-size: 1.5rem;
	color: var(--brand-primary);
}

.dashboard-alert {
	margin: 12px 0 0;
}

.quick-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.data-table--compact th,
.data-table--compact td {
	padding: 10px 12px;
}

@media (max-width: 900px) {
	.stat-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.dashboard-grid {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 480px) {
	.stat-grid {
		grid-template-columns: 1fr 1fr;
	}

	.stat-card__value {
		font-size: 1.4rem;
	}
}

.hide-mobile {
	display: inline-flex;
}

.has-nav .app-main {
	padding-bottom: 24px;
}

@media (max-width: 900px) {
	.app-sidebar {
		position: fixed;
		left: 0;
		transform: translateX(-100%);
		transition: transform 0.2s ease;
		box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
	}

	.app-sidebar.is-open {
		transform: translateX(0);
	}

	.app-sidebar-backdrop {
		display: block;
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, 0.35);
		z-index: 35;
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.2s;
	}

	.app-sidebar-backdrop.is-visible {
		opacity: 1;
		pointer-events: auto;
	}

	.app-topbar {
		display: flex;
	}

	.app-bottom-nav {
		display: flex;
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		background: #fff;
		border-top: 1px solid var(--border);
		z-index: 30;
		padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
	}

	.app-bottom-nav__link {
		flex: 1;
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 2px;
		padding: 6px 4px;
		text-decoration: none;
		color: #666;
		font-size: 0.7rem;
		font-weight: 600;
	}

	.app-bottom-nav__link.is-active {
		color: var(--brand-primary);
	}

	.app-bottom-nav__icon {
		width: 22px;
		height: 22px;
		background: currentColor;
		mask-size: contain;
		mask-repeat: no-repeat;
		mask-position: center;
		-webkit-mask-size: contain;
		-webkit-mask-repeat: no-repeat;
		-webkit-mask-position: center;
	}

	.app-bottom-nav__icon--home {
		mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3Cpath d='M9 22V12h6v10'/%3E%3C/svg%3E");
		-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3Cpath d='M9 22V12h6v10'/%3E%3C/svg%3E");
	}

	.app-bottom-nav__icon--ruler {
		mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 8h16M6 8v3M10 8v2M14 8v3M18 8v2M4 16h16'/%3E%3C/svg%3E");
		-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 8h16M6 8v3M10 8v2M14 8v3M18 8v2M4 16h16'/%3E%3C/svg%3E");
	}

	.app-bottom-nav__icon--list {
		mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01'/%3E%3C/svg%3E");
		-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01'/%3E%3C/svg%3E");
	}

	.app-bottom-nav__icon--plus {
		mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
		-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
	}

	.has-nav .app-main {
		padding-bottom: calc(72px + env(safe-area-inset-bottom));
	}

	.hide-mobile {
		display: none;
	}
}

@media (min-width: 901px) {
	.app-bottom-nav {
		display: none !important;
	}
}

/* ——— Legacy header (unused) ——— */
.app-header {
	background: #fff;
	border-bottom: 1px solid var(--border);
}
.app-header__inner {
	max-width: 1100px;
	margin: 0 auto;
	padding: 12px 16px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
}
.app-brand { font-weight: 700; color: var(--brand-primary); text-decoration: none; }
.app-nav { display: flex; gap: 16px; align-items: center; font-size: 0.9rem; }
.app-nav a { color: var(--brand-primary); }

.auth-card {
	max-width: 400px;
	margin: 48px auto;
	background: #fff;
	padding: 32px 24px;
	border-radius: var(--radius);
	box-shadow: 0 4px 24px rgba(0,0,0,.06);
	text-align: center;
}
.auth-card__logo { margin-bottom: 16px; }
.auth-card h1 { margin: 0 0 4px; font-size: 1.5rem; }

.page-head {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	margin-bottom: 20px;
}
.page-head h1 { margin: 0; font-size: 1.5rem; }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card {
	background: #fff;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 20px;
	margin-bottom: 16px;
}
.card h2 { margin: 0 0 16px; font-size: 1.1rem; color: var(--brand-primary); }
.card--narrow { max-width: 520px; }
.card__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card__head h2 { margin: 0; }

.grid { display: grid; gap: 12px; }
.grid--2 { grid-template-columns: 1fr 1fr; }
.grid-span-2 { grid-column: 1 / -1; }

label span { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; color: #444; }
input, textarea, select {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--border);
	border-radius: 6px;
	font: inherit;
}
textarea { resize: vertical; min-height: 64px; }

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 16px;
	border-radius: 6px;
	border: 1px solid transparent;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	font-size: 0.95rem;
	background: #fff;
	color: var(--brand-primary);
}
.btn--primary { background: var(--brand-primary); color: #fff; }
.btn--ghost { border-color: var(--border); }
.btn--danger { color: #991b1b; border-color: #fecaca; }
.btn--danger:hover { background: #fee2e2; }
.btn--sm { padding: 6px 10px; font-size: 0.85rem; }
.btn--block { width: 100%; }

.stack { display: grid; gap: 12px; text-align: left; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.form-actions--left { justify-content: flex-start; margin-top: 12px; }

.col-check { width: 40px; text-align: center; }
.col-check input { width: auto; margin: 0; }

.linked-list { margin: 0 0 16px; padding-left: 1.2rem; }
.linked-list li { margin-bottom: 6px; }

.medidas-import__list {
	display: grid;
	gap: 8px;
	max-height: 220px;
	overflow-y: auto;
	padding: 10px;
	border: 1px solid var(--border);
	border-radius: 6px;
	background: var(--brand-light);
}
.medidas-import__item { margin: 0; align-items: center; }

.medidas-cot-actions__append { margin-top: 8px; }

.line-item {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
	padding: 14px 0;
	border-bottom: 1px solid var(--border);
	position: relative;
}
.line-item__desc { grid-column: 1 / -1; }
.line-item__sub { font-size: 0.9rem; }
.line-item__global-toggle {
	grid-column: 1 / -1;
	margin: 0;
}
.line-item__remove {
	position: absolute;
	top: 8px;
	right: 0;
	min-width: 36px;
}

.totals {
	background: var(--brand-light);
	padding: 14px;
	border-radius: 6px;
	margin: 16px 0;
	display: grid;
	gap: 6px;
}
.totals__total { font-size: 1.15rem; color: var(--brand-primary); border-top: 1px solid var(--border); padding-top: 8px; }
.totals div { display: flex; justify-content: space-between; }

.checkbox { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0; }
.checkbox input { width: auto; margin-top: 4px; }

.alert { padding: 12px 14px; border-radius: 6px; margin-bottom: 16px; }
.alert--success { background: #e8f7ee; color: #1a5c34; }
.alert--error { background: #fdecea; color: #8a1f11; }
.alert--info { background: #eef3f8; color: #2c3e50; }
.muted { color: #666; }

.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.data-table th, .data-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { background: var(--brand-light); font-size: 0.8rem; text-transform: uppercase; letter-spacing: .03em; }
.actions { white-space: nowrap; }
.actions a { margin-right: 10px; color: var(--brand-primary); }
.actions form.inline-form { display: inline; }
.btn-link {
	background: none;
	border: none;
	padding: 0;
	color: var(--brand-primary);
	font: inherit;
	font-size: 0.95rem;
	cursor: pointer;
	text-decoration: underline;
}

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }
.badge--borrador { background: #eee; }
.badge--emitida { background: #dbeafe; color: #1e40af; }
.badge--aceptada { background: #dcfce7; color: #166534; }
.badge--rechazada { background: #fee2e2; color: #991b1b; }
.badge--en_cobro { background: #fef3c7; color: #92400e; }
.badge--pagada { background: #bbf7d0; color: #14532d; }
.badge--facturada { background: #e0e7ff; color: #3730a3; }

[x-cloak] { display: none !important; }

.cobro-summary {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 16px;
	margin-bottom: 16px;
	padding: 14px;
	background: var(--surface-muted, #f5f7f8);
	border-radius: var(--radius);
}

.cobro-summary strong { display: block; font-size: 1.15rem; margin-top: 4px; }
.text-warn { color: #b45309; }
.text-success { color: #166534; }

.table-wrap--compact { margin-top: 12px; }

.pdf-preview {
	background: #fff;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 16px;
	overflow-x: auto;
}

/* ——— Medidas ——— */
.medidas-intro {
	margin: -8px 0 16px;
}

.medidas-layout {
	display: grid;
	grid-template-columns: 1fr 280px;
	gap: 16px;
	align-items: start;
}

.medidas-main {
	min-width: 0;
}

.medidas-sidebar.stack {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.medida-item {
	padding: 14px 0;
	border-bottom: 1px solid var(--border);
}

.medida-item:last-child {
	border-bottom: none;
}

.medida-item__head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 10px;
}

.medida-item__alt {
	margin: 8px 0 0;
	font-size: 0.85rem;
}

.medida-item__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 10px;
}

.medida-item__cantidad {
	max-width: 120px;
}

.medidas-add-line {
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid var(--border);
}

.converter-card {
	position: sticky;
	top: 16px;
}

.converter-card__hint {
	margin: -8px 0 12px;
	font-size: 0.9rem;
}

.converter-result {
	background: var(--brand-light);
	border-radius: 6px;
	padding: 12px;
}

.converter-result__label {
	display: block;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	color: #666;
	margin-bottom: 4px;
}

.converter-result__value {
	font-size: 1.35rem;
	color: var(--brand-primary);
}

.inline-form {
	display: inline;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}

@media (max-width: 900px) {
	.medidas-layout {
		grid-template-columns: 1fr;
	}

	.converter-card {
		position: static;
		order: -1;
	}
}

@media (min-width: 720px) {
	.line-item {
		grid-template-columns: 140px 1fr 80px 120px 100px 40px;
		align-items: end;
	}
	.line-item__desc { grid-column: auto; }
	.line-item__remove { position: static; }
}

@media (max-width: 640px) {
	.grid--2 { grid-template-columns: 1fr; }
}
