:root {
	--ink: #14201c;
	--muted: #5f6c67;
	--muted2: #4c5a55;
	--dim: #8a9691;
	--line: #e3e7ee;
	--row: #eef1f6;
	--field: #dde3ec;
	--bg: #f1f3f7;
	--accent: #1f5fae;
	--accent-hover: #174a8a;
	--accent-soft: #e8eff9;
	--accent-sel: #f1f6fd;
	--etsy-bg: #fbeee4;
	--etsy: #8f3f0f;
	--warn-bg: #fff1cc;
	--warn: #6b4e00;
	--danger: #b3261e;
	--ok-bg: #e6f4ea;
	--ok: #1e6b34;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
	background: var(--bg);
	color: var(--ink);
	font-family: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 14px;
	line-height: 1.5;
	font-variant-numeric: tabular-nums;
}
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
h1 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
h2 { margin: 0; font-size: 17px; font-weight: 600; }
p { margin: 0; }

/* Estructura */
.app { display: flex; flex-wrap: wrap; min-height: 100vh; }
.nav {
	flex: 1 1 220px; max-width: 100%;
	background: #fff; border-right: 1px solid var(--line);
	padding: 24px 16px; display: flex; flex-direction: column; gap: 28px;
}
.marca { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.marca .logo { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.marca strong { display: block; font-size: 15px; font-weight: 600; }
.marca span { font-size: 12px; color: var(--muted); }
.menu { display: flex; flex-direction: column; gap: 4px; }
.menu a {
	display: flex; align-items: center; gap: 10px; padding: 0 12px; min-height: 44px;
	border-radius: 9px; text-decoration: none; color: var(--ink);
}
.menu a:hover { background: var(--accent-sel); }
.menu a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.menu svg { flex: 0 0 auto; }
.menu .cuenta { margin-left: auto; font-size: 12px; font-weight: 600; background: var(--warn-bg); color: var(--warn); border-radius: 999px; padding: 1px 8px; }
.conexiones { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 14px 12px; border: 1px solid var(--line); border-radius: 12px; }
.conexiones .t { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.conexiones div { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.conexiones i { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.conexiones i.si { background: var(--accent); }
.conexiones small { margin-left: auto; font-size: 12px; color: var(--muted); }
.salir { font-size: 13px; color: var(--muted); padding: 0 12px; }

.main {
	flex: 999 1 560px; min-width: 0;
	padding: 32px 40px 48px; display: flex; flex-direction: column; gap: 20px;
}
@media (max-width: 700px) {
	.main { padding: 20px 16px 40px; }
	.nav { padding: 16px; gap: 16px; }
	.conexiones { display: none; }
}

.cabecera { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.cabecera p { margin-top: 4px; color: var(--muted); }
.volver { font-size: 13px; text-decoration: none; }
.titulo-fila { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

/* Bloques */
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 12px; }
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.cols > .ancha { flex: 999 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.cols > .estrecha { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; align-items: start; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.kpi span { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.kpi strong { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.kpi small { font-size: 13px; color: var(--muted); }
.nota { font-size: 12px; color: var(--muted); }
.vacio { padding: 24px; text-align: center; color: var(--muted); }
.lista-fila { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--row); }
.lista-fila .info { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lista-fila .sub { font-size: 13px; color: var(--muted); }
.importe { display: flex; justify-content: space-between; gap: 12px; }
.importe.resta { color: var(--muted2); }
.importe.total { padding-top: 12px; border-top: 1px solid var(--line); align-items: baseline; }
.importe.total strong:last-child { font-size: 24px; color: var(--accent); }
.importe.total strong.negativo { color: var(--danger); }
.barra { height: 10px; border-radius: 999px; background: var(--row); overflow: hidden; }
.barra div { height: 100%; border-radius: 999px; background: var(--accent); }
.barra div.etsy { background: #b2541a; }

/* Etiquetas */
.badge { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 6px; padding: 1px 8px; white-space: nowrap; }
.badge.etsy { background: var(--etsy-bg); color: var(--etsy); }
.badge.woo { background: var(--accent-soft); color: var(--accent); }
.badge.pend { background: var(--warn-bg); color: var(--warn); border-radius: 999px; padding: 3px 10px; }
.badge.env { background: var(--row); color: var(--muted2); font-weight: 500; border-radius: 999px; padding: 3px 10px; }
.badge.act { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 2px 10px; }
.badge.gris { background: var(--row); color: var(--muted2); border-radius: 999px; padding: 2px 10px; }
.badge.error { background: #fbeceb; color: var(--danger); border-radius: 999px; padding: 2px 10px; }

/* Formularios */
.fila { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.campo { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.campo.crece { flex: 1 1 220px; }
input[type=text], input[type=number], input[type=email], input[type=password], input[type=search], input[type=url],
input[type=date], input[type=time], input[type=datetime-local], select, textarea {
	font: inherit; font-size: 15px; color: var(--ink); background: #fff;
	border: 1px solid var(--field); border-radius: 9px; padding: 0 10px; min-height: 40px; max-width: 100%;
}
textarea { padding: 10px 12px; resize: vertical; min-height: 120px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input.num { width: 96px; text-align: right; }
input.num-s { width: 84px; text-align: right; min-height: 36px; font-size: 14px; }
.chk { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); }
.chk input { width: 18px; height: 18px; accent-color: var(--accent); }

.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 40px; padding: 0 14px; border-radius: 9px; cursor: pointer;
	background: #fff; color: var(--accent); border: 1px solid var(--accent);
	font: inherit; font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--accent-sel); color: var(--accent); }
.btn.primario { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; font-size: 14px; }
.btn.primario:hover { background: var(--accent-hover); color: #fff; }
.btn.grande { min-height: 46px; font-size: 15px; }
.btn.gris { color: var(--ink); border-color: var(--field); }
.btn.peligro { color: var(--danger); border-color: #e3b9b5; }
.btn.peligro:hover { background: #fbeeed; }
.btn.enlace { border: 0; background: none; padding: 0; min-height: 0; text-decoration: underline; }
.acciones { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.seg { display: inline-flex; flex-wrap: wrap; background: var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg a, .seg button {
	display: inline-flex; align-items: center; border: 0; border-radius: 8px; min-height: 36px; padding: 0 14px;
	font: inherit; font-size: 13px; background: transparent; color: var(--muted2); cursor: pointer; text-decoration: none;
}
.seg .on { background: #fff; color: var(--ink); font-weight: 600; }
.pestanas { display: flex; flex-wrap: wrap; gap: 6px; }
.pestanas a { min-height: 40px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: 999px; border: 1px solid var(--field); background: #fff; color: var(--muted2); text-decoration: none; }
.pestanas a.on { border-color: var(--accent); background: var(--accent); color: #fff; font-weight: 600; }

/* Avisos */
.flash { padding: 12px 16px; border-radius: 10px; font-size: 14px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: #fbeceb; color: var(--danger); }
.flash.info { background: var(--accent-soft); color: var(--ink); }
.aviso { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); font-size: 13px; }
.aviso.warn { background: var(--warn-bg); color: var(--warn); }

/* Tablas */
.tabla-caja { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; }
.card .tabla-caja { border: 0; border-radius: 0; margin: 0 -6px; }
table.tabla { width: 100%; border-collapse: collapse; }
.tabla th {
	text-align: left; font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; font-weight: 500;
	color: var(--muted); padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tabla td { padding: 10px 8px; border-bottom: 1px solid var(--row); vertical-align: middle; }
.tabla th:first-child, .tabla td:first-child { padding-left: 16px; }
.tabla th:last-child, .tabla td:last-child { padding-right: 16px; }
.tabla .r { text-align: right; white-space: nowrap; }
.tabla .ben { font-weight: 600; color: var(--accent); }
.tabla .ben.flojo { color: var(--etsy); }
.tabla .ben.negativo { color: var(--danger); }
.tabla tr.sel td { background: var(--accent-sel); }

/* Tarifas de envío */
.tarifas { display: flex; flex-direction: column; gap: 8px; }
.tarifa {
	display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 11px;
	border: 1px solid var(--field); background: #fff; cursor: pointer;
}
.tarifa:has(input:checked) { border: 2px solid var(--accent); background: var(--accent-sel); }
.tarifa input { width: 18px; height: 18px; accent-color: var(--accent); }
.tarifa .que { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tarifa .que small { font-size: 12px; color: var(--muted); }
.tarifa .queda { font-size: 13px; color: var(--muted); }
.tarifa strong { font-size: 16px; }

/* Vinilo */
.subida {
	display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 11px;
	border: 1.5px dashed var(--dim); background: #fff; cursor: pointer;
}
.subida input { position: absolute; left: -9999px; }
.subida b { color: var(--accent); font-weight: 600; display: block; }
.subida small { font-size: 12px; color: var(--muted); }
.vinilo { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 11px; border: 1px solid var(--line); background: #f6f8fb; }
.vinilo img { max-width: 180px; max-height: 90px; border-radius: 4px; background: #fff; border: 1px solid var(--line); }

/* Artículos */
.arts { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.art { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.art .foto { aspect-ratio: 4 / 3; background: var(--field); object-fit: cover; width: 100%; display: block; }
.art .cuerpo { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.art h2 { font-size: 15px; line-height: 1.3; }
.art .pie { margin-top: auto; }
.fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.fotos .f { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--field); }
.fotos .f img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fotos .f form { position: absolute; top: 6px; right: 6px; }
.fotos .f button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(20, 32, 28, .75); color: #fff; cursor: pointer; font-size: 15px; line-height: 1; }
.fotos .f .portada { position: absolute; left: 6px; bottom: 6px; font-size: 11px; background: var(--accent); color: #fff; border-radius: 999px; padding: 1px 8px; }
.fotos label.f { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 1.5px dashed var(--dim); background: #fff; color: var(--accent); cursor: pointer; font-size: 13px; }
.fotos label.f input { position: absolute; left: -9999px; }

/* Redes */
.previa { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.previa .cab { display: flex; align-items: center; gap: 10px; padding: 10px 12px; font-size: 13px; font-weight: 600; }
.previa .cab i { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); }
.previa .img { aspect-ratio: 1; background: var(--field); display: grid; place-items: center; color: var(--muted2); font-size: 13px; }
.previa .img img { width: 100%; height: 100%; object-fit: cover; }
.previa p { padding: 10px 12px 14px; font-size: 13px; white-space: pre-line; }

/* Calculadora (plugin) dentro del panel: mismos colores azules */
body #ccm-app {
	--ccm-accent: #1f5fae;
	--ccm-accent-soft: #e8eff9;
	--ccm-line: #e3e7ee;
	--ccm-field: #dde3ec;
	--ccm-bg: #f1f3f7;
	padding-top: 0 !important;
	max-width: none !important;
}
#ccm-app .ccm-table tr.on { background: #f1f6fd; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: 100%; max-width: 360px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.login input { width: 100%; }
